1import{r as dt,g as uS,R as Xp}from"./vendor-react-E98sgxjj.js";import{j as jn}from"./vendor-motion-hRg_q8lq.js";/** 2 * @license 3 * Copyright 2010-2025 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Ua="182",ha={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},fa={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nx=0,Jp=1,ix=2,hS=3,rx=0,Ro=1,Nl=2,ma=3,Mr=0,Hn=1,$n=2,ii=0,Ma=1,Yp=2,Kp=3,Zp=4,sx=5,bs=100,ax=101,ox=102,lx=103,cx=104,ux=200,hx=201,fx=202,dx=203,ah=204,oh=205,px=206,mx=207,gx=208,vx=209,_x=210,xx=211,yx=212,Ax=213,Sx=214,lh=0,Jl=1,ch=2,Ta=3,uh=4,hh=5,fh=6,dh=7,ac=0,Mx=1,Ex=2,Wi=0,gm=1,vm=2,_m=3,$h=4,xm=5,ym=6,Am=7,Qp="attached",wx="detached",ef=300,Or=301,Ps=302,Yl=303,Kl=304,Wo=306,Ds=1e3,wi=1001,Do=1002,xn=1003,tf=1004,fS=1004,ga=1005,dS=1005,rn=1006,Io=1007,pS=1007,or=1008,mS=1008,Rn=1009,Sm=1010,Mm=1011,Lo=1012,nf=1013,Ji=1014,In=1015,Vn=1016,rf=1017,sf=1018,Ca=1020,Em=35902,wm=35899,bm=1021,Tm=1022,ni=1023,Gr=1026,ts=1027,oc=1028,lc=1029,Ra=1030,af=1031,gS=1032,of=1033,Ol=33776,Gl=33777,Hl=33778,zl=33779,ph=35840,mh=35841,gh=35842,vh=35843,_h=36196,xh=37492,yh=37496,Ah=37488,Sh=37489,Mh=37490,Eh=37491,wh=37808,bh=37809,Th=37810,Ch=37811,Rh=37812,Ih=37813,Bh=37814,Ph=37815,Dh=37816,Lh=37817,Fh=37818,Uh=37819,Nh=37820,Oh=37821,Gh=36492,Hh=36494,zh=36495,kh=36283,Vh=36284,Wh=36285,Xh=36286,bx=2200,Tx=2201,Cx=2202,Fo=2300,Uo=2301,nh=2302,va=2400,_a=2401,Zl=2402,lf=2500,Cm=2501,Rx=0,Rm=1,Jh=2,Us=3200,vS=3201,_S=3202,xS=3203,Ns=0,Ix=1,xr="",pn="srgb",as="srgb-linear",Ql="linear",dn="srgb",yS="",AS="rg",SS="ga",MS=0,da=7680,ES=7681,wS=7682,bS=7683,TS=34055,CS=34056,RS=5386,IS=512,BS=513,PS=514,DS=515,LS=516,FS=517,US=518,qp=519,Bx=512,Px=513,Dx=514,cf=515,Lx=516,Fx=517,uf=518,Ux=519,ql=35044,NS=35048,OS=35040,GS=35045,HS=35049,zS=35041,kS=35046,VS=35050,WS=35042,XS="100",jp="300 es",Vi=2e3,No=2001,JS={COMPUTE:"compute",RENDER:"render"},YS={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},KS={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function Nx(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const ZS={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function To(r,e){return new ZS[r](e)}function Ox(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function jl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Gx(){const r=jl("canvas");return r.style.display="block",r}const Z0={};let Ls=null;function QS(r){Ls=r}function qS(){return Ls}function $l(...r){const e="THREE."+r.shift();Ls?Ls("log",e,...r):console.log(e,...r)}function nt(...r){const e="THREE."+r.shift();Ls?Ls("warn",e,...r):console.warn(e,...r)}function bt(...r){const e="THREE."+r.shift();Ls?Ls("error",e,...r):console.error(e,...r)}function Oo(...r){const e=r.join(" ");e in Z0||(Z0[e]=!0,nt(...r))}function jS(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}let Ki=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const di=["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","5
55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Q0=1234567;const Ea=Math.PI/180,Go=180/Math.PI;function Xi(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(di[r&255]+di[r>>8&255]+di[r>>16&255]+di[r>>24&255]+"-"+di[e&255]+di[e>>8&255]+"-"+di[e>>16&15|64]+di[e>>24&255]+"-"+di[t&63|128]+di[t>>8&255]+"-"+di[t>>16&255]+di[t>>24&255]+di[n&255]+di[n>>8&255]+di[n>>16&255]+di[n>>24&255]).toLowerCase()}function Ft(r,e,t){return Math.max(e,Math.min(t,r))}function Im(r,e){return(r%e+e)%e}function $S(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function eM(r,e,t){return r!==e?(t-r)/(e-r):0}function kl(r,e,t){return(1-t)*r+t*e}function tM(r,e,t,n){return kl(r,e,1-Math.exp(-t*n))}function nM(r,e=1){return e-Math.abs(Im(r,e*2)-e)}function iM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function rM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function sM(r,e){return r+Math.floor(Math.random()*(e-r+1))}function aM(r,e){return r+Math.random()*(e-r)}function oM(r){return r*(.5-Math.random())}function lM(r){r!==void 0&&(Q0=r);let e=Q0+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function cM(r){return r*Ea}function uM(r){return r*Go}function hM(r){return(r&r-1)===0&&r!==0}function fM(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function dM(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function pM(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),u=a(t/2),h=s((e+n)/2),f=a((e+n)/2),d=s((e-n)/2),p=a((e-n)/2),g=s((n-e)/2),v=a((n-e)/2);switch(i){case"XYX":r.set(o*f,u*d,u*p,o*h);break;case"YZY":r.set(u*p,o*f,u*d,o*h);break;case"ZXZ":r.set(u*d,u*p,o*f,o*h);break;case"XZX":r.set(o*f,u*v,u*g,o*h);break;case"YXY":r.set(u*g,o*f,u*v,o*h);break;case"ZYZ":r.set(u*v,u*g,o*f,o*h);break;default:nt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ei(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function kt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Hx={DEG2RAD:Ea,RAD2DEG:Go,generateUUID:Xi,clamp:Ft,euclideanModulo:Im,mapLinear:$S,inverseLerp:eM,lerp:kl,damp:tM,pingpong:nM,smoothstep:iM,smootherstep:rM,randInt:sM,randFloat:aM,randFloatSpread:oM,seededRandom:lM,degToRad:cM,radToDeg:uM,isPowerOfTwo:hM,ceilPowerOfTwo:fM,floorPowerOfTwo:dM,setQuaternionFromProperEuler:pM,normalize:kt,denormalize:Ei};class _e{constructor(e=0,t=0){_e.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 10,081 bytes, line 5
5sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class on{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let u=n[i+0],h=n[i+1],f=n[i+2],d=n[i+3],p=s[a+0],g=s[a+1],v=s[a+2],A=s[a+3];if(o<=0){e[t+0]=u,e[t+1]=h,e[t+2]=f,e[t+3]=d;return}if(o>=1){e[t+0]=p,e[t+1]=g,e[t+2]=v,e[t+3]=A;return}if(d!==A||u!==p||h!==g||f!==v){let y=u*p+h*g+f*v+d*A;y<0&&(p=-p,g=-g,v=-v,A=-A,y=-y);let _=1-o;if(y<.9995){const M=Math.acos(y),E=Math.sin(M);_=Math.sin(_*M)/E,o=Math.sin(o*M)/E,u=u*_+p*o,h=h*_+g*o,f=f*_+v*o,d=d*_+A*o}else{u=u*_+p*o,h=h*_+g*o,f=f*_+v*o,d=d*_+A*o;const M=1/Math.sqrt(u*u+h*h+f*f+d*d);u*=M,h*=M,f*=M,d*=M}}e[t]=u,e[t+1]=h,e[t+2]=f,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],u=n[i+1],h=n[i+2],f=n[i+3],d=s[a],p=s[a+1],g=s[a+2],v=s[a+3];return e[t]=o*v+f*d+u*g-h*p,e[t+1]=u*v+f*p+h*d-o*g,e[t+2]=h*v+f*g+o*p-u*d,e[t+3]=f*v-o*d-u*p-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,u=Math.sin,h=o(n/2),f=o(i/2),d=o(s/2),p=u(n/2),g=u(i/2),v=u(s/2);switch(a){case"XYZ":this._x=p*f*d+h*g*v,this._y=h*g*d-p*f*v,this._z=h*f*v+p*g*d,this._w=h*f*d-p*g*v;break;case"YXZ":this._x=p*f*d+h*g*v,this._y=h*g*d-p*f*v,this._z=h*f*v-p*g*d,this._w=h*f*d+p*g*v;break;case"ZXY":this._x=p*f*d-h*g*v,this._y=h*g*d+p*f*v,this._z=h*f*v+p*g*d,this._w=h*f*d-p*g*v;break;case"ZYX":this._x=p*f*d-h*g*v,this._y=h*g*d+p*f*v,this._z=h*f*v-p*g*d,this._w=h*f*d+p*g*v;break;case"YZX":this._x=p*f*d+h*g*v,this._y=h*g*d+p*f*v,this._z=h*f*v-p*g*d,this._w=h*f*d-p*g*v;break;case"XZY":this._x=p*f*d-h*g*v,this._y=h*g*d-p*f*v,this._z=h*f*v+p*g*d,this._w=h*f*d+p*g*v;break;default:nt("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],u=t[9],h=t[2],f=t[6],d=t[10],p=n+o+d;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(f-u)*g,this._y=(s-h)*g,this._z=(a-i)*g}else if(n>o&&n>d){const g=2*Math.sqrt(1+n-o-d);this._w=(f-u)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(s+h)/g}else if(o>d){const g=2*Math.sqrt(1+o-n-d);this._w=(s-h)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(u+f)/g}else{const g=2*Math.sqrt(1+d-n-o);this._w=(a-i)/g,this._x=(s+h)/g,this._y=(u+f)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ft(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,u=t._y,h=t._z,f=t._w;return this._x=n*f+a*o+i*h-s*u,this._y=i*f+a*u+s*o-n*h,this._z=s*f+a*h+n*u-i*o,this._w=a*f-n*o-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,s=-s,a=-a,o=-o);let u=1-t;if(o<.9995){const h=Math.acos(o),f=Math.sin(h);u=Math.sin(u*h)/f,t=Math.sin(t*h)/f,this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+s*t,this._w=this._w*u+a*t,this._onChangeCallback()}else this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+s*t,this._w=this._w*u+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{constructor(e=0,t=0,n=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(q0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(q0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}
vendor: 5,480 bytes, line 5
5applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,u=e.w,h=2*(a*i-o*n),f=2*(o*t-s*i),d=2*(s*n-a*t);return this.x=t+u*h+a*d-o*f,this.y=n+u*f+o*h-s*d,this.z=i+u*d+s*f-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this.z=Ft(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this.z=Ft(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,u=t.z;return this.x=i*u-s*o,this.y=s*a-n*u,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Od.copy(this).projectOnVector(e),this.sub(Od)}reflect(e){return this.sub(Od.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Od=new N,q0=new on;class zt{constructor(e,t,n,i,s,a,o,u,h){zt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,u,h)}set(e,t,n,i,s,a,o,u,h){const f=this.elements;return f[0]=e,f[1]=i,f[2]=o,f[3]=t,f[4]=s,f[5]=u,f[6]=n,f[7]=a,f[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],u=n[6],h=n[1],f=n[4],d=n[7],p=n[2],g=n[5],v=n[8],A=i[0],y=i[3],_=i[6],M=i[1],E=i[4],w=i[7],B=i[2],P=i[5],D=i[8];
vendor: 67,281 bytes, line 5
5return s[0]=a*A+o*M+u*B,s[3]=a*y+o*E+u*P,s[6]=a*_+o*w+u*D,s[1]=h*A+f*M+d*B,s[4]=h*y+f*E+d*P,s[7]=h*_+f*w+d*D,s[2]=p*A+g*M+v*B,s[5]=p*y+g*E+v*P,s[8]=p*_+g*w+v*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],u=e[6],h=e[7],f=e[8];return t*a*f-t*o*h-n*s*f+n*o*u+i*s*h-i*a*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],u=e[6],h=e[7],f=e[8],d=f*a-o*h,p=o*u-f*s,g=h*s-a*u,v=t*d+n*p+i*g;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/v;return e[0]=d*A,e[1]=(i*h-f*n)*A,e[2]=(o*n-i*a)*A,e[3]=p*A,e[4]=(f*t-i*u)*A,e[5]=(i*s-o*t)*A,e[6]=g*A,e[7]=(n*u-h*t)*A,e[8]=(a*t-n*s)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*o)+a+e,-i*h,i*u,-i*(-h*a+u*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Gd.makeScale(e,t)),this}rotate(e){return this.premultiply(Gd.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Gd=new zt,j0=new zt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),$0=new zt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function mM(){const r={enabled:!0,workingColorSpace:as,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===dn&&(i.r=is(i.r),i.g=is(i.g),i.b=is(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===dn&&(i.r=Bo(i.r),i.g=Bo(i.g),i.b=Bo(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===xr?Ql:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Oo("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Oo("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[as]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:j0,fromXYZ:$0,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:pn},outputColorSpaceConfig:{drawingBufferColorSpace:pn}},[pn]:{primaries:e,whitePoint:n,transfer:dn,toXYZ:j0,fromXYZ:$0,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:pn}}}),r}const nn=mM();function is(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Bo(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let to;class zx{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{to===void 0&&(to=jl("canvas")),to.width=e.width,to.height=e.height;const i=to.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=to}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=jl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=is(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(is(t[n]/255)*255):t[n]=is(t[n]);return{data:t,width:e.width,height:e.height}}else return nt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let gM=0;class Ts{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gM++}),this.uuid=Xi(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Hd(i[a].image)):s.push(Hd(i[a]))}else s=Hd(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Hd(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?zx.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(nt("Texture: Unable to serialize Texture."),{})}let vM=0;const zd=new N;class yn extends Ki{constructor(e=yn.DEFAULT_IMAGE,t=yn.DEFAULT_MAPPING,n=wi,i=wi,s=rn,a=or,o=ni,u=Rn,h=yn.DEFAULT_ANISOTROPY,f=xr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:vM++}),this.uuid=Xi(),this.name="",this.source=new Ts(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=h,this.format=o,this.internalFormat=null,this.type=u,this.offset=new _e(0,0),this.repeat=new _e(1,1),this.center=new _e(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(zd).x}get height(){return this.source.getSize(zd).y}get depth(){return this.source.getSize(zd).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){nt(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){nt(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ef)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ds:e.x=e.x-Math.floor(e.x);break;case wi:e.x=e.x<0?0:1;break;case Do:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ds:e.y=e.y-Math.floor(e.y);break;case wi:e.y=e.y<0?0:1;break;case Do:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}yn.DEFAULT_IMAGE=null;yn.DEFAULT_MAPPING=ef;yn.DEFAULT_ANISOTROPY=1;class gn{constructor(e=0,t=0,n=0,i=1){gn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,h=u[0],f=u[4],d=u[8],p=u[1],g=u[5],v=u[9],A=u[2],y=u[6],_=u[10];if(Math.abs(f-p)<.01&&Math.abs(d-A)<.01&&Math.abs(v-y)<.01){if(Math.abs(f+p)<.1&&Math.abs(d+A)<.1&&Math.abs(v+y)<.1&&Math.abs(h+g+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(h+1)/2,w=(g+1)/2,B=(_+1)/2,P=(f+p)/4,D=(d+A)/4,F=(v+y)/4;return E>w&&E>B?E<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(E),i=P/n,s=D/n):w>B?w<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(w),n=P/i,s=F/i):B<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(B),n=D/s,i=F/s),this.set(n,i,s,t),this}let M=Math.sqrt((y-v)*(y-v)+(d-A)*(d-A)+(p-f)*(p-f));return Math.abs(M)<.001&&(M=1),this.x=(y-v)/M,this.y=(d-A)/M,this.z=(p-f)/M,this.w=Math.acos((h+g+_-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this.z=Ft(this.z,e.z,t.z),this.w=Ft(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this.z=Ft(this.z,e,t),this.w=Ft(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Bm extends Ki{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:rn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new yn(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:rn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Ts(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class bn extends Bm{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class hf extends yn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xn,this.minFilter=xn,this.wrapR=wi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class _M extends bn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new hf(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ff extends yn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xn,this.minFilter=xn,this.wrapR=wi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class xM extends bn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new ff(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ri{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(pr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(pr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=pr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,pr):pr.fromBufferAttribute(s,a),pr.applyMatrix4(e.matrixWorld),this.expandByPoint(pr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ou.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ou.copy(n.boundingBox)),ou.applyMatrix4(e.matrixWorld),this.union(ou)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,pr),pr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ml),lu.subVectors(this.max,ml),no.subVectors(e.a,ml),io.subVectors(e.b,ml),ro.subVectors(e.c,ml),gs.subVectors(io,no),vs.subVectors(ro,io),Qs.subVectors(no,ro);let t=[0,-gs.z,gs.y,0,-vs.z,vs.y,0,-Qs.z,Qs.y,gs.z,0,-gs.x,vs.z,0,-vs.x,Qs.z,0,-Qs.x,-gs.y,gs.x,0,-vs.y,vs.x,0,-Qs.y,Qs.x,0];return!kd(t,no,io,ro,lu)||(t=[1,0,0,0,1,0,0,0,1],!kd(t,no,io,ro,lu))?!1:(cu.crossVectors(gs,vs),t=[cu.x,cu.y,cu.z],kd(t,no,io,ro,lu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,pr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(pr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Jr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Jr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Jr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Jr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Jr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Jr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Jr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Jr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Jr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Jr=[new N,new N,new N,new N,new N,new N,new N,new N],pr=new N,ou=new ri,no=new N,io=new N,ro=new N,gs=new N,vs=new N,Qs=new N,ml=new N,lu=new N,cu=new N,qs=new N;function kd(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){qs.fromArray(r,s);const o=i.x*Math.abs(qs.x)+i.y*Math.abs(qs.y)+i.z*Math.abs(qs.z),u=e.dot(qs),h=t.dot(qs),f=n.dot(qs);if(Math.max(-Math.max(u,h,f),Math.min(u,h,f))>o)return!1}return!0}const yM=new ri,gl=new N,Vd=new N;class ei{constructor(e=new N,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):yM.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;gl.subVectors(e,this.center);const t=gl.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(gl,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vd.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gl.copy(e.center).add(Vd)),this.expandByPoint(gl.copy(e.center).sub(Vd))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const Yr=new N,Wd=new N,uu=new N,_s=new N,Xd=new N,hu=new N,Jd=new N;class Na{constructor(e=new N,t=new N(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Yr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yr.copy(this.origin).addScaledVector(this.direction,t),Yr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Wd.copy(e).add(t).multiplyScalar(.5),uu.copy(t).sub(e).normalize(),_s.copy(this.origin).sub(Wd);const s=e.distanceTo(t)*.5,a=-this.direction.dot(uu),o=_s.dot(this.direction),u=-_s.dot(uu),h=_s.lengthSq(),f=Math.abs(1-a*a);let d,p,g,v;if(f>0)if(d=a*u-o,p=a*o-u,v=s*f,d>=0)if(p>=-v)if(p<=v){const A=1/f;d*=A,p*=A,g=d*(d+a*p+2*o)+p*(a*d+p+2*u)+h}else p=s,d=Math.max(0,-(a*p+o)),g=-d*d+p*(p+2*u)+h;else p=-s,d=Math.max(0,-(a*p+o)),g=-d*d+p*(p+2*u)+h;else p<=-v?(d=Math.max(0,-(-a*s+o)),p=d>0?-s:Math.min(Math.max(-s,-u),s),g=-d*d+p*(p+2*u)+h):p<=v?(d=0,p=Math.min(Math.max(-s,-u),s),g=p*(p+2*u)+h):(d=Math.max(0,-(a*s+o)),p=d>0?s:Math.min(Math.max(-s,-u),s),g=-d*d+p*(p+2*u)+h);else p=a>0?-s:s,d=Math.max(0,-(a*p+o)),g=-d*d+p*(p+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(Wd).addScaledVector(uu,p),g}intersectSphere(e,t){Yr.subVectors(e.center,this.origin);const n=Yr.dot(this.direction),i=Yr.dot(Yr)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,u=n+a;return u<0?null:o<0?this.at(u,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,u;const h=1/this.direction.x,f=1/this.direction.y,d=1/this.direction.z,p=this.origin;return h>=0?(n=(e.min.x-p.x)*h,i=(e.max.x-p.x)*h):(n=(e.max.x-p.x)*h,i=(e.min.x-p.x)*h),f>=0?(s=(e.min.y-p.y)*f,a=(e.max.y-p.y)*f):(s=(e.max.y-p.y)*f,a=(e.min.y-p.y)*f),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),d>=0?(o=(e.min.z-p.z)*d,u=(e.max.z-p.z)*d):(o=(e.max.z-p.z)*d,u=(e.min.z-p.z)*d),n>u||o>i)||((o>n||n!==n)&&(n=o),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Yr)!==null}intersectTriangle(e,t,n,i,s){Xd.subVectors(t,e),hu.subVectors(n,e),Jd.crossVectors(Xd,hu);let a=this.direction.dot(Jd),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;_s.subVectors(this.origin,e);const u=o*this.direction.dot(hu.crossVectors(_s,hu));if(u<0)return null;const h=o*this.direction.dot(Xd.cross(_s));if(h<0||u+h>a)return null;const f=-o*_s.dot(Jd);return f<0?null:this.at(f/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class It{constructor(e,t,n,i,s,a,o,u,h,f,d,p,g,v,A,y){It.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,u,h,f,d,p,g,v,A,y)}set(e,t,n,i,s,a,o,u,h,f,d,p,g,v,A,y){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=s,_[5]=a,_[9]=o,_[13]=u,_[2]=h,_[6]=f,_[10]=d,_[14]=p,_[3]=g,_[7]=v,_[11]=A,_[15]=y,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 It().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/so.setFromMatrixColumn(e,0).length(),s=1/so.setFromMatrixColumn(e,1).length(),a=1/so.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),u=Math.cos(i),h=Math.sin(i),f=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=a*f,g=a*d,v=o*f,A=o*d;t[0]=u*f,t[4]=-u*d,t[8]=h,t[1]=g+v*h,t[5]=p-A*h,t[9]=-o*u,t[2]=A-p*h,t[6]=v+g*h,t[10]=a*u}else if(e.order==="YXZ"){const p=u*f,g=u*d,v=h*f,A=h*d;t[0]=p+A*o,t[4]=v*o-g,t[8]=a*h,t[1]=a*d,t[5]=a*f,t[9]=-o,t[2]=g*o-v,t[6]=A+p*o,t[10]=a*u}else if(e.order==="ZXY"){const p=u*f,g=u*d,v=h*f,A=h*d;t[0]=p-A*o,t[4]=-a*d,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*f,t[9]=A-p*o,t[2]=-a*h,t[6]=o,t[10]=a*u}else if(e.order==="ZYX"){const p=a*f,g=a*d,v=o*f,A=o*d;t[0]=u*f,t[4]=v*h-g,t[8]=p*h+A,t[1]=u*d,t[5]=A*h+p,t[9]=g*h-v,t[2]=-h,t[6]=o*u,t[10]=a*u}else if(e.order==="YZX"){const p=a*u,g=a*h,v=o*u,A=o*h;t[0]=u*f,t[4]=A-p*d,t[8]=v*d+g,t[1]=d,t[5]=a*f,t[9]=-o*f,t[2]=-h*f,t[6]=g*d+v,t[10]=p-A*d}else if(e.order==="XZY"){const p=a*u,g=a*h,v=o*u,A=o*h;t[0]=u*f,t[4]=-d,t[8]=h*f,t[1]=p*d+A,t[5]=a*f,t[9]=g*d-v,t[2]=v*d-g,t[6]=o*f,t[10]=A*d+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(AM,e,SM)}lookAt(e,t,n){const i=this.elements;return Hi.subVectors(e,t),Hi.lengthSq()===0&&(Hi.z=1),Hi.normalize(),xs.crossVectors(n,Hi),xs.lengthSq()===0&&(Math.abs(n.z)===1?Hi.x+=1e-4:Hi.z+=1e-4,Hi.normalize(),xs.crossVectors(n,Hi)),xs.normalize(),fu.crossVectors(Hi,xs),i[0]=xs.x,i[4]=fu.x,i[8]=Hi.x,i[1]=xs.y,i[5]=fu.y,i[9]=Hi.y,i[2]=xs.z,i[6]=fu.z,i[10]=Hi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],u=n[8],h=n[12],f=n[1],d=n[5],p=n[9],g=n[13],v=n[2],A=n[6],y=n[10],_=n[14],M=n[3],E=n[7],w=n[11],B=n[15],P=i[0],D=i[4],F=i[8],b=i[12],C=i[1],U=i[5],V=i[9],J=i[13],Q=i[2],oe=i[6],q=i[10],ue=i[14],z=i[3],ne=i[7],Y=i[11],se=i[15];return s[0]=a*P+o*C+u*Q+h*z,s[4]=a*D+o*U+u*oe+h*ne,s[8]=a*F+o*V+u*q+h*Y,s[12]=a*b+o*J+u*ue+h*se,s[1]=f*P+d*C+p*Q+g*z,s[5]=f*D+d*U+p*oe+g*ne,s[9]=f*F+d*V+p*q+g*Y,s[13]=f*b+d*J+p*ue+g*se,s[2]=v*P+A*C+y*Q+_*z,s[6]=v*D+A*U+y*oe+_*ne,s[10]=v*F+A*V+y*q+_*Y,s[14]=v*b+A*J+y*ue+_*se,s[3]=M*P+E*C+w*Q+B*z,s[7]=M*D+E*U+w*oe+B*ne,s[11]=M*F+E*V+w*q+B*Y,s[15]=M*b+E*J+w*ue+B*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],u=e[9],h=e[13],f=e[2],d=e[6],p=e[10],g=e[14],v=e[3],A=e[7],y=e[11],_=e[15],M=u*g-h*p,E=o*g-h*d,w=o*p-u*d,B=a*g-h*f,P=a*p-u*f,D=a*d-o*f;return t*(A*M-y*E+_*w)-n*(v*M-y*B+_*P)+i*(v*E-A*B+_*D)-s*(v*w-A*P+y*D)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],u=e[6],h=e[7],f=e[8],d=e[9],p=e[10],g=e[11],v=e[12],A=e[13],y=e[14],_=e[15],M=d*y*h-A*p*h+A*u*g-o*y*g-d*u*_+o*p*_,E=v*p*h-f*y*h-v*u*g+a*y*g+f*u*_-a*p*_,w=f*A*h-v*d*h+v*o*g-a*A*g-f*o*_+a*d*_,B=v*d*u-f*A*u-v*o*p+a*A*p+f*o*y-a*d*y,P=t*M+n*E+i*w+s*B;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/P;return e[0]=M*D,e[1]=(A*p*s-d*y*s-A*i*g+n*y*g+d*i*_-n*p*_)*D,e[2]=(o*y*s-A*u*s+A*i*h-n*y*h-o*i*_+n*u*_)*D,e[3]=(d*u*s-o*p*s-d*i*h+n*p*h+o*i*g-n*u*g)*D,e[4]=E*D,e[5]=(f*y*s-v*p*s+v*i*g-t*y*g-f*i*_+t*p*_)*D,e[6]=(v*u*s-a*y*s-v*i*h+t*y*h+a*i*_-t*u*_)*D,e[7]=(a*p*s-f*u*s+f*i*h-t*p*h-a*i*g+t*u*g)*D,e[8]=w*D,e[9]=(v*d*s-f*A*s-v*n*g+t*A*g+f*n*_-t*d*_)*D,e[10]=(a*A*s-v*o*s+v*n*h-t*A*h-a*n*_+t*o*_)*D,e[11]=(f*o*s-a*d*s-f*n*h+t*d*h+a*n*g-t*o*g)*D,e[12]=B*D,e[13]=(f*A*i-v*d*i+v*n*p-t*A*p-f*n*y+t*d*y)*D,e[14]=(v*o*i-a*A*i-v*n*u+t*A*u+a*n*y-t*o*y)*D,e[15]=(a*d*i-f*o*i+f*n*u-t*d*u-a*n*p+t*o*p)*D,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,u=e.z,h=s*a,f=s*o;return this.set(h*a+n,h*o-i*u,h*u+i*o,0,h*o+i*u,f*o+n,f*u-i*a,0,h*u-i*o,f*u+i*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,u=t._w,h=s+s,f=a+a,d=o+o,p=s*h,g=s*f,v=s*d,A=a*f,y=a*d,_=o*d,M=u*h,E=u*f,w=u*d,B=n.x,P=n.y,D=n.z;return i[0]=(1-(A+_))*B,i[1]=(g+w)*B,i[2]=(v-E)*B,i[3]=0,i[4]=(g-w)*P,i[5]=(1-(p+_))*P,i[6]=(y+M)*P,i[7]=0,i[8]=(v+E)*D,i[9]=(y-M)*D,i[10]=(1-(p+A))*D,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let s=so.set(i[0],i[1],i[2]).length();const a=so.set(i[4],i[5],i[6]).length(),o=so.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),mr.copy(this);const h=1/s,f=1/a,d=1/o;return mr.elements[0]*=h,mr.elements[1]*=h,mr.elements[2]*=h,mr.elements[4]*=f,mr.elements[5]*=f,mr.elements[6]*=f,mr.elements[8]*=d,mr.elements[9]*=d,mr.elements[10]*=d,t.setFromRotationMatrix(mr),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=Vi,u=!1){const h=this.elements,f=2*s/(t-e),d=2*s/(n-i),p=(t+e)/(t-e),g=(n+i)/(n-i);let v,A;if(u)v=s/(a-s),A=a*s/(a-s);else if(o===Vi)v=-(a+s)/(a-s),A=-2*a*s/(a-s);else if(o===No)v=-a/(a-s),A=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return h[0]=f,h[4]=0,h[8]=p,h[12]=0,h[1]=0,h[5]=d,h[9]=g,h[13]=0,h[2]=0,h[6]=0,h[10]=v,h[14]=A,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Vi,u=!1){const h=this.elements,f=2/(t-e),d=2/(n-i),p=-(t+e)/(t-e),g=-(n+i)/(n-i);let v,A;if(u)v=1/(a-s),A=a/(a-s);else if(o===Vi)v=-2/(a-s),A=-(a+s)/(a-s);else if(o===No)v=-1/(a-s),A=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return h[0]=f,h[4]=0,h[8]=0,h[12]=p,h[1]=0,h[5]=d,h[9]=0,h[13]=g,h[2]=0,h[6]=0,h[10]=v,h[14]=A,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const so=new N,mr=new It,AM=new N(0,0,0),SM=new N(1,1,1),xs=new N,fu=new N,Hi=new N,ev=new It,tv=new on;class Li{constructor(e=0,t=0,n=0,i=Li.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],u=i[1],h=i[5],f=i[9],d=i[2],p=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(Ft(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-f,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Ft(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ft(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,g),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Ft(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Ft(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,h),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-Ft(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-f,g),this._y=0);break;default:nt("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ev.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ev,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tv.setFromEuler(this),this.setFromQuaternion(tv,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Li.DEFAULT_ORDER="XYZ";class wa{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let MM=0;const nv=new N,ao=new on,Kr=new It,du=new N,vl=new N,EM=new N,wM=new on,iv=new N(1,0,0),rv=new N(0,1,0),sv=new N(0,0,1),av={type:"added"},bM={type:"removed"},oo={type:"childadded",child:null},Yd={type:"childremoved",child:null};class qt extends Ki{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:MM++}),this.uuid=Xi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=qt.DEFAULT_UP.clone();const e=new N,t=new Li,n=new on,i=new N(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new It},normalMatrix:{value:new zt}}),this.matrix=new It,this.matrixWorld=new It,this.matrixAutoUpdate=qt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=qt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new wa,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ao.setFromAxisAngle(e,t),this.quaternion.multiply(ao),this}rotateOnWorldAxis(e,t){return ao.setFromAxisAngle(e,t),this.quaternion.premultiply(ao),this}rotateX(e){return this.rotateOnAxis(iv,e)}rotateY(e){return this.rotateOnAxis(rv,e)}rotateZ(e){return this.rotateOnAxis(sv,e)}translateOnAxis(e,t){return nv.copy(e).applyQuaternion(this.quaternion),this.position.add(nv.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(iv,e)}translateY(e){return this.translateOnAxis(rv,e)}translateZ(e){return this.translateOnAxis(sv,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Kr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?du.copy(e):du.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),vl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Kr.lookAt(vl,du,this.up):Kr.lookAt(du,vl,this.up),this.quaternion.setFromRotationMatrix(Kr),i&&(Kr.extractRotation(i.matrixWorld),ao.setFromRotationMatrix(Kr),this.quaternion.premultiply(ao.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(bt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(av),oo.child=e,this.dispatchEvent(oo),oo.child=null):bt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(bM),Yd.child=e,this.dispatchEvent(Yd),Yd.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Kr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Kr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Kr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(av),oo.child=e,this.dispatchEvent(oo),oo.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vl,e,EM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vl,wM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,u){return o[u.uuid]===void 0&&(o[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const u=o.shapes;if(Array.isArray(u))for(let h=0,f=u.length;h<f;h++){const d=u[h];s(e.shapes,d)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let u=0,h=this.material.length;u<h;u++)o.push(s(e.materials,this.material[u]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const u=this.animations[o];i.animations.push(s(e.animations,u))}}if(t){const o=a(e.geometries),u=a(e.materials),h=a(e.textures),f=a(e.images),d=a(e.shapes),p=a(e.skeletons),g=a(e.animations),v=a(e.nodes);o.length>0&&(n.geometries=o),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),f.length>0&&(n.images=f),d.length>0&&(n.shapes=d),p.length>0&&(n.skeletons=p),g.length>0&&(n.animations=g),v.length>0&&(n.nodes=v)}return n.object=i,n;function a(o){const u=[];for(const h in o){const f=o[h];delete f.metadata,u.push(f)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}qt.DEFAULT_UP=new N(0,1,0);qt.DEFAULT_MATRIX_AUTO_UPDATE=!0;qt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const gr=new N,Zr=new N,Kd=new N,Qr=new N,lo=new N,co=new N,ov=new N,Zd=new N,Qd=new N,qd=new N,jd=new gn,$d=new gn,ep=new gn;class Di{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),gr.subVectors(e,t),i.cross(gr);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){gr.subVectors(i,t),Zr.subVectors(n,t),Kd.subVectors(e,t);const a=gr.dot(gr),o=gr.dot(Zr),u=gr.dot(Kd),h=Zr.dot(Zr),f=Zr.dot(Kd),d=a*h-o*o;if(d===0)return s.set(0,0,0),null;const p=1/d,g=(h*u-o*f)*p,v=(a*f-o*u)*p;return s.set(1-g-v,v,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Qr)===null?!1:Qr.x>=0&&Qr.y>=0&&Qr.x+Qr.y<=1}static getInterpolation(e,t,n,i,s,a,o,u){return this.getBarycoord(e,t,n,i,Qr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,Qr.x),u.addScaledVector(a,Qr.y),u.addScaledVector(o,Qr.z),u)}static getInterpolatedAttribute(e,t,n,i,s,a){return jd.setScalar(0),$d.setScalar(0),ep.setScalar(0),jd.fromBufferAttribute(e,t),$d.fromBufferAttribute(e,n),ep.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(jd,s.x),a.addScaledVector($d,s.y),a.addScaledVector(ep,s.z),a}static isFrontFacing(e,t,n,i){return gr.subVectors(n,t),Zr.subVectors(e,t),gr.cross(Zr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return gr.subVectors(this.c,this.b),Zr.subVectors(this.a,this.b),gr.cross(Zr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Di.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Di.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;lo.subVectors(i,n),co.subVectors(s,n),Zd.subVectors(e,n);const u=lo.dot(Zd),h=co.dot(Zd);if(u<=0&&h<=0)return t.copy(n);Qd.subVectors(e,i);const f=lo.dot(Qd),d=co.dot(Qd);if(f>=0&&d<=f)return t.copy(i);const p=u*d-f*h;if(p<=0&&u>=0&&f<=0)return a=u/(u-f),t.copy(n).addScaledVector(lo,a);qd.subVectors(e,s);const g=lo.dot(qd),v=co.dot(qd);if(v>=0&&g<=v)return t.copy(s);const A=g*h-u*v;if(A<=0&&h>=0&&v<=0)return o=h/(h-v),t.copy(n).addScaledVector(co,o);const y=f*v-g*d;if(y<=0&&d-f>=0&&g-v>=0)return ov.subVectors(s,i),o=(d-f)/(d-f+(g-v)),t.copy(i).addScaledVector(ov,o);const _=1/(y+A+p);return a=A*_,o=p*_,t.copy(n).addScaledVector(lo,a).addScaledVector(co,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const kx={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},ys={h:0,s:0,l:0},pu={h:0,s:0,l:0};function tp(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class je{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=pn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,nn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=nn.workingColorSpace){return this.r=e,this.g=t,this.b=n,nn.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=nn.workingColorSpace){if(e=Im(e,1),t=Ft(t,0,1),n=Ft(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=tp(a,s,e+1/3),this.g=tp(a,s,e),this.b=tp(a,s,e-1/3)}return nn.colorSpaceToWorking(this,i),this}setStyle(e,t=pn){function n(s){s!==void 0&&parseFloat(s)<1&&nt("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:nt("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);nt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=pn){const n=kx[e.toLowerCase()];return n!==void 0?this.setHex(n,t):nt("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=is(e.r),this.g=is(e.g),this.b=is(e.b),this}copyLinearToSRGB(e){return this.r=Bo(e.r),this.g=Bo(e.g),this.b=Bo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=pn){return nn.workingToColorSpace(pi.copy(this),e),Math.round(Ft(pi.r*255,0,255))*65536+Math.round(Ft(pi.g*255,0,255))*256+Math.round(Ft(pi.b*255,0,255))}getHexString(e=pn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nn.workingColorSpace){nn.workingToColorSpace(pi.copy(this),t);const n=pi.r,i=pi.g,s=pi.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let u,h;const f=(o+a)/2;if(o===a)u=0,h=0;else{const d=a-o;switch(h=f<=.5?d/(a+o):d/(2-a-o),a){case n:u=(i-s)/d+(i<s?6:0);break;case i:u=(s-n)/d+2;break;case s:u=(n-i)/d+4;break}u/=6}return e.h=u,e.s=h,e.l=f,e}getRGB(e,t=nn.workingColorSpace){return nn.workingToColorSpace(pi.copy(this),t),e.r=pi.r,e.g=pi.g,e.b=pi.b,e}getStyle(e=pn){nn.workingToColorSpace(pi.copy(this),e);const t=pi.r,n=pi.g,i=pi.b;return e!==pn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ys),this.setHSL(ys.h+e,ys.s+t,ys.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ys),e.getHSL(pu);const n=kl(ys.h,pu.h,t),i=kl(ys.s,pu.s,t),s=kl(ys.l,pu.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const pi=new je;je.NAMES=kx;let TM=0;class Fn extends Ki{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:TM++}),this.uuid=Xi(),this.name="",this.type="Material",this.blending=Ma,this.side=Mr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ah,this.blendDst=oh,this.blendEquation=bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new je(0,0,0),this.blendAlpha=0,this.depthFunc=Ta,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=qp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=da,this.stencilZFail=da,this.stencilZPass=da,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){nt(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){nt(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 9,098 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).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(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).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(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).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!==Ma&&(n.blending=this.blending),this.side!==Mr&&(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!==ah&&(n.blendSrc=this.blendSrc),this.blendDst!==oh&&(n.blendDst=this.blendDst),this.blendEquation!==bs&&(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!==Ta&&(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!==qp&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==da&&(n.stencilFail=this.stencilFail),this.stencilZFail!==da&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==da&&(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 i(s){const a=[];for(const o in s){const u=s[o];delete u.metadata,a.push(u)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 6,373 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class bi extends Fn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new je(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 Li,this.combine=ac,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const es=CM();function CM(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,f=0;for(;!(h&8388608);)h<<=1,f-=8388608;h&=-8388609,f+=947912704,s[u]=h|f}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(o[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function Pi(r){Math.abs(r)>65504&&nt("DataUtils.toHalfFloat(): Value out of range."),r=Ft(r,-65504,65504),es.floatView[0]=r;const e=es.uint32View[0],t=e>>23&511;return es.baseTable[t]+((e&8388607)>>es.shiftTable[t])}function Ll(r){const e=r>>10;return es.uint32View[0]=es.mantissaTable[es.offsetTable[e]+(r&1023)]+es.exponentTable[e],es.floatView[0]}class xa{static toHalfFloat(e){return Pi(e)}static fromHalfFloat(e){return Ll(e)}}const Gn=new N,mu=new _e;let RM=0;class sn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:RM++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ql,this.updateRanges=[],this.gpuType=In,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)mu.fromBufferAttribute(this,t),mu.applyMatrix3(e),this.setXY(t,mu.x,mu.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Gn.fromBufferAttribute(this,t),Gn.applyMatrix3(e),this.setXYZ(t,Gn.x,Gn.y,Gn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Gn.fromBufferAttribute(this,t),Gn.applyMatrix4(e),this.setXYZ(t,Gn.x,Gn.y,Gn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Gn.fromBufferAttribute(this,t),Gn.applyNormalMatrix(e),this.setXYZ(t,Gn.x,Gn.y,Gn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Gn.fromBufferAttribute(this,t),Gn.transformDirection(e),this.setXYZ(t,Gn.x,Gn.y,Gn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ei(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=kt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ei(t,this.array)),t}setX(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ei(t,this.array)),t}setY(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ei(t,this.array)),t}setZ(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ei(t,this.array)),t}setW(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array),i=kt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array),i=kt(i,this.array),s=kt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 5,325 bytes, line 5
5onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ql&&(e.usage=this.usage),e}}class IM extends sn{constructor(e,t,n){super(new Int8Array(e),t,n)}}class BM extends sn{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class PM extends sn{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class DM extends sn{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Pm extends sn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class LM extends sn{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Dm extends sn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class FM extends sn{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ll(this.array[e*this.itemSize]);return this.normalized&&(t=Ei(t,this.array)),t}setX(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize]=Pi(t),this}getY(e){let t=Ll(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ei(t,this.array)),t}setY(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+1]=Pi(t),this}getZ(e){let t=Ll(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ei(t,this.array)),t}setZ(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+2]=Pi(t),this}getW(e){let t=Ll(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ei(t,this.array)),t}setW(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+3]=Pi(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array)),this.array[e+0]=Pi(t),this.array[e+1]=Pi(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array),i=kt(i,this.array)),this.array[e+0]=Pi(t),this.array[e+1]=Pi(n),this.array[e+2]=Pi(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array),i=kt(i,this.array),s=kt(s,this.array)),this.array[e+0]=Pi(t),this.array[e+1]=Pi(n),this.array[e+2]=Pi(i),this.array[e+3]=Pi(s),this}}class pt extends sn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let UM=0;const ir=new It,np=new qt,uo=new N,zi=new ri,_l=new ri,qn=new N;class Lt extends Ki{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:UM++}),this.uuid=Xi(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Nx(e)?Dm:Pm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new zt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ir.makeRotationFromQuaternion(e),this.applyMatrix4(ir),this}rotateX(e){return ir.makeRotationX(e),this.applyMatrix4(ir),this}rotateY(e){return ir.makeRotationY(e),this.applyMatrix4(ir),this}rotateZ(e){return ir.makeRotationZ(e),this.applyMatrix4(ir),this}translate(e,t,n){return ir.makeTranslation(e,t,n),this.applyMatrix4(ir),this}scale(e,t,n){return ir.makeScale(e,t,n),this.applyMatrix4(ir),this}lookAt(e){return np.lookAt(e),np.updateMatrix(),this.applyMatrix4(np.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(uo).negate(),this.translate(uo.x,uo.y,uo.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new pt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&nt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ri);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){bt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];
vendor: 21,291 bytes, lines 5-9
5zi.setFromBufferAttribute(s),this.morphTargetsRelative?(qn.addVectors(this.boundingBox.min,zi.min),this.boundingBox.expandByPoint(qn),qn.addVectors(this.boundingBox.max,zi.max),this.boundingBox.expandByPoint(qn)):(this.boundingBox.expandByPoint(zi.min),this.boundingBox.expandByPoint(zi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&bt('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 ei);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){bt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){const n=this.boundingSphere.center;if(zi.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];_l.setFromBufferAttribute(o),this.morphTargetsRelative?(qn.addVectors(zi.min,_l.min),zi.expandByPoint(qn),qn.addVectors(zi.max,_l.max),zi.expandByPoint(qn)):(zi.expandByPoint(_l.min),zi.expandByPoint(_l.max))}zi.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)qn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(qn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],u=this.morphTargetsRelative;for(let h=0,f=o.count;h<f;h++)qn.fromBufferAttribute(o,h),u&&(uo.fromBufferAttribute(e,h),qn.add(uo)),i=Math.max(i,n.distanceToSquared(qn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&bt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){bt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new sn(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],u=[];for(let F=0;F<n.count;F++)o[F]=new N,u[F]=new N;const h=new N,f=new N,d=new N,p=new _e,g=new _e,v=new _e,A=new N,y=new N;function _(F,b,C){h.fromBufferAttribute(n,F),f.fromBufferAttribute(n,b),d.fromBufferAttribute(n,C),p.fromBufferAttribute(s,F),g.fromBufferAttribute(s,b),v.fromBufferAttribute(s,C),f.sub(h),d.sub(h),g.sub(p),v.sub(p);const U=1/(g.x*v.y-v.x*g.y);isFinite(U)&&(A.copy(f).multiplyScalar(v.y).addScaledVector(d,-g.y).multiplyScalar(U),y.copy(d).multiplyScalar(g.x).addScaledVector(f,-v.x).multiplyScalar(U),o[F].add(A),o[b].add(A),o[C].add(A),u[F].add(y),u[b].add(y),u[C].add(y))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let F=0,b=M.length;F<b;++F){const C=M[F],U=C.start,V=C.count;for(let J=U,Q=U+V;J<Q;J+=3)_(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const E=new N,w=new N,B=new N,P=new N;function D(F){B.fromBufferAttribute(i,F),P.copy(B);const b=o[F];E.copy(b),E.sub(B.multiplyScalar(B.dot(b))).normalize(),w.crossVectors(P,b);const U=w.dot(u[F])<0?-1:1;a.setXYZW(F,E.x,E.y,E.z,U)}for(let F=0,b=M.length;F<b;++F){const C=M[F],U=C.start,V=C.count;for(let J=U,Q=U+V;J<Q;J+=3)D(e.getX(J+0)),D(e.getX(J+1)),D(e.getX(J+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new sn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,g=n.count;p<g;p++)n.setXYZ(p,0,0,0);const i=new N,s=new N,a=new N,o=new N,u=new N,h=new N,f=new N,d=new N;if(e)for(let p=0,g=e.count;p<g;p+=3){const v=e.getX(p+0),A=e.getX(p+1),y=e.getX(p+2);i.fromBufferAttribute(t,v),s.fromBufferAttribute(t,A),a.fromBufferAttribute(t,y),f.subVectors(a,s),d.subVectors(i,s),f.cross(d),o.fromBufferAttribute(n,v),u.fromBufferAttribute(n,A),h.fromBufferAttribute(n,y),o.add(f),u.add(f),h.add(f),n.setXYZ(v,o.x,o.y,o.z),n.setXYZ(A,u.x,u.y,u.z),n.setXYZ(y,h.x,h.y,h.z)}else for(let p=0,g=t.count;p<g;p+=3)i.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),a.fromBufferAttribute(t,p+2),f.subVectors(a,s),d.subVectors(i,s),f.cross(d),n.setXYZ(p+0,f.x,f.y,f.z),n.setXYZ(p+1,f.x,f.y,f.z),n.setXYZ(p+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)qn.fromBufferAttribute(e,t),qn.normalize(),e.setXYZ(t,qn.x,qn.y,qn.z)}toNonIndexed(){function e(o,u){const h=o.array,f=o.itemSize,d=o.normalized,p=new h.constructor(u.length*f);let g=0,v=0;for(let A=0,y=u.length;A<y;A++){o.isInterleavedBufferAttribute?g=u[A]*o.data.stride+o.offset:g=u[A]*f;for(let _=0;_<f;_++)p[v++]=h[g++]}return new sn(p,f,d)}if(this.index===null)return nt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Lt,n=this.index.array,i=this.attributes;for(const o in i){const u=i[o],h=e(u,n);t.setAttribute(o,h)}const s=this.morphAttributes;for(const o in s){const u=[],h=s[o];for(let f=0,d=h.length;f<d;f++){const p=h[f],g=e(p,n);u.push(g)}t.morphAttributes[o]=u}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,u=a.length;o<u;o++){const h=a[o];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],f=[];for(let d=0,p=h.length;d<p;d++){const g=h[d];f.push(g.toJSON(e.data))}f.length>0&&(i[u]=f,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const h in i){const f=i[h];this.setAttribute(h,f.clone(t))}const s=e.morphAttributes;for(const h in s){const f=[],d=s[h];for(let p=0,g=d.length;p<g;p++)f.push(d[p].clone(t));this.morphAttributes[h]=f}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,f=a.length;h<f;h++){const d=a[h];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const lv=new It,js=new Na,gu=new ei,cv=new N,vu=new N,_u=new N,xu=new N,ip=new N,yu=new N,uv=new N,Au=new N;class ot extends qt{constructor(e=new Lt,t=new bi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){yu.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const f=o[u],d=s[u];f!==0&&(ip.fromBufferAttribute(d,e),a?yu.addScaledVector(ip,f):yu.addScaledVector(ip.sub(t),f))}t.add(yu)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),gu.copy(n.boundingSphere),gu.applyMatrix4(s),js.copy(e.ray).recast(e.near),!(gu.containsPoint(js.origin)===!1&&(js.intersectSphere(gu,cv)===null||js.origin.distanceToSquared(cv)>(e.far-e.near)**2))&&(lv.copy(s).invert(),js.copy(e.ray).applyMatrix4(lv),!(n.boundingBox!==null&&js.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,js)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,u=s.attributes.position,h=s.attributes.uv,f=s.attributes.uv1,d=s.attributes.normal,p=s.groups,g=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,A=p.length;v<A;v++){const y=p[v],_=a[y.materialIndex],M=Math.max(y.start,g.start),E=Math.min(o.count,Math.min(y.start+y.count,g.start+g.count));for(let w=M,B=E;w<B;w+=3){const P=o.getX(w),D=o.getX(w+1),F=o.getX(w+2);i=Su(this,_,e,n,h,f,d,P,D,F),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const v=Math.max(0,g.start),A=Math.min(o.count,g.start+g.count);for(let y=v,_=A;y<_;y+=3){const M=o.getX(y),E=o.getX(y+1),w=o.getX(y+2);i=Su(this,a,e,n,h,f,d,M,E,w),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(a))for(let v=0,A=p.length;v<A;v++){const y=p[v],_=a[y.materialIndex],M=Math.max(y.start,g.start),E=Math.min(u.count,Math.min(y.start+y.count,g.start+g.count));for(let w=M,B=E;w<B;w+=3){const P=w,D=w+1,F=w+2;i=Su(this,_,e,n,h,f,d,P,D,F),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const v=Math.max(0,g.start),A=Math.min(u.count,g.start+g.count);for(let y=v,_=A;y<_;y+=3){const M=y,E=y+1,w=y+2;i=Su(this,a,e,n,h,f,d,M,E,w),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}}}function NM(r,e,t,n,i,s,a,o){let u;if(e.side===Hn?u=n.intersectTriangle(a,s,i,!0,o):u=n.intersectTriangle(i,s,a,e.side===Mr,o),u===null)return null;Au.copy(o),Au.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo(Au);return h<t.near||h>t.far?null:{distance:h,point:Au.clone(),object:r}}function Su(r,e,t,n,i,s,a,o,u,h){r.getVertexPosition(o,vu),r.getVertexPosition(u,_u),r.getVertexPosition(h,xu);const f=NM(r,e,t,n,vu,_u,xu,uv);if(f){const d=new N;Di.getBarycoord(uv,vu,_u,xu,d),i&&(f.uv=Di.getInterpolatedAttribute(i,o,u,h,d,new _e)),s&&(f.uv1=Di.getInterpolatedAttribute(s,o,u,h,d,new _e)),a&&(f.normal=Di.getInterpolatedAttribute(a,o,u,h,d,new N),f.normal.dot(n.direction)>0&&f.normal.multiplyScalar(-1));const p={a:o,b:u,c:h,normal:new N,materialIndex:0};Di.getNormal(vu,_u,xu,p.normal),f.face=p,f.barycoord=d}return f}class Mi extends Lt{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],f=[],d=[];let p=0,g=0;v("z","y","x",-1,-1,n,t,e,a,s,0),v("z","y","x",1,-1,n,t,-e,a,s,1),v("x","z","y",1,1,e,n,t,i,a,2),v("x","z","y",1,-1,e,n,-t,i,a,3),v("x","y","z",1,-1,e,t,n,i,s,4),v("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new pt(h,3)),this.setAttribute("normal",new pt(f,3)),this.setAttribute("uv",new pt(d,2));function v(A,y,_,M,E,w,B,P,D,F,b){const C=w/D,U=B/F,V=w/2,J=B/2,Q=P/2,oe=D+1,q=F+1;let ue=0,z=0;const ne=new N;for(let Y=0;Y<q;Y++){const se=Y*U-J;for(let pe=0;pe<oe;pe++){const we=pe*C-V;ne[A]=we*M,ne[y]=se*E,ne[_]=Q,h.push(ne.x,ne.y,ne.z),ne[A]=0,ne[y]=0,ne[_]=P>0?1:-1,f.push(ne.x,ne.y,ne.z),d.push(pe/D),d.push(1-Y/F),ue+=1}}for(let Y=0;Y<F;Y++)for(let se=0;se<D;se++){const pe=p+se+oe*Y,we=p+se+oe*(Y+1),$=p+(se+1)+oe*(Y+1),xt=p+(se+1)+oe*Y;u.push(pe,we,xt),u.push(we,$,xt),z+=6}o.addGroup(g,z,b),g+=z,p+=ue}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ho(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(nt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Si(r){const e={};for(let t=0;t<r.length;t++){const n=Ho(r[t]);for(const i in n)e[i]=n[i]}return e}function OM(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function Vx(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:nn.workingColorSpace}const Lm={clone:Ho,merge:Si};var GM=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,HM=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class Bn extends Fn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=GM,this.fragmentShader=HM,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ho(e.uniforms),this.uniformsGroups=OM(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class cc extends qt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new It,this.projectionMatrix=new It,this.projectionMatrixInverse=new It,this.coordinateSystem=Vi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const As=new N,hv=new _e,fv=new _e;class En extends cc{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Go*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ea*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Go*2*Math.atan(Math.tan(Ea*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){As.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(As.x,As.y).multiplyScalar(-e/As.z),As.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(As.x,As.y).multiplyScalar(-e/As.z)}getViewSize(e,t){return this.getViewBounds(e,hv,fv),t.subVectors(fv,hv)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ea*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,h=a.fullHeight;s+=a.offsetX*i/u,t-=a.offsetY*n/h,i*=a.width/u,n*=a.height/h}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ho=-90,fo=1;class Wx extends qt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new En(ho,fo,e,t);i.layers=this.layers,this.add(i);const s=new En(ho,fo,e,t);s.layers=this.layers,this.add(s);const a=new En(ho,fo,e,t);a.layers=this.layers,this.add(a);const o=new En(ho,fo,e,t);o.layers=this.layers,this.add(o);const u=new En(ho,fo,e,t);u.layers=this.layers,this.add(u);const h=new En(ho,fo,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,u]=t;for(const h of t)this.remove(h);if(e===Vi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===No)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,u,h,f]=this.children,d=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,u),e.setRenderTarget(n,4,i),e.render(t,h),n.texture.generateMipmaps=A,e.setRenderTarget(n,5,i),e.render(t,f),e.setRenderTarget(d,p,g),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}}class uc extends yn{constructor(e=[],t=Or,n,i,s,a,o,u,h,f){super(e,t,n,i,s,a,o,u,h,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Fm extends bn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new uc(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 18,557 bytes, lines 9-44
9=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},i=new Mi(5,5,5),s=new Bn({name:"CubemapFromEquirect",uniforms:Ho(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Hn,blending:ii});s.uniforms.tEquirect.value=t;const a=new ot(i,s),o=t.minFilter;return t.minFilter===or&&(t.minFilter=rn),new Wx(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}class ns extends qt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zM={type:"move"};class ih{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ns,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 ns,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ns,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const A of e.hand.values()){const y=t.getJointPose(A,n),_=this._getHandJoint(h,A);y!==null&&(_.matrix.fromArray(y.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=y.radius),_.visible=y!==null}const f=h.joints["index-finger-tip"],d=h.joints["thumb-tip"],p=f.position.distanceTo(d.position),g=.02,v=.005;h.inputState.pinching&&p>g+v?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&p<=g-v&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zM)))}return o!==null&&(o.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ns;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class df{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new je(e),this.density=t}clone(){return new df(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class pf{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new je(e),this.near=t,this.far=n}clone(){return new pf(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class ec extends qt{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 Li,this.environmentIntensity=1,this.environmentRotation=new Li,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class hc{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ql,this.updateRanges=[],this.version=0,this.uuid=Xi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Xi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Xi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ai=new N;class Fs{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ai.fromBufferAttribute(this,t),Ai.applyMatrix4(e),this.setXYZ(t,Ai.x,Ai.y,Ai.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ai.fromBufferAttribute(this,t),Ai.applyNormalMatrix(e),this.setXYZ(t,Ai.x,Ai.y,Ai.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ai.fromBufferAttribute(this,t),Ai.transformDirection(e),this.setXYZ(t,Ai.x,Ai.y,Ai.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Ei(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=kt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=kt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=kt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=kt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=kt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Ei(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ei(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ei(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ei(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array),i=kt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=kt(t,this.array),n=kt(n,this.array),i=kt(i,this.array),s=kt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){$l("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new sn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Fs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){$l("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Um extends Fn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new je(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let po;const xl=new N,mo=new N,go=new N,vo=new _e,yl=new _e,Xx=new It,Mu=new N,Al=new N,Eu=new N,dv=new _e,rp=new _e,pv=new _e;class Jx extends qt{constructor(e=new Um){if(super(),this.isSprite=!0,this.type="Sprite",po===void 0){po=new Lt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new hc(t,5);po.setIndex([0,1,2,0,2,3]),po.setAttribute("position",new Fs(n,3,0,!1)),po.setAttribute("uv",new Fs(n,2,3,!1))}this.geometry=po,this.material=e,this.center=new _e(.5,.5),this.count=1}raycast(e,t){e.camera===null&&bt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),mo.setFromMatrixScale(this.matrixWorld),Xx.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),go.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&mo.multiplyScalar(-go.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;wu(Mu.set(-.5,-.5,0),go,a,mo,i,s),wu(Al.set(.5,-.5,0),go,a,mo,i,s),wu(Eu.set(.5,.5,0),go,a,mo,i,s),dv.set(0,0),rp.set(1,0),pv.set(1,1);let o=e.ray.intersectTriangle(Mu,Al,Eu,!1,xl);if(o===null&&(wu(Al.set(-.5,.5,0),go,a,mo,i,s),rp.set(0,1),o=e.ray.intersectTriangle(Mu,Eu,Al,!1,xl),o===null))return;const u=e.ray.origin.distanceTo(xl);u<e.near||u>e.far||t.push({distance:u,point:xl.clone(),uv:Di.getInterpolation(xl,Mu,Al,Eu,dv,rp,pv,new _e),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function wu(r,e,t,n,i,s){vo.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(yl.x=s*vo.x-i*vo.y,yl.y=i*vo.x+s*vo.y):yl.copy(vo),r.copy(e),r.x+=yl.x,r.y+=yl.y,r.applyMatrix4(Xx)}const bu=new N,mv=new N;class Yx extends qt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){bu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(bu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){bu.setFromMatrixPosition(e.matrixWorld),mv.setFromMatrixPosition(this.matrixWorld);const n=bu.distanceTo(mv)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const gv=new N,vv=new gn,_v=new gn,kM=new N,xv=new It,Tu=new N,sp=new ei,yv=new It,ap=new Na;class Nm extends ot{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Qp,this.bindMatrix=new It,this.bindMatrixInverse=new It,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ri),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Tu),this.boundingBox.expandByPoint(Tu)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ei),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Tu),this.boundingSphere.expandByPoint(Tu)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),sp.copy(this.boundingSphere),sp.applyMatrix4(i),e.ray.intersectsSphere(sp)!==!1&&(yv.copy(i).invert(),ap.copy(e.ray).applyMatrix4(yv),!(this.boundingBox!==null&&ap.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,ap)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new gn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Qp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===wx?this.bindMatrixInverse.copy(this.bindMatrix).invert():nt("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;vv.fromBufferAttribute(i.attributes.skinIndex,e),_v.fromBufferAttribute(i.attributes.skinWeight,e),gv.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=_v.getComponent(s);if(a!==0){const o=vv.getComponent(s);xv.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(kM.copy(gv).applyMatrix4(xv),a)}}
vendor: 9,979 bytes, line 44
44return t.applyMatrix4(this.bindMatrixInverse)}}class mf extends qt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ar extends yn{constructor(e=null,t=1,n=1,i,s,a,o,u,h=xn,f=xn,d,p){super(null,a,o,u,h,f,i,s,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Av=new It,VM=new It;class fc{constructor(e=[],t=[]){this.uuid=Xi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){nt("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new It)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new It;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:VM;Av.multiplyMatrices(o,t[s]),Av.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new fc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Ar(t,e,e,ni,In);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(nt("Skeleton: No bone found with UUID:",s),a=new mf),this.bones.push(a),this.boneInverses.push(new It().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Ia extends sn{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const _o=new It,Sv=new It,Cu=[],Mv=new ri,WM=new It,Sl=new ot,Ml=new ei;class Om extends ot{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ia(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,WM)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ri),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,_o),Mv.copy(e.boundingBox).applyMatrix4(_o),this.boundingBox.union(Mv)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ei),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,_o),Ml.copy(e.boundingSphere).applyMatrix4(_o),this.boundingSphere.union(Ml)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Sl.geometry=this.geometry,Sl.material=this.material,Sl.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ml.copy(this.boundingSphere),Ml.applyMatrix4(n),e.ray.intersectsSphere(Ml)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,_o),Sv.multiplyMatrices(n,_o),Sl.matrixWorld=Sv,Sl.raycast(e,Cu);for(let a=0,o=Cu.length;a<o;a++){const u=Cu[a];u.instanceId=s,u.object=this,t.push(u)}Cu.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ia(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Ar(new Float32Array(i*this.count),i,this.count,oc,In));const s=this.morphTexture.source.data.data;let a=0;for(let h=0;h<n.length;h++)a+=n[h];const o=this.geometry.morphTargetsRelative?1:1-a,u=i*e;s[u]=o,s.set(n,u+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const op=new N,XM=new N,JM=new zt;class $r{constructor(e=new N(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=op.subVectors(n,t).cross(XM.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(op),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||JM.getNormalMatrix(e),i=this.coplanarPoint(op).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const $s=new ei,YM=new _e(.5,.5),Ru=new N;class Xo{constructor(e=new $r,t=new $r,n=new $r,i=new $r,s=new $r,a=new $r){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Vi,n=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],u=s[2],h=s[3],f=s[4],d=s[5],p=s[6],g=s[7],v=s[8],A=s[9],y=s[10],_=s[11],M=s[12],E=s[13],w=s[14],B=s[15];if(i[0].setComponents(h-a,g-f,_-v,B-M).normalize(),i[1].setComponents(h+a,g+f,_+v,B+M).normalize(),i[2].setComponents(h+o,g+d,_+A,B+E).normalize(),i[3].setComponents(h-o,g-d,_-A,B-E).normalize(),n)i[4].setComponents(u,p,y,w).normalize(),i[5].setComponents(h-u,g-p,_-y,B-w).normalize();else if(i[4].setComponents(h-u,g-p,_-y,B-w).normalize(),t===Vi)i[5].setComponents(h+u,g+p,_+y,B+w).normalize();else if(t===No)i[5].setComponents(u,p,y,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),$s.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),$s.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($s)}intersectsSprite(e){$s.center.set(0,0,0);const t=YM.distanceTo(e.center);return $s.radius=.7071067811865476+t,$s.applyMatrix4(e.matrixWorld),this.intersectsSphere($s)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Ru.x=i.normal.x>0?e.max.x:e.min.x,Ru.y=i.normal.y>0?e.max.y:e.min.y,Ru.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ru)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Lr=new It,Fr=new Xo;class gf{constructor(){this.coordinateSystem=Vi}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Lr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Fr.
vendor: 3,805 bytes, line 44
44setFromProjectionMatrix(Lr,i.coordinateSystem,i.reversedDepth),Fr.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Lr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Fr.setFromProjectionMatrix(Lr,i.coordinateSystem,i.reversedDepth),Fr.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Lr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Fr.setFromProjectionMatrix(Lr,i.coordinateSystem,i.reversedDepth),Fr.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Lr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Fr.setFromProjectionMatrix(Lr,i.coordinateSystem,i.reversedDepth),Fr.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Lr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Fr.setFromProjectionMatrix(Lr,i.coordinateSystem,i.reversedDepth),Fr.containsPoint(e))return!0}return!1}clone(){return new gf}}function lp(r,e){return r-e}function KM(r,e){return r.z-e.z}function ZM(r,e){return e.z-r.z}class QM{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const Bi=new It,qM=new je(1,1,1),Ev=new Xo,jM=new gf,Iu=new ri,ea=new ei,El=new N,wv=new N,$M=new N,cp=new QM,mi=new ot,Bu=[];function eE(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function ta(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class Kx extends ot{constructor(e,t,n=t*2,i){super(new Lt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Ar(t,e,e,ni,In);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Ar(t,e,e,lc,Ji);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Ar(t,e,e,ni,In);
44n.colorSpace=nn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:u,normalized:h}=a,f=new o.constructor(n*u),d=new sn(f,u,h);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new sn(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ri);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,Bi),this.getBoundingBoxAt(s,Iu).applyMatrix4(Bi),e.union(Iu)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ei);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,Bi),this.getBoundingSphereAt(s,ea).applyMatrix4(Bi),e.union(ea)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(lp),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Bi.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(qM.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(lp),u=this._availableGeometryIds.shift(),s[u]=i):(u=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(u,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(i&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=o.vertexStart,h=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const f in n.attributes){const d=t.getAttribute(f),p=n.getAttribute(f);eE(d,p,u);const g=d.itemSize;
vendor: 10,179 bytes, line 44
44for(let v=d.count,A=h;v<A;v++){const y=u+v;for(let _=0;_<g;_++)p.setComponent(y,_,0)}p.needsUpdate=!0,p.addUpdateRange(u*g,h*g)}if(i){const f=o.indexStart,d=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let p=0;p<a.count;p++)s.setX(f+p,u+a.getX(p));for(let p=a.count,g=d;p<g;p++)s.setX(f+p,u);s.needsUpdate=!0,s.addUpdateRange(f,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((a,o)=>o).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),s=this.geometry;for(let a=0,o=n.length;a<o;a++){const u=i[a],h=n[u];if(h.active!==!1){if(s.index!==null){if(h.indexStart!==t){const{indexStart:f,vertexStart:d,reservedIndexCount:p}=h,g=s.index,v=g.array,A=e-d;for(let y=f;y<f+p;y++)v[y]=v[y]+A;g.array.copyWithin(t,f,f+p),g.addUpdateRange(t,p),g.needsUpdate=!0,h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:f,reservedVertexCount:d}=h,p=s.attributes;for(const g in p){const v=p[g],{array:A,itemSize:y}=v;A.copyWithin(e*y,f*y,(f+d)*y),v.addUpdateRange(e*y,d*y),v.needsUpdate=!0}h.vertexStart=e}e+=h.reservedVertexCount,h.start=s.index?h.indexStart:h.vertexStart,this._nextIndexStart=s.index?h.indexStart+h.reservedIndexCount:0,this._nextVertexStart=h.vertexStart+h.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new ri,a=n.index,o=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let f=u;a&&(f=a.getX(f)),s.expandByPoint(El.fromBufferAttribute(o,f))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new ei;this.getBoundingBoxAt(e,Iu),Iu.getCenter(s.center);const a=n.index,o=n.attributes.position;let u=0;for(let h=i.start,f=i.start+i.count;h<f;h++){let d=h;a&&(d=a.getX(d)),El.fromBufferAttribute(o,d),u=Math.max(u,s.center.distanceToSquared(El))}s.radius=Math.sqrt(u),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(lp);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);ta(this._multiDrawCounts,i),ta(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,u=this._colorsTexture;a.dispose(),this._initIndirectTexture(),ta(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ta(o.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),ta(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Lt,this._initializeGeometry(s));const a=this.geometry;s.index&&ta(s.index.array,a.index.array);for(const o in s.attributes)ta(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;mi.material=this.material,mi.geometry.index=a.index,mi.geometry.attributes=a.attributes,mi.geometry.boundingBox===null&&(mi.geometry.boundingBox=new ri),mi.geometry.boundingSphere===null&&(mi.geometry.boundingSphere=new ei);for(let o=0,u=n.length;o<u;o++){if(!n[o].visible||!n[o].active)continue;const h=n[o].geometryIndex,f=i[h];mi.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(o,mi.matrixWorld).premultiply(s),this.getBoundingBoxAt(h,mi.geometry.boundingBox),this.getBoundingSphereAt(h,mi.geometry.boundingSphere),mi.raycast(e,Bu);for(let d=0,p=Bu.length;d<p;d++){const g=Bu[d];g.object=this,g.batchId=o,t.push(g)}Bu.length=0}mi.material=null,mi.geometry.index=null,mi.geometry.attributes={},mi.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,u=this._instanceInfo,h=this._multiDrawStarts,f=this._multiDrawCounts,d=this._geometryInfo,p=this.perObjectFrustumCulled,g=this._indirectTexture,v=g.image.data,A=n.isArrayCamera?jM:Ev;p&&!n.isArrayCamera&&(Bi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Ev.setFromProjectionMatrix(Bi,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){Bi.copy(this.matrixWorld).invert(),El.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Bi),wv.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Bi);for(let E=0,w=u.length;E<w;E++)if(u[E].visible&&u[E].active){const B=u[E].geometryIndex;this.getMatrixAt(E,Bi),this.getBoundingSphereAt(B,ea).applyMatrix4(Bi);let P=!1;if(p&&(P=!A.intersectsSphere(ea,n)),!P){const D=d[B],F=$M.subVectors(ea.center,El).dot(wv);cp.push(D.start,D.count,F,E)}}const _=cp.list,M=this.customSort;M===null?_.sort(s.transparent?ZM:KM):M.call(this,_,n);for(let E=0,w=_.length;E<w;E++){const B=_[E];h[y]=B.start*o,f[y]=B.count,v[y]=B.index,y++}cp.reset()}else for(let _=0,M=u.length;_<M;_++)if(u[_].visible&&u[_].active){const E=u[_].geometryIndex;let w=!1;if(p&&(this.getMatrixAt(_,Bi),this.getBoundingSphereAt(E,ea).applyMatrix4(Bi),w=!A.intersectsSphere(ea,n)),!w){const B=d[E];h[y]=B.start*o,f[y]=B.count,v[y]=_,y++}}g.needsUpdate=!0,this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class si extends Fn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new je(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}
vendor: 8,056 bytes, line 44
44const Yh=new N,Kh=new N,bv=new It,wl=new Na,Pu=new ei,up=new N,Tv=new N;class Yt extends qt{constructor(e=new Lt,t=new si){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Yh.fromBufferAttribute(t,i-1),Kh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Yh.distanceTo(Kh);e.setAttribute("lineDistance",new pt(n,1))}else nt("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Pu.copy(n.boundingSphere),Pu.applyMatrix4(i),Pu.radius+=s,e.ray.intersectsSphere(Pu)===!1)return;bv.copy(i).invert(),wl.copy(e.ray).applyMatrix4(bv);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=o*o,h=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(f!==null){const g=Math.max(0,a.start),v=Math.min(f.count,a.start+a.count);for(let A=g,y=v-1;A<y;A+=h){const _=f.getX(A),M=f.getX(A+1),E=Du(this,e,wl,u,_,M,A);E&&t.push(E)}if(this.isLineLoop){const A=f.getX(v-1),y=f.getX(g),_=Du(this,e,wl,u,A,y,v-1);_&&t.push(_)}}else{const g=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count);for(let A=g,y=v-1;A<y;A+=h){const _=Du(this,e,wl,u,A,A+1,A);_&&t.push(_)}if(this.isLineLoop){const A=Du(this,e,wl,u,v-1,g,v-1);A&&t.push(A)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Du(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(Yh.fromBufferAttribute(o,i),Kh.fromBufferAttribute(o,s),t.distanceSqToSegment(Yh,Kh,up,Tv)>n)return;up.applyMatrix4(r.matrixWorld);const h=e.ray.origin.distanceTo(up);if(!(h<e.near||h>e.far))return{distance:h,point:Tv.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const Cv=new N,Rv=new N;class Er extends Yt{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Cv.fromBufferAttribute(t,i),Rv.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Cv.distanceTo(Rv);e.setAttribute("lineDistance",new pt(n,1))}else nt("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Gm extends Yt{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class vf extends Fn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new je(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Iv=new It,$p=new Na,Lu=new ei,Fu=new N;class Hm extends qt{constructor(e=new Lt,t=new vf){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Lu.copy(n.boundingSphere),Lu.applyMatrix4(i),Lu.radius+=s,e.ray.intersectsSphere(Lu)===!1)return;Iv.copy(i).invert(),$p.copy(e.ray).applyMatrix4(Iv);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=o*o,h=n.index,d=n.attributes.position;if(h!==null){const p=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let v=p,A=g;v<A;v++){const y=h.getX(v);Fu.fromBufferAttribute(d,y),Bv(Fu,y,u,i,e,t,this)}}else{const p=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let v=p,A=g;v<A;v++)Fu.fromBufferAttribute(d,v),Bv(Fu,v,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Bv(r,e,t,n,i,s,a){const o=$p.distanceSqToPoint(r);if(o<t){const u=new N;$p.closestPointToPoint(r,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;s.push({distance:h,distanceToRay:Math.sqrt(o),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Zx extends yn{constructor(e,t,n,i,s=rn,a=rn,o,u,h){super(e,t,n,i,s,a,o,u,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const f=this;function d(){f.needsUpdate=!0,f._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class tE extends Zx{constructor(e,t,n,i,s,a,o,u){super({},e,t,n,i,s,a,o,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class nE extends yn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xn,this.minFilter=xn,this.generateMipmaps=!1,this.needsUpdate=!0}}class _f extends yn{constructor(e,t,n,i,s,a,o,u,h,f,d,p){super(null,a,o,u,h,f,i,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class iE extends _f{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=wi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class rE extends _f{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Or),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class sE extends yn{constructor(e,t,n,i,s,a,o,u,h){super(e,t,n,i,s,a,o,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ba extends yn{constructor(e,t,n=Ji,i,s,a,o=xn,u=xn,h,f=Gr,d=1){if(f!==Gr&&f!==ts)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:t,depth:d};super(p,i,s,a,o,u,f,n,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ts(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Qx extends Ba{constructor(e,t=Ji,n=Or,i,s,a=xn,o=xn,u,h=Gr){const f={width:e,height:e,depth:1},d=[f,f,f,f,f,f];super(e,e,t,n,i,s,a,o,u,h),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class zm extends yn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class xf extends Lt{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
vendor: 3,787 bytes, line 44
44s:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const a=[],o=[],u=[],h=[],f=t/2,d=Math.PI/2*e,p=t,g=2*d+p,v=n*2+s,A=i+1,y=new N,_=new N;for(let M=0;M<=v;M++){let E=0,w=0,B=0,P=0;if(M<=n){const b=M/n,C=b*Math.PI/2;w=-f-e*Math.cos(C),B=e*Math.sin(C),P=-e*Math.cos(C),E=b*d}else if(M<=n+s){const b=(M-n)/s;w=-f+b*t,B=e,P=0,E=d+b*p}else{const b=(M-n-s)/n,C=b*Math.PI/2;w=f+e*Math.sin(C),B=e*Math.cos(C),P=e*Math.sin(C),E=d+p+b*d}const D=Math.max(0,Math.min(1,E/g));let F=0;M===0?F=.5/i:M===v&&(F=-.5/i);for(let b=0;b<=i;b++){const C=b/i,U=C*Math.PI*2,V=Math.sin(U),J=Math.cos(U);_.x=-B*J,_.y=w,_.z=B*V,o.push(_.x,_.y,_.z),y.set(-B*J,P,B*V),y.normalize(),u.push(y.x,y.y,y.z),h.push(C+F,D)}if(M>0){const b=(M-1)*A;for(let C=0;C<i;C++){const U=b+C,V=b+C+1,J=M*A+C,Q=M*A+C+1;a.push(U,V,J),a.push(V,Q,J)}}}this.setIndex(a),this.setAttribute("position",new pt(o,3)),this.setAttribute("normal",new pt(u,3)),this.setAttribute("uv",new pt(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xf(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class yf extends Lt{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],o=[],u=[],h=new N,f=new _e;a.push(0,0,0),o.push(0,0,1),u.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const g=n+d/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),a.push(h.x,h.y,h.z),o.push(0,0,1),f.x=(a[p]/e+1)/2,f.y=(a[p+1]/e+1)/2,u.push(f.x,f.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new pt(a,3)),this.setAttribute("normal",new pt(o,3)),this.setAttribute("uv",new pt(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yf(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class gi extends Lt{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const f=[],d=[],p=[],g=[];let v=0;const A=[],y=n/2;let _=0;M(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(f),this.setAttribute("position",new pt(d,3)),this.setAttribute("normal",new pt(p,3)),this.setAttribute("uv",new pt(g,2));function M(){const w=new N,B=new N;let P=0;const D=(t-e)/n;for(let F=0;F<=s;F++){const b=[],C=F/s,U=C*(t-e)+e;for(let V=0;V<=i;V++){const J=V/i,Q=J*u+o,oe=Math.sin(Q),q=Math.cos(Q);B.x=U*oe,B.y=-C*n+y,B.z=U*q,d.push(B.x,B.y,B.z),w.set(oe,D,q).normalize(),p.push(w.x,w.y,w.z),g.push(J,1-C),b.push(v++)}A.push(b)}for(let F=0;F<i;F++)for(let b=0;b<s;b++){const C=A[b][F],U=A[b+1][F],V=A[b+1][F+1],J=A[b][F+1];(e>0||b!==0)&&(f.push(C,U,J),P+=3),(t>0||b!==s-1)&&(f.push(U,V,J),P+=3)}h.addGroup(_,P,0),_+=P}function E(w){const B=v,P=new _e,D=new N;let F=0;const b=w===!0?e:t,C=w===!0?1:-1;for(let V=1;V<=i;V++)d.push(0,y*C,0),p.push(0,C,0),g.push(.5,.5),v++;const U=v;for(let V=0;V<=i;V++){const Q=V/i*u+o,oe=Math.cos(Q),q=Math.sin(Q);D.x=b*q,D.y=y*C,D.z=b*oe,d.push(D.x,D.y,D.z),p.push(0,C,0),P.x=oe*.5+.5,P.y=q*.5*C+.5,g.push(P.x,P.y),v++}for(let V=0;V<i;V++){const J=B+V,Q=U+V;w===!0?f.push(Q,Q+1,J):f.push(Q+1,Q,J),F+=3}h.addGroup(_,F,w===!0?1:2),_+=F}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gi(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class dc extends gi{constructor(e=1,t=1,n=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,i,s,a,o),this.type="C
44oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new dc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Os extends Lt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];o(i),h(n),f(),this.setAttribute("position",new pt(s,3)),this.setAttribute("normal",new pt(s.slice(),3)),this.setAttribute("uv",new pt(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(M){const E=new N,w=new N,B=new N;for(let P=0;P<t.length;P+=3)g(t[P+0],E),g(t[P+1],w),g(t[P+2],B),u(E,w,B,M)}function u(M,E,w,B){const P=B+1,D=[];for(let F=0;F<=P;F++){D[F]=[];const b=M.clone().lerp(w,F/P),C=E.clone().lerp(w,F/P),U=P-F;for(let V=0;V<=U;V++)V===0&&F===P?D[F][V]=b:D[F][V]=b.clone().lerp(C,V/U)}for(let F=0;F<P;F++)for(let b=0;b<2*(P-F)-1;b++){const C=Math.floor(b/2);b%2===0?(p(D[F][C+1]),p(D[F+1][C]),p(D[F][C])):(p(D[F][C+1]),p(D[F+1][C+1]),p(D[F+1][C]))}}function h(M){const E=new N;for(let w=0;w<s.length;w+=3)E.x=s[w+0],E.y=s[w+1],E.z=s[w+2],E.normalize().multiplyScalar(M),s[w+0]=E.x,s[w+1]=E.y,s[w+2]=E.z}function f(){const M=new N;for(let E=0;E<s.length;E+=3){M.x=s[E+0],M.y=s[E+1],M.z=s[E+2];const w=y(M)/2/Math.PI+.5,B=_(M)/Math.PI+.5;a.push(w,1-B)}v(),d()}function d(){for(let M=0;M<a.length;M+=6){const E=a[M+0],w=a[M+2],B=a[M+4],P=Math.max(E,w,B),D=Math.min(E,w,B);P>.9&&D<.1&&(E<.2&&(a[M+0]+=1),w<.2&&(a[M+2]+=1),B<.2&&(a[M+4]+=1))}}function p(M){s.push(M.x,M.y,M.z)}function g(M,E){const w=M*3;E.x=e[w+0],E.y=e[w+1],E.z=e[w+2]}function v(){const M=new N,E=new N,w=new N,B=new N,P=new _e,D=new _e,F=new _e;for(let b=0,C=0;b<s.length;b+=9,C+=6){M.set(s[b+0],s[b+1],s[b+2]),E.set(s[b+3],s[b+4],s[b+5]),w.set(s[b+6],s[b+7],s[b+8]),P.set(a[C+0],a[C+1]),D.set(a[C+2],a[C+3]),F.set(a[C+4],a[C+5]),B.copy(M).add(E).add(w).divideScalar(3);const U=y(B);A(P,C+0,M,U),A(D,C+2,E,U),A(F,C+4,w,U)}}function A(M,E,w,B){B<0&&M.x===1&&(a[E]=M.x-1),w.x===0&&w.z===0&&(a[E]=B/2/Math.PI+.5)}function y(M){return Math.atan2(M.z,-M.x)}function _(M){return Math.atan2(-M.y,Math.sqrt(M.x*M.x+M.z*M.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Os(e.vertices,e.indices,e.radius,e.detail)}}class Af extends Os{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 10,112 bytes, line 44
4419,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Af(e.radius,e.detail)}}const Uu=new N,Nu=new N,hp=new N,Ou=new Di;class qx extends Lt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Ea*t),a=e.getIndex(),o=e.getAttribute("position"),u=a?a.count:o.count,h=[0,0,0],f=["a","b","c"],d=new Array(3),p={},g=[];for(let v=0;v<u;v+=3){a?(h[0]=a.getX(v),h[1]=a.getX(v+1),h[2]=a.getX(v+2)):(h[0]=v,h[1]=v+1,h[2]=v+2);const{a:A,b:y,c:_}=Ou;if(A.fromBufferAttribute(o,h[0]),y.fromBufferAttribute(o,h[1]),_.fromBufferAttribute(o,h[2]),Ou.getNormal(hp),d[0]=`${Math.round(A.x*i)},${Math.round(A.y*i)},${Math.round(A.z*i)}`,d[1]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,d[2]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let M=0;M<3;M++){const E=(M+1)%3,w=d[M],B=d[E],P=Ou[f[M]],D=Ou[f[E]],F=`${w}_${B}`,b=`${B}_${w}`;b in p&&p[b]?(hp.dot(p[b].normal)<=s&&(g.push(P.x,P.y,P.z),g.push(D.x,D.y,D.z)),p[b]=null):F in p||(p[F]={index0:h[M],index1:h[E],normal:hp.clone()})}}for(const v in p)if(p[v]){const{index0:A,index1:y}=p[v];Uu.fromBufferAttribute(o,A),Nu.fromBufferAttribute(o,y),g.push(Uu.x,Uu.y,Uu.z),g.push(Nu.x,Nu.y,Nu.z)}this.setAttribute("position",new pt(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class wr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){nt("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,u=s-1,h;for(;o<=u;)if(i=Math.floor(o+(u-o)/2),h=n[i]-a,h<0)o=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===a)return i/(s-1);const f=n[i],p=n[i+1]-f,g=(a-f)/p;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),u=t||(a.isVector2?new _e:new N);return u.copy(o).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new N,i=[],s=[],a=[],o=new N,u=new It;for(let g=0;g<=e;g++){const v=g/e;i[g]=this.getTangentAt(v,new N)}s[0]=new N,a[0]=new N;let h=Number.MAX_VALUE;const f=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);f<=h&&(h=f,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),p<=h&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),a[g]=a[g-1].clone(),o.crossVectors(i[g-1],i[g]),o.length()>Number.EPSILON){o.normalize();const v=Math.acos(Ft(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(o,v))}a[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(Ft(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(g=-g);for(let v=1;v<=e;v++)s[v].applyMatrix4(u.makeRotationAxis(i[v],g*v)),a[v].crossVectors(i[v],s[v])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Sf extends wr{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=u}getPoint(e,t=new _e){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(o),h=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const f=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=u-this.aX,g=h-this.aY;u=p*f-g*d+this.aX,h=p*d+g*f+this.aY}return n.set(u,h)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class jx extends Sf{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function km(){let r=0,e=0,t=0,n=0;function i(s,a,o,u){r=s,e=o,t=-3*s+3*a-2*o-u,n=2*s-2*a+o+u}return{initCatmullRom:function(s,a,o,u,h){i(a,o,h*(o-s),h*(u-a))},initNonuniformCatmullRom:function(s,a,o,u,h,f,d){let p=(a-s)/h-(o-s)/(h+f)+(o-a)/f,g=(o-a)/f-(u-a)/(f+d)+(u-o)/d;p*=f,g*=f,i(a,o,p,g)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const Gu=new N,fp=new km,dp=new km,pp=new km;class $x extends wr{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new N){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),u=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:u===0&&o===s-1&&(o=s-2,u=1);let h,f;this.closed||o>0?h=i[(o-1)%s]:(Gu.subVectors(i[0],i[1]).add(i[0]),h=Gu);const d=i[o%s],p=i[(o+1)%s];if(this.closed||o+2<s?f=i[(o+2)%s]:(Gu.subVectors(i[s-1],i[s-2]).add(i[s-1]),f=Gu),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let v=Math.pow(h.distanceToSquared(d),g),A=Math.pow(d.distanceToSquared(p),g),y=Math.pow(p.distanceToSquared(f),g);A<1e-4&&(A=1),v<1e-4&&(v=A),y<1e-4&&(y=A),fp.initNonuniformCatmullRom(h.x,d.x,p.x,f.x,v,A,y),dp.initNonuniformCatmullRom(h.y,d.y,p.y,f.y,v,A,y),pp.initNonuniformCatmullRom(h.z,d.z,p.z,f.z,v,A,y)}else this.curveType==="catmullrom"&&(fp.initCatmullRom(h.x,d.x,p.x,f.x,this.tension),dp.initCatmullRom(h.y,d.y,p.y,f.y,this.tension),pp.initCatmullRom(h.z,d.z,p.z,f.z,this.tension));return n.set(fp.calc(u),dp.calc(u),pp.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new N().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Pv(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,u=r*o;return(2*t-2*n+s+a)*u+(-3*t+3*n-2*s-a)*o+s*r+t}function aE(r,e){const t=1-r;return t*t*e}function oE(r,e){return 2*(1-r)*r*e}function lE(r,e){return r*r*e}function Vl(r,e,t,n){return aE(r,e)+oE(r,t)+lE(r,n)}function cE(r,e){const t=1-r;return t*t*t*e}function uE(r,e){const t=1-r;return 3*t*t*r*e}function hE(r,e){return 3*(1-r)*r*r*e}function fE(r,e){return r*r*r*e}function Wl(r,e,t,n,i){return cE(r,e)+uE(r,t)+hE(r,n)+fE(r,i)}class Vm extends wr{constructor(e=new _e,t=new _e,n=new _e,i=new _e){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new _e){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Wl(e,i.x,s.x,a.x,o.x),Wl(e,i.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ey extends wr{constructor(e=new N,t=new N,n=new N,i=new N){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new N){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Wl(e,i.x,s.x,a.x,o.x),Wl(e,i.y,s.y,a.y,o.y),Wl(e,i.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Wm extends wr{constructor(e=new _e,t=new _e){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new _e){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 13,952 bytes, line 44
44getTangent(e,t=new _e){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ty extends wr{constructor(e=new N,t=new N){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new N){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new N){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Xm extends wr{constructor(e=new _e,t=new _e,n=new _e){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new _e){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Vl(e,i.x,s.x,a.x),Vl(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Jm extends wr{constructor(e=new N,t=new N,n=new N){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new N){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Vl(e,i.x,s.x,a.x),Vl(e,i.y,s.y,a.y),Vl(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ym extends wr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new _e){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,u=i[a===0?a:a-1],h=i[a],f=i[a>i.length-2?i.length-1:a+1],d=i[a>i.length-3?i.length-1:a+2];return n.set(Pv(o,u.x,h.x,f.x,d.x),Pv(o,u.y,h.y,f.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new _e().fromArray(i))}return this}}var Zh=Object.freeze({__proto__:null,ArcCurve:jx,CatmullRomCurve3:$x,CubicBezierCurve:Vm,CubicBezierCurve3:ey,EllipseCurve:Sf,LineCurve:Wm,LineCurve3:ty,QuadraticBezierCurve:Xm,QuadraticBezierCurve3:Jm,SplineCurve:Ym});class ny extends wr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Zh[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],u=o.getLength(),h=u===0?0:1-a/u;return o.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,u=a.getPoints(o);for(let h=0;h<u.length;h++){const f=u[h];n&&n.equals(f)||(t.push(f),n=f)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Zh[i.type]().fromJSON(i))}return this}}class Qh extends ny{constructor(e){super(),this.type="Path",this.currentPoint=new _e,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Wm(this.currentPoint.clone(),new _e(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Xm(this.currentPoint.clone(),new _e(e,t),new _e(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new Vm(this.currentPoint.clone(),new _e(e,t),new _e(n,i),new _e(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Ym(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+o,t+u,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,u){const h=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+h,t+f,n,i,s,a,o,u),this}absellipse(e,t,n,i,s,a,o,u){const h=new Sf(e,t,n,i,s,a,o,u);if(this.curves.length>0){const d=h.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(h);const f=h.getPoint(1);return this.currentPoint.copy(f),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ba extends Qh{constructor(e){super(e),this.uuid=Xi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Qh().fromJSON(i))}return this}}function dE(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=iy(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,u,h;if(n&&(s=_E(r,e,s,t)),r.length>80*t){o=r[0],u=r[1];let f=o,d=u;for(let p=t;p<i;p+=t){const g=r[p],v=r[p+1];g<o&&(o=g),v<u&&(u=v),g>f&&(f=g),v>d&&(d=v)}h=Math.max(f-o,d-u),h=h!==0?32767/h:0}return tc(s,a,t,o,u,h,0),a}function iy(r,e,t,n,i){let s;if(i===RE(r,e,t,n)>0)for(let a=e;a<t;a+=n)s=Dv(a/n|0,r[a],r[a+1],s);else for(let a=t-n;a>=e;a-=n)s=Dv(a/n|0,r[a],r[a+1],s);return s&&zo(s,s.next)&&(ic(s),s=s.next),s}function Pa(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(zo(t,t.next)||wn(t.prev,t,t.next)===0)){if(ic(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function tc(r,e,t,n,i,s,a){if(!r)return;!a&&s&&ME(r,n,i,s);let o=r;for(;r.prev!==r.next;){const u=r.prev,h=r.next;if(s?mE(r,n,i,s):pE(r)){e.push(u.i,r.i,h.i),ic(r),r=h.next,o=h.next;continue}if(r=h,r===o){a?a===1?(r=gE(Pa(r),e),tc(r,e,t,n,i,s,2)):a===2&&vE(r,e,t,n,i,s):tc(Pa(r),e,t,n,i,s,1);break}}}function pE(r){const e=r.prev,t=r,n=r.next;if(wn(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,u=t.y,h=n.y,f=Math.min(i,s,a),d=Math.min(o,u,h),p=Math.max(i,s,a),g=Math.max(o,u,h);let v=n.next;for(;v!==e;){if(v.x>=f&&v.x<=p&&v.y>=d&&v.y<=g&&Fl(i,o,s,u,a,h,v.x,v.y)&&wn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function mE(r,e,t,n){const i=r.prev,s=r,a=r.next;if(wn(i,s,a)>=0)return!1;const o=i.x,u=s.x,h=a.x,f=i.y,d=s.y,p=a.y,g=Math.min(o,u,h),v=Math.min(f,d,p),A=Math.max(o,u,h),y=Math.max(f,d,p),_=em(g,v,e,t,n),M=em(A,y,e,t,n);let E=r.prevZ,w=r.nextZ;for(;E&&E.z>=_&&w&&w.z<=M;){if(E.x>=g&&E.x<=A&&E.y>=v&&E.y<=y&&E!==i&&E!==a&&Fl(o,f,u,d,h,p,E.x,E.y)&&wn(E.prev,E,E.next)>=0||(E=E.prevZ,w.x>=g&&w.x<=A&&w.y>=v&&w.y<=y&&w!==i&&w!==a&&Fl(o,f,u,d,h,p,w.x,w.y)&&wn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;E&&E.z>=_;){if(E.x>=g&&E.x<=A&&E.y>=v&&E.y<=y&&E!==i&&E!==a&&Fl(o,f,u,d,h,p,E.x,E.y)&&wn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;w&&w.z<=M;){if(w.x>=g&&w.x<=A&&w.y>=v&&w.y<=y&&w!==i&&w!==a&&Fl(o,f,u,d,h,p,w.x,w.y)&&wn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function gE(r,e){let t=r;do{const n=t.prev,i=t.next.next;!zo(n,i)&&sy(n,t,t.next,i)&&nc(n,i)&&nc(i,n)&&(e.push(n.i,t.i,i.i),ic(t),ic(t.next),t=r=i),t=t.next}while(t!==r);return Pa(t)}function vE(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&bE(a,o)){let u=ay(a,o);a=Pa(a,a.next),u=Pa(u,u.next),tc(a,e,t,n,i,s,0),tc(u,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function _E(r,e,t,n){const i=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,u=s<a-1?e[s+1]*n:r.length,h=iy(r,o,u,n,!1);h===h.next&&(h.steiner=!0),i.push(wE(h))}i.sort(xE);for(let s=0;s<i.length;s++)t=yE(i[s],t);return t}function xE(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function yE(r,e){const t=AE(r,e);if(!t)return e;const n=ay(t,r);return Pa(n,n.next),Pa(t,t.next)}function AE(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;if(zo(r,t))return t;do{if(zo(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s&&(s=d,a=t.x<t.next.x?t:t.next,d===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,u=a.x,h=a.y;let f=1/0;t=a;do{if(n>=t.x&&t.x>=u&&n!==t.x&&ry(i<h?n:s,i,u,h,i<h?s:n,i,t.x,t.y)){const d=Math.abs(i-t.y)/(n-t.x);nc(t,r)&&(d<f||d===f&&(t.x>a.x||t.x===a.x&&SE(a,t)))&&(a=t,f=d)}t=t.next}while(t!==o);return a}function SE(r,e){return wn(r.prev,r,e.prev)<0&&wn(e.next,r,r.next)<0}function ME(r,e,t,n){let i=r;do i.z===0&&(i.z=em(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,EE(i)}function EE(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let h=0;h<t&&(o++,a=a.nextZ,!!a);h++);let u=t;for(;o>0||u>0&&a;)o!==0&&(u===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=a}s.nextZ=null,t*=2}while(e>1);return r}function em(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function wE(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function ry(r,e,t,n,i,s,a,o){return(i-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function Fl(r,e,t,n,i,s,a,o){return!(r===a&&e===o)&&ry(r,e,t,n,i,s,a,o)}function bE(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!TE(r,e)&&(nc(r,e)&&nc(e,r)&&CE(r,e)&&(wn(r.prev,r,e.prev)||wn(r,e.prev,e))||zo(r,e)&&wn(r.prev,r,r.next)>0&&wn(e.prev,e,e.next)>0)}function wn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function zo(r,e){return r.x===e.x&&r.y===e.y}function sy(r,e,t,n){const i=zu(wn(r,e,t)),s=zu(wn(r,e,n)),a=zu(wn(t,n,r)),o=zu(wn(t,n,e));return!!(i!==s&&a!==o||i===0&&Hu(r,t,e)||s===0&&Hu(r,n,e)||a===0&&Hu(t,r,n)||o===0&&Hu(t,e,n))}function Hu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function zu(r){return r>0?1:r<0?-1:0}function TE(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&sy(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function nc(r,e){return wn(r.prev,r,r.next)<0?wn(r,e,r.next)>=0&&wn(r,r.prev,e)>=0:wn(r,e,r.prev)<0||wn(r,r.next,e)<0}function CE(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function ay(r,e){const t=tm(r.i,r.x,r.y),n=tm(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Dv(r,e,t,n){const i=tm(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ic(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function tm(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function RE(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class IE{static triangulate(e,t,n=2){return dE(e,t,n)}}class yr{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return yr.area(e)<0}
vendor: 37,307 bytes, line 44
44static triangulateShape(e,t){const n=[],i=[],s=[];Lv(e),Fv(n,e);let a=e.length;t.forEach(Lv);for(let u=0;u<t.length;u++)i.push(a),a+=t[u].length,Fv(n,t[u]);const o=IE.triangulate(n,i);for(let u=0;u<o.length;u+=3)s.push(o.slice(u,u+3));return s}}function Lv(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Fv(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Mf extends Lt{constructor(e=new ba([new _e(.5,.5),new _e(-.5,.5),new _e(-.5,-.5),new _e(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let o=0,u=e.length;o<u;o++){const h=e[o];a(h)}this.setAttribute("position",new pt(i,3)),this.setAttribute("uv",new pt(s,2)),this.computeVertexNormals();function a(o){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:g-.1,A=t.bevelOffset!==void 0?t.bevelOffset:0,y=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,M=t.UVGenerator!==void 0?t.UVGenerator:BE;let E,w=!1,B,P,D,F;if(_){E=_.getSpacedPoints(f),w=!0,p=!1;const Te=_.isCatmullRomCurve3?_.closed:!1;B=_.computeFrenetFrames(f,Te),P=new N,D=new N,F=new N}p||(y=0,g=0,v=0,A=0);const b=o.extractPoints(h);let C=b.shape;const U=b.holes;if(!yr.isClockWise(C)){C=C.reverse();for(let Te=0,Ue=U.length;Te<Ue;Te++){const Ie=U[Te];yr.isClockWise(Ie)&&(U[Te]=Ie.reverse())}}function J(Te){const Ie=10000000000000001e-36;let $e=Te[0];for(let H=1;H<=Te.length;H++){const At=H%Te.length,tt=Te[At],Tt=tt.x-$e.x,We=tt.y-$e.y,G=Tt*Tt+We*We,R=Math.max(Math.abs(tt.x),Math.abs(tt.y),Math.abs($e.x),Math.abs($e.y)),ee=Ie*R*R;if(G<=ee){Te.splice(At,1),H--;continue}$e=tt}}J(C),U.forEach(J);const Q=U.length,oe=C;for(let Te=0;Te<Q;Te++){const Ue=U[Te];C=C.concat(Ue)}function q(Te,Ue,Ie){return Ue||bt("ExtrudeGeometry: vec does not exist"),Te.clone().addScaledVector(Ue,Ie)}const ue=C.length;function z(Te,Ue,Ie){let $e,H,At;const tt=Te.x-Ue.x,Tt=Te.y-Ue.y,We=Ie.x-Te.x,G=Ie.y-Te.y,R=tt*tt+Tt*Tt,ee=tt*G-Tt*We;if(Math.abs(ee)>Number.EPSILON){const me=Math.sqrt(R),Ce=Math.sqrt(We*We+G*G),ge=Ue.x-Tt/me,ht=Ue.y+tt/me,Ye=Ie.x-G/Ce,ft=Ie.y+We/Ce,Rt=((Ye-ge)*G-(ft-ht)*We)/(tt*G-Tt*We);$e=ge+tt*Rt-Te.x,H=ht+Tt*Rt-Te.y;const Pe=$e*$e+H*H;if(Pe<=2)return new _e($e,H);At=Math.sqrt(Pe/2)}else{let me=!1;tt>Number.EPSILON?We>Number.EPSILON&&(me=!0):tt<-Number.EPSILON?We<-Number.EPSILON&&(me=!0):Math.sign(Tt)===Math.sign(G)&&(me=!0),me?($e=-Tt,H=tt,At=Math.sqrt(R)):($e=tt,H=Tt,At=Math.sqrt(R/2))}return new _e($e/At,H/At)}const ne=[];for(let Te=0,Ue=oe.length,Ie=Ue-1,$e=Te+1;Te<Ue;Te++,Ie++,$e++)Ie===Ue&&(Ie=0),$e===Ue&&($e=0),ne[Te]=z(oe[Te],oe[Ie],oe[$e]);const Y=[];let se,pe=ne.concat();for(let Te=0,Ue=Q;Te<Ue;Te++){const Ie=U[Te];se=[];for(let $e=0,H=Ie.length,At=H-1,tt=$e+1;$e<H;$e++,At++,tt++)At===H&&(At=0),tt===H&&(tt=0),se[$e]=z(Ie[$e],Ie[At],Ie[tt]);Y.push(se),pe=pe.concat(se)}let we;if(y===0)we=yr.triangulateShape(oe,U);else{const Te=[],Ue=[];for(let Ie=0;Ie<y;Ie++){const $e=Ie/y,H=g*Math.cos($e*Math.PI/2),At=v*Math.sin($e*Math.PI/2)+A;for(let tt=0,Tt=oe.length;tt<Tt;tt++){const We=q(oe[tt],ne[tt],At);yt(We.x,We.y,-H),$e===0&&Te.push(We)}for(let tt=0,Tt=Q;tt<Tt;tt++){const We=U[tt];se=Y[tt];const G=[];for(let R=0,ee=We.length;R<ee;R++){const me=q(We[R],se[R],At);yt(me.x,me.y,-H),$e===0&&G.push(me)}$e===0&&Ue.push(G)}}we=yr.triangulateShape(Te,Ue)}const $=we.length,xt=v+A;for(let Te=0;Te<ue;Te++){const Ue=p?q(C[Te],pe[Te],xt):C[Te];w?(D.copy(B.normals[0]).multiplyScalar(Ue.x),P.copy(B.binormals[0]).multiplyScalar(Ue.y),F.copy(E[0]).add(D).add(P),yt(F.x,F.y,F.z)):yt(Ue.x,Ue.y,0)}for(let Te=1;Te<=f;Te++)for(let Ue=0;Ue<ue;Ue++){const Ie=p?q(C[Ue],pe[Ue],xt):C[Ue];w?(D.copy(B.normals[Te]).multiplyScalar(Ie.x),P.copy(B.binormals[Te]).multiplyScalar(Ie.y),F.copy(E[Te]).add(D).add(P),yt(F.x,F.y,F.z)):yt(Ie.x,Ie.y,d/f*Te)}for(let Te=y-1;Te>=0;Te--){const Ue=Te/y,Ie=g*Math.cos(Ue*Math.PI/2),$e=v*Math.sin(Ue*Math.PI/2)+A;for(let H=0,At=oe.length;H<At;H++){const tt=q(oe[H],ne[H],$e);yt(tt.x,tt.y,d+Ie)}for(let H=0,At=U.length;H<At;H++){const tt=U[H];se=Y[H];for(let Tt=0,We=tt.length;Tt<We;Tt++){const G=q(tt[Tt],se[Tt],$e);w?yt(G.x,G.y+E[f-1].y,E[f-1].x+Ie):yt(G.x,G.y,d+Ie)}}}le(),Ae();function le(){const Te=i.length/3;if(p){let Ue=0,Ie=ue*Ue;for(let $e=0;$e<$;$e++){const H=we[$e];st(H[2]+Ie,H[1]+Ie,H[0]+Ie)}Ue=f+y*2,Ie=ue*Ue;for(let $e=0;$e<$;$e++){const H=we[$e];st(H[0]+Ie,H[1]+Ie,H[2]+Ie)}}else{for(let Ue=0;Ue<$;Ue++){const Ie=we[Ue];st(Ie[2],Ie[1],Ie[0])}for(let Ue=0;Ue<$;Ue++){const Ie=we[Ue];st(Ie[0]+ue*f,Ie[1]+ue*f,Ie[2]+ue*f)}}n.addGroup(Te,i.length/3-Te,0)}function Ae(){const Te=i.length/3;let Ue=0;Qe(oe,Ue),Ue+=oe.length;for(let Ie=0,$e=U.length;Ie<$e;Ie++){const H=U[Ie];Qe(H,Ue),Ue+=H.length}n.addGroup(Te,i.length/3-Te,1)}function Qe(Te,Ue){let Ie=Te.length;for(;--Ie>=0;){const $e=Ie;let H=Ie-1;H<0&&(H=Te.length-1);for(let At=0,tt=f+y*2;At<tt;At++){const Tt=ue*At,We=ue*(At+1),G=Ue+$e+Tt,R=Ue+H+Tt,ee=Ue+H+We,me=Ue+$e+We;Dt(G,R,ee,me)}}}function yt(Te,Ue,Ie){u.push(Te),u.push(Ue),u.push(Ie)}function st(Te,Ue,Ie){Zt(Te),Zt(Ue),Zt(Ie);const $e=i.length/3,H=M.generateTopUV(n,i,$e-3,$e-2,$e-1);_t(H[0]),_t(H[1]),_t(H[2])}function Dt(Te,Ue,Ie,$e){Zt(Te),Zt(Ue),Zt($e),Zt(Ue),Zt(Ie),Zt($e);const H=i.length/3,At=M.generateSideWallUV(n,i,H-6,H-3,H-2,H-1);_t(At[0]),_t(At[1]),_t(At[3]),_t(At[1]),_t(At[2]),_t(At[3])}function Zt(Te){i.push(u[Te*3+0]),i.push(u[Te*3+1]),i.push(u[Te*3+2])}function _t(Te){s.push(Te.x),s.push(Te.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return PE(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Zh[i.type]().fromJSON(i)),new Mf(n,e.options)}}const BE={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],o=e[n*3],u=e[n*3+1],h=e[i*3],f=e[i*3+1];return[new _e(s,a),new _e(o,u),new _e(h,f)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],o=e[t*3+1],u=e[t*3+2],h=e[n*3],f=e[n*3+1],d=e[n*3+2],p=e[i*3],g=e[i*3+1],v=e[i*3+2],A=e[s*3],y=e[s*3+1],_=e[s*3+2];return Math.abs(o-f)<Math.abs(a-h)?[new _e(a,1-u),new _e(h,1-d),new _e(p,1-v),new _e(A,1-_)]:[new _e(o,1-u),new _e(f,1-d),new _e(g,1-v),new _e(y,1-_)]}};function PE(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class pc extends Os{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new pc(e.radius,e.detail)}}class Ef extends Lt{constructor(e=[new _e(0,-.5),new _e(.5,0),new _e(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Ft(i,0,Math.PI*2);const s=[],a=[],o=[],u=[],h=[],f=1/t,d=new N,p=new _e,g=new N,v=new N,A=new N;let y=0,_=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:y=e[M+1].x-e[M].x,_=e[M+1].y-e[M].y,g.x=_*1,g.y=-y,g.z=_*0,A.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(A.x,A.y,A.z);break;default:y=e[M+1].x-e[M].x,_=e[M+1].y-e[M].y,g.x=_*1,g.y=-y,g.z=_*0,v.copy(g),g.x+=A.x,g.y+=A.y,g.z+=A.z,g.normalize(),u.push(g.x,g.y,g.z),A.copy(v)}for(let M=0;M<=t;M++){const E=n+M*f*i,w=Math.sin(E),B=Math.cos(E);for(let P=0;P<=e.length-1;P++){d.x=e[P].x*w,d.y=e[P].y,d.z=e[P].x*B,a.push(d.x,d.y,d.z),p.x=M/t,p.y=P/(e.length-1),o.push(p.x,p.y);const D=u[3*P+0]*w,F=u[3*P+1],b=u[3*P+0]*B;h.push(D,F,b)}}for(let M=0;M<t;M++)for(let E=0;E<e.length-1;E++){const w=E+M*e.length,B=w,P=w+e.length,D=w+e.length+1,F=w+1;s.push(B,P,F),s.push(D,F,P)}this.setIndex(s),this.setAttribute("position",new pt(a,3)),this.setAttribute("uv",new pt(o,2)),this.setAttribute("normal",new pt(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ef(e.points,e.segments,e.phiStart,e.phiLength)}}class sr extends Os{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sr(e.radius,e.detail)}}class ki extends Lt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),u=Math.floor(i),h=o+1,f=u+1,d=e/o,p=t/u,g=[],v=[],A=[],y=[];for(let _=0;_<f;_++){const M=_*p-a;for(let E=0;E<h;E++){const w=E*d-s;v.push(w,-M,0),A.push(0,0,1),y.push(E/o),y.push(1-_/u)}}for(let _=0;_<u;_++)for(let M=0;M<o;M++){const E=M+h*_,w=M+h*(_+1),B=M+1+h*(_+1),P=M+1+h*_;g.push(E,w,P),g.push(w,B,P)}this.setIndex(g),this.setAttribute("position",new pt(v,3)),this.setAttribute("normal",new pt(A,3)),this.setAttribute("uv",new pt(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ki(e.width,e.height,e.widthSegments,e.heightSegments)}}class wf extends Lt{constructor(e=.5,t=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const o=[],u=[],h=[],f=[];let d=e;const p=(t-e)/i,g=new N,v=new _e;for(let A=0;A<=i;A++){for(let y=0;y<=n;y++){const _=s+y/n*a;g.x=d*Math.cos(_),g.y=d*Math.sin(_),u.push(g.x,g.y,g.z),h.push(0,0,1),v.x=(g.x/t+1)/2,v.y=(g.y/t+1)/2,f.push(v.x,v.y)}d+=p}for(let A=0;A<i;A++){const y=A*(n+1);for(let _=0;_<n;_++){const M=_+y,E=M,w=M+n+1,B=M+n+2,P=M+1;o.push(E,w,P),o.push(w,B,P)}}this.setIndex(o),this.setAttribute("position",new pt(u,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wf(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class bf extends Lt{constructor(e=new ba([new _e(0,.5),new _e(-.5,-.5),new _e(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let f=0;f<e.length;f++)h(e[f]),this.addGroup(o,u,f),o+=u,u=0;this.setIndex(n),this.setAttribute("position",new pt(i,3)),this.setAttribute("normal",new pt(s,3)),this.setAttribute("uv",new pt(a,2));function h(f){const d=i.length/3,p=f.extractPoints(t);let g=p.shape;const v=p.holes;yr.isClockWise(g)===!1&&(g=g.reverse());for(let y=0,_=v.length;y<_;y++){const M=v[y];yr.isClockWise(M)===!0&&(v[y]=M.reverse())}const A=yr.triangulateShape(g,v);for(let y=0,_=v.length;y<_;y++){const M=v[y];g=g.concat(M)}for(let y=0,_=g.length;y<_;y++){const M=g[y];i.push(M.x,M.y,0),s.push(0,0,1),a.push(M.x,M.y)}for(let y=0,_=A.length;y<_;y++){const M=A[y],E=M[0]+d,w=M[1]+d,B=M[2]+d;n.push(E,w,B),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return DE(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new bf(n,e.curveSegments)}}function DE(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Jo extends Lt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(a+o,Math.PI);let h=0;const f=[],d=new N,p=new N,g=[],v=[],A=[],y=[];for(let _=0;_<=n;_++){const M=[],E=_/n;let w=0;_===0&&a===0?w=.5/t:_===n&&u===Math.PI&&(w=-.5/t);for(let B=0;B<=t;B++){const P=B/t;d.x=-e*Math.cos(i+P*s)*Math.sin(a+E*o),d.y=e*Math.cos(a+E*o),d.z=e*Math.sin(i+P*s)*Math.sin(a+E*o),v.push(d.x,d.y,d.z),p.copy(d).normalize(),A.push(p.x,p.y,p.z),y.push(P+w,1-E),M.push(h++)}f.push(M)}for(let _=0;_<n;_++)for(let M=0;M<t;M++){const E=f[_][M+1],w=f[_][M],B=f[_+1][M],P=f[_+1][M+1];(_!==0||a>0)&&g.push(E,w,P),(_!==n-1||u<Math.PI)&&g.push(w,B,P)}this.setIndex(g),this.setAttribute("position",new pt(v,3)),this.setAttribute("normal",new pt(A,3)),this.setAttribute("uv",new pt(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jo(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Tf extends Os{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Tf(e.radius,e.detail)}}class Cs extends Lt{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],u=[],h=[],f=new N,d=new N,p=new N;for(let g=0;g<=n;g++)for(let v=0;v<=i;v++){const A=v/i*s,y=g/n*Math.PI*2;d.x=(e+t*Math.cos(y))*Math.cos(A),d.y=(e+t*Math.cos(y))*Math.sin(A),d.z=t*Math.sin(y),o.push(d.x,d.y,d.z),f.x=e*Math.cos(A),f.y=e*Math.sin(A),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(v/i),h.push(g/n)}for(let g=1;g<=n;g++)for(let v=1;v<=i;v++){const A=(i+1)*g+v-1,y=(i+1)*(g-1)+v-1,_=(i+1)*(g-1)+v,M=(i+1)*g+v;a.push(A,y,M),a.push(y,_,M)}this.setIndex(a),this.setAttribute("position",new pt(o,3)),this.setAttribute("normal",new pt(u,3)),this.setAttribute("uv",new pt(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cs(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Cf extends Lt{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],u=[],h=[],f=[],d=new N,p=new N,g=new N,v=new N,A=new N,y=new N,_=new N;for(let E=0;E<=n;++E){const w=E/n*s*Math.PI*2;M(w,s,a,e,g),M(w+.01,s,a,e,v),y.subVectors(v,g),_.addVectors(v,g),A.crossVectors(y,_),_.crossVectors(A,y),A.normalize(),_.normalize();for(let B=0;B<=i;++B){const P=B/i*Math.PI*2,D=-t*Math.cos(P),F=t*Math.sin(P);d.x=g.x+(D*_.x+F*A.x),d.y=g.y+(D*_.y+F*A.y),d.z=g.z+(D*_.z+F*A.z),u.push(d.x,d.y,d.z),p.subVectors(d,g).normalize(),h.push(p.x,p.y,p.z),f.push(E/n),f.push(B/i)}}for(let E=1;E<=n;E++)for(let w=1;w<=i;w++){const B=(i+1)*(E-1)+(w-1),P=(i+1)*E+(w-1),D=(i+1)*E+w,F=(i+1)*(E-1)+w;o.push(B,P,F),o.push(P,D,F)}this.setIndex(o),this.setAttribute("position",new pt(u,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(f,2));function M(E,w,B,P,D){const F=Math.cos(E),b=Math.sin(E),C=B/w*E,U=Math.cos(C);D.x=P*(2+U)*.5*F,D.y=P*(2+U)*b*.5,D.z=P*Math.sin(C)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cf(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Rf extends Lt{constructor(e=new Jm(new N(-1,-1,0),new N(-1,1,0),new N(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new N,u=new N,h=new _e;let f=new N;const d=[],p=[],g=[],v=[];A(),this.setIndex(v),this.setAttribute("position",new pt(d,3)),this.setAttribute("normal",new pt(p,3)),this.setAttribute("uv",new pt(g,2));function A(){for(let E=0;E<t;E++)y(E);y(s===!1?t:0),M(),_()}function y(E){f=e.getPointAt(E/t,f);const w=a.normals[E],B=a.binormals[E];for(let P=0;P<=i;P++){const D=P/i*Math.PI*2,F=Math.sin(D),b=-Math.cos(D);u.x=b*w.x+F*B.x,u.y=b*w.y+F*B.y,u.z=b*w.z+F*B.z,u.normalize(),p.push(u.x,u.y,u.z),o.x=f.x+n*u.x,o.y=f.y+n*u.y,o.z=f.z+n*u.z,d.push(o.x,o.y,o.z)}}function _(){for(let E=1;E<=t;E++)for(let w=1;w<=i;w++){const B=(i+1)*(E-1)+(w-1),P=(i+1)*E+(w-1),D=(i+1)*E+w,F=(i+1)*(E-1)+w;v.push(B,P,F),v.push(P,D,F)}}function M(){for(let E=0;E<=t;E++)for(let w=0;w<=i;w++)h.x=E/t,h.y=w/i,g.push(h.x,h.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Rf(new Zh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class oy extends Lt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new N,s=new N;if(e.index!==null){const a=e.attributes.position,o=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:o.count,materialIndex:0}]);for(let h=0,f=u.length;h<f;++h){const d=u[h],p=d.start,g=d.count;for(let v=p,A=p+g;v<A;v+=3)for(let y=0;y<3;y++){const _=o.getX(v+y),M=o.getX(v+(y+1)%3);i.fromBufferAttribute(a,_),s.fromBufferAttribute(a,M),Uv(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,u=a.count/3;o<u;o++)for(let h=0;h<3;h++){const f=3*o+h,d=3*o+(h+1)%3;i.fromBufferAttribute(a,f),s.fromBufferAttribute(a,d),Uv(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new pt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Uv(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Nv=Object.freeze({__proto__:null,BoxGeometry:Mi,CapsuleGeometry:xf,CircleGeometry:yf,ConeGeometry:dc,CylinderGeometry:gi,DodecahedronGeometry:Af,EdgesGeometry:qx,ExtrudeGeometry:Mf,IcosahedronGeometry:pc,LatheGeometry:Ef,OctahedronGeometry:sr,PlaneGeometry:ki,PolyhedronGeometry:Os,RingGeometry:wf,ShapeGeometry:bf,SphereGeometry:Jo,TetrahedronGeometry:Tf,TorusGeometry:Cs,TorusKnotGeometry:Cf,TubeGeometry:Rf,WireframeGeometry:oy});class ly extends Fn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new je(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Km extends Bn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class mc extends Fn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new je(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 je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ns,this.normalScale=new _e(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 Li,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lr extends mc{constructor(e){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 _e(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ft(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new je(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 je(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new je(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(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class cy extends Fn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new je(16777215),this.specular=new je(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ns,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Li,this.combine=ac,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class uy extends Fn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new je(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ns,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Zm extends Fn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ns,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class hy extends Fn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ns,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Li,this.combine=ac,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Qm extends Fn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Us,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class qm extends Fn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class fy extends Fn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new je(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ns,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class dy extends si{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ya(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function py(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function nm(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let u=0;u!==e;++u)i[a++]=r[o+u]}return i}function jm(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function LE(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let u=0;u<s.tracks.length;++u){const h=s.tracks[u],f=h.getValueSize(),d=[],p=[];for(let g=0;g<h.times.length;++g){const v=h.times[g]*i;if(!(v<t||v>=n)){d.push(h.times[g]);for(let A=0;A<f;++A)p.push(h.values[g*f+A])}}d.length!==0&&(h.times=ya(d,h.times.constructor),h.values=ya(p,h.values.constructor),a.push(h))}s.tracks=a;let o=1/0;for(let u=0;u<s.tracks.length;++u)o>s.tracks[u].times[0]&&(o=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*o);return s.resetDuration(),s}function FE(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const o=t.tracks[a],u=o.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(_){return _.name===o.name&&_.ValueTypeName===u});if(h===void 0)continue;let f=0;const d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);const v=o.times.length-1;let A;if(s<=o.times[0]){const _=f,M=d-f;A=o.values.slice(_,M)}else if(s>=o.times[v]){const _=v*d+f,M=_+d-f;A=o.values.slice(_,M)}else{const _=o.createInterpolant(),M=f,E=d-f;_.evaluate(s),A=_.resultBuffer.slice(M,E)}u==="quaternion"&&new on().fromArray(A).normalize().conjugate().toArray(A);const y=h.times.length;for(let _=0;_<y;++_){const M=_*g+p;if(u==="quaternion")on.multiplyQuaternionsFlat(h.values,M,A,0,h.values,M);else{const E=g-p*2;for(let w=0;w<E;++w)h.values[M+w]-=A[w]}}}return r.blendMode=Cm,r}class UE{static convertArray(e,t){return ya(e,t)}static isTypedArray(e){return Ox(e)}static getKeyframeOrder(e){return py(e)}static sortedArray(e,t,n){return nm(e,t,n)}static flattenJSON(e,t,n,i){jm(e,t,n,i)}static subclip(e,t,n,i,s=30){return LE(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return FE(e,t,n,i)}}class Yo{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class my extends Yo{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:va,endingEnd:va}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],u=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case _a:s=e,o=2*t-n;break;case Zl:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(u===void 0)switch(this.getSettings_().endingEnd){case _a:a=e,u=2*n-t;break;case Zl:a=1,u=n+i[1]-i[0];break;default:a=e-1,u=t}const h=(n-t)*.5,f=this.valueSize;this._weightPrev=h/(t-o),this._weightNext=h/(u-n),this._offsetPrev=s*f,this._offsetNext=a*f}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,u=e*o,h=u-o,f=this._offsetPrev,d=this._offsetNext,p=this._weightPrev,g=this._weightNext,v=(n-t)/(i-t),A=v*v,y=A*v,_=-p*y+2*p*A-p*v,M=(1+p)*y+(-1.5-2*p)*A+(-.5+p)*v+1,E=(-1-g)*y+(1.5+g)*A+.5*v,w=g*y-g*A;for(let B=0;B!==o;++B)s[B]=_*a[f+B]+M*a[h+B]+E*a[u+B]+w*a[d+B];return s}}class $m extends Yo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,u=e*o,h=u-o,f=(n-t)/(i-t),d=1-f;for(let p=0;p!==o;
vendor: 8,281 bytes, line 44
44++p)s[p]=a[h+p]*d+a[u+p]*f;return s}}class gy extends Yo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class cr{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ya(t,this.TimeBufferType),this.values=ya(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ya(e.times,Array),values:ya(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new gy(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new $m(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new my(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Fo:t=this.InterpolantFactoryMethodDiscrete;break;case Uo:t=this.InterpolantFactoryMethodLinear;break;case nh:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return nt("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Fo;case this.InterpolantFactoryMethodLinear:return Uo;case this.InterpolantFactoryMethodSmooth:return nh}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(bt("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(bt("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const u=n[o];if(typeof u=="number"&&isNaN(u)){bt("KeyframeTrack: Time is not a valid number.",this,o,u),e=!1;break}if(a!==null&&a>u){bt("KeyframeTrack: Out of order keys.",this,o,u,a),e=!1;break}a=u}if(i!==void 0&&Ox(i))for(let o=0,u=i.length;o!==u;++o){const h=i[o];if(isNaN(h)){bt("KeyframeTrack: Value is not a valid number.",this,o,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===nh,s=e.length-1;let a=1;for(let o=1;o<s;++o){let u=!1;const h=e[o],f=e[o+1];if(h!==f&&(o!==1||h!==e[0]))if(i)u=!0;else{const d=o*n,p=d-n,g=d+n;for(let v=0;v!==n;++v){const A=t[d+v];if(A!==t[p+v]||A!==t[g+v]){u=!0;break}}}if(u){if(o!==a){e[a]=e[o];const d=o*n,p=a*n;for(let g=0;g!==n;++g)t[p+g]=t[d+g]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,u=a*n,h=0;h!==n;++h)t[u+h]=t[o+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}cr.prototype.ValueTypeName="";cr.prototype.TimeBufferType=Float32Array;cr.prototype.ValueBufferType=Float32Array;cr.prototype.DefaultInterpolation=Uo;class Oa extends cr{constructor(e,t,n){super(e,t,n)}}Oa.prototype.ValueTypeName="bool";Oa.prototype.ValueBufferType=Array;Oa.prototype.DefaultInterpolation=Fo;Oa.prototype.InterpolantFactoryMethodLinear=void 0;Oa.prototype.InterpolantFactoryMethodSmooth=void 0;class eg extends cr{constructor(e,t,n,i){super(e,t,n,i)}}eg.prototype.ValueTypeName="color";class Da extends cr{constructor(e,t,n,i){super(e,t,n,i)}}Da.prototype.ValueTypeName="number";class vy extends Yo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,u=(n-t)/(i-t);let h=e*o;for(let f=h+o;h!==f;h+=4)on.slerpFlat(s,0,a,h-o,a,h,u);return s}}class La extends cr{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new vy(this.times,this.values,this.getValueSize(),e)}}La.prototype.ValueTypeName="quaternion";La.prototype.InterpolantFactoryMethodSmooth=void 0;class Ga extends cr{constructor(e,t,n){super(e,t,n)}}Ga.prototype.ValueTypeName="string";Ga.prototype.ValueBufferType=Array;Ga.prototype.DefaultInterpolation=Fo;Ga.prototype.InterpolantFactoryMethodLinear=void 0;Ga.prototype.InterpolantFactoryMethodSmooth=void 0;class Fa extends cr{constructor(e,t,n,i){super(e,t,n,i)}}Fa.prototype.ValueTypeName="vector";class ko{constructor(e="",t=-1,n=[],i=lf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Xi(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(OE(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(cr.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let u=[],h=[];u.push((o+s-1)%s,o,(o+1)%s),h.push(0,1,0);const f=py(u);u=nm(u,1,f),h=nm(h,1,f),!i&&u[0]===0&&(u.push(s),h.push(h[0])),a.push(new Da(".morphTargetInfluences["+t[o].name+"]",u,h).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,u=e.length;o<u;o++){const h=e[o],f=h.name.match(s);if(f&&f.length>1){const d=f[1];let p=i[d];p||(i[d]=p=[]),p.push(h)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(nt("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return bt("AnimationClip: No animation in JSONLoader data."),null;const n=function(d,p,g,v,A){if(g.length!==0){const y=[],_=[];jm(g,y,_,v),y.length!==0&&A.push(new d(p,y,_))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let d=0;d<h.length;d++){const p=h[d].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const g={};let v;for(v=0;v<p.length;v++)if(p[v].morphTargets)for(let A=0;A<p[v].morphTargets.length;A++)g[p[v].morphTargets[A]]=-1;for(const A in g){const y=[],_=[];for(let M=0;M!==p[v].morphTargets.length;++M){const E=p[v];y.push(E.time),_.push(E.morphTarget===A?1:0)}i.push(new Da(".morphTargetInfluence["+A+"]",y,_))}u=g.length*a}else{const g=".bones["+t[d].name+"]";n(Fa,g+".position",p,"pos",i),n(La,g+".quaternion",p,"rot",i),n(Fa,g+".scale",p,"scl",i)}}return i.length===0?null:new this(s,u,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function NE(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Da;
vendor: 37,843 bytes, line 44
44case"vector":case"vector2":case"vector3":case"vector4":return Fa;case"color":return eg;case"quaternion":return La;case"bool":case"boolean":return Oa;case"string":return Ga}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function OE(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=NE(r.type);if(r.times===void 0){const t=[],n=[];jm(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Nr={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class tg{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(f){o++,s===!1&&i.onStart!==void 0&&i.onStart(f,a,o),s=!0},this.itemEnd=function(f){a++,i.onProgress!==void 0&&i.onProgress(f,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return u?u(f):f},this.setURLModifier=function(f){return u=f,this},this.addHandler=function(f,d){return h.push(f,d),this},this.removeHandler=function(f){const d=h.indexOf(f);return d!==-1&&h.splice(d,2),this},this.getHandler=function(f){for(let d=0,p=h.length;d<p;d+=2){const g=h[d],v=h[d+1];if(g.global&&(g.lastIndex=0),g.test(f))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const _y=new tg;class _i{constructor(e){this.manager=e!==void 0?e:_y,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}_i.DEFAULT_MATERIAL_NAME="__DEFAULT";const qr={};class GE extends Error{constructor(e,t){super(e),this.response=t}}class Yi extends _i{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Nr.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(qr[e]!==void 0){qr[e].push({onLoad:t,onProgress:n,onError:i});return}qr[e]=[],qr[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,u=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&nt("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const f=qr[e],d=h.body.getReader(),p=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),g=p?parseInt(p):0,v=g!==0;let A=0;const y=new ReadableStream({start(_){M();function M(){d.read().then(({done:E,value:w})=>{if(E)_.close();else{A+=w.byteLength;const B=new ProgressEvent("progress",{lengthComputable:v,loaded:A,total:g});for(let P=0,D=f.length;P<D;P++){const F=f[P];F.onProgress&&F.onProgress(B)}_.enqueue(w),M()}},E=>{_.error(E)})}}});return new Response(y)}else throw new GE(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(f=>new DOMParser().parseFromString(f,o));case"json":return h.json();default:if(o==="")return h.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),p=d&&d[1]?d[1].toLowerCase():void 0,g=new TextDecoder(p);return h.arrayBuffer().then(v=>g.decode(v))}}}).then(h=>{Nr.add(`file:${e}`,h);const f=qr[e];delete qr[e];for(let d=0,p=f.length;d<p;d++){const g=f[d];g.onLoad&&g.onLoad(h)}}).catch(h=>{const f=qr[e];if(f===void 0)throw this.manager.itemError(e),h;delete qr[e];for(let d=0,p=f.length;d<p;d++){const g=f[d];g.onError&&g.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class HE extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Yi(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(u){i?i(u):bt(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=ko.parse(e[n]);t.push(i)}return t}}class zE extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],o=new _f,u=new Yi(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let h=0;function f(d){u.load(e[d],function(p){const g=s.parse(p,!0);a[d]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(o.minFilter=rn),o.image=a,o.format=g.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(Array.isArray(e))for(let d=0,p=e.length;d<p;++d)f(d);else u.load(e,function(d){const p=s.parse(d,!0);if(p.isCubemap){const g=p.mipmaps.length/p.mipmapCount;for(let v=0;v<g;v++){a[v]={mipmaps:[]};for(let A=0;A<p.mipmapCount;A++)a[v].mipmaps.push(p.mipmaps[v*p.mipmapCount+A]),a[v].format=p.format,a[v].width=p.width,a[v].height=p.height}o.image=a}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=rn),o.format=p.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}const xo=new WeakMap;class rc extends _i{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Nr.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let d=xo.get(a);d===void 0&&(d=[],xo.set(a,d)),d.push({onLoad:t,onError:i})}return a}const o=jl("img");function u(){f(),t&&t(this);const d=xo.get(this)||[];for(let p=0;p<d.length;p++){const g=d[p];g.onLoad&&g.onLoad(this)}xo.delete(this),s.manager.itemEnd(e)}function h(d){f(),i&&i(d),Nr.remove(`image:${e}`);const p=xo.get(this)||[];for(let g=0;g<p.length;g++){const v=p[g];v.onError&&v.onError(d)}xo.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){o.removeEventListener("load",u,!1),o.removeEventListener("error",h,!1)}return o.addEventListener("load",u,!1),o.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Nr.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class kE extends _i{constructor(e){super(e)}load(e,t,n,i){const s=new uc;s.colorSpace=pn;const a=new rc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function u(h){a.load(e[h],function(f){s.images[h]=f,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class ng extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Ar,o=new Yi(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(u){let h;try{h=s.parse(u)}catch(f){if(i!==void 0)i(f);else{f(f);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:wi,a.wrapT=h.wrapT!==void 0?h.wrapT:wi,a.magFilter=h.magFilter!==void 0?h.magFilter:rn,a.minFilter=h.minFilter!==void 0?h.minFilter:rn,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(a.colorSpace=h.colorSpace),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=or),h.mipmapCount===1&&(a.minFilter=rn),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},n,i),a}}class xy extends _i{constructor(e){super(e)}load(e,t,n,i){const s=new yn,a=new rc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Gs extends qt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new je(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class yy extends Gs{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(qt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new je(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const mp=new It,Ov=new N,Gv=new N;class ig{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new _e(512,512),this.mapType=Rn,this.map=null,this.mapPass=null,this.matrix=new It,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xo,this._frameExtents=new _e(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Ov.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ov),Gv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Gv),t.updateMatrixWorld(),mp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mp,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(mp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class VE extends ig{constructor(){super(new En(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Go*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class rg extends Gs{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(qt.DEFAULT_UP),this.updateMatrix(),this.target=new qt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new VE}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class WE extends ig{constructor(){super(new En(90,1,.5,500)),this.isPointLightShadow=!0}}class sg extends Gs{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new WE}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Sr extends cc{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,o-=f*this.view.offsetY,u=o-f*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,u,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class XE extends ig{constructor(){super(new Sr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ag extends Gs{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(qt.DEFAULT_UP),this.updateMatrix(),this.target=new qt,this.shadow=new XE}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Ay extends Gs{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Sy extends Gs{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class og{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new N)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class My extends Gs{constructor(e=new og,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class If extends _i{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new Yi(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(u){i?i(u):bt(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&nt("MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new je().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new je().setHex(a.value);break;case"v2":i.uniforms[s].value=new _e().fromArray(a.value);break;case"v3":i.uniforms[s].value=new N().fromArray(a.value);break;case"v4":i.uniforms[s].value=new gn().fromArray(a.value);break;case"m3":i.uniforms[s].value=new zt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new It().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new _e().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new _e().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return If.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:ly,SpriteMaterial:Um,RawShaderMaterial:Km,ShaderMaterial:Bn,PointsMaterial:vf,MeshPhysicalMaterial:lr,MeshStandardMaterial:mc,MeshPhongMaterial:cy,MeshToonMaterial:uy,MeshNormalMaterial:Zm,MeshLambertMaterial:hy,MeshDepthMaterial:Qm,MeshDistanceMaterial:qm,MeshBasicMaterial:bi,MeshMatcapMaterial:fy,LineDashedMaterial:dy,LineBasicMaterial:si,Material:Fn};return new t[e]}}class Bs{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Ey extends Lt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class wy extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Yi(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(u){i?i(u):bt(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,v){if(t[v]!==void 0)return t[v];const y=g.interleavedBuffers[v],_=s(g,y.buffer),M=To(y.type,_),E=new hc(M,y.stride);return E.uuid=y.uuid,t[v]=E,E}function s(g,v){if(n[v]!==void 0)return n[v];const y=g.arrayBuffers[v],_=new Uint32Array(y).buffer;return n[v]=_,_}const a=e.isInstancedBufferGeometry?new Ey:new Lt,o=e.data.index;if(o!==void 0){const g=To(o.type,o.array);a.setIndex(new sn(g,1))}const u=e.data.attributes;for(const g in u){const v=u[g];let A;if(v.isInterleavedBufferAttribute){const y=i(e.data,v.data);A=new Fs(y,v.itemSize,v.offset,v.normalized)}else{const y=To(v.type,v.array),_=v.isInstancedBufferAttribute?Ia:sn;A=new _(y,v.itemSize,v.normalized)}v.name!==void 0&&(A.name=v.name),v.usage!==void 0&&A.setUsage(v.usage),a.setAttribute(g,A)}const h=e.data.morphAttributes;if(h)for(const g in h){const v=h[g],A=[];for(let y=0,_=v.length;y<_;y++){const M=v[y];let E;if(M.isInterleavedBufferAttribute){const w=i(e.data,M.data);E=new Fs(w,M.itemSize,M.offset,M.normalized)}else{const w=To(M.type,M.array);E=new sn(w,M.itemSize,M.normalized)}M.name!==void 0&&(E.name=M.name),A.push(E)}a.morphAttributes[g]=A}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let g=0,v=d.length;g!==v;++g){const A=d[g];a.addGroup(A.start,A.count,A.materialIndex)}const p=e.data.boundingSphere;return p!==void 0&&(a.boundingSphere=new ei().fromJSON(p)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class JE extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?Bs.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new Yi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(d){i!==void 0&&i(d),d("ObjectLoader: Can't parse "+e+".",d.message);return}const f=h.metadata;if(f===void 0||f.type===void 0||f.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),bt("ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Bs.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Yi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),u=o.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(h)}),o=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,o),h=this.parseObject(e.object,s,u,o,n),f=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,f),this.bindLightTargets(h),t!==void 0){let d=!1;for(const p in a)if(a[p].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,i,o,a,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),this.bindLightTargets(u),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new ba().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new fc().fromJSON(e[s],i);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new wy;for(let s=0,a=e.length;s<a;s++){let o;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(u);break;default:u.type in Nv?o=Nv[u.type].fromJSON(u,t):nt(`ObjectLoader: Unsupported geometry type "${u.type}"`)}o.uuid=u.uuid,u.name!==void 0&&(o.name=u.name),u.userData!==void 0&&(o.userData=u.userData),n[u.uuid]=o}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new If;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const u=e[a];n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=ko.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function o(u){if(typeof u=="string"){const h=u,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return a(f)}else return u.data?{data:To(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new tg(t);s=new rc(u),s.setCrossOrigin(this.crossOrigin);for(let h=0,f=e.length;h<f;h++){const d=e[h],p=d.url;if(Array.isArray(p)){const g=[];for(let v=0,A=p.length;v<A;v++){const y=p[v],_=o(y);_!==null&&(_ instanceof HTMLImageElement?g.push(_):g.push(new Ar(_.data,_.width,_.height)))}i[d.uuid]=new Ts(g)}else{const g=o(d.url);i[d.uuid]=new Ts(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const o=a,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await i.loadAsync(u)}else return a.data?{data:To(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new rc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const u=e[a],h=u.url;if(Array.isArray(h)){const f=[];for(let d=0,p=h.length;d<p;d++){const g=h[d],v=await s(g);v!==null&&(v instanceof HTMLImageElement?f.push(v):f.push(new Ar(v.data,v.width,v.height)))}n[u.uuid]=new Ts(f)}else{const f=await s(u.url);n[u.uuid]=new Ts(f)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(nt("ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&nt('ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&nt("ObjectLoader: Undefined image",o.image);const u=t[o.image],h=u.data;let f;Array.isArray(h)?(f=new uc,h.length===6&&(f.needsUpdate=!0)):(h&&h.data?f=new Ar:f=new yn,h&&(f.needsUpdate=!0)),f.source=u,f.uuid=o.uuid,o.name!==void 0&&(f.name=o.name),o.mapping!==void 0&&(f.mapping=n(o.mapping,YE)),o.channel!==void 0&&(f.channel=o.channel),o.offset!==void 0&&f.offset.fromArray(o.offset),o.repeat!==void 0&&f.repeat.fromArray(o.repeat),o.center!==void 0&&f.center.fromArray(o.center),o.rotation!==void 0&&(f.rotation=o.rotation),o.wrap!==void 0&&(f.wrapS=n(o.wrap[0],Hv),f.wrapT=n(o.wrap[1],Hv)),o.format!==void 0&&(f.format=o.format),o.internalFormat!==void 0&&(f.internalFormat=o.internalFormat),o.type!==void 0&&(f.type=o.type),o.colorSpace!==void 0&&(f.colorSpace=o.colorSpace),o.minFilter!==void 0&&(f.minFilter=n(o.minFilter,zv)),o.magFilter!==void 0&&(f.magFilter=n(o.magFilter,zv)),o.anisotropy!==void 0&&(f.anisotropy=o.anisotropy),o.flipY!==void 0&&(f.flipY=o.flipY),o.generateMipmaps!==void 0&&(f.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(f.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(f.compareFunction=o.compareFunction),o.userData!==void 0&&(f.userData=o.userData),i[o.uuid]=f}return i}parseObject(e,t,n,i,s){let a;function o(p){return t[p]===void 0&&nt("ObjectLoader: Undefined geometry",p),t[p]}function u(p){if(p!==void 0){if(Array.isArray(p)){const g=[];for(let v=0,A=p.length;v<A;v++){const y=p[v];n[y]===void 0&&nt("ObjectLoader: Undefined material",y),g.push(n[y])}return g}return n[p]===void 0&&nt("ObjectLoader: Undefined material",p),n[p]}}function h(p){return i[p]===void 0&&nt("ObjectLoader: Undefined texture",p),i[p]}let f,d;switch(e.type){case"Scene":a=new ec,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new je(e.background):a.background=h(e.background)),e.environment!==void 0&&(a.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new pf(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new df(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new En(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Sr(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Ay(e.color,e.intensity);break;case"DirectionalLight":a=new ag(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new sg(e.color,e.intensity,e.distance,e.decay);break;
vendor: 5,494 bytes, line 44
44case"RectAreaLight":a=new Sy(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new rg(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new yy(e.color,e.groundColor,e.intensity);break;case"LightProbe":const p=new og().fromArray(e.sh);a=new My(p,e.intensity);break;case"SkinnedMesh":f=o(e.geometry),d=u(e.material),a=new Nm(f,d),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":f=o(e.geometry),d=u(e.material),a=new ot(f,d);break;case"InstancedMesh":f=o(e.geometry),d=u(e.material);const g=e.count,v=e.instanceMatrix,A=e.instanceColor;a=new Om(f,d,g),a.instanceMatrix=new Ia(new Float32Array(v.array),16),A!==void 0&&(a.instanceColor=new Ia(new Float32Array(A.array),A.itemSize));break;case"BatchedMesh":f=o(e.geometry),d=u(e.material),a=new Kx(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),a.geometry=f,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(y=>{let _=null,M=null;return y.boundingBox!==void 0&&(_=new ri().fromJSON(y.boundingBox)),y.boundingSphere!==void 0&&(M=new ei().fromJSON(y.boundingSphere)),{...y,boundingBox:_,boundingSphere:M}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=h(e.matricesTexture.uuid),a._indirectTexture=h(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=h(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new ei().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new ri().fromJSON(e.boundingBox));break;case"LOD":a=new Yx;break;case"Line":a=new Yt(o(e.geometry),u(e.material));break;case"LineLoop":a=new Gm(o(e.geometry),u(e.material));break;case"LineSegments":a=new Er(o(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new Hm(o(e.geometry),u(e.material));break;case"Sprite":a=new Jx(u(e.material));break;case"Group":a=new ns;break;case"Bone":a=new mf;break;default:a=new qt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let g=0;g<p.length;g++)a.add(this.parseObject(p[g],t,n,i,s))}if(e.animations!==void 0){const p=e.animations;for(let g=0;g<p.length;g++){const v=p[g];a.animations.push(s[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const p=e.levels;for(let g=0;g<p.length;g++){const v=p[g],A=a.getObjectByProperty("uuid",v.object);A!==void 0&&a.addLevel(A,v.distance,v.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?nt("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new qt}})}}const YE={UVMapping:ef,CubeReflectionMapping:Or,CubeRefractionMapping:Ps,EquirectangularReflectionMapping:Yl,EquirectangularRefractionMapping:Kl,CubeUVReflectionMapping:Wo},Hv={RepeatWrapping:Ds,ClampToEdgeWrapping:wi,MirroredRepeatWrapping:Do},zv={NearestFilter:xn,NearestMipmapNearestFilter:tf,NearestMipmapLinearFilter:ga,LinearFilter:rn,LinearMipmapNearestFilter:Io,LinearMipmapLinearFilter:or},gp=new WeakMap;class by extends _i{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&nt("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&nt("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Nr.get(`image-bitmap:${e}`);
vendor: 5,429 bytes, line 44
44if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{if(gp.has(a)===!0)i&&i(gp.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(h),s.manager.itemEnd(e),h});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const u=fetch(e,o).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return Nr.add(`image-bitmap:${e}`,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),gp.set(u,h),Nr.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Nr.add(`image-bitmap:${e}`,u),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let ku;class lg{static getContext(){return ku===void 0&&(ku=new(window.AudioContext||window.webkitAudioContext)),ku}static setContext(e){ku=e}}class KE extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Yi(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(u){try{const h=u.slice(0);lg.getContext().decodeAudioData(h,function(d){t(d)}).catch(o)}catch(h){o(h)}},n,i);function o(u){i?i(u):bt(u),s.manager.itemError(e)}}}const kv=new It,Vv=new It,na=new It;class ZE{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new En,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new En,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(Ea*t.fov*.5)/t.zoom;let o,u;Vv.elements[12]=-i,kv.elements[12]=i,o=-a*t.aspect+s,u=a*t.aspect+s,na.elements[0]=2*t.near/(u-o),na.elements[8]=(u+o)/(u-o),this.cameraL.projectionMatrix.copy(na),o=-a*t.aspect-s,u=a*t.aspect-s,na.elements[0]=2*t.near/(u-o),na.elements[8]=(u+o)/(u-o),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Vv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(kv)}}class Ty extends En{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class cg{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const ia=new N,vp=new on,QE=new N,ra=new N,sa=new N;class qE extends qt{constructor(){super(),this.type="AudioListener",this.context=lg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new cg}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ia,vp,QE),ra.set(0,0,-1).applyQuaternion(vp),sa.set(0,1,0).applyQuaternion(vp),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,n),t.positionY.linearRampToValueAtTime(ia.y,n),t.positionZ.linearRampToValueAtTime(ia.z,n),t.forwardX.linearRampToValueAtTime(ra.x,n),t.forwardY.linearRampToValueAtTime(ra.y,n),t.forwardZ.linearRampToValueAtTime(ra.z,n),t.upX.linearRampToValueAtTime(sa.x,n),t.upY.linearRampToValueAtTime(sa.y,n),t.upZ.linearRampToValueAtTime(sa.z,n)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(ra.x,ra.y,ra.z,sa.x,sa.y,sa.z)}}class Cy extends qt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl
vendor: 4,110 bytes, line 44
44=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){nt("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){nt("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){nt("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){nt("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){nt("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(nt("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){nt("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(nt("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl
vendor: 13,393 bytes, line 44
44=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const aa=new N,Wv=new on,jE=new N,oa=new N;class $E extends Cy{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(aa,Wv,jE),oa.set(0,0,1).applyQuaternion(Wv);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(aa.x,n),t.positionY.linearRampToValueAtTime(aa.y,n),t.positionZ.linearRampToValueAtTime(aa.z,n),t.orientationX.linearRampToValueAtTime(oa.x,n),t.orientationY.linearRampToValueAtTime(oa.y,n),t.orientationZ.linearRampToValueAtTime(oa.z,n)}else t.setPosition(aa.x,aa.y,aa.z),t.setOrientation(oa.x,oa.y,oa.z)}}class e1{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Ry{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){on.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;on.multiplyQuaternionsFlat(e,a,e,t,e,n),on.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const u=t+o;e[u]=e[u]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const ug="\\[\\]\\.:\\/",t1=new RegExp("["+ug+"]","g"),hg="[^"+ug+"]",n1="[^"+ug.replace("\\.","")+"]",i1=/((?:WC+[\/:])*)/.source.replace("WC",hg),r1=/(WCOD+)?/.source.replace("WCOD",n1),s1=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",hg),a1=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",hg),o1=new RegExp("^"+i1+r1+s1+a1+"$"),l1=["material","materials","bones","map"];class c1{constructor(e,t,n){const i=n||an.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class an{constructor(e,t,n){this.path=t,this.parsedPath=n||an.parseTrackName(t),this.node=an.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new an.Composite(e,t,n):new an(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(t1,"")}static parseTrackName(e){const t=o1.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);l1.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const u=n(o.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=an.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){nt("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){bt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){bt("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){bt("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let f=0;f<e.length;f++)if(e[f].name===h){h=f;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){bt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){bt("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){bt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){bt("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const a=e[i];if(a===void 0){const h=t.nodeName;bt("PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){bt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){bt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}an.Composite=c1;an.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};an.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};an.prototype.GetterByBindingType=[an.prototype._getValue_direct,an.prototype._getValue_array,an.prototype._getValue_arrayElement,an.prototype._getValue_toArray];an.prototype.SetterByBindingTypeAndVersioning=[[an.prototype._setValue_direct,an.prototype._setValue_direct_setNeedsUpdate,an.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[an.prototype._setValue_array,an.prototype._setValue_array_setNeedsUpdate,an.prototype._setValue_array_setMatrixWorldNeedsUpdate],[an.prototype._setValue_arrayElement,an.prototype._setValue_arrayElement_setNeedsUpdate,an.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[an.prototype._setValue_fromArray,an.prototype._setValue_fromArray_setNeedsUpdate,an.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class u1{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Xi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,u=e.length,h=this.nCachedObjects_;for(let f=0,d=arguments.length;f!==d;++f){const p=arguments[f],g=p.uuid;let v=t[g];if(v===void 0){v=u++,t[g]=v,e.push(p);for(let A=0,y=a;A!==y;++A)s[A].push(new an(p,n[A],i[A]))}else if(v<h){o=e[v];const A=--h,y=e[A];t[y.uuid]=v,e[v]=y,t[g]=A,e[A]=p;for(let _=0,M=a;_!==M;++_){const E=s[_],w=E[A];let B=E[v];E[v]=w,B===void 0&&(B=new an(p,n[_],i[_])),E[A]=B}}else e[v]!==o&&bt("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
44cture when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const u=arguments[a],h=u.uuid,f=t[h];if(f!==void 0&&f>=s){const d=s++,p=e[d];t[p.uuid]=f,e[f]=p,t[h]=d,e[d]=u;for(let g=0,v=i;g!==v;++g){const A=n[g],y=A[d],_=A[f];A[f]=y,A[d]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,u=arguments.length;o!==u;++o){const h=arguments[o],f=h.uuid,d=t[f];if(d!==void 0)if(delete t[f],d<s){const p=--s,g=e[p],v=--a,A=e[v];t[g.uuid]=d,e[d]=g,t[A.uuid]=p,e[p]=A,e.pop();for(let y=0,_=i;y!==_;++y){const M=n[y],E=M[p],w=M[v];M[d]=E,M[p]=w,M.pop()}}else{const p=--a,g=e[p];p>0&&(t[g.uuid]=d),e[d]=g,e.pop();for(let v=0,A=i;v!==A;++v){const y=n[v];y[d]=y[p],y.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,u=this._objects,h=u.length,f=this.nCachedObjects_,d=new Array(h);i=s.length,n[e]=i,a.push(e),o.push(t),s.push(d);for(let p=f,g=u.length;p!==g;++p){const v=u[p];d[p]=new an(v,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,u=a[o],h=e[o];t[h]=n,a[n]=u,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class Iy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),u={endingStart:va,endingEnd:va};for(let h=0;h!==a;++h){const f=s[h].createInterpolant(null);o[h]=f,f.settings=u}this._interpolantSettings=u,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Tx,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const u=o.parameterPositions,h=o.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/a,h[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case Cm:for(let f=0,d=u.length;f!==d;++f)u[f].evaluate(a),h[f].accumulateAdditive(o);break;case lf:default:for(let f=0,d=u.length;f!==d;++f)u[f].evaluate(a),h[f].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Cx;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===bx){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const u=this.repetitions-s;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;
vendor: 8,996 bytes, line 44
44if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=_a,i.endingEnd=_a):(e?i.endingStart=this.zeroSlopeAtStart?_a:va:i.endingStart=Zl,t?i.endingEnd=this.zeroSlopeAtEnd?_a:va:i.endingEnd=Zl)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,u=a.sampleValues;return o[0]=s,u[0]=t,o[1]=s+e,u[1]=n,this}}const h1=new Float32Array(1);class f1 extends Ki{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let f=h[u];f===void 0&&(f={},h[u]=f);for(let d=0;d!==s;++d){const p=i[d],g=p.name;let v=f[g];if(v!==void 0)++v.referenceCount,a[d]=v;else{if(v=a[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,u,g));continue}const A=t&&t._propertyBindings[d].binding.parsedPath;v=new Ry(an.create(n,g,A),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,u,g),a[d]=v}o[d].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],u=o.knownActions,h=u[u.length-1],f=e._byClipCacheIndex;h._byClipCacheIndex=f,u[f]=h,u.pop(),e._byClipCacheIndex=null;const d=o.actionByRoot,p=(e._localRoot||this._root).uuid;delete d[p],u.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new $m(new Float32Array(2),new Float32Array(2),1,h1),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?ko.findByName(i,e):e;const o=a!==null?a.uuid:e,u=this._actionsByClip[o];let h=null;if(n===void 0&&(a!==null?n=a.blendMode:n=lf),u!==void 0){const d=u.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;h=u.knownActions[0],a===null&&(a=h._clip)}if(a===null)return null;const f=new Iy(this,a,t,n);return this._bindAction(f,h),this._addInactiveAction(f,o,s),f}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?ko.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,a);const o=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)o[h].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,u=a.length;o!==u;++o){const h=a[o];this._deactivateAction(h);const f=h._cacheIndex,d=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,d._cacheIndex=f,t[f]=d,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,u=o[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class d1 extends Bm{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new ff(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class en{constructor(e){this.value=e}clone(){return new en(this.value.clone===void 0?this.value:this.value.clone())}}let p1=0;class m1 extends Ki{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:p1++}),this.name="",this.usage=ql,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class g1 extends hc{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class v1{constructor(e,t,n,i,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Xv=new It;class Bf{constructor(e,t,n=0,i=1/0){this.ray=new Na(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new wa,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):bt("Raycaster:
44Unsupported camera type: "+t.type)}setFromXRController(e){return Xv.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Xv),this}intersectObject(e,t=!0,n=[]){return im(e,this,n,t),n.sort(Jv),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)im(e[i],this,n,t);return n.sort(Jv),n}}function Jv(r,e){return r.distance-e.distance}function im(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)im(s[a],e,t,!0)}}let _1=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=x1.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function x1(){this._document.hidden===!1&&this.reset()}class rm{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ft(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ft(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class y1{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class fg{constructor(e,t,n,i){fg.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const Yv=new _e;class A1{constructor(e=new _e(1/0,1/0),t=new _e(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Yv.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Yv).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Kv=new N,Vu=new N,yo=new N,Ao=new N,_p=new N,S1=new N,M1=new N;class E1{constructor(e=new N,t=new N){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Kv.subVectors(e,this.start),Vu.subVectors(this.end,this.start);const n=Vu.dot(Vu);let s=Vu.dot(Kv)/n;return t&&(s=Ft(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 4,772 bytes, line 44
44distanceSqToLine3(e,t=S1,n=M1){const i=10000000000000001e-32;let s,a;const o=this.start,u=e.start,h=this.end,f=e.end;yo.subVectors(h,o),Ao.subVectors(f,u),_p.subVectors(o,u);const d=yo.dot(yo),p=Ao.dot(Ao),g=Ao.dot(_p);if(d<=i&&p<=i)return t.copy(o),n.copy(u),t.sub(n),t.dot(t);if(d<=i)s=0,a=g/p,a=Ft(a,0,1);else{const v=yo.dot(_p);if(p<=i)a=0,s=Ft(-v/d,0,1);else{const A=yo.dot(Ao),y=d*p-A*A;y!==0?s=Ft((A*g-v*p)/y,0,1):s=0,a=(A*s+g)/p,a<0?(a=0,s=Ft(-v/d,0,1)):a>1&&(a=1,s=Ft((A-v)/d,0,1))}}return t.copy(o).add(yo.multiplyScalar(s)),n.copy(u).add(Ao.multiplyScalar(a)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Zv=new N;class w1 extends qt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Lt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,u=32;a<u;a++,o++){const h=a/u*Math.PI*2,f=o/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new pt(i,3));const s=new si({fog:!1,toneMapped:!1});this.cone=new Er(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Zv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Zv),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ss=new N,Wu=new It,xp=new It;class b1 extends Er{constructor(e){const t=By(e),n=new Lt,i=[],s=[];for(let h=0;h<t.length;h++){const f=t[h];f.parent&&f.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new pt(i,3)),n.setAttribute("color",new pt(s,3));const a=new si({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new je(255),u=new je(65280);this.setColors(o,u)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");xp.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Wu.multiplyMatrices(xp,o.matrixWorld),Ss.setFromMatrixPosition(Wu),i.setXYZ(a,Ss.x,Ss.y,Ss.z),Wu.multiplyMatrices(xp,o.parent.matrixWorld),Ss.setFromMatrixPosition(Wu),i.setXYZ(a+1,Ss.x,Ss.y,Ss.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function By(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...By(r.children[t]));return e}class T1 extends ot{constructor(e,t,n){const i=new Jo(t,4,2),s=new bi({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const C1=new N,Qv=new je,qv=new je;class R1 extends qt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new sr(t);i.rotateY(Math.PI*.5),this.material=new bi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new sn(a,3)),this.add(new ot(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Qv.copy(this.light.color),qv.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Qv:qv;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(C1.setFromMatrixPosition(this.light.matrixWorld).negate())}}
vendor: 5,088 bytes, line 44
44class I1 extends Er{constructor(e=10,t=10,n=4473924,i=8947848){n=new je(n),i=new je(i);const s=t/2,a=e/t,o=e/2,u=[],h=[];for(let p=0,g=0,v=-o;p<=t;p++,v+=a){u.push(-o,0,v,o,0,v),u.push(v,0,-o,v,0,o);const A=p===s?n:i;A.toArray(h,g),g+=3,A.toArray(h,g),g+=3,A.toArray(h,g),g+=3,A.toArray(h,g),g+=3}const f=new Lt;f.setAttribute("position",new pt(u,3)),f.setAttribute("color",new pt(h,3));const d=new si({vertexColors:!0,toneMapped:!1});super(f,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class B1 extends Er{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new je(s),a=new je(a);const o=[],u=[];if(t>1)for(let d=0;d<t;d++){const p=d/t*(Math.PI*2),g=Math.sin(p)*e,v=Math.cos(p)*e;o.push(0,0,0),o.push(g,0,v);const A=d&1?s:a;u.push(A.r,A.g,A.b),u.push(A.r,A.g,A.b)}for(let d=0;d<n;d++){const p=d&1?s:a,g=e-e/n*d;for(let v=0;v<i;v++){let A=v/i*(Math.PI*2),y=Math.sin(A)*g,_=Math.cos(A)*g;o.push(y,0,_),u.push(p.r,p.g,p.b),A=(v+1)/i*(Math.PI*2),y=Math.sin(A)*g,_=Math.cos(A)*g,o.push(y,0,_),u.push(p.r,p.g,p.b)}}const h=new Lt;h.setAttribute("position",new pt(o,3)),h.setAttribute("color",new pt(u,3));const f=new si({vertexColors:!0,toneMapped:!1});super(h,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const jv=new N,Xu=new N,$v=new N;class P1 extends qt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new Lt;i.setAttribute("position",new pt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new si({fog:!1,toneMapped:!1});this.lightPlane=new Yt(i,s),this.add(this.lightPlane),i=new Lt,i.setAttribute("position",new pt([0,0,0,0,0,1],3)),this.targetLine=new Yt(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),jv.setFromMatrixPosition(this.light.matrixWorld),Xu.setFromMatrixPosition(this.light.target.matrixWorld),$v.subVectors(Xu,jv),this.lightPlane.lookAt(Xu),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Xu),this.targetLine.scale.z=$v.length()}}const Ju=new N,Cn=new cc;class D1 extends Er{constructor(e){const t=new Lt,n=new si({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(v,A){u(v),u(A)}function u(v){i.push(0,0,0),s.push(0,0,0),a[v]===void 0&&(a[v]=[]),a[v].push(i.length/3-1)}t.setAttribute("position",new pt(i,3)),t.setAttribute("color",new pt(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const h=new je(16755200),f=new je(16711680),d=new je(43775),p=new je(16777215),g=new je(3355443);this.setColors(h,f,d,p,g)}setColors(e,t,n,i,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let s,a;if(Cn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===Vi)s=-1,a=1;else if(this.camera.coordinateSystem===No)s=0,a=1;
vendor: 1,850 bytes, line 44
44else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Ln("c",t,e,Cn,0,0,s),Ln("t",t,e,Cn,0,0,a),Ln("n1",t,e,Cn,-n,-i,s),Ln("n2",t,e,Cn,n,-i,s),Ln("n3",t,e,Cn,-n,i,s),Ln("n4",t,e,Cn,n,i,s),Ln("f1",t,e,Cn,-n,-i,a),Ln("f2",t,e,Cn,n,-i,a),Ln("f3",t,e,Cn,-n,i,a),Ln("f4",t,e,Cn,n,i,a),Ln("u1",t,e,Cn,n*.7,i*1.1,s),Ln("u2",t,e,Cn,-n*.7,i*1.1,s),Ln("u3",t,e,Cn,0,i*2,s),Ln("cf1",t,e,Cn,-n,0,a),Ln("cf2",t,e,Cn,n,0,a),Ln("cf3",t,e,Cn,0,-i,a),Ln("cf4",t,e,Cn,0,i,a),Ln("cn1",t,e,Cn,-n,0,s),Ln("cn2",t,e,Cn,n,0,s),Ln("cn3",t,e,Cn,0,-i,s),Ln("cn4",t,e,Cn,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ln(r,e,t,n,i,s,a){Ju.set(i,s,a).unproject(n);const o=e[r];if(o!==void 0){const u=t.getAttribute("position");for(let h=0,f=o.length;h<f;h++)u.setXYZ(o[h],Ju.x,Ju.y,Ju.z)}}const Yu=new ri;class L1 extends Er{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Lt;s.setIndex(new sn(n,1)),s.setAttribute("position",new sn(i,3)),super(s,new si({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Yu.setFromObject(this.object),Yu.isEmpty())return;const e=Yu.min,t=Yu.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}
vendor: 4,118 bytes, line 44
44class F1 extends Er{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Lt;s.setIndex(new sn(n,1)),s.setAttribute("position",new pt(i,3)),super(s,new si({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class U1 extends Yt{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Lt;a.setAttribute("position",new pt(s,3)),a.computeBoundingSphere(),super(a,new si({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new Lt;u.setAttribute("position",new pt(o,3)),u.computeBoundingSphere(),this.add(new ot(u,new bi({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const e_=new N;let Ku,yp;class N1 extends qt{constructor(e=new N(0,0,1),t=new N(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Ku===void 0&&(Ku=new Lt,Ku.setAttribute("position",new pt([0,0,0,0,1,0],3)),yp=new dc(.5,1,5,1),yp.translate(0,-.5,0)),this.position.copy(t),this.line=new Yt(Ku,new si({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ot(yp,new bi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{e_.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(e_,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class O1 extends Er{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Lt;i.setAttribute("position",new pt(t,3)),i.setAttribute("color",new pt(n,3));const s=new si({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new je,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class G1{constructor(){this.type="ShapePath",this.color=new je,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Qh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const M=[];for(let E=0,w=_.length;E<w;E++){const B=_[E],P=new ba;P.curves=B.curves,M.push(P)}return M}function n(_,M){const E=M.length;let w=!1;for(let B=E-1,P=0;P<E;B=P++){let D=M[B],F=M[P],b=F.x-D.x,C=F.y-D.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(D=M[P],b=-b,F=M[B],C=-C),_.y<D.y||_.y>F.y)continue;if(_.y===D.y){if(_.x===D.x)return!0}else{const U=C*(_.x-D.x)-b*(_.y-D.y);if(U===0)return!0;
vendor: 9,049 bytes, lines 44-107
44if(U<0)continue;w=!w}}else{if(_.y!==D.y)continue;if(F.x<=_.x&&_.x<=D.x||D.x<=_.x&&_.x<=F.x)return!0}}return w}const i=yr.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,u;const h=[];if(s.length===1)return o=s[0],u=new ba,u.curves=o.curves,h.push(u),h;let f=!i(s[0].getPoints());f=e?!f:f;const d=[],p=[];let g=[],v=0,A;p[v]=void 0,g[v]=[];for(let _=0,M=s.length;_<M;_++)o=s[_],A=o.getPoints(),a=i(A),a=e?!a:a,a?(!f&&p[v]&&v++,p[v]={s:new ba,p:A},p[v].s.curves=o.curves,f&&v++,g[v]=[]):g[v].push({h:o,p:A[0]});if(!p[0])return t(s);if(p.length>1){let _=!1,M=0;for(let E=0,w=p.length;E<w;E++)d[E]=[];for(let E=0,w=p.length;E<w;E++){const B=g[E];for(let P=0;P<B.length;P++){const D=B[P];let F=!0;for(let b=0;b<p.length;b++)n(D.p,p[b].p)&&(E!==b&&M++,F?(F=!1,d[b].push(D)):_=!0);F&&d[E].push(D)}}M>0&&_===!1&&(g=d)}let y;for(let _=0,M=p.length;_<M;_++){u=p[_].s,h.push(u),y=g[_];for(let E=0,w=y.length;E<w;E++)u.holes.push(y[E].h)}return h}}class H1 extends Ki{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){nt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function z1(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function k1(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function V1(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function sm(r,e,t,n){const i=W1(n);switch(t){case bm:return r*e;case oc:return r*e/i.components*i.byteLength;case lc:return r*e/i.components*i.byteLength;case Ra:return r*e*2/i.components*i.byteLength;case af:return r*e*2/i.components*i.byteLength;case Tm:return r*e*3/i.components*i.byteLength;case ni:return r*e*4/i.components*i.byteLength;case of:return r*e*4/i.components*i.byteLength;case Ol:case Gl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Hl:case zl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case mh:case vh:return Math.max(r,16)*Math.max(e,8)/4;case ph:case gh:return Math.max(r,8)*Math.max(e,8)/2;case _h:case xh:case Ah:case Sh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case yh:case Mh:case Eh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case wh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case bh:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Th:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Ch:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Rh:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Ih:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Bh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Ph:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Dh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Lh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Fh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Uh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Nh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Oh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Gh:case Hh:case zh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case kh:case Vh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case Wh:case Xh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function W1(r){switch(r){case Rn:case Sm:return{byteLength:1,components:1};case Lo:case Mm:case Vn:return{byteLength:2,components:1};case rf:case sf:return{byteLength:2,components:4};case Ji:case nf:case In:return{byteLength:4,components:1};case Em:case wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class X1{static contain(e,t){return z1(e,t)}static cover(e,t){return k1(e,t)}static fill(e){return V1(e)}static getByteLength(e,t,n,i){return sm(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ua}}));typeof window<"u"&&(window.__THREE__?nt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ua);/** 45 * @license 46 * Copyright 2010-2025 Three.js Authors 47 * SPDX-License-Identifier: MIT 48 */function Py(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function J1(r){const e=new WeakMap;function t(o,u){const h=o.array,f=o.usage,d=h.byteLength,p=r.createBuffer();r.bindBuffer(u,p),r.bufferData(u,h,f),o.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)g=r.HALF_FLOAT;else if(h instanceof Uint16Array)o.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,u,h){const f=u.array,d=u.updateRanges;if(r.bindBuffer(h,o),d.length===0)r.bufferSubData(h,0,f);else{d.sort((g,v)=>g.start-v.start);let p=0;for(let g=1;g<d.length;g++){const v=d[p],A=d[g];A.start<=v.start+v.count+1?v.count=Math.max(v.count,A.start+A.count-v.start):(++p,d[p]=A)}d.length=p+1;for(let g=0,v=d.length;g<v;g++){const A=d[g];r.bufferSubData(h,A.start*f.BYTES_PER_ELEMENT,f,A.start,A.count)}u.clearUpdateRanges()}u.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const u=e.get(o);u&&(r.deleteBuffer(u.buffer),e.delete(o))}function a(o,u){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const f=e.get(o);(!f||f.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const h=e.get(o);if(h===void 0)e.set(o,t(o,u));else if(h.version<o.version){if(h.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(h.buffer,o,u),h.version=o.version}}return{get:i,remove:s,update:a}}var Y1=`#ifdef USE_ALPHAHASH 49 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 50#endif`,K1=`#ifdef USE_ALPHAHASH 51 const float ALPHA_HASH_SCALE = 0.05; 52 float hash2D( vec2 value ) { 53 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 54 } 55 float hash3D( vec3 value ) { 56 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 57 } 58 float getAlphaHashThreshold( vec3 position ) { 59 float maxDeriv = max( 60 length( dFdx( position.xyz ) ), 61 length( dFdy( position.xyz ) ) 62 ); 63 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 64 vec2 pixScales = vec2( 65 exp2( floor( log2( pixScale ) ) ), 66 exp2( ceil( log2( pixScale ) ) ) 67 ); 68 vec2 alpha = vec2( 69 hash3D( floor( pixScales.x * position.xyz ) ), 70 hash3D( floor( pixScales.y * position.xyz ) ) 71 ); 72 float lerpFactor = fract( log2( pixScale ) ); 73 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 74 float a = min( lerpFactor, 1.0 - lerpFactor ); 75 vec3 cases = vec3( 76 x * x / ( 2.0 * a * ( 1.0 - a ) ), 77 ( x - 0.5 * a ) / ( 1.0 - a ), 78 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 79 ); 80 float threshold = ( x < ( 1.0 - a ) ) 81 ? ( ( x < a ) ? cases.x : cases.y ) 82 : cases.z; 83 return clamp( threshold , 1.0e-6, 1.0 ); 84 } 85#endif`,Z1=`#ifdef USE_ALPHAMAP 86 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 87#endif`,Q1=`#ifdef USE_ALPHAMAP 88 uniform sampler2D alphaMap; 89#endif`,q1=`#ifdef USE_ALPHATEST 90 #ifdef ALPHA_TO_COVERAGE 91 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 92 if ( diffuseColor.a == 0.0 ) discard; 93 #else 94 if ( diffuseColor.a < alphaTest ) discard; 95 #endif 96#endif`,j1=`#ifdef USE_ALPHATEST 97 uniform float alphaTest; 98#endif`,$1=`#ifdef USE_AOMAP 99 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 100 reflectedLight.indirectDiffuse *= ambientOcclusion; 101 #if defined( USE_CLEARCOAT ) 102 clearcoatSpecularIndirect *= ambientOcclusion; 103 #endif 104 #if defined( USE_SHEEN ) 105 sheenSpecularIndirect *= ambientOcclusion; 106 #endif 107 #if defined( USE_ENVMAP ) && defined( STANDARD )
108 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 109 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 110 #endif 111#endif`,ew=`#ifdef USE_AOMAP 112 uniform sampler2D aoMap; 113 uniform float aoMapIntensity; 114#endif`,tw=`#ifdef USE_BATCHING 115 #if ! defined( GL_ANGLE_multi_draw ) 116 #define gl_DrawID _gl_DrawID 117 uniform int _gl_DrawID; 118 #endif 119 uniform highp sampler2D batchingTexture; 120 uniform highp usampler2D batchingIdTexture; 121 mat4 getBatchingMatrix( const in float i ) { 122 int size = textureSize( batchingTexture, 0 ).x; 123 int j = int( i ) * 4; 124 int x = j % size; 125 int y = j / size; 126 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 127 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 128 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 129 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 130 return mat4( v1, v2, v3, v4 ); 131 } 132 float getIndirectIndex( const in int i ) { 133 int size = textureSize( batchingIdTexture, 0 ).x; 134 int x = i % size; 135 int y = i / size; 136 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 137 } 138#endif 139#ifdef USE_BATCHING_COLOR 140 uniform sampler2D batchingColorTexture; 141 vec3 getBatchingColor( const in float i ) { 142 int size = textureSize( batchingColorTexture, 0 ).x; 143 int j = int( i ); 144 int x = j % size; 145 int y = j / size; 146 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 147 } 148#endif`,nw=`#ifdef USE_BATCHING 149 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 150#endif`,iw=`vec3 transformed = vec3( position ); 151#ifdef USE_ALPHAHASH 152 vPosition = vec3( position ); 153#endif`,rw=`vec3 objectNormal = vec3( normal ); 154#ifdef USE_TANGENT 155 vec3 objectTangent = vec3( tangent.xyz ); 156#endif`,sw=`float G_BlinnPhong_Implicit( ) { 157 return 0.25; 158} 159float D_BlinnPhong( const in float shininess, const in float dotNH ) { 160 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 161} 162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 163 vec3 halfDir = normalize( lightDir + viewDir ); 164 float dotNH = saturate( dot( normal, halfDir ) ); 165 float dotVH = saturate( dot( viewDir, halfDir ) ); 166 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 167 float G = G_BlinnPhong_Implicit( ); 168 float D = D_BlinnPhong( shininess, dotNH ); 169 return F * ( G * D ); 170} // validated`,aw=`#ifdef USE_IRIDESCENCE 171 const mat3 XYZ_TO_REC709 = mat3( 172 3.2404542, -0.9692660, 0.0556434, 173 -1.5371385, 1.8760108, -0.2040259, 174 -0.4985314, 0.0415560, 1.0572252 175 ); 176 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 177 vec3 sqrtF0 = sqrt( fresnel0 ); 178 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 179 } 180 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 181 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 182 } 183 float IorToFresnel0( float transmittedIor, float incidentIor ) { 184 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 185 } 186 vec3 evalSensitivity( float OPD, vec3 shift ) { 187 float phase = 2.0 * PI * OPD * 1.0e-9; 188 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 189 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 190 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 191 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 192 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 193 xyz /= 1.0685e-7; 194 vec3 rgb = XYZ_TO_REC709 * xyz; 195 return rgb; 196 } 197 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 198 vec3 I; 199 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 200 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 201 float cosTheta2Sq = 1.0 - sinTheta2Sq; 202 if ( cosTheta2Sq < 0.0 ) { 203 return vec3( 1.0 ); 204 } 205 float cosTheta2 = sqrt( cosTheta2Sq ); 206 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 208 float T121 = 1.0 - R12; 209 float phi12 = 0.0; 210 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 211 float phi21 = PI - phi12; 212 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 213 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 214 vec3 phi23 = vec3( 0.0 ); 215 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 216 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 217 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 218 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 219 vec3 phi = vec3( phi21 ) + phi23; 220 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 221 vec3 r123 = sqrt( R123 ); 222 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 223 vec3 C0 = R12 + Rs; 224 I = C0; 225 vec3 Cm = Rs - T121; 226 for ( int m = 1; m <= 2; ++ m ) { 227 Cm *= r123; 228 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 229 I += Cm * Sm; 230 } 231 return max( I, vec3( 0.0 ) ); 232 } 233#endif`,ow=`#ifdef USE_BUMPMAP 234 uniform sampler2D bumpMap; 235 uniform float bumpScale; 236 vec2 dHdxy_fwd() { 237 vec2 dSTdx = dFdx( vBumpMapUv ); 238 vec2 dSTdy = dFdy( vBumpMapUv ); 239 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 240 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 241 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 242 return vec2( dBx, dBy ); 243 } 244 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 245 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 246 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 247 vec3 vN = surf_norm; 248 vec3 R1 = cross( vSigmaY, vN ); 249 vec3 R2 = cross( vN, vSigmaX ); 250 float fDet = dot( vSigmaX, R1 ) * faceDirection; 251 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 252 return normalize( abs( fDet ) * surf_norm - vGrad ); 253 } 254#endif`,lw=`#if NUM_CLIPPING_PLANES > 0 255 vec4 plane; 256 #ifdef ALPHA_TO_COVERAGE 257 float distanceToPlane, distanceGradient; 258 float clipOpacity = 1.0; 259 #pragma unroll_loop_start 260 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 261 plane = clippingPlanes[ i ]; 262 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 263 distanceGradient = fwidth( distanceToPlane ) / 2.0; 264 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 265 if ( clipOpacity == 0.0 ) discard; 266 } 267 #pragma unroll_loop_end 268 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 269 float unionClipOpacity = 1.0; 270 #pragma unroll_loop_start 271 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 272 plane = clippingPlanes[ i ]; 273 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 274 distanceGradient = fwidth( distanceToPlane ) / 2.0; 275 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 276 } 277 #pragma unroll_loop_end 278 clipOpacity *= 1.0 - unionClipOpacity; 279 #endif 280 diffuseColor.a *= clipOpacity; 281 if ( diffuseColor.a == 0.0 ) discard; 282 #else 283 #pragma unroll_loop_start 284 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 285 plane = clippingPlanes[ i ]; 286 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 287 } 288 #pragma unroll_loop_end 289 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 290 bool clipped = true; 291 #pragma unroll_loop_start 292 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 293 plane = clippingPlanes[ i ]; 294 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 295 } 296 #pragma unroll_loop_end 297 if ( clipped ) discard; 298 #endif 299 #endif 300#endif`,cw=`#if NUM_CLIPPING_PLANES > 0 301 varying vec3 vClipPosition; 302 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 303#endif`,uw=`#if NUM_CLIPPING_PLANES > 0 304 varying vec3 vClipPosition; 305#endif`,hw=`#if NUM_CLIPPING_PLANES > 0 306 vClipPosition = - mvPosition.xyz; 307#endif`,fw=`#if defined( USE_COLOR_ALPHA ) 308 diffuseColor *= vColor; 309#elif defined( USE_COLOR ) 310 diffuseColor.rgb *= vColor; 311#endif`,dw=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) 314 varying vec3 vColor; 315#endif`,pw=`#if defined( USE_COLOR_ALPHA ) 316 varying vec4 vColor; 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 varying vec3 vColor; 319#endif`,mw=`#if defined( USE_COLOR_ALPHA ) 320 vColor = vec4( 1.0 ); 321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 322 vColor = vec3( 1.0 ); 323#endif 324#ifdef USE_COLOR 325 vColor *= color; 326#endif 327#ifdef USE_INSTANCING_COLOR 328 vColor.xyz *= instanceColor.xyz; 329#endif 330#ifdef USE_BATCHING_COLOR 331 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 332 vColor.xyz *= batchingColor.xyz; 333#endif`,gw=`#define PI 3.141592653589793 334#define PI2 6.283185307179586 335#define PI_HALF 1.5707963267948966 336#define RECIPROCAL_PI 0.3183098861837907 337#define RECIPROCAL_PI2 0.15915494309189535 338#define EPSILON 1e-6 339#ifndef saturate 340#define saturate( a ) clamp( a, 0.0, 1.0 ) 341#endif 342#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 343float pow2( const in float x ) { return x*x; } 344vec3 pow2( const in vec3 x ) { return x*x; } 345float pow3( const in float x ) { return x*x*x; } 346float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 349highp float rand( const in vec2 uv ) { 350 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 351 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 352 return fract( sin( sn ) * c ); 353} 354#ifdef HIGH_PRECISION 355 float precisionSafeLength( vec3 v ) { return length( v ); } 356#else 357 float precisionSafeLength( vec3 v ) { 358 float maxComponent = max3( abs( v ) ); 359 return length( v / maxComponent ) * maxComponent; 360 } 361#endif 362struct IncidentLight { 363 vec3 color; 364 vec3 direction; 365 bool visible; 366}; 367struct ReflectedLight { 368 vec3 directDiffuse; 369 vec3 directSpecular; 370 vec3 indirectDiffuse; 371 vec3 indirectSpecular; 372}; 373#ifdef USE_ALPHAHASH 374 varying vec3 vPosition; 375#endif 376vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 377 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 378} 379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 381} 382bool isPerspectiveMatrix( mat4 m ) { 383 return m[ 2 ][ 3 ] == - 1.0; 384} 385vec2 equirectUv( in vec3 dir ) { 386 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 387 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 388 return vec2( u, v ); 389}
390vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 391 return RECIPROCAL_PI * diffuseColor; 392} 393vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 394 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 395 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 396} 397float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 398 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 399 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 400} // validated`,vw=`#ifdef ENVMAP_TYPE_CUBE_UV 401 #define cubeUV_minMipLevel 4.0 402 #define cubeUV_minTileSize 16.0 403 float getFace( vec3 direction ) { 404 vec3 absDirection = abs( direction ); 405 float face = - 1.0; 406 if ( absDirection.x > absDirection.z ) { 407 if ( absDirection.x > absDirection.y ) 408 face = direction.x > 0.0 ? 0.0 : 3.0; 409 else 410 face = direction.y > 0.0 ? 1.0 : 4.0; 411 } else { 412 if ( absDirection.z > absDirection.y ) 413 face = direction.z > 0.0 ? 2.0 : 5.0; 414 else 415 face = direction.y > 0.0 ? 1.0 : 4.0; 416 } 417 return face; 418 } 419 vec2 getUV( vec3 direction, float face ) { 420 vec2 uv; 421 if ( face == 0.0 ) { 422 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 423 } else if ( face == 1.0 ) { 424 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 425 } else if ( face == 2.0 ) { 426 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 427 } else if ( face == 3.0 ) { 428 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 429 } else if ( face == 4.0 ) { 430 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 431 } else { 432 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 433 } 434 return 0.5 * ( uv + 1.0 ); 435 } 436 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 437 float face = getFace( direction ); 438 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 439 mipInt = max( mipInt, cubeUV_minMipLevel ); 440 float faceSize = exp2( mipInt ); 441 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 442 if ( face > 2.0 ) { 443 uv.y += faceSize; 444 face -= 3.0; 445 } 446 uv.x += face * faceSize; 447 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 448 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 449 uv.x *= CUBEUV_TEXEL_WIDTH; 450 uv.y *= CUBEUV_TEXEL_HEIGHT; 451 #ifdef texture2DGradEXT 452 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 453 #else 454 return texture2D( envMap, uv ).rgb; 455 #endif 456 } 457 #define cubeUV_r0 1.0 458 #define cubeUV_m0 - 2.0 459 #define cubeUV_r1 0.8 460 #define cubeUV_m1 - 1.0 461 #define cubeUV_r4 0.4 462 #define cubeUV_m4 2.0 463 #define cubeUV_r5 0.305 464 #define cubeUV_m5 3.0 465 #define cubeUV_r6 0.21 466 #define cubeUV_m6 4.0 467 float roughnessToMip( float roughness ) { 468 float mip = 0.0; 469 if ( roughness >= cubeUV_r1 ) { 470 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 471 } else if ( roughness >= cubeUV_r4 ) { 472 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 473 } else if ( roughness >= cubeUV_r5 ) { 474 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 475 } else if ( roughness >= cubeUV_r6 ) { 476 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 477 } else { 478 mip = - 2.0 * log2( 1.16 * roughness ); } 479 return mip; 480 } 481 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 482 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 483 float mipF = fract( mip ); 484 float mipInt = floor( mip ); 485 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 486 if ( mipF == 0.0 ) { 487 return vec4( color0, 1.0 ); 488 } else { 489 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 490 return vec4( mix( color0, color1, mipF ), 1.0 ); 491 } 492 } 493#endif`,_w=`vec3 transformedNormal = objectNormal; 494#ifdef USE_TANGENT 495 vec3 transformedTangent = objectTangent; 496#endif 497#ifdef USE_BATCHING 498 mat3 bm = mat3( batchingMatrix ); 499 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 500 transformedNormal = bm * transformedNormal; 501 #ifdef USE_TANGENT 502 transformedTangent = bm * transformedTangent; 503 #endif 504#endif 505#ifdef USE_INSTANCING 506 mat3 im = mat3( instanceMatrix ); 507 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 508 transformedNormal = im * transformedNormal; 509 #ifdef USE_TANGENT 510 transformedTangent = im * transformedTangent; 511 #endif 512#endif 513transformedNormal = normalMatrix * transformedNormal; 514#ifdef FLIP_SIDED 515 transformedNormal = - transformedNormal; 516#endif 517#ifdef USE_TANGENT 518 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 519 #ifdef FLIP_SIDED 520 transformedTangent = - transformedTangent; 521 #endif 522#endif`,xw=`#ifdef USE_DISPLACEMENTMAP 523 uniform sampler2D displacementMap; 524 uniform float displacementScale; 525 uniform float displacementBias; 526#endif`,yw=`#ifdef USE_DISPLACEMENTMAP 527 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
527placementBias ); 528#endif`,Aw=`#ifdef USE_EMISSIVEMAP 529 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 530 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 531 emissiveColor = sRGBTransferEOTF( emissiveColor ); 532 #endif 533 totalEmissiveRadiance *= emissiveColor.rgb; 534#endif`,Sw=`#ifdef USE_EMISSIVEMAP 535 uniform sampler2D emissiveMap; 536#endif`,Mw="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ew=`vec4 LinearTransferOETF( in vec4 value ) { 537 return value; 538} 539vec4 sRGBTransferEOTF( in vec4 value ) { 540 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 ); 541} 542vec4 sRGBTransferOETF( in vec4 value ) { 543 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 ); 544}`,ww=`#ifdef USE_ENVMAP 545 #ifdef ENV_WORLDPOS 546 vec3 cameraToFrag; 547 if ( isOrthographic ) { 548 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 549 } else { 550 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 551 } 552 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 553 #ifdef ENVMAP_MODE_REFLECTION 554 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 555 #else 556 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 557 #endif 558 #else 559 vec3 reflectVec = vReflect; 560 #endif 561 #ifdef ENVMAP_TYPE_CUBE 562 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 563 #else 564 vec4 envColor = vec4( 0.0 ); 565 #endif 566 #ifdef ENVMAP_BLENDING_MULTIPLY 567 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 568 #elif defined( ENVMAP_BLENDING_MIX ) 569 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 570 #elif defined( ENVMAP_BLENDING_ADD ) 571 outgoingLight += envColor.xyz * specularStrength * reflectivity; 572 #endif 573#endif`,bw=`#ifdef USE_ENVMAP 574 uniform float envMapIntensity; 575 uniform float flipEnvMap; 576 uniform mat3 envMapRotation; 577 #ifdef ENVMAP_TYPE_CUBE 578 uniform samplerCube envMap; 579 #else 580 uniform sampler2D envMap; 581 #endif 582#endif`,Tw=`#ifdef USE_ENVMAP 583 uniform float reflectivity; 584 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 585 #define ENV_WORLDPOS 586 #endif 587 #ifdef ENV_WORLDPOS 588 varying vec3 vWorldPosition; 589 uniform float refractionRatio; 590 #else 591 varying vec3 vReflect; 592 #endif 593#endif`,Cw=`#ifdef USE_ENVMAP 594 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 595 #define ENV_WORLDPOS 596 #endif 597 #ifdef ENV_WORLDPOS 598 599 varying vec3 vWorldPosition; 600 #else 601 varying vec3 vReflect; 602 uniform float refractionRatio; 603 #endif 604#endif`,Rw=`#ifdef USE_ENVMAP 605 #ifdef ENV_WORLDPOS 606 vWorldPosition = worldPosition.xyz; 607 #else 608 vec3 cameraToVertex; 609 if ( isOrthographic ) { 610 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 611 } else {
612 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 613 } 614 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 615 #ifdef ENVMAP_MODE_REFLECTION 616 vReflect = reflect( cameraToVertex, worldNormal ); 617 #else 618 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 619 #endif 620 #endif 621#endif`,Iw=`#ifdef USE_FOG 622 vFogDepth = - mvPosition.z; 623#endif`,Bw=`#ifdef USE_FOG 624 varying float vFogDepth; 625#endif`,Pw=`#ifdef USE_FOG 626 #ifdef FOG_EXP2 627 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 628 #else 629 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 630 #endif 631 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 632#endif`,Dw=`#ifdef USE_FOG 633 uniform vec3 fogColor; 634 varying float vFogDepth; 635 #ifdef FOG_EXP2 636 uniform float fogDensity; 637 #else 638 uniform float fogNear; 639 uniform float fogFar; 640 #endif 641#endif`,Lw=`#ifdef USE_GRADIENTMAP 642 uniform sampler2D gradientMap; 643#endif 644vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 645 float dotNL = dot( normal, lightDirection ); 646 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 647 #ifdef USE_GRADIENTMAP 648 return vec3( texture2D( gradientMap, coord ).r ); 649 #else 650 vec2 fw = fwidth( coord ) * 0.5; 651 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 652 #endif 653}`,Fw=`#ifdef USE_LIGHTMAP 654 uniform sampler2D lightMap; 655 uniform float lightMapIntensity; 656#endif`,Uw=`LambertMaterial material; 657material.diffuseColor = diffuseColor.rgb; 658material.specularStrength = specularStrength;`,Nw=`varying vec3 vViewPosition; 659struct LambertMaterial { 660 vec3 diffuseColor; 661 float specularStrength; 662}; 663void 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 ) { 664 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 665 vec3 irradiance = dotNL * directLight.color; 666 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 667} 668void 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 ) { 669 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 670} 671#define RE_Direct RE_Direct_Lambert 672#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Ow=`uniform bool receiveShadow; 673uniform vec3 ambientLightColor; 674#if defined( USE_LIGHT_PROBES ) 675 uniform vec3 lightProbe[ 9 ]; 676#endif 677vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 678 float x = normal.x, y = normal.y, z = normal.z; 679 vec3 result = shCoefficients[ 0 ] * 0.886227; 680 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 681 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 682 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 683 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 684 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 685 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 686 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 687 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 688 return result; 689} 690vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 691 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 692 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 693 return irradiance; 694} 695vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 696 vec3 irradiance = ambientLightColor; 697 return irradiance; 698} 699float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 700 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 701 if ( cutoffDistance > 0.0 ) { 702 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 703 } 704 return distanceFalloff; 705} 706float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 707 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 708} 709#if NUM_DIR_LIGHTS > 0 710 struct DirectionalLight { 711 vec3 direction; 712 vec3 color; 713 }; 714 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 715 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 716 light.color = directionalLight.color; 717 light.direction = directionalLight.direction; 718 light.visible = true; 719 } 720#endif 721#if NUM_POINT_LIGHTS > 0 722 struct PointLight { 723 vec3 position; 724 vec3 color; 725 float distance; 726 float decay; 727 }; 728 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 729 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 730 vec3 lVector = pointLight.position - geometryPosition; 731 light.direction = normalize( lVector ); 732 float lightDistance = length( lVector ); 733 light.color = pointLight.color; 734 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 735 light.visible = ( light.color != vec3( 0.0 ) ); 736 } 737#endif
738#if NUM_SPOT_LIGHTS > 0 739 struct SpotLight { 740 vec3 position; 741 vec3 direction; 742 vec3 color; 743 float distance; 744 float decay; 745 float coneCos; 746 float penumbraCos; 747 }; 748 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 749 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 750 vec3 lVector = spotLight.position - geometryPosition; 751 light.direction = normalize( lVector ); 752 float angleCos = dot( light.direction, spotLight.direction ); 753 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 754 if ( spotAttenuation > 0.0 ) { 755 float lightDistance = length( lVector ); 756 light.color = spotLight.color * spotAttenuation; 757 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 758 light.visible = ( light.color != vec3( 0.0 ) ); 759 } else { 760 light.color = vec3( 0.0 ); 761 light.visible = false; 762 } 763 } 764#endif 765#if NUM_RECT_AREA_LIGHTS > 0 766 struct RectAreaLight { 767 vec3 color; 768 vec3 position; 769 vec3 halfWidth; 770 vec3 halfHeight; 771 }; 772 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 773 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 774#endif 775#if NUM_HEMI_LIGHTS > 0 776 struct HemisphereLight { 777 vec3 direction; 778 vec3 skyColor; 779 vec3 groundColor; 780 }; 781 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 782 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 783 float dotNL = dot( normal, hemiLight.direction ); 784 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 785 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 786 return irradiance; 787 } 788#endif`,Gw=`#ifdef USE_ENVMAP 789 vec3 getIBLIrradiance( const in vec3 normal ) { 790 #ifdef ENVMAP_TYPE_CUBE_UV 791 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 792 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 793 return PI * envMapColor.rgb * envMapIntensity; 794 #else 795 return vec3( 0.0 ); 796 #endif 797 } 798 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 799 #ifdef ENVMAP_TYPE_CUBE_UV 800 vec3 reflectVec = reflect( - viewDir, normal ); 801 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 802 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 803 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 804 return envMapColor.rgb * envMapIntensity; 805 #else 806 return vec3( 0.0 ); 807 #endif 808 } 809 #ifdef USE_ANISOTROPY 810 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 811 #ifdef ENVMAP_TYPE_CUBE_UV 812 vec3 bentNormal = cross( bitangent, viewDir ); 813 bentNormal = normalize( cross( bentNormal, bitangent ) ); 814 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 815 return getIBLRadiance( viewDir, bentNormal, roughness ); 816 #else 817 return vec3( 0.0 ); 818 #endif 819 } 820 #endif 821#endif`,Hw=`ToonMaterial material; 822material.diffuseColor = diffuseColor.rgb;`,zw=`varying vec3 vViewPosition; 823struct ToonMaterial { 824 vec3 diffuseColor; 825}; 826void 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 ) { 827 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 828 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 829} 830void 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 ) { 831 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 832} 833#define RE_Direct RE_Direct_Toon 834#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,kw=`BlinnPhongMaterial material; 835material.diffuseColor = diffuseColor.rgb; 836material.specularColor = specular; 837material.specularShininess = shininess; 838material.specularStrength = specularStrength;`,Vw=`varying vec3 vViewPosition; 839struct BlinnPhongMaterial { 840 vec3 diffuseColor; 841 vec3 specularColor; 842 float specularShininess; 843 float specularStrength; 844}; 845void 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 ) {
846 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 847 vec3 irradiance = dotNL * directLight.color; 848 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 849 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 850} 851void 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 ) { 852 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 853} 854#define RE_Direct RE_Direct_BlinnPhong 855#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Ww=`PhysicalMaterial material; 856material.diffuseColor = diffuseColor.rgb; 857material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 858material.metalness = metalnessFactor; 859vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 860float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 861material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 862material.roughness = min( material.roughness, 1.0 ); 863#ifdef IOR 864 material.ior = ior; 865 #ifdef USE_SPECULAR 866 float specularIntensityFactor = specularIntensity; 867 vec3 specularColorFactor = specularColor; 868 #ifdef USE_SPECULAR_COLORMAP 869 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 870 #endif 871 #ifdef USE_SPECULAR_INTENSITYMAP 872 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 873 #endif 874 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 875 #else 876 float specularIntensityFactor = 1.0; 877 vec3 specularColorFactor = vec3( 1.0 ); 878 material.specularF90 = 1.0; 879 #endif 880 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 881 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 882#else 883 material.specularColor = vec3( 0.04 ); 884 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 885 material.specularF90 = 1.0; 886#endif 887#ifdef USE_CLEARCOAT 888 material.clearcoat = clearcoat; 889 material.clearcoatRoughness = clearcoatRoughness; 890 material.clearcoatF0 = vec3( 0.04 ); 891 material.clearcoatF90 = 1.0; 892 #ifdef USE_CLEARCOATMAP 893 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 894 #endif 895 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 896 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 897 #endif 898 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 899 material.clearcoatRoughness += geometryRoughness; 900 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 901#endif 902#ifdef USE_DISPERSION 903 material.dispersion = dispersion; 904#endif 905#ifdef USE_IRIDESCENCE 906 material.iridescence = iridescence; 907 material.iridescenceIOR = iridescenceIOR; 908 #ifdef USE_IRIDESCENCEMAP 909 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 910 #endif 911 #ifdef USE_IRIDESCENCE_THICKNESSMAP 912 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 913 #else 914 material.iridescenceThickness = iridescenceThicknessMaximum; 915 #endif 916#endif 917#ifdef USE_SHEEN 918 material.sheenColor = sheenColor; 919 #ifdef USE_SHEEN_COLORMAP 920 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 921 #endif 922 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 923 #ifdef USE_SHEEN_ROUGHNESSMAP 924 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 925 #endif 926#endif 927#ifdef USE_ANISOTROPY 928 #ifdef USE_ANISOTROPYMAP 929 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 930 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 931 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 932 #else 933 vec2 anisotropyV = anisotropyVector; 934 #endif 935 material.anisotropy = length( anisotropyV ); 936 if( material.anisotropy == 0.0 ) { 937 anisotropyV = vec2( 1.0, 0.0 ); 938 } else { 939 anisotropyV /= material.anisotropy; 940 material.anisotropy = saturate( material.anisotropy ); 941 } 942 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
943 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 944 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 945#endif`,Xw
vendor: 17,312 bytes, lines 945-1293
945=`uniform sampler2D dfgLUT; 946struct PhysicalMaterial { 947 vec3 diffuseColor; 948 vec3 diffuseContribution; 949 vec3 specularColor; 950 vec3 specularColorBlended; 951 float roughness; 952 float metalness; 953 float specularF90; 954 float dispersion; 955 #ifdef USE_CLEARCOAT 956 float clearcoat; 957 float clearcoatRoughness; 958 vec3 clearcoatF0; 959 float clearcoatF90; 960 #endif 961 #ifdef USE_IRIDESCENCE 962 float iridescence; 963 float iridescenceIOR; 964 float iridescenceThickness; 965 vec3 iridescenceFresnel; 966 vec3 iridescenceF0; 967 vec3 iridescenceFresnelDielectric; 968 vec3 iridescenceFresnelMetallic; 969 #endif 970 #ifdef USE_SHEEN 971 vec3 sheenColor; 972 float sheenRoughness; 973 #endif 974 #ifdef IOR 975 float ior; 976 #endif 977 #ifdef USE_TRANSMISSION 978 float transmission; 979 float transmissionAlpha; 980 float thickness; 981 float attenuationDistance; 982 vec3 attenuationColor; 983 #endif 984 #ifdef USE_ANISOTROPY 985 float anisotropy; 986 float alphaT; 987 vec3 anisotropyT; 988 vec3 anisotropyB; 989 #endif 990}; 991vec3 clearcoatSpecularDirect = vec3( 0.0 ); 992vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 993vec3 sheenSpecularDirect = vec3( 0.0 ); 994vec3 sheenSpecularIndirect = vec3(0.0 ); 995vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 996 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 997 float x2 = x * x; 998 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 999 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1000} 1001float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1002 float a2 = pow2( alpha ); 1003 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1004 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1005 return 0.5 / max( gv + gl, EPSILON ); 1006} 1007float D_GGX( const in float alpha, const in float dotNH ) { 1008 float a2 = pow2( alpha ); 1009 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1010 return RECIPROCAL_PI * a2 / pow2( denom ); 1011} 1012#ifdef USE_ANISOTROPY 1013 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 ) { 1014 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1015 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1016 float v = 0.5 / ( gv + gl ); 1017 return v; 1018 } 1019 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1020 float a2 = alphaT * alphaB; 1021 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1022 highp float v2 = dot( v, v ); 1023 float w2 = a2 / v2; 1024 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1025 } 1026#endif 1027#ifdef USE_CLEARCOAT 1028 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1029 vec3 f0 = material.clearcoatF0; 1030 float f90 = material.clearcoatF90; 1031 float roughness = material.clearcoatRoughness; 1032 float alpha = pow2( roughness ); 1033 vec3 halfDir = normalize( lightDir + viewDir ); 1034 float dotNL = saturate( dot( normal, lightDir ) ); 1035 float dotNV = saturate( dot( normal, viewDir ) ); 1036 float dotNH = saturate( dot( normal, halfDir ) ); 1037 float dotVH = saturate( dot( viewDir, halfDir ) ); 1038 vec3 F = F_Schlick( f0, f90, dotVH ); 1039 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1040 float D = D_GGX( alpha, dotNH ); 1041 return F * ( V * D ); 1042 } 1043#endif 1044vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1045 vec3 f0 = material.specularColorBlended; 1046 float f90 = material.specularF90; 1047 float roughness = material.roughness; 1048 float alpha = pow2( roughness ); 1049 vec3 halfDir = normalize( lightDir + viewDir ); 1050 float dotNL = saturate( dot( normal, lightDir ) ); 1051 float dotNV = saturate( dot( normal, viewDir ) ); 1052 float dotNH = saturate( dot( normal, halfDir ) ); 1053 float dotVH = saturate( dot( viewDir, halfDir ) ); 1054 vec3 F = F_Schlick( f0, f90, dotVH ); 1055 #ifdef USE_IRIDESCENCE 1056 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1057 #endif 1058 #ifdef USE_ANISOTROPY 1059 float dotTL = dot( material.anisotropyT, lightDir ); 1060 float dotTV = dot( material.anisotropyT, viewDir ); 1061 float dotTH = dot( material.anisotropyT, halfDir ); 1062 float dotBL = dot( material.anisotropyB, lightDir ); 1063 float dotBV = dot( material.anisotropyB, viewDir ); 1064 float dotBH = dot( material.anisotropyB, halfDir ); 1065 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1066 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1067 #else 1068 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1069 float D = D_GGX( alpha, dotNH ); 1070 #endif 1071 return F * ( V * D ); 1072} 1073vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1074 const float LUT_SIZE = 64.0; 1075 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1076 const float LUT_BIAS = 0.5 / LUT_SIZE; 1077 float dotNV = saturate( dot( N, V ) ); 1078 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1079 uv = uv * LUT_SCALE + LUT_BIAS; 1080 return uv; 1081} 1082float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1083 float l = length( f ); 1084 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1085} 1086vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1087 float x = dot( v1, v2 ); 1088 float y = abs( x ); 1089 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1090 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1091 float v = a / b; 1092 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1093 return cross( v1, v2 ) * theta_sintheta; 1094} 1095vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1096 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1097 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1098 vec3 lightNormal = cross( v1, v2 ); 1099 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1100 vec3 T1, T2; 1101 T1 = normalize( V - N * dot( V, N ) ); 1102 T2 = - cross( N, T1 ); 1103 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1104 vec3 coords[ 4 ]; 1105 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1106 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1107 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1108 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1109 coords[ 0 ] = normalize( coords[ 0 ] ); 1110 coords[ 1 ] = normalize( coords[ 1 ] ); 1111 coords[ 2 ] = normalize( coords[ 2 ] ); 1112 coords[ 3 ] = normalize( coords[ 3 ] ); 1113 vec3 vectorFormFactor = vec3( 0.0 ); 1114 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1115 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1116 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1117 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1118 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1119 return vec3( result ); 1120} 1121#if defined( USE_SHEEN ) 1122float D_Charlie( float roughness, float dotNH ) { 1123 float alpha = pow2( roughness ); 1124 float invAlpha = 1.0 / alpha; 1125 float cos2h = dotNH * dotNH; 1126 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1127 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1128} 1129float V_Neubelt( float dotNV, float dotNL ) { 1130 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1131} 1132vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1133 vec3 halfDir = normalize( lightDir + viewDir ); 1134 float dotNL = saturate( dot( normal, lightDir ) ); 1135 float dotNV = saturate( dot( normal, viewDir ) ); 1136 float dotNH = saturate( dot( normal, halfDir ) ); 1137 float D = D_Charlie( sheenRoughness, dotNH ); 1138 float V = V_Neubelt( dotNV, dotNL ); 1139 return sheenColor * ( D * V ); 1140} 1141#endif 1142float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1143 float dotNV = saturate( dot( normal, viewDir ) ); 1144 float r2 = roughness * roughness; 1145 float rInv = 1.0 / ( roughness + 0.1 ); 1146 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1147 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1148 float DG = exp( a * dotNV + b ); 1149 return saturate( DG ); 1150} 1151vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1152 float dotNV = saturate( dot( normal, viewDir ) ); 1153 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1154 return specularColor * fab.x + specularF90 * fab.y; 1155} 1156#ifdef USE_IRIDESCENCE 1157void 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 ) { 1158#else 1159void 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 ) { 1160#endif 1161 float dotNV = saturate( dot( normal, viewDir ) ); 1162 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1163 #ifdef USE_IRIDESCENCE 1164 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1165 #else 1166 vec3 Fr = specularColor; 1167 #endif 1168 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1169 float Ess = fab.x + fab.y; 1170 float Ems = 1.0 - Ess; 1171 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1172 singleScatter += FssEss; 1173 multiScatter += Fms * Ems; 1174} 1175vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1176 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); 1177 float dotNL = saturate( dot( normal, lightDir ) ); 1178 float dotNV = saturate( dot( normal, viewDir ) ); 1179 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1180 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1181 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1182 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1183 float Ess_V = dfgV.x + dfgV.y; 1184 float Ess_L = dfgL.x + dfgL.y; 1185 float Ems_V = 1.0 - Ess_V; 1186 float Ems_L = 1.0 - Ess_L; 1187 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1188 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1189 float compensationFactor = Ems_V * Ems_L; 1190 vec3 multiScatter = Fms * compensationFactor; 1191 return singleScatter + multiScatter; 1192} 1193#if NUM_RECT_AREA_LIGHTS > 0 1194 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 ) { 1195 vec3 normal = geometryNormal; 1196 vec3 viewDir = geometryViewDir; 1197 vec3 position = geometryPosition; 1198 vec3 lightPos = rectAreaLight.position; 1199 vec3 halfWidth = rectAreaLight.halfWidth; 1200 vec3 halfHeight = rectAreaLight.halfHeight; 1201 vec3 lightColor = rectAreaLight.color; 1202 float roughness = material.roughness; 1203 vec3 rectCoords[ 4 ]; 1204 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1205 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1206 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1207 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1208 vec4 t1 = texture2D( ltc_1, uv ); 1209 vec4 t2 = texture2D( ltc_2, uv ); 1210 mat3 mInv = mat3( 1211 vec3( t1.x, 0, t1.y ), 1212 vec3( 0, 1, 0 ), 1213 vec3( t1.z, 0, t1.w ) 1214 ); 1215 vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y ); 1216 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1217 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1218 } 1219#endif 1220void 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 ) { 1221 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1222 vec3 irradiance = dotNL * directLight.color; 1223 #ifdef USE_CLEARCOAT 1224 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1225 vec3 ccIrradiance = dotNLcc * directLight.color; 1226 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1227 #endif 1228 #ifdef USE_SHEEN 1229 1230 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1231 1232 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1233 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1234 1235 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1236 1237 irradiance *= sheenEnergyComp; 1238 1239 #endif 1240 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1241 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1242} 1243void 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 ) { 1244 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1245 #ifdef USE_SHEEN 1246 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1247 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1248 diffuse *= sheenEnergyComp; 1249 #endif 1250 reflectedLight.indirectDiffuse += diffuse; 1251} 1252void 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) { 1253 #ifdef USE_CLEARCOAT 1254 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1255 #endif 1256 #ifdef USE_SHEEN 1257 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1258 #endif 1259 vec3 singleScatteringDielectric = vec3( 0.0 ); 1260 vec3 multiScatteringDielectric = vec3( 0.0 ); 1261 vec3 singleScatteringMetallic = vec3( 0.0 ); 1262 vec3 multiScatteringMetallic = vec3( 0.0 ); 1263 #ifdef USE_IRIDESCENCE 1264 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1265 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1266 #else 1267 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1268 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1269 #endif 1270 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1271 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1272 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1273 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1274 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1275 vec3 indirectSpecular = radiance * singleScattering; 1276 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1277 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1278 #ifdef USE_SHEEN 1279 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1280 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1281 indirectSpecular *= sheenEnergyComp; 1282 indirectDiffuse *= sheenEnergyComp; 1283 #endif 1284 reflectedLight.indirectSpecular += indirectSpecular; 1285 reflectedLight.indirectDiffuse += indirectDiffuse; 1286} 1287#define RE_Direct RE_Direct_Physical 1288#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1289#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1290#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1291float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1292 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1293}`,
1293Jw=` 1294vec3 geometryPosition = - vViewPosition; 1295vec3 geometryNormal = normal; 1296vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1297vec3 geometryClearcoatNormal = vec3( 0.0 ); 1298#ifdef USE_CLEARCOAT 1299 geometryClearcoatNormal = clearcoatNormal; 1300#endif 1301#ifdef USE_IRIDESCENCE 1302 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1303 if ( material.iridescenceThickness == 0.0 ) { 1304 material.iridescence = 0.0; 1305 } else { 1306 material.iridescence = saturate( material.iridescence ); 1307 } 1308 if ( material.iridescence > 0.0 ) { 1309 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1310 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1311 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1312 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1313 } 1314#endif 1315IncidentLight directLight; 1316#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1317 PointLight pointLight; 1318 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1319 PointLightShadow pointLightShadow; 1320 #endif 1321 #pragma unroll_loop_start 1322 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1323 pointLight = pointLights[ i ]; 1324 getPointLightInfo( pointLight, geometryPosition, directLight ); 1325 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1326 pointLightShadow = pointLightShadows[ i ]; 1327 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1328 #endif 1329 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1330 } 1331 #pragma unroll_loop_end 1332#endif 1333#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1334 SpotLight spotLight; 1335 vec4 spotColor; 1336 vec3 spotLightCoord; 1337 bool inSpotLightMap; 1338 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1339 SpotLightShadow spotLightShadow; 1340 #endif 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1343 spotLight = spotLights[ i ]; 1344 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1345 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1346 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1347 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1348 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1349 #else 1350 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1351 #endif 1352 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1353 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1354 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1355 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1356 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1357 #endif 1358 #undef SPOT_LIGHT_MAP_INDEX 1359 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1360 spotLightShadow = spotLightShadows[ i ]; 1361 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1362 #endif 1363 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1364 } 1365 #pragma unroll_loop_end 1366#endif 1367#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1368 DirectionalLight directionalLight; 1369 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1370 DirectionalLightShadow directionalLightShadow; 1371 #endif 1372 #pragma unroll_loop_start 1373 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1374 directionalLight = directionalLights[ i ]; 1375 getDirectionalLightInfo( directionalLight, directLight ); 1376 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1377 directionalLightShadow = directionalLightShadows[ i ]; 1378 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1379 #endif 1380 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1381 } 1382 #pragma unroll_loop_end 1383#endif 1384#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1385 RectAreaLight rectAreaLight; 1386 #pragma unroll_loop_start 1387 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1388 rectAreaLight = rectAreaLights[ i ]; 1389 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1390 } 1391 #pragma unroll_loop_end 1392#endif 1393#if defined( RE_IndirectDiffuse ) 1394 vec3 iblIrradiance = vec3( 0.0 ); 1395 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1396 #if defined( USE_LIGHT_PROBES ) 1397 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1398 #endif 1399 #if ( NUM_HEMI_LIGHTS > 0 ) 1400 #pragma unroll_loop_start 1401 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1402 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1403 } 1404 #pragma unroll_loop_end 1405 #endif 1406#endif 1407#if defined( RE_IndirectSpecular ) 1408 vec3 radiance = vec3( 0.0 ); 1409 vec3 clearcoatRadiance = vec3( 0.0 ); 1410#endif`,Yw=`#if defined( RE_IndirectDiffuse ) 1411 #ifdef USE_LIGHTMAP 1412 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1413 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1414 irradiance += lightMapIrradiance; 1415 #endif 1416 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1417 iblIrradiance += getIBLIrradiance( geometryNormal ); 1418 #endif 1419#endif 1420#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1421 #ifdef USE_ANISOTROPY 1422 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1423 #else 1424 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1425 #endif 1426 #ifdef USE_CLEARCOAT 1427 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1428 #endif 1429#endif`,Kw=`#if defined( RE_IndirectDiffuse ) 1430 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1431#endif 1432#if defined( RE_IndirectSpecular ) 1433 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1434#endif`,Zw=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1435 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1436#endif`,Qw=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1437 uniform float logDepthBufFC; 1438 varying float vFragDepth; 1439 varying float vIsPerspective; 1440#endif`,qw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1441 varying float vFragDepth; 1442 varying float vIsPerspective; 1443#endif`,jw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1444 vFragDepth = 1.0 + gl_Position.w; 1445 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1446#endif`,$w=`#ifdef USE_MAP 1447 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1448 #ifdef DECODE_VIDEO_TEXTURE 1449 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1450 #endif 1451 diffuseColor *= sampledDiffuseColor; 1452#endif`,eb=`#ifdef USE_MAP 1453 uniform sampler2D map; 1454#endif`,tb=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1455 #if defined( USE_POINTS_UV ) 1456 vec2 uv = vUv; 1457 #else 1458 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1459 #endif 1460#endif 1461#ifdef USE_MAP 1462 diffuseColor *= texture2D( map, uv ); 1463#endif 1464#ifdef USE_ALPHAMAP 1465 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1466#endif`,nb=`#if defined( USE_POINTS_UV ) 1467 varying vec2 vUv; 1468#else 1469 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1470 uniform mat3 uvTransform; 1471 #endif 1472#endif 1473#ifdef USE_MAP 1474 uniform sampler2D map; 1475#endif 1476#ifdef USE_ALPHAMAP 1477 uniform sampler2D alphaMap; 1478#endif`,ib=`float metalnessFactor = metalness; 1479#ifdef USE_METALNESSMAP 1480 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1481 metalnessFactor *= texelMetalness.b; 1482#endif`,rb=`#ifdef USE_METALNESSMAP 1483 uniform sampler2D metalnessMap; 1484#endif`,sb=`#ifdef USE_INSTANCING_MORPH 1485 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1486 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1487 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1488 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1489 } 1490#endif`,ab=`#if defined( USE_MORPHCOLORS ) 1491 vColor *= morphTargetBaseInfluence; 1492 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1493 #if defined( USE_COLOR_ALPHA ) 1494 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1495 #elif defined( USE_COLOR ) 1496 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1497 #endif 1498 } 1499#endif`,ob=`#ifdef USE_MORPHNORMALS 1500 objectNormal *= morphTargetBaseInfluence; 1501 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1502 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1503 } 1504#endif`,lb=`#ifdef USE_MORPHTARGETS 1505 #ifndef USE_INSTANCING_MORPH 1506 uniform float morphTargetBaseInfluence; 1507 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1508 #endif 1509 uniform sampler2DArray morphTargetsTexture; 1510 uniform ivec2 morphTargetsTextureSize; 1511 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1512 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1513 int y = texelIndex / morphTargetsTextureSize.x; 1514 int x = texelIndex - y * morphTargetsTextureSize.x; 1515 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1516 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1517 } 1518#endif`,cb=`#ifdef USE_MORPHTARGETS 1519 transformed *= morphTargetBaseInfluence; 1520 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1521 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1522 } 1523#endif`,ub=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1524#ifdef FLAT_SHADED 1525 vec3 fdx = dFdx( vViewPosition ); 1526 vec3 fdy = dFdy( vViewPosition ); 1527 vec3 normal = normalize( cross( fdx, fdy ) ); 1528#else 1529 vec3 normal = normalize( vNormal ); 1530 #ifdef DOUBLE_SIDED 1531 normal *= faceDirection; 1532 #endif 1533#endif 1534#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1535 #ifdef USE_TANGENT 1536 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1537 #else 1538 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1539 #if defined( USE_NORMALMAP ) 1540 vNormalMapUv 1541 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1542 vClearcoatNormalMapUv 1543 #else 1544 vUv 1545 #endif 1546 ); 1547 #endif 1548 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1549 tbn[0] *= faceDirection; 1550 tbn[1] *= faceDirection; 1551 #endif 1552#endif 1553#ifdef USE_CLEARCOAT_NORMALMAP 1554 #ifdef USE_TANGENT 1555 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1556 #else 1557 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1558 #endif 1559 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1560 tbn2[0] *= faceDirection; 1561 tbn2[1] *= faceDirection; 1562 #endif 1563#endif 1564vec3 nonPerturbedNormal = normal;`,hb=`#ifdef USE_NORMALMAP_OBJECTSPACE 1565 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1566 #ifdef FLIP_SIDED 1567 normal = - normal; 1568 #endif 1569 #ifdef DOUBLE_SIDED 1570 normal = normal * faceDirection; 1571 #endif 1572 normal = normalize( normalMatrix * normal ); 1573#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1574 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1575 mapN.xy *= normalScale; 1576 normal = normalize( tbn * mapN ); 1577#elif defined( USE_BUMPMAP )
1578 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1579#endif`,fb=`#ifndef FLAT_SHADED 1580 varying vec3 vNormal; 1581 #ifdef USE_TANGENT 1582 varying vec3 vTangent; 1583 varying vec3 vBitangent; 1584 #endif 1585#endif`,db=`#ifndef FLAT_SHADED 1586 varying vec3 vNormal; 1587 #ifdef USE_TANGENT 1588 varying vec3 vTangent; 1589 varying vec3 vBitangent; 1590 #endif 1591#endif`,pb=`#ifndef FLAT_SHADED 1592 vNormal = normalize( transformedNormal ); 1593 #ifdef USE_TANGENT 1594 vTangent = normalize( transformedTangent ); 1595 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1596 #endif 1597#endif`,mb=`#ifdef USE_NORMALMAP 1598 uniform sampler2D normalMap; 1599 uniform vec2 normalScale; 1600#endif 1601#ifdef USE_NORMALMAP_OBJECTSPACE 1602 uniform mat3 normalMatrix; 1603#endif 1604#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1605 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1606 vec3 q0 = dFdx( eye_pos.xyz ); 1607 vec3 q1 = dFdy( eye_pos.xyz ); 1608 vec2 st0 = dFdx( uv.st ); 1609 vec2 st1 = dFdy( uv.st ); 1610 vec3 N = surf_norm; 1611 vec3 q1perp = cross( q1, N ); 1612 vec3 q0perp = cross( N, q0 ); 1613 vec3 T = q1perp * st0.x + q0perp * st1.x; 1614 vec3 B = q1perp * st0.y + q0perp * st1.y; 1615 float det = max( dot( T, T ), dot( B, B ) ); 1616 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1617 return mat3( T * scale, B * scale, N ); 1618 } 1619#endif`,gb=`#ifdef USE_CLEARCOAT 1620 vec3 clearcoatNormal = nonPerturbedNormal; 1621#endif`,vb=`#ifdef USE_CLEARCOAT_NORMALMAP 1622 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1623 clearcoatMapN.xy *= clearcoatNormalScale; 1624 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1625#endif`,_b=`#ifdef USE_CLEARCOATMAP 1626 uniform sampler2D clearcoatMap; 1627#endif 1628#ifdef USE_CLEARCOAT_NORMALMAP 1629 uniform sampler2D clearcoatNormalMap; 1630 uniform vec2 clearcoatNormalScale; 1631#endif 1632#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1633 uniform sampler2D clearcoatRoughnessMap; 1634#endif`,xb=`#ifdef USE_IRIDESCENCEMAP 1635 uniform sampler2D iridescenceMap; 1636#endif 1637#ifdef USE_IRIDESCENCE_THICKNESSMAP 1638 uniform sampler2D iridescenceThicknessMap; 1639#endif`,yb=`#ifdef OPAQUE 1640diffuseColor.a = 1.0; 1641#endif 1642#ifdef USE_TRANSMISSION 1643diffuseColor.a *= material.transmissionAlpha; 1644#endif 1645gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Ab=`vec3 packNormalToRGB( const in vec3 normal ) { 1646 return normalize( normal ) * 0.5 + 0.5; 1647} 1648vec3 unpackRGBToNormal( const in vec3 rgb ) { 1649 return 2.0 * rgb.xyz - 1.0; 1650} 1651const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1652const float Inv255 = 1. / 255.; 1653const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1654const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1655const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1656const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1657vec4 packDepthToRGBA( const in float v ) { 1658 if( v <= 0.0 ) 1659 return vec4( 0., 0., 0., 0. ); 1660 if( v >= 1.0 ) 1661 return vec4( 1., 1., 1., 1. ); 1662 float vuf; 1663 float af = modf( v * PackFactors.a, vuf ); 1664 float bf = modf( vuf * ShiftRight8, vuf ); 1665 float gf = modf( vuf * ShiftRight8, vuf ); 1666 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1667} 1668vec3 packDepthToRGB( const in float v ) { 1669 if( v <= 0.0 ) 1670 return vec3( 0., 0., 0. ); 1671 if( v >= 1.0 ) 1672 return vec3( 1., 1., 1. ); 1673 float vuf; 1674 float bf = modf( v * PackFactors.b, vuf ); 1675 float gf = modf( vuf * ShiftRight8, vuf ); 1676 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1677} 1678vec2 packDepthToRG( const in float v ) { 1679 if( v <= 0.0 ) 1680 return vec2( 0., 0. ); 1681 if( v >= 1.0 ) 1682 return vec2( 1., 1. ); 1683 float vuf; 1684 float gf = modf( v * 256., vuf ); 1685 return vec2( vuf * Inv255, gf ); 1686} 1687float unpackRGBAToDepth( const in vec4 v ) { 1688 return dot( v, UnpackFactors4 ); 1689} 1690float unpackRGBToDepth( const in vec3 v ) { 1691 return dot( v, UnpackFactors3 ); 1692} 1693float unpackRGToDepth( const in vec2 v ) { 1694 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1695} 1696vec4 pack2HalfToRGBA( const in vec2 v ) {
1697 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1698 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1699} 1700vec2 unpackRGBATo2Half( const in vec4 v ) { 1701 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1702} 1703float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1704 return ( viewZ + near ) / ( near - far ); 1705} 1706float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1707 return depth * ( near - far ) - near; 1708} 1709float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1710 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1711} 1712float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1713 return ( near * far ) / ( ( far - near ) * depth - far ); 1714}`,Sb=`#ifdef PREMULTIPLIED_ALPHA 1715 gl_FragColor.rgb *= gl_FragColor.a; 1716#endif`,Mb=`vec4 mvPosition = vec4( transformed, 1.0 ); 1717#ifdef USE_BATCHING 1718 mvPosition = batchingMatrix * mvPosition; 1719#endif 1720#ifdef USE_INSTANCING 1721 mvPosition = instanceMatrix * mvPosition; 1722#endif 1723mvPosition = modelViewMatrix * mvPosition; 1724gl_Position = projectionMatrix * mvPosition;`,Eb=`#ifdef DITHERING 1725 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1726#endif`,wb=`#ifdef DITHERING 1727 vec3 dithering( vec3 color ) { 1728 float grid_position = rand( gl_FragCoord.xy ); 1729 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1730 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1731 return color + dither_shift_RGB; 1732 } 1733#endif`,bb=`float roughnessFactor = roughness; 1734#ifdef USE_ROUGHNESSMAP 1735 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1736 roughnessFactor *= texelRoughness.g; 1737#endif`,Tb=`#ifdef USE_ROUGHNESSMAP 1738 uniform sampler2D roughnessMap; 1739#endif`,Cb=`#if NUM_SPOT_LIGHT_COORDS > 0 1740 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1741#endif 1742#if NUM_SPOT_LIGHT_MAPS > 0 1743 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1744#endif 1745#ifdef USE_SHADOWMAP 1746 #if NUM_DIR_LIGHT_SHADOWS > 0 1747 #if defined( SHADOWMAP_TYPE_PCF ) 1748 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1749 #else 1750 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1751 #endif 1752 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1753 struct DirectionalLightShadow { 1754 float shadowIntensity; 1755 float shadowBias; 1756 float shadowNormalBias; 1757 float shadowRadius; 1758 vec2 shadowMapSize; 1759 }; 1760 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1761 #endif 1762 #if NUM_SPOT_LIGHT_SHADOWS > 0 1763 #if defined( SHADOWMAP_TYPE_PCF ) 1764 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1765 #else 1766 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1767 #endif 1768 struct SpotLightShadow { 1769 float shadowIntensity; 1770 float shadowBias; 1771 float shadowNormalBias; 1772 float shadowRadius; 1773 vec2 shadowMapSize; 1774 }; 1775 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1776 #endif 1777 #if NUM_POINT_LIGHT_SHADOWS > 0 1778 #if defined( SHADOWMAP_TYPE_PCF ) 1779 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1780 #elif defined( SHADOWMAP_TYPE_BASIC ) 1781 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1782 #endif 1783 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1784 struct PointLightShadow { 1785 float shadowIntensity; 1786 float shadowBias; 1787 float shadowNormalBias; 1788 float shadowRadius; 1789 vec2 shadowMapSize; 1790 float shadowCameraNear; 1791 float shadowCameraFar; 1792 }; 1793 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1794 #endif 1795 #if defined( SHADOWMAP_TYPE_PCF ) 1796 float interleavedGradientNoise( vec2 position ) { 1797 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1798 } 1799 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1800 const float goldenAngle = 2.399963229728653; 1801 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1802 float theta = float( sampleIndex ) * goldenAngle + phi; 1803 return vec2( cos( theta ), sin( theta ) ) * r; 1804 } 1805 #endif 1806 #if defined( SHADOWMAP_TYPE_PCF ) 1807 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1808 float shadow = 1.0; 1809 shadowCoord.xyz /= shadowCoord.w; 1810 shadowCoord.z += shadowBias; 1811 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1812 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1813 if ( frustumTest ) { 1814 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1815 float radius = shadowRadius * texelSize.x; 1816 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; 1817 shadow = ( 1818 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1819 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1820 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1821 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1822 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1823 ) * 0.2; 1824 } 1825 return mix( 1.0, shadow, shadowIntensity ); 1826 } 1827 #elif defined( SHADOWMAP_TYPE_VSM ) 1828 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1829 float shadow = 1.0; 1830 shadowCoord.xyz /= shadowCoord.w; 1831 shadowCoord.z += shadowBias; 1832 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1833 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1834 if ( frustumTest ) { 1835 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1836 float mean = distribution.x; 1837 float variance = distribution.y * distribution.y; 1838 #ifdef USE_REVERSED_DEPTH_BUFFER 1839 float hard_shadow = step( mean, shadowCoord.z ); 1840 #else 1841 float hard_shadow = step( shadowCoord.z, mean ); 1842 #endif 1843 if ( hard_shadow == 1.0 ) { 1844 shadow = 1.0; 1845 } else { 1846 variance = max( variance, 0.0000001 ); 1847 float d = shadowCoord.z - mean; 1848 float p_max = variance / ( variance + d * d ); 1849 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1850 shadow = max( hard_shadow, p_max ); 1851 } 1852 } 1853 return mix( 1.0, shadow, shadowIntensity ); 1854 } 1855 #else 1856 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1857 float shadow = 1.0; 1858 shadowCoord.xyz /= shadowCoord.w; 1859 shadowCoord.z += shadowBias; 1860 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1861 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1862 if ( frustumTest ) { 1863 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1864 #ifdef USE_REVERSED_DEPTH_BUFFER 1865 shadow = step( depth, shadowCoord.z ); 1866 #else 1867 shadow = step( shadowCoord.z, depth ); 1868 #endif 1869 } 1870 return mix( 1.0, shadow, shadowIntensity ); 1871 } 1872 #endif 1873 #if NUM_POINT_LIGHT_SHADOWS > 0 1874 #if defined( SHADOWMAP_TYPE_PCF ) 1875 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1876 float shadow = 1.0; 1877 vec3 lightToPosition = shadowCoord.xyz; 1878 vec3 bd3D = normalize( lightToPosition ); 1879 vec3 absVec = abs( lightToPosition ); 1880 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1881 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1882 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1883 dp += shadowBias; 1884 float texelSize = shadowRadius / shadowMapSize.x; 1885 vec3 absDir = abs( bd3D ); 1886 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1887 tangent = normalize( cross( bd3D, tangent ) ); 1888 vec3 bitangent = cross( bd3D, tangent ); 1889 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; 1890 shadow = ( 1891 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) + 1892 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) + 1893 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) + 1894 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) + 1895 texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) ) 1896 ) * 0.2; 1897 } 1898 return mix( 1.0, shadow, shadowIntensity ); 1899 } 1900 #elif defined( SHADOWMAP_TYPE_BASIC ) 1901 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1902 float shadow = 1.0; 1903 vec3 lightToPosition = shadowCoord.xyz; 1904 vec3 bd3D = normalize( lightToPosition ); 1905 vec3 absVec = abs( lightToPosition ); 1906 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1907 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1908 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1909 dp += shadowBias; 1910 float depth = textureCube( shadowMap, bd3D ).r; 1911 #ifdef USE_REVERSED_DEPTH_BUFFER 1912 shadow = step( depth, dp ); 1913 #else 1914 shadow = step( dp, depth ); 1915 #endif 1916 } 1917 return mix( 1.0, shadow, shadowIntensity ); 1918 } 1919 #endif 1920 #endif
1921#endif`,Rb=`#if NUM_SPOT_LIGHT_COORDS > 0 1922 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1923 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1924#endif 1925#ifdef USE_SHADOWMAP 1926 #if NUM_DIR_LIGHT_SHADOWS > 0 1927 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1928 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1929 struct DirectionalLightShadow { 1930 float shadowIntensity; 1931 float shadowBias; 1932 float shadowNormalBias; 1933 float shadowRadius; 1934 vec2 shadowMapSize; 1935 }; 1936 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1937 #endif 1938 #if NUM_SPOT_LIGHT_SHADOWS > 0 1939 struct SpotLightShadow { 1940 float shadowIntensity; 1941 float shadowBias; 1942 float shadowNormalBias; 1943 float shadowRadius; 1944 vec2 shadowMapSize; 1945 }; 1946 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1947 #endif 1948 #if NUM_POINT_LIGHT_SHADOWS > 0 1949 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1950 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1951 struct PointLightShadow { 1952 float shadowIntensity; 1953 float shadowBias; 1954 float shadowNormalBias; 1955 float shadowRadius; 1956 vec2 shadowMapSize; 1957 float shadowCameraNear; 1958 float shadowCameraFar; 1959 }; 1960 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1961 #endif 1962#endif`,Ib=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1963 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1964 vec4 shadowWorldPosition; 1965#endif 1966#if defined( USE_SHADOWMAP ) 1967 #if NUM_DIR_LIGHT_SHADOWS > 0 1968 #pragma unroll_loop_start 1969 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1970 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1971 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1972 } 1973 #pragma unroll_loop_end 1974 #endif 1975 #if NUM_POINT_LIGHT_SHADOWS > 0 1976 #pragma unroll_loop_start 1977 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1978 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1979 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1980 } 1981 #pragma unroll_loop_end 1982 #endif 1983#endif 1984#if NUM_SPOT_LIGHT_COORDS > 0 1985 #pragma unroll_loop_start 1986 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1987 shadowWorldPosition = worldPosition; 1988 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1989 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1990 #endif 1991 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1992 } 1993 #pragma unroll_loop_end 1994#endif`,Bb=`float getShadowMask() { 1995 float shadow = 1.0; 1996 #ifdef USE_SHADOWMAP 1997 #if NUM_DIR_LIGHT_SHADOWS > 0 1998 DirectionalLightShadow directionalLight; 1999 #pragma unroll_loop_start 2000 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2001 directionalLight = directionalLightShadows[ i ]; 2002 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2003 } 2004 #pragma unroll_loop_end 2005 #endif 2006 #if NUM_SPOT_LIGHT_SHADOWS > 0 2007 SpotLightShadow spotLight; 2008 #pragma unroll_loop_start 2009 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2010 spotLight = spotLightShadows[ i ]; 2011 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2012 } 2013 #pragma unroll_loop_end 2014 #endif 2015 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2016 PointLightShadow pointLight; 2017 #pragma unroll_loop_start 2018 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2019 pointLight = pointLightShadows[ i ]; 2020 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2021 } 2022 #pragma unroll_loop_end 2023 #endif 2024 #endif 2025 return shadow; 2026}
2026`,Pb=`#ifdef USE_SKINNING 2027 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2028 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2029 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2030 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2031#endif`,Db=`#ifdef USE_SKINNING 2032 uniform mat4 bindMatrix; 2033 uniform mat4 bindMatrixInverse; 2034 uniform highp sampler2D boneTexture; 2035 mat4 getBoneMatrix( const in float i ) { 2036 int size = textureSize( boneTexture, 0 ).x; 2037 int j = int( i ) * 4; 2038 int x = j % size; 2039 int y = j / size; 2040 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2041 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2042 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2043 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2044 return mat4( v1, v2, v3, v4 ); 2045 } 2046#endif`,Lb=`#ifdef USE_SKINNING 2047 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2048 vec4 skinned = vec4( 0.0 ); 2049 skinned += boneMatX * skinVertex * skinWeight.x; 2050 skinned += boneMatY * skinVertex * skinWeight.y; 2051 skinned += boneMatZ * skinVertex * skinWeight.z; 2052 skinned += boneMatW * skinVertex * skinWeight.w; 2053 transformed = ( bindMatrixInverse * skinned ).xyz; 2054#endif`,Fb=`#ifdef USE_SKINNING 2055 mat4 skinMatrix = mat4( 0.0 ); 2056 skinMatrix += skinWeight.x * boneMatX; 2057 skinMatrix += skinWeight.y * boneMatY; 2058 skinMatrix += skinWeight.z * boneMatZ; 2059 skinMatrix += skinWeight.w * boneMatW; 2060 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2061 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2062 #ifdef USE_TANGENT 2063 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2064 #endif 2065#endif`,Ub=`float specularStrength; 2066#ifdef USE_SPECULARMAP 2067 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2068 specularStrength = texelSpecular.r; 2069#else 2070 specularStrength = 1.0; 2071#endif`,Nb=`#ifdef USE_SPECULARMAP 2072 uniform sampler2D specularMap; 2073#endif`,Ob=`#if defined( TONE_MAPPING ) 2074 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2075#endif`,Gb=`#ifndef saturate 2076#define saturate( a ) clamp( a, 0.0, 1.0 ) 2077#endif 2078uniform float toneMappingExposure; 2079vec3 LinearToneMapping( vec3 color ) { 2080 return saturate( toneMappingExposure * color ); 2081} 2082vec3 ReinhardToneMapping( vec3 color ) { 2083 color *= toneMappingExposure; 2084 return saturate( color / ( vec3( 1.0 ) + color ) ); 2085} 2086vec3 CineonToneMapping( vec3 color ) { 2087 color *= toneMappingExposure; 2088 color = max( vec3( 0.0 ), color - 0.004 ); 2089 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2090} 2091vec3 RRTAndODTFit( vec3 v ) { 2092 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2093 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2094 return a / b; 2095} 2096vec3 ACESFilmicToneMapping( vec3 color ) { 2097 const mat3 ACESInputMat = mat3( 2098 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2099 vec3( 0.04823, 0.01566, 0.83777 ) 2100 ); 2101 const mat3 ACESOutputMat = mat3( 2102 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2103 vec3( -0.07367, -0.00605, 1.07602 ) 2104 ); 2105 color *= toneMappingExposure / 0.6; 2106 color = ACESInputMat * color; 2107 color = RRTAndODTFit( color ); 2108 color = ACESOutputMat * color; 2109 return saturate( color ); 2110} 2111const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2112 vec3( 1.6605, - 0.1246, - 0.0182 ), 2113 vec3( - 0.5876, 1.1329, - 0.1006 ), 2114 vec3( - 0.0728, - 0.0083, 1.1187 ) 2115); 2116const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2117 vec3( 0.6274, 0.0691, 0.0164 ), 2118 vec3( 0.3293, 0.9195, 0.0880 ), 2119 vec3( 0.0433, 0.0113, 0.8956 ) 2120); 2121vec3 agxDefaultContrastApprox( vec3 x ) { 2122 vec3 x2 = x * x; 2123 vec3 x4 = x2 * x2; 2124 return + 15.5 * x4 * x2 2125 - 40.14 * x4 * x 2126 + 31.96 * x4 2127 - 6.868 * x2 * x 2128 + 0.4298 * x2 2129 + 0.1191 * x 2130 - 0.00232; 2131} 2132vec3 AgXToneMapping( vec3 color ) { 2133 const mat3 AgXInsetMatrix = mat3( 2134 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2135 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2136 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2137 );
2138 const mat3 AgXOutsetMatrix = mat3( 2139 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2140 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2141 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2142 ); 2143 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2144 color *= toneMappingExposure; 2145 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2146 color = AgXInsetMatrix * color; 2147 color = max( color, 1e-10 ); color = log2( color ); 2148 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2149 color = clamp( color, 0.0, 1.0 ); 2150 color = agxDefaultContrastApprox( color ); 2151 color = AgXOutsetMatrix * color; 2152 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2153 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2154 color = clamp( color, 0.0, 1.0 ); 2155 return color; 2156} 2157vec3 NeutralToneMapping( vec3 color ) { 2158 const float StartCompression = 0.8 - 0.04; 2159 const float Desaturation = 0.15; 2160 color *= toneMappingExposure; 2161 float x = min( color.r, min( color.g, color.b ) ); 2162 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2163 color -= offset; 2164 float peak = max( color.r, max( color.g, color.b ) ); 2165 if ( peak < StartCompression ) return color; 2166 float d = 1. - StartCompression; 2167 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2168 color *= newPeak / peak; 2169 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2170 return mix( color, vec3( newPeak ), g ); 2171} 2172vec3 CustomToneMapping( vec3 color ) { return color; }`,Hb=`#ifdef USE_TRANSMISSION 2173 material.transmission = transmission; 2174 material.transmissionAlpha = 1.0; 2175 material.thickness = thickness; 2176 material.attenuationDistance = attenuationDistance; 2177 material.attenuationColor = attenuationColor; 2178 #ifdef USE_TRANSMISSIONMAP 2179 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2180 #endif 2181 #ifdef USE_THICKNESSMAP 2182 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2183 #endif 2184 vec3 pos = vWorldPosition; 2185 vec3 v = normalize( cameraPosition - pos ); 2186 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2187 vec4 transmitted = getIBLVolumeRefraction( 2188 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2189 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2190 material.attenuationColor, material.attenuationDistance ); 2191 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2192 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2193#endif`,zb=`#ifdef USE_TRANSMISSION 2194 uniform float transmission; 2195 uniform float thickness; 2196 uniform float attenuationDistance; 2197 uniform vec3 attenuationColor; 2198 #ifdef USE_TRANSMISSIONMAP 2199 uniform sampler2D transmissionMap; 2200 #endif 2201 #ifdef USE_THICKNESSMAP 2202 uniform sampler2D thicknessMap; 2203 #endif 2204 uniform vec2 transmissionSamplerSize; 2205 uniform sampler2D transmissionSamplerMap; 2206 uniform mat4 modelMatrix; 2207 uniform mat4 projectionMatrix; 2208 varying vec3 vWorldPosition; 2209 float w0( float a ) { 2210 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2211 } 2212 float w1( float a ) { 2213 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2214 } 2215 float w2( float a ){ 2216 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2217 } 2218 float w3( float a ) { 2219 return ( 1.0 / 6.0 ) * ( a * a * a ); 2220 } 2221 float g0( float a ) { 2222 return w0( a ) + w1( a ); 2223 } 2224 float g1( float a ) { 2225 return w2( a ) + w3( a ); 2226 } 2227 float h0( float a ) { 2228 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2229 } 2230 float h1( float a ) { 2231 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2232 } 2233 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2234 uv = uv * texelSize.zw + 0.5; 2235 vec2 iuv = floor( uv ); 2236 vec2 fuv = fract( uv ); 2237 float g0x = g0( fuv.x ); 2238 float g1x = g1( fuv.x ); 2239 float h0x = h0( fuv.x ); 2240 float h1x = h1( fuv.x ); 2241 float h0y = h0( fuv.y ); 2242 float h1y = h1( fuv.y ); 2243 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2244 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2245 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2246 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2247 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2248 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2249 } 2250 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2251 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2252 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2253 vec2 fLodSizeInv = 1.0 / fLodSize; 2254 vec2 cLodSizeInv = 1.0 / cLodSize; 2255 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2256 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2257 return mix( fSample, cSample, fract( lod ) ); 2258 } 2259 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2260 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2261 vec3 modelScale; 2262 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2263 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2264 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2265 return normalize( refractionVector ) * thickness * modelScale; 2266 } 2267 float applyIorToRoughness( const in float roughness, const in float ior ) { 2268 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2269 } 2270 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2271 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2272 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2273 } 2274 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2275 if ( isinf( attenuationDistance ) ) { 2276 return vec3( 1.0 ); 2277 } else { 2278 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2279 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2280 } 2281 } 2282 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2283 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2284 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2285 const in vec3 attenuationColor, const in float attenuationDistance ) { 2286 vec4 transmittedLight; 2287 vec3 transmittance; 2288 #ifdef USE_DISPERSION 2289 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2290 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2291 for ( int i = 0; i < 3; i ++ ) { 2292 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2293 vec3 refractedRayExit = position + transmissionRay; 2294 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2295 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2296 refractionCoords += 1.0; 2297 refractionCoords /= 2.0; 2298 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2299 transmittedLight[ i ] = transmissionSample[ i ]; 2300 transmittedLight.a += transmissionSample.a; 2301 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2302 } 2303 transmittedLight.a /= 3.0; 2304 #else 2305 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2306 vec3 refractedRayExit = position + transmissionRay; 2307 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2308 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2309 refractionCoords += 1.0; 2310 refractionCoords /= 2.0; 2311 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2312 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2313 #endif 2314 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2315 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2316 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2317 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2318 } 2319#endif`,kb=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2320 varying vec2 vUv; 2321#endif 2322#ifdef USE_MAP 2323 varying vec2 vMapUv; 2324#endif 2325#ifdef USE_ALPHAMAP
2326 varying vec2 vAlphaMapUv; 2327#endif 2328#ifdef USE_LIGHTMAP 2329 varying vec2 vLightMapUv; 2330#endif 2331#ifdef USE_AOMAP 2332 varying vec2 vAoMapUv; 2333#endif 2334#ifdef USE_BUMPMAP 2335 varying vec2 vBumpMapUv; 2336#endif 2337#ifdef USE_NORMALMAP 2338 varying vec2 vNormalMapUv; 2339#endif 2340#ifdef USE_EMISSIVEMAP 2341 varying vec2 vEmissiveMapUv; 2342#endif 2343#ifdef USE_METALNESSMAP 2344 varying vec2 vMetalnessMapUv; 2345#endif 2346#ifdef USE_ROUGHNESSMAP 2347 varying vec2 vRoughnessMapUv; 2348#endif 2349#ifdef USE_ANISOTROPYMAP 2350 varying vec2 vAnisotropyMapUv; 2351#endif 2352#ifdef USE_CLEARCOATMAP 2353 varying vec2 vClearcoatMapUv; 2354#endif 2355#ifdef USE_CLEARCOAT_NORMALMAP 2356 varying vec2 vClearcoatNormalMapUv; 2357#endif 2358#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2359 varying vec2 vClearcoatRoughnessMapUv; 2360#endif 2361#ifdef USE_IRIDESCENCEMAP 2362 varying vec2 vIridescenceMapUv; 2363#endif 2364#ifdef USE_IRIDESCENCE_THICKNESSMAP 2365 varying vec2 vIridescenceThicknessMapUv; 2366#endif 2367#ifdef USE_SHEEN_COLORMAP 2368 varying vec2 vSheenColorMapUv; 2369#endif 2370#ifdef USE_SHEEN_ROUGHNESSMAP 2371 varying vec2 vSheenRoughnessMapUv; 2372#endif 2373#ifdef USE_SPECULARMAP 2374 varying vec2 vSpecularMapUv; 2375#endif 2376#ifdef USE_SPECULAR_COLORMAP 2377 varying vec2 vSpecularColorMapUv; 2378#endif 2379#ifdef USE_SPECULAR_INTENSITYMAP 2380 varying vec2 vSpecularIntensityMapUv; 2381#endif 2382#ifdef USE_TRANSMISSIONMAP 2383 uniform mat3 transmissionMapTransform; 2384 varying vec2 vTransmissionMapUv; 2385#endif 2386#ifdef USE_THICKNESSMAP 2387 uniform mat3 thicknessMapTransform; 2388 varying vec2 vThicknessMapUv; 2389#endif`,Vb=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2390 varying vec2 vUv; 2391#endif 2392#ifdef USE_MAP 2393 uniform mat3 mapTransform; 2394 varying vec2 vMapUv; 2395#endif 2396#ifdef USE_ALPHAMAP 2397 uniform mat3 alphaMapTransform; 2398 varying vec2 vAlphaMapUv; 2399#endif 2400#ifdef USE_LIGHTMAP 2401 uniform mat3 lightMapTransform; 2402 varying vec2 vLightMapUv; 2403#endif 2404#ifdef USE_AOMAP 2405 uniform mat3 aoMapTransform; 2406 varying vec2 vAoMapUv; 2407#endif 2408#ifdef USE_BUMPMAP 2409 uniform mat3 bumpMapTransform; 2410 varying vec2 vBumpMapUv; 2411#endif 2412#ifdef USE_NORMALMAP 2413 uniform mat3 normalMapTransform; 2414 varying vec2 vNormalMapUv; 2415#endif 2416#ifdef USE_DISPLACEMENTMAP 2417 uniform mat3 displacementMapTransform; 2418 varying vec2 vDisplacementMapUv; 2419#endif 2420#ifdef USE_EMISSIVEMAP 2421 uniform mat3 emissiveMapTransform; 2422 varying vec2 vEmissiveMapUv; 2423#endif 2424#ifdef USE_METALNESSMAP 2425 uniform mat3 metalnessMapTransform; 2426 varying vec2 vMetalnessMapUv; 2427#endif 2428#ifdef USE_ROUGHNESSMAP 2429 uniform mat3 roughnessMapTransform; 2430 varying vec2 vRoughnessMapUv; 2431#endif 2432#ifdef USE_ANISOTROPYMAP 2433 uniform mat3 anisotropyMapTransform; 2434 varying vec2 vAnisotropyMapUv; 2435#endif 2436#ifdef USE_CLEARCOATMAP 2437 uniform mat3 clearcoatMapTransform; 2438 varying vec2 vClearcoatMapUv; 2439#endif 2440#ifdef USE_CLEARCOAT_NORMALMAP 2441 uniform mat3 clearcoatNormalMapTransform; 2442 varying vec2 vClearcoatNormalMapUv; 2443#endif 2444#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2445 uniform mat3 clearcoatRoughnessMapTransform; 2446 varying vec2 vClearcoatRoughnessMapUv; 2447#endif 2448#ifdef USE_SHEEN_COLORMAP 2449 uniform mat3 sheenColorMapTransform; 2450 varying vec2 vSheenColorMapUv; 2451#endif 2452#ifdef USE_SHEEN_ROUGHNESSMAP 2453 uniform mat3 sheenRoughnessMapTransform; 2454 varying vec2 vSheenRoughnessMapUv; 2455#endif 2456#ifdef USE_IRIDESCENCEMAP 2457 uniform mat3 iridescenceMapTransform; 2458 varying vec2 vIridescenceMapUv; 2459#endif 2460#ifdef USE_IRIDESCENCE_THICKNESSMAP 2461 uniform mat3 iridescenceThicknessMapTransform; 2462 varying vec2 vIridescenceThicknessMapUv; 2463#endif 2464#ifdef USE_SPECULARMAP 2465 uniform mat3 specularMapTransform; 2466 varying vec2 vSpecularMapUv; 2467#endif 2468#ifdef USE_SPECULAR_COLORMAP 2469 uniform mat3 specularColorMapTransform; 2470 varying vec2 vSpecularColorMapUv; 2471#endif 2472#ifdef USE_SPECULAR_INTENSITYMAP 2473 uniform mat3 specularIntensityMapTransform; 2474 varying vec2 vSpecularIntensityMapUv; 2475#endif 2476#ifdef USE_TRANSMISSIONMAP 2477 uniform mat3 transmissionMapTransform; 2478 varying vec2 vTransmissionMapUv; 2479#endif 2480#ifdef USE_THICKNESSMAP 2481 uniform mat3 thicknessMapTransform; 2482 varying vec2 vThicknessMapUv; 2483#endif`,Wb=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2484 vUv = vec3( uv, 1 ).xy; 2485#endif 2486#ifdef USE_MAP 2487 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2488#endif 2489#ifdef USE_ALPHAMAP 2490 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2491#endif 2492#ifdef USE_LIGHTMAP 2493 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2494#endif 2495#ifdef USE_AOMAP 2496 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2497#endif 2498#ifdef USE_BUMPMAP 2499 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2500#endif 2501#ifdef USE_NORMALMAP 2502 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2503#endif 2504#ifdef USE_DISPLACEMENTMAP 2505 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2506#endif 2507#ifdef USE_EMISSIVEMAP 2508 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2509#endif 2510#ifdef USE_METALNESSMAP 2511 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2512#endif 2513#ifdef USE_ROUGHNESSMAP 2514 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2515#endif 2516#ifdef USE_ANISOTROPYMAP 2517 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2518#endif 2519#ifdef USE_CLEARCOATMAP 2520 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2521#endif 2522#ifdef USE_CLEARCOAT_NORMALMAP 2523 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2524#endif 2525#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2526 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2527#endif
2528#ifdef USE_IRIDESCENCEMAP 2529 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2530#endif 2531#ifdef USE_IRIDESCENCE_THICKNESSMAP 2532 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2533#endif 2534#ifdef USE_SHEEN_COLORMAP 2535 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2536#endif 2537#ifdef USE_SHEEN_ROUGHNESSMAP 2538 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2539#endif 2540#ifdef USE_SPECULARMAP 2541 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2542#endif 2543#ifdef USE_SPECULAR_COLORMAP 2544 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2545#endif 2546#ifdef USE_SPECULAR_INTENSITYMAP 2547 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2548#endif 2549#ifdef USE_TRANSMISSIONMAP 2550 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2551#endif 2552#ifdef USE_THICKNESSMAP 2553 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2554#endif`,Xb=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2555 vec4 worldPosition = vec4( transformed, 1.0 ); 2556 #ifdef USE_BATCHING 2557 worldPosition = batchingMatrix * worldPosition; 2558 #endif 2559 #ifdef USE_INSTANCING 2560 worldPosition = instanceMatrix * worldPosition; 2561 #endif 2562 worldPosition = modelMatrix * worldPosition; 2563#endif`;const Jb=`varying vec2 vUv; 2564uniform mat3 uvTransform; 2565void main() { 2566 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2567 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2568}`,Yb=`uniform sampler2D t2D; 2569uniform float backgroundIntensity; 2570varying vec2 vUv; 2571void main() { 2572 vec4 texColor = texture2D( t2D, vUv ); 2573 #ifdef DECODE_VIDEO_TEXTURE 2574 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 ); 2575 #endif 2576 texColor.rgb *= backgroundIntensity; 2577 gl_FragColor = texColor; 2578 #include <tonemapping_fragment> 2579 #include <colorspace_fragment> 2580}`,Kb=`varying vec3 vWorldDirection; 2581#include <common> 2582void main() { 2583 vWorldDirection = transformDirection( position, modelMatrix ); 2584 #include <begin_vertex> 2585 #include <project_vertex> 2586 gl_Position.z = gl_Position.w; 2587}`,Zb=`#ifdef ENVMAP_TYPE_CUBE 2588 uniform samplerCube envMap; 2589#elif defined( ENVMAP_TYPE_CUBE_UV ) 2590 uniform sampler2D envMap; 2591#endif 2592uniform float flipEnvMap; 2593uniform float backgroundBlurriness; 2594uniform float backgroundIntensity; 2595uniform mat3 backgroundRotation; 2596varying vec3 vWorldDirection; 2597#include <cube_uv_reflection_fragment> 2598void main() { 2599 #ifdef ENVMAP_TYPE_CUBE 2600 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2601 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2602 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2603 #else 2604 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2605 #endif 2606 texColor.rgb *= backgroundIntensity; 2607 gl_FragColor = texColor; 2608 #include <tonemapping_fragment> 2609 #include <colorspace_fragment> 2610}`,Qb=`varying vec3 vWorldDirection; 2611#include <common> 2612void main() { 2613 vWorldDirection = transformDirection( position, modelMatrix ); 2614 #include <begin_vertex> 2615 #include <project_vertex> 2616 gl_Position.z = gl_Position.w; 2617}`,qb=`uniform samplerCube tCube; 2618uniform float tFlip; 2619uniform float opacity; 2620varying vec3 vWorldDirection; 2621void main() { 2622 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2623 gl_FragColor = texColor; 2624 gl_FragColor.a *= opacity; 2625 #include <tonemapping_fragment> 2626 #include <colorspace_fragment> 2627}`,jb=`#include <common> 2628#include <batching_pars_vertex> 2629#include <uv_pars_vertex> 2630#include <displacementmap_pars_vertex> 2631#include <morphtarget_pars_vertex> 2632#include <skinning_pars_vertex> 2633#include <logdepthbuf_pars_vertex> 2634#include <clipping_planes_pars_vertex> 2635varying vec2 vHighPrecisionZW; 2636void main() { 2637 #include <uv_vertex> 2638 #include <batching_vertex> 2639 #include <skinbase_vertex> 2640 #include <morphinstance_vertex> 2641 #ifdef USE_DISPLACEMENTMAP 2642 #include <beginnormal_vertex> 2643 #include <morphnormal_vertex> 2644 #include <skinnormal_vertex> 2645 #endif 2646 #include <begin_vertex> 2647 #include <morphtarget_vertex> 2648 #include <skinning_vertex> 2649 #include <displacementmap_vertex> 2650 #include <project_vertex> 2651 #include <logdepthbuf_vertex> 2652 #include <clipping_planes_vertex> 2653 vHighPrecisionZW = gl_Position.zw; 2654}`,$b=`#if DEPTH_PACKING == 3200 2655 uniform float opacity; 2656#endif 2657#include <common> 2658#include <packing> 2659#include <uv_pars_fragment> 2660#include <map_pars_fragment> 2661#include <alphamap_pars_fragment> 2662#include <alphatest_pars_fragment> 2663#include <alphahash_pars_fragment> 2664#include <logdepthbuf_pars_fragment> 2665#include <clipping_planes_pars_fragment> 2666varying vec2 vHighPrecisionZW; 2667void main() { 2668 vec4 diffuseColor = vec4( 1.0 ); 2669 #include <clipping_planes_fragment> 2670 #if DEPTH_PACKING == 3200 2671 diffuseColor.a = opacity; 2672 #endif 2673 #include <map_fragment> 2674 #include <alphamap_fragment> 2675 #include <alphatest_fragment> 2676 #include <alphahash_fragment> 2677 #include <logdepthbuf_fragment> 2678 #ifdef USE_REVERSED_DEPTH_BUFFER 2679 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2680 #else 2681 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2682 #endif 2683 #if DEPTH_PACKING == 3200 2684 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2685 #elif DEPTH_PACKING == 3201 2686 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2687 #elif DEPTH_PACKING == 3202 2688 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2689 #elif DEPTH_PACKING == 3203 2690 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2691 #endif 2692}`,eT=`#define DISTANCE 2693varying vec3 vWorldPosition; 2694#include <common> 2695#include <batching_pars_vertex> 2696#include <uv_pars_vertex> 2697#include <displacementmap_pars_vertex> 2698#include <morphtarget_pars_vertex> 2699#include <skinning_pars_vertex> 2700#include <clipping_planes_pars_vertex> 2701void main() { 2702 #include <uv_vertex> 2703 #include <batching_vertex> 2704 #include <skinbase_vertex> 2705 #include <morphinstance_vertex> 2706 #ifdef USE_DISPLACEMENTMAP 2707 #include <beginnormal_vertex> 2708 #include <morphnormal_vertex> 2709 #include <skinnormal_vertex> 2710 #endif 2711 #include <begin_vertex> 2712 #include <morphtarget_vertex> 2713 #include <skinning_vertex> 2714 #include <displacementmap_vertex> 2715 #include <project_vertex> 2716 #include <worldpos_vertex> 2717 #include <clipping_planes_vertex> 2718 vWorldPosition = worldPosition.xyz; 2719}`,tT=`#define DISTANCE 2720uniform vec3 referencePosition; 2721uniform float nearDistance; 2722uniform float farDistance; 2723varying vec3 vWorldPosition; 2724#include <common> 2725#include <uv_pars_fragment> 2726#include <map_pars_fragment> 2727#include <alphamap_pars_fragment> 2728#include <alphatest_pars_fragment> 2729#include <alphahash_pars_fragment> 2730#include <clipping_planes_pars_fragment> 2731void main () { 2732 vec4 diffuseColor = vec4( 1.0 ); 2733 #include <clipping_planes_fragment> 2734 #include <map_fragment> 2735 #include <alphamap_fragment> 2736 #include <alphatest_fragment> 2737 #include <alphahash_fragment> 2738 float dist = length( vWorldPosition - referencePosition ); 2739 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2740 dist = saturate( dist ); 2741 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2742}`,nT=`varying vec3 vWorldDirection; 2743#include <common> 2744void main() { 2745 vWorldDirection = transformDirection( position, modelMatrix ); 2746 #include <begin_vertex> 2747 #include <project_vertex> 2748}`,iT=`uniform sampler2D tEquirect; 2749varying vec3 vWorldDirection; 2750#include <common> 2751void main() { 2752 vec3 direction = normalize( vWorldDirection ); 2753 vec2 sampleUV = equirectUv( direction ); 2754 gl_FragColor = texture2D( tEquirect, sampleUV ); 2755 #include <tonemapping_fragment> 2756 #include <colorspace_fragment> 2757}`,rT=`uniform float scale; 2758attribute float lineDistance; 2759varying float vLineDistance; 2760#include <common> 2761#include <uv_pars_vertex> 2762#include <color_pars_vertex> 2763#include <fog_pars_vertex> 2764#include <morphtarget_pars_vertex> 2765#include <logdepthbuf_pars_vertex> 2766#include <clipping_planes_pars_vertex> 2767void main() { 2768 vLineDistance = scale * lineDistance; 2769 #include <uv_vertex> 2770 #include <color_vertex> 2771 #include <morphinstance_vertex> 2772 #include <morphcolor_vertex> 2773 #include <begin_vertex> 2774 #include <morphtarget_vertex> 2775 #include <project_vertex> 2776 #include <logdepthbuf_vertex> 2777 #include <clipping_planes_vertex> 2778 #include <fog_vertex> 2779}`,sT=`uniform vec3 diffuse; 2780uniform float opacity; 2781uniform float dashSize; 2782uniform float totalSize; 2783varying float vLineDistance; 2784#include <common> 2785#include <color_pars_fragment> 2786#include <uv_pars_fragment> 2787#include <map_pars_fragment> 2788#include <fog_pars_fragment> 2789#include <logdepthbuf_pars_fragment> 2790#include <clipping_planes_pars_fragment> 2791void main() { 2792 vec4 diffuseColor = vec4( diffuse, opacity ); 2793 #include <clipping_planes_fragment> 2794 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2795 discard; 2796 } 2797 vec3 outgoingLight = vec3( 0.0 ); 2798 #include <logdepthbuf_fragment> 2799 #include <map_fragment> 2800 #include <color_fragment> 2801 outgoingLight = diffuseColor.rgb; 2802 #include <opaque_fragment> 2803 #include <tonemapping_fragment> 2804 #include <colorspace_fragment> 2805 #include <fog_fragment> 2806 #include <premultiplied_alpha_fragment> 2807}`,aT=`#include <common> 2808#include <batching_pars_vertex> 2809#include <uv_pars_vertex> 2810#include <envmap_pars_vertex> 2811#include <color_pars_vertex> 2812#include <fog_pars_vertex> 2813#include <morphtarget_pars_vertex> 2814#include <skinning_pars_vertex> 2815#include <logdepthbuf_pars_vertex> 2816#include <clipping_planes_pars_vertex> 2817void main() { 2818 #include <uv_vertex> 2819 #include <color_vertex> 2820 #include <morphinstance_vertex> 2821 #include <morphcolor_vertex> 2822 #include <batching_vertex> 2823 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2824 #include <beginnormal_vertex> 2825 #include <morphnormal_vertex> 2826 #include <skinbase_vertex> 2827 #include <skinnormal_vertex> 2828 #include <defaultnormal_vertex> 2829 #endif 2830 #include <begin_vertex> 2831 #include <morphtarget_vertex> 2832 #include <skinning_vertex> 2833 #include <project_vertex> 2834 #include <logdepthbuf_vertex> 2835 #include <clipping_planes_vertex> 2836 #include <worldpos_vertex> 2837 #include <envmap_vertex> 2838 #include <fog_vertex> 2839}`,oT=`uniform vec3 diffuse; 2840uniform float opacity; 2841#ifndef FLAT_SHADED 2842 varying vec3 vNormal; 2843#endif 2844#include <common> 2845#include <dithering_pars_fragment> 2846#include <color_pars_fragment> 2847#include <uv_pars_fragment> 2848#include <map_pars_fragment> 2849#include <alphamap_pars_fragment> 2850#include <alphatest_pars_fragment> 2851#include <alphahash_pars_fragment> 2852#include <aomap_pars_fragment> 2853#include <lightmap_pars_fragment> 2854#include <envmap_common_pars_fragment> 2855#include <envmap_pars_fragment> 2856#include <fog_pars_fragment> 2857#include <specularmap_pars_fragment> 2858#include <logdepthbuf_pars_fragment> 2859#include <clipping_planes_pars_fragment> 2860void main() { 2861 vec4 diffuseColor = vec4( diffuse, opacity ); 2862 #include <clipping_planes_fragment> 2863 #include <logdepthbuf_fragment> 2864 #include <map_fragment> 2865 #include <color_fragment> 2866 #include <alphamap_fragment> 2867 #include <alphatest_fragment> 2868 #include <alphahash_fragment> 2869 #include <specularmap_fragment> 2870 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2871 #ifdef USE_LIGHTMAP 2872 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2873 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2874 #else 2875 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2876 #endif 2877 #include <aomap_fragment> 2878 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2879 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2880 #include <envmap_fragment> 2881 #include <opaque_fragment> 2882 #include <tonemapping_fragment> 2883 #include <colorspace_fragment> 2884 #include <fog_fragment> 2885 #include <premultiplied_alpha_fragment> 2886 #include <dithering_fragment> 2887}`,lT=`#define LAMBERT 2888varying vec3 vViewPosition; 2889#include <common> 2890#include <batching_pars_vertex> 2891#include <uv_pars_vertex> 2892#include <displacementmap_pars_vertex> 2893#include <envmap_pars_vertex> 2894#include <color_pars_vertex> 2895#include <fog_pars_vertex> 2896#include <normal_pars_vertex> 2897#include <morphtarget_pars_vertex> 2898#include <skinning_pars_vertex> 2899#include <shadowmap_pars_vertex> 2900#include <logdepthbuf_pars_vertex> 2901#include <clipping_planes_pars_vertex> 2902void main() { 2903 #include <uv_vertex> 2904 #include <color_vertex> 2905 #include <morphinstance_vertex> 2906 #include <morphcolor_vertex> 2907 #include <batching_vertex> 2908 #include <beginnormal_vertex> 2909 #include <morphnormal_vertex> 2910 #include <skinbase_vertex> 2911 #include <skinnormal_vertex> 2912 #include <defaultnormal_vertex> 2913 #include <normal_vertex> 2914 #include <begin_vertex> 2915 #include <morphtarget_vertex> 2916 #include <skinning_vertex> 2917 #include <displacementmap_vertex> 2918 #include <project_vertex> 2919 #include <logdepthbuf_vertex> 2920 #include <clipping_planes_vertex> 2921 vViewPosition = - mvPosition.xyz; 2922 #include <worldpos_vertex> 2923 #include <envmap_vertex> 2924 #include <shadowmap_vertex> 2925 #include <fog_vertex> 2926}`,cT=`#define LAMBERT 2927uniform vec3 diffuse; 2928uniform vec3 emissive; 2929uniform float opacity; 2930#include <common> 2931#include <dithering_pars_fragment> 2932#include <color_pars_fragment> 2933#include <uv_pars_fragment> 2934#include <map_pars_fragment> 2935#include <alphamap_pars_fragment> 2936#include <alphatest_pars_fragment> 2937#include <alphahash_pars_fragment> 2938#include <aomap_pars_fragment> 2939#include <lightmap_pars_fragment> 2940#include <emissivemap_pars_fragment> 2941#include <envmap_common_pars_fragment> 2942#include <envmap_pars_fragment> 2943#include <fog_pars_fragment> 2944#include <bsdfs> 2945#include <lights_pars_begin> 2946#include <normal_pars_fragment> 2947#include <lights_lambert_pars_fragment> 2948#include <shadowmap_pars_fragment> 2949#include <bumpmap_pars_fragment> 2950#include <normalmap_pars_fragment> 2951#include <specularmap_pars_fragment> 2952#include <logdepthbuf_pars_fragment> 2953#include <clipping_planes_pars_fragment> 2954void main() { 2955 vec4 diffuseColor = vec4( diffuse, opacity ); 2956 #include <clipping_planes_fragment> 2957 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2958 vec3 totalEmissiveRadiance = emissive; 2959 #include <logdepthbuf_fragment> 2960 #include <map_fragment> 2961 #include <color_fragment> 2962 #include <alphamap_fragment> 2963 #include <alphatest_fragment> 2964 #include <alphahash_fragment> 2965 #include <specularmap_fragment> 2966 #include <normal_fragment_begin> 2967 #include <normal_fragment_maps> 2968 #include <emissivemap_fragment> 2969 #include <lights_lambert_fragment> 2970 #include <lights_fragment_begin> 2971 #include <lights_fragment_maps> 2972 #include <lights_fragment_end> 2973 #include <aomap_fragment> 2974 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2975 #include <envmap_fragment> 2976 #include <opaque_fragment> 2977 #include <tonemapping_fragment> 2978 #include <colorspace_fragment> 2979 #include <fog_fragment> 2980 #include <premultiplied_alpha_fragment> 2981 #include <dithering_fragment> 2982}`,uT=`#define MATCAP 2983varying vec3 vViewPosition; 2984#include <common> 2985#include <batching_pars_vertex> 2986#include <uv_pars_vertex> 2987#include <color_pars_vertex> 2988#include <displacementmap_pars_vertex> 2989#include <fog_pars_vertex> 2990#include <normal_pars_vertex> 2991#include <morphtarget_pars_vertex> 2992#include <skinning_pars_vertex> 2993#include <logdepthbuf_pars_vertex> 2994#include <clipping_planes_pars_vertex> 2995void main() { 2996 #include <uv_vertex> 2997 #include <color_vertex> 2998 #include <morphinstance_vertex> 2999 #include <morphcolor_vertex> 3000 #include <batching_vertex> 3001 #include <beginnormal_vertex> 3002 #include <morphnormal_vertex> 3003 #include <skinbase_vertex> 3004 #include <skinnormal_vertex> 3005 #include <defaultnormal_vertex> 3006 #include <normal_vertex> 3007 #include <begin_vertex> 3008 #include <morphtarget_vertex> 3009 #include <skinning_vertex> 3010 #include <displacementmap_vertex> 3011 #include <project_vertex> 3012 #include <logdepthbuf_vertex> 3013 #include <clipping_planes_vertex> 3014 #include <fog_vertex> 3015 vViewPosition = - mvPosition.xyz; 3016}`,hT=`#define MATCAP 3017uniform vec3 diffuse; 3018uniform float opacity; 3019uniform sampler2D matcap; 3020varying vec3 vViewPosition; 3021#include <common> 3022#include <dithering_pars_fragment> 3023#include <color_pars_fragment> 3024#include <uv_pars_fragment> 3025#include <map_pars_fragment> 3026#include <alphamap_pars_fragment> 3027#include <alphatest_pars_fragment> 3028#include <alphahash_pars_fragment> 3029#include <fog_pars_fragment> 3030#include <normal_pars_fragment> 3031#include <bumpmap_pars_fragment> 3032#include <normalmap_pars_fragment> 3033#includ
3033e <logdepthbuf_pars_fragment> 3034#include <clipping_planes_pars_fragment> 3035void main() { 3036 vec4 diffuseColor = vec4( diffuse, opacity ); 3037 #include <clipping_planes_fragment> 3038 #include <logdepthbuf_fragment> 3039 #include <map_fragment> 3040 #include <color_fragment> 3041 #include <alphamap_fragment> 3042 #include <alphatest_fragment> 3043 #include <alphahash_fragment> 3044 #include <normal_fragment_begin> 3045 #include <normal_fragment_maps> 3046 vec3 viewDir = normalize( vViewPosition ); 3047 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3048 vec3 y = cross( viewDir, x ); 3049 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3050 #ifdef USE_MATCAP 3051 vec4 matcapColor = texture2D( matcap, uv ); 3052 #else 3053 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3054 #endif 3055 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3056 #include <opaque_fragment> 3057 #include <tonemapping_fragment> 3058 #include <colorspace_fragment> 3059 #include <fog_fragment> 3060 #include <premultiplied_alpha_fragment> 3061 #include <dithering_fragment> 3062}`,fT=`#define NORMAL 3063#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3064 varying vec3 vViewPosition; 3065#endif 3066#include <common> 3067#include <batching_pars_vertex> 3068#include <uv_pars_vertex> 3069#include <displacementmap_pars_vertex> 3070#include <normal_pars_vertex> 3071#include <morphtarget_pars_vertex> 3072#include <skinning_pars_vertex> 3073#include <logdepthbuf_pars_vertex> 3074#include <clipping_planes_pars_vertex> 3075void main() { 3076 #include <uv_vertex> 3077 #include <batching_vertex> 3078 #include <beginnormal_vertex> 3079 #include <morphinstance_vertex> 3080 #include <morphnormal_vertex> 3081 #include <skinbase_vertex> 3082 #include <skinnormal_vertex> 3083 #include <defaultnormal_vertex> 3084 #include <normal_vertex> 3085 #include <begin_vertex> 3086 #include <morphtarget_vertex> 3087 #include <skinning_vertex> 3088 #include <displacementmap_vertex> 3089 #include <project_vertex> 3090 #include <logdepthbuf_vertex> 3091 #include <clipping_planes_vertex> 3092#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3093 vViewPosition = - mvPosition.xyz; 3094#endif 3095}`,dT=`#define NORMAL 3096uniform float opacity; 3097#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3098 varying vec3 vViewPosition; 3099#endif 3100#include <uv_pars_fragment> 3101#include <normal_pars_fragment> 3102#include <bumpmap_pars_fragment> 3103#include <normalmap_pars_fragment> 3104#include <logdepthbuf_pars_fragment> 3105#include <clipping_planes_pars_fragment> 3106void main() { 3107 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3108 #include <clipping_planes_fragment> 3109 #include <logdepthbuf_fragment> 3110 #include <normal_fragment_begin> 3111 #include <normal_fragment_maps> 3112 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3113 #ifdef OPAQUE 3114 gl_FragColor.a = 1.0; 3115 #endif 3116}`,pT=`#define PHONG 3117varying vec3 vViewPosition; 3118#include <common> 3119#include <batching_pars_vertex> 3120#include <uv_pars_vertex> 3121#include <displacementmap_pars_vertex> 3122#include <envmap_pars_vertex> 3123#include <color_pars_vertex> 3124#include <fog_pars_vertex> 3125#include <normal_pars_vertex> 3126#include <morphtarget_pars_vertex> 3127#include <skinning_pars_vertex> 3128#include <shadowmap_pars_vertex> 3129#include <logdepthbuf_pars_vertex> 3130#include <clipping_planes_pars_vertex> 3131void main() { 3132 #include <uv_vertex> 3133 #include <color_vertex> 3134 #include <morphcolor_vertex> 3135 #include <batching_vertex> 3136 #include <beginnormal_vertex> 3137 #include <morphinstance_vertex> 3138 #include <morphnormal_vertex> 3139 #include <skinbase_vertex> 3140 #include <skinnormal_vertex> 3141 #include <defaultnormal_vertex> 3142 #include <normal_vertex> 3143 #include <begin_vertex> 3144 #include <morphtarget_vertex> 3145 #include <skinning_vertex> 3146 #include <displacementmap_vertex> 3147 #include <project_vertex> 3148 #include <logdepthbuf_vertex> 3149 #include <clipping_planes_vertex> 3150 vViewPosition = - mvPosition.xyz; 3151 #include <worldpos_vertex> 3152 #include <envmap_vertex> 3153 #include <shadowmap_vertex> 3154 #include <fog_vertex> 3155}`,mT=`#define PHONG 3156uniform vec3 diffuse; 3157uniform vec3 emissive; 3158uniform vec3 specular; 3159uniform float shininess; 3160uniform float opacity; 3161#include <common> 3162#include <dithering_pars_fragment> 3163#include <color_pars_fragment> 3164#include <uv_pars_fragment> 3165#include <map_pars_fragment> 3166#include <alphamap_pars_fragment> 3167#include <alphatest_pars_fragment> 3168#include <alphahash_pars_fragment> 3169#include <aomap_pars_fragment> 3170#include <lightmap_pars_fragment> 3171#include <emissivemap_pars_fragment> 3172#include <envmap_common_pars_fragment> 3173#include <envmap_pars_fragment> 3174#include <fog_pars_fragment> 3175#include <bsdfs> 3176#include <lights_pars_begin> 3177#include <normal_pars_fragment> 3178#include <lights_phong_pars_fragment> 3179#include <shadowmap_pars_fragment> 3180#include <bumpmap_pars_fragment> 3181#include <normalmap_pars_fragment> 3182#include <specularmap_pars_fragment> 3183#include <logdepthbuf_pars_fragment> 3184#include <clipping_planes_pars_fragment> 3185void main() { 3186 vec4 diffuseColor = vec4( diffuse, opacity ); 3187 #include <clipping_planes_fragment> 3188 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3189 vec3 totalEmissiveRadiance = emissive; 3190 #include <logdepthbuf_fragment> 3191 #include <map_fragment> 3192 #include <color_fragment> 3193 #include <alphamap_fragment> 3194 #include <alphatest_fragment> 3195 #include <alphahash_fragment> 3196 #include <specularmap_fragment> 3197 #include <normal_fragment_begin> 3198 #include <normal_fragment_maps> 3199 #include <emissivemap_fragment> 3200 #include <lights_phong_fragment> 3201 #include <lights_fragment_begin> 3202 #include <lights_fragment_maps> 3203 #include <lights_fragment_end> 3204 #include <aomap_fragment> 3205 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3206 #include <envmap_fragment> 3207 #include <opaque_fragment> 3208 #include <tonemapping_fragment> 3209 #include <colorspace_fragment> 3210 #include <fog_fragment> 3211 #include <premultiplied_alpha_fragment> 3212 #include <dithering_fragment> 3213}`,gT=`#define STANDARD 3214varying vec3 vViewPosition; 3215#ifdef USE_TRANSMISSION 3216 varying vec3 vWorldPosition; 3217#endif 3218#include <common> 3219#include <batching_pars_vertex> 3220#include <uv_pars_vertex> 3221#include <displacementmap_pars_vertex> 3222#include <color_pars_vertex> 3223#include <fog_pars_vertex> 3224#include <normal_pars_vertex> 3225#include <morphtarget_pars_vertex> 3226#include <skinning_pars_vertex> 3227#include <shadowmap_pars_vertex> 3228#include <logdepthbuf_pars_vertex> 3229#include <clipping_planes_pars_vertex> 3230void main() { 3231 #include <uv_vertex> 3232 #include <color_vertex> 3233 #include <morphinstance_vertex> 3234 #include <morphcolor_vertex> 3235 #include <batching_vertex> 3236 #include <beginnormal_vertex> 3237 #include <morphnormal_vertex> 3238 #include <skinbase_vertex> 3239 #include <skinnormal_vertex> 3240 #include <defaultnormal_vertex> 3241 #include <normal_vertex> 3242 #include <begin_vertex> 3243 #include <morphtarget_vertex> 3244 #include <skinning_vertex> 3245 #include <displacementmap_vertex> 3246 #include <project_vertex> 3247 #include <logdepthbuf_vertex> 3248 #include <clipping_planes_vertex> 3249 vViewPosition = - mvPosition.xyz; 3250 #include <worldpos_vertex> 3251 #include <shadowmap_vertex> 3252 #include <fog_vertex> 3253#ifdef USE_TRANSMISSION 3254 vWorldPosition = worldPosition.xyz; 3255#endif 3256}`,vT=`#define STANDARD 3257#ifdef PHYSICAL 3258 #define IOR 3259 #define USE_SPECULAR 3260#endif 3261uniform vec3 diffuse; 3262uniform vec3 emissive; 3263uniform float roughness; 3264uniform float metalness; 3265uniform float opacity; 3266#ifdef IOR 3267 uniform float ior; 3268#endif 3269#ifdef USE_SPECULAR 3270 uniform float specularIntensity; 3271 uniform vec3 specularColor; 3272 #ifdef USE_SPECULAR_COLORMAP 3273 uniform sampler2D specularColorMap; 3274 #endif 3275 #ifdef USE_SPECULAR_INTENSITYMAP 3276 uniform sampler2D specularIntensityMap; 3277 #endif 3278#endif 3279#ifdef USE_CLEARCOAT 3280 uniform float clearcoat; 3281 uniform float clearcoatRoughness; 3282#endif 3283#ifdef USE_DISPERSION 3284 uniform float dispersion; 3285#endif
3286#ifdef USE_IRIDESCENCE 3287 uniform float iridescence; 3288 uniform float iridescenceIOR; 3289 uniform float iridescenceThicknessMinimum; 3290 uniform float iridescenceThicknessMaximum; 3291#endif 3292#ifdef USE_SHEEN 3293 uniform vec3 sheenColor; 3294 uniform float sheenRoughness; 3295 #ifdef USE_SHEEN_COLORMAP 3296 uniform sampler2D sheenColorMap; 3297 #endif 3298 #ifdef USE_SHEEN_ROUGHNESSMAP 3299 uniform sampler2D sheenRoughnessMap; 3300 #endif 3301#endif 3302#ifdef USE_ANISOTROPY 3303 uniform vec2 anisotropyVector; 3304 #ifdef USE_ANISOTROPYMAP 3305 uniform sampler2D anisotropyMap; 3306 #endif 3307#endif 3308varying vec3 vViewPosition; 3309#include <common> 3310#include <dithering_pars_fragment> 3311#include <color_pars_fragment> 3312#include <uv_pars_fragment> 3313#include <map_pars_fragment> 3314#include <alphamap_pars_fragment> 3315#include <alphatest_pars_fragment> 3316#include <alphahash_pars_fragment> 3317#include <aomap_pars_fragment> 3318#include <lightmap_pars_fragment> 3319#include <emissivemap_pars_fragment> 3320#include <iridescence_fragment> 3321#include <cube_uv_reflection_fragment> 3322#include <envmap_common_pars_fragment> 3323#include <envmap_physical_pars_fragment> 3324#include <fog_pars_fragment> 3325#include <lights_pars_begin> 3326#include <normal_pars_fragment> 3327#include <lights_physical_pars_fragment> 3328#include <transmission_pars_fragment> 3329#include <shadowmap_pars_fragment> 3330#include <bumpmap_pars_fragment> 3331#include <normalmap_pars_fragment> 3332#include <clearcoat_pars_fragment> 3333#include <iridescence_pars_fragment> 3334#include <roughnessmap_pars_fragment> 3335#include <metalnessmap_pars_fragment> 3336#include <logdepthbuf_pars_fragment> 3337#include <clipping_planes_pars_fragment> 3338void main() { 3339 vec4 diffuseColor = vec4( diffuse, opacity ); 3340 #include <clipping_planes_fragment> 3341 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3342 vec3 totalEmissiveRadiance = emissive; 3343 #include <logdepthbuf_fragment> 3344 #include <map_fragment> 3345 #include <color_fragment> 3346 #include <alphamap_fragment> 3347 #include <alphatest_fragment> 3348 #include <alphahash_fragment> 3349 #include <roughnessmap_fragment> 3350 #include <metalnessmap_fragment> 3351 #include <normal_fragment_begin> 3352 #include <normal_fragment_maps> 3353 #include <clearcoat_normal_fragment_begin> 3354 #include <clearcoat_normal_fragment_maps> 3355 #include <emissivemap_fragment> 3356 #include <lights_physical_fragment> 3357 #include <lights_fragment_begin> 3358 #include <lights_fragment_maps> 3359 #include <lights_fragment_end> 3360 #include <aomap_fragment> 3361 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3362 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3363 #include <transmission_fragment> 3364 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3365 #ifdef USE_SHEEN 3366 3367 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3368 3369 #endif 3370 #ifdef USE_CLEARCOAT 3371 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3372 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3373 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3374 #endif 3375 #include <opaque_fragment> 3376 #include <tonemapping_fragment> 3377 #include <colorspace_fragment> 3378 #include <fog_fragment> 3379 #include <premultiplied_alpha_fragment> 3380 #include <dithering_fragment> 3381}`,_T=`#define TOON 3382varying vec3 vViewPosition; 3383#include <common> 3384#include <batching_pars_vertex> 3385#include <uv_pars_vertex> 3386#include <displacementmap_pars_vertex> 3387#include <color_pars_vertex> 3388#include <fog_pars_vertex> 3389#include <normal_pars_vertex> 3390#include <morphtarget_pars_vertex> 3391#include <skinning_pars_vertex> 3392#include <shadowmap_pars_vertex> 3393#include <logdepthbuf_pars_vertex> 3394#include <clipping_planes_pars_vertex> 3395void main() { 3396 #include <uv_vertex> 3397 #include <color_vertex> 3398 #include <morphinstance_vertex> 3399 #include <morphcolor_vertex> 3400 #include <batching_vertex> 3401 #include <beginnormal_vertex> 3402 #include <morphnormal_vertex> 3403 #include <skinbase_vertex> 3404 #include <skinnormal_vertex> 3405 #include <defaultnormal_vertex> 3406 #include <normal_vertex> 3407 #include <begin_vertex> 3408 #include <morphtarget_vertex> 3409 #include <skinning_vertex> 3410 #include <displacementmap_vertex> 3411 #include <project_vertex> 3412 #include <logdepthbuf_vertex> 3413 #include <clipping_planes_vertex> 3414 vViewPosition = - mvPosition.xyz; 3415 #include <worldpos_vertex> 3416 #include <shadowmap_vertex> 3417 #include <fog_vertex> 3418}`,xT=`#define TOON 3419uniform vec3 diffuse; 3420uniform vec3 emissive; 3421uniform float opacity; 3422#include <common> 3423#include <dithering_pars_fragment> 3424#include <color_pars_fragment> 3425#include <uv_pars_fragment> 3426#include <map_pars_fragment> 3427#include <alphamap_pars_fragment> 3428#include <alphatest_pars_fragment> 3429#include <alphahash_pars_fragment> 3430#include <aomap_pars_fragment> 3431#include <lightmap_pars_fragment> 3432#include <emissivemap_pars_fragment> 3433#include <gradientmap_pars_fragment> 3434#include <fog_pars_fragment> 3435#include <bsdfs> 3436#include <lights_pars_begin> 3437#include <normal_pars_fragment> 3438#include <lights_toon_pars_fragment> 3439#include <shadowmap_pars_fragment> 3440#include <bumpmap_pars_fragment> 3441#include <normalmap_pars_fragment> 3442#include <logdepthbuf_pars_fragment> 3443#include <clipping_planes_pars_fragment> 3444void main() { 3445 vec4 diffuseColor = vec4( diffuse, opacity ); 3446 #include <clipping_planes_fragment> 3447 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3448 vec3 totalEmissiveRadiance = emissive; 3449 #include <logdepthbuf_fragment> 3450 #include <map_fragment> 3451 #include <color_fragment> 3452 #include <alphamap_fragment> 3453 #include <alphatest_fragment> 3454 #include <alphahash_fragment> 3455 #include <normal_fragment_begin> 3456 #include <normal_fragment_maps> 3457 #include <emissivemap_fragment> 3458 #include <lights_toon_fragment> 3459 #include <lights_fragment_begin> 3460 #include <lights_fragment_maps> 3461 #include <lights_fragment_end> 3462 #include <aomap_fragment> 3463 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3464 #include <opaque_fragment> 3465 #include <tonemapping_fragment> 3466 #include <colorspace_fragment> 3467 #include <fog_fragment> 3468 #include <premultiplied_alpha_fragment> 3469 #include <dithering_fragment> 3470}`,yT=`uniform float size; 3471uniform float scale; 3472#include <common> 3473#include <color_pars_vertex> 3474#include <fog_pars_vertex> 3475#include <morphtarget_pars_vertex> 3476#include <logdepthbuf_pars_vertex> 3477#include <clipping_planes_pars_vertex> 3478#ifdef USE_POINTS_UV 3479 varying vec2 vUv; 3480 uniform mat3 uvTransform; 3481#endif 3482void main() { 3483 #ifdef USE_POINTS_UV 3484 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3485 #endif 3486 #include <color_vertex> 3487 #include <morphinstance_vertex> 3488 #include <morphcolor_vertex> 3489 #include <begin_vertex> 3490 #include <morphtarget_vertex> 3491 #include <project_vertex> 3492 gl_PointSize = size; 3493 #ifdef USE_SIZEATTENUATION 3494 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3495 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3496 #endif 3497 #include <logdepthbuf_vertex> 3498 #include <clipping_planes_vertex> 3499 #include <worldpos_vertex> 3500 #include <fog_vertex> 3501}`,AT=`uniform vec3 diffuse; 3502uniform float opacity; 3503#include <common> 3504#include <color_pars_fragment> 3505#include <map_particle_pars_fragment> 3506#include <alphatest_pars_fragment> 3507#include <alphahash_pars_fragment> 3508#include <fog_pars_fragment> 3509#include <logdepthbuf_pars_fragment> 3510#include <clipping_planes_pars_fragment> 3511void main() { 3512 vec4 diffuseColor = vec4( diffuse, opacity ); 3513 #include <clipping_planes_fragment> 3514 vec3 outgoingLight = vec3( 0.0 ); 3515 #include <logdepthbuf_fragment> 3516 #include <map_particle_fragment> 3517 #include <color_fragment> 3518 #include <alphatest_fragment> 3519 #include <alphahash_fragment> 3520 outgoingLight = diffuseColor.rgb; 3521 #include <opaque_fragment> 3522 #include <tonemapping_fragment> 3523 #include <colorspace_fragment> 3524 #include <fog_fragment> 3525 #include <premultiplied_alpha_fragment> 3526}`,ST=`#include <common> 3527#include <batching_pars_vertex> 3528#include <fog_pars_vertex> 3529#include <morphtarget_pars_vertex> 3530#include <skinning_pars_vertex> 3531#include <logdepthbuf_pars_vertex> 3532#include <shadowmap_pars_vertex> 3533void main() { 3534 #include <batching_vertex> 3535 #include <beginnormal_vertex> 3536 #include <morphinstance_vertex> 3537 #include <morphnormal_vertex> 3538 #include <skinbase_vertex> 3539 #include <skinnormal_vertex> 3540 #include <defaultnormal_vertex> 3541 #include <begin_vertex> 3542 #include <morphtarget_vertex> 3543 #include <skinning_vertex> 3544 #include <project_vertex> 3545 #include <logdepthbuf_vertex> 3546 #include <worldpos_vertex> 3547 #include <shadowmap_vertex> 3548 #include <fog_vertex> 3549}`,MT=`uniform vec3 color; 3550uniform float opacity; 3551#include <common> 3552#include <fog_pars_fragment> 3553#include <bsdfs> 3554#include <lights_pars_begin> 3555#include <logdepthbuf_pars_fragment> 3556#include <shadowmap_pars_fragment> 3557#include <shadowmask_pars_fragment> 3558void main() { 3559 #include <logdepthbuf_fragment> 3560 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3561 #include <tonemapping_fragment> 3562 #include <colorspace_fragment> 3563 #include <fog_fragment> 3564}`,ET=`uniform float rotation; 3565uniform vec2 center; 3566#include <common> 3567#include <uv_pars_vertex> 3568#include <fog_pars_vertex> 3569#include <logdepthbuf_pars_vertex> 3570#include <clipping_planes_pars_vertex> 3571void main() { 3572 #include <uv_vertex> 3573 vec4 mvPosition = modelViewMatrix[ 3 ]; 3574 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3575 #ifndef USE_SIZEATTENUATION 3576 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3577 if ( isPerspective ) scale *= - mvPosition.z; 3578 #endif 3579 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3580 vec2 rotatedPosition; 3581 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3582 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3583 mvPosition.xy += rotatedPosition; 3584 gl_Position = projectionMatrix * mvPosition; 3585 #include <logdepthbuf_vertex> 3586 #include <clipping_planes_vertex> 3587 #include <fog_vertex> 3588}`,wT=`uniform vec3 diffuse; 3589uniform float opacity; 3590#include <common> 3591#include <uv_pars_fragment> 3592#include <map_pars_fragment> 3593#include <alphamap_pars_fragment> 3594#include <alphatest_pars_fragment> 3595#include <alphahash_pars_fragment> 3596#include <fog_pars_fragment> 3597#include <logdepthbuf_pars_fragment> 3598#include <clipping_planes_pars_fragment> 3599void main() { 3600 vec4 diffuseColor = vec4( diffuse, opacity ); 3601 #include <clipping_planes_fragment> 3602 vec3 outgoingLight = vec3( 0.0 ); 3603 #include <logdepthbuf_fragment> 3604 #include <map_fragment> 3605 #include <alphamap_fragment> 3606 #include <alphatest_fragment> 3607 #include <alphahash_fragment> 3608 outgoingLight = diffuseColor.rgb; 3609 #include <opaque_fragment> 3610 #include <tonemapping_fragment> 3611 #include <colorspace_fragment> 3612 #include <fog_fragment> 3613}
3613`,Vt={alphahash_fragment:Y1,alphahash_pars_fragment:K1,alphamap_fragment:Z1,alphamap_pars_fragment:Q1,alphatest_fragment:q1,alphatest_pars_fragment:j1,aomap_fragment:$1,aomap_pars_fragment:ew,batching_pars_vertex:tw,batching_vertex:nw,begin_vertex:iw,beginnormal_vertex:rw,bsdfs:sw,iridescence_fragment:aw,bumpmap_pars_fragment:ow,clipping_planes_fragment:lw,clipping_planes_pars_fragment:cw,clipping_planes_pars_vertex:uw,clipping_planes_vertex:hw,color_fragment:fw,color_pars_fragment:dw,color_pars_vertex:pw,color_vertex:mw,common:gw,cube_uv_reflection_fragment:vw,defaultnormal_vertex:_w,displacementmap_pars_vertex:xw,displacementmap_vertex:yw,emissivemap_fragment:Aw,emissivemap_pars_fragment:Sw,colorspace_fragment:Mw,colorspace_pars_fragment:Ew,envmap_fragment:ww,envmap_common_pars_fragment:bw,envmap_pars_fragment:Tw,envmap_pars_vertex:Cw,envmap_physical_pars_fragment:Gw,envmap_vertex:Rw,fog_vertex:Iw,fog_pars_vertex:Bw,fog_fragment:Pw,fog_pars_fragment:Dw,gradientmap_pars_fragment:Lw,lightmap_pars_fragment:Fw,lights_lambert_fragment:Uw,lights_lambert_pars_fragment:Nw,lights_pars_begin:Ow,lights_toon_fragment:Hw,lights_toon_pars_fragment:zw,lights_phong_fragment:kw,lights_phong_pars_fragment:Vw,lights_physical_fragment:Ww,lights_physical_pars_fragment:Xw,lights_fragment_begin:Jw,lights_fragment_maps:Yw,lights_fragment_end:Kw,logdepthbuf_fragment:Zw,logdepthbuf_pars_fragment:Qw,logdepthbuf_pars_vertex:qw,logdepthbuf_vertex:jw,map_fragment:$w,map_pars_fragment:eb,map_particle_fragment:tb,map_particle_pars_fragment:nb,metalnessmap_fragment:ib,metalnessmap_pars_fragment:rb,morphinstance_vertex:sb,morphcolor_vertex:ab,morphnormal_vertex:ob,morphtarget_pars_vertex:lb,morphtarget_vertex:cb,normal_fragment_begin:ub,normal_fragment_maps:hb,normal_pars_fragment:fb,normal_pars_vertex:db,normal_vertex:pb,normalmap_pars_fragment:mb,clearcoat_normal_fragment_begin:gb,clearcoat_normal_fragment_maps:vb,clearcoat_pars_fragment:_b,iridescence_pars_fragment:xb,opaque_fragment:yb,packing:Ab,premultiplied_alpha_fragment:Sb,project_vertex:Mb,dithering_fragment:Eb,dithering_pars_fragment:wb,roughnessmap_fragment:bb,roughnessmap_pars_fragment:Tb,shadowmap_pars_fragment:Cb,shadowmap_pars_vertex:Rb,shadowmap_vertex:Ib,shadowmask_pars_fragment:Bb,skinbase_vertex:Pb,skinning_pars_vertex:Db,skinning_vertex:Lb,skinnormal_vertex:Fb,specularmap_fragment:Ub,specularmap_pars_fragment:Nb,tonemapping_fragment:Ob,tonemapping_pars_fragment:Gb,transmission_fragment:Hb,transmission_pars_fragment:zb,uv_pars_fragment:kb,uv_pars_vertex:Vb,uv_vertex:Wb,worldpos_vertex:Xb,background_vert:Jb,background_frag:Yb,backgroundCube_vert:Kb,backgroundCube_frag:Zb,cube_vert:Qb,cube_frag:qb,depth_vert:jb,depth_frag:$b,distance_vert:eT,distance_frag:tT,equirect_vert:nT,equirect_frag:iT,linedashed_vert:rT,linedashed_frag:sT,meshbasic_vert:aT,meshbasic_frag:oT,meshlambert_vert:lT,meshlambert_frag:cT,meshmatcap_vert:uT,meshmatcap_frag:hT,meshnormal_vert:fT,meshnormal_frag:dT,meshphong_vert:pT,meshphong_frag:mT,meshphysical_vert:gT,meshphysical_frag:vT,meshtoon_vert:_T,meshtoon_frag:xT,points_vert:yT,points_frag:AT,shadow_vert:ST,shadow_frag:MT,sprite_vert:ET,sprite_frag:wT},rt={common:{diffuse:{value:new je(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new zt},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new zt}},envmap:{envMap:{value:null},envMapRotation:{value:new zt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new zt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new zt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new zt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new zt},normalScale:{value:new _e(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new zt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new zt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new zt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new zt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new je(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0},uvTransform:{value:new zt}},sprite:{diffuse:{value:new je(16777215)},opacity:{value:1},center:{value:new _e(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new zt},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0}}},_r={basic:{uniforms:Si([rt.common,rt.specularmap,rt.envmap,rt.aomap,rt.lightmap,rt.fog]),vertexShader:Vt.meshbasic_vert,fragmentShader:Vt.meshbasic_frag},lambert:{uniforms:Si([rt.common,rt.specularmap,rt.envmap,rt.aomap,rt.lightmap,rt.emissivemap,rt.bumpmap,rt.normalmap,rt.displacementmap,rt.fog,rt.lights,{emissive:{value:new je(0)}}]),vertexShader:Vt.meshlambert_vert,fragmentShader:Vt.meshlambert_frag},phong:{uniforms:Si([rt.common,rt.specularmap,rt.envmap,rt.aomap,rt.lightmap,rt.emissivemap,rt.bumpmap,rt.normalmap,rt.displacementmap,rt.fog,rt.lights,{emissive:{value:new je(0)},specular:{value:new je(1118481)},shininess:{value:30}}]),vertexShader:Vt.meshphong_vert,fragmentShader:Vt.meshphong_frag},standard:{uniforms:Si([rt.common,rt.envmap,rt.aomap,rt.lightmap,rt.emissivemap,rt.bumpmap,rt.normalmap,rt.displacementmap,rt.roughnessmap,rt.metalnessmap,rt.fog,rt.lights,{emissive:{value:new je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vt.meshphysical_vert,fragmentShader:Vt.meshphysical_frag},toon:{uniforms:Si([rt.common,rt.aomap,rt.lightmap,rt.emissivemap,rt.bumpmap,rt.normalmap,rt.displacementmap,rt.gradientmap,rt.fog,rt.lights,{emissive:{value:new je(0)}}]),vertexShader:Vt.meshtoon_vert,fragmentShader:Vt.meshtoon_frag},matcap:{uniforms:Si([rt.common,rt.bumpmap,rt.normalmap,rt.displacementmap,rt.fog,{matc
vendor: 4,651 bytes, line 3613
3613ap:{value:null}}]),vertexShader:Vt.meshmatcap_vert,fragmentShader:Vt.meshmatcap_frag},points:{uniforms:Si([rt.points,rt.fog]),vertexShader:Vt.points_vert,fragmentShader:Vt.points_frag},dashed:{uniforms:Si([rt.common,rt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vt.linedashed_vert,fragmentShader:Vt.linedashed_frag},depth:{uniforms:Si([rt.common,rt.displacementmap]),vertexShader:Vt.depth_vert,fragmentShader:Vt.depth_frag},normal:{uniforms:Si([rt.common,rt.bumpmap,rt.normalmap,rt.displacementmap,{opacity:{value:1}}]),vertexShader:Vt.meshnormal_vert,fragmentShader:Vt.meshnormal_frag},sprite:{uniforms:Si([rt.sprite,rt.fog]),vertexShader:Vt.sprite_vert,fragmentShader:Vt.sprite_frag},background:{uniforms:{uvTransform:{value:new zt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Vt.background_vert,fragmentShader:Vt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new zt}},vertexShader:Vt.backgroundCube_vert,fragmentShader:Vt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vt.cube_vert,fragmentShader:Vt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Vt.equirect_vert,fragmentShader:Vt.equirect_frag},distance:{uniforms:Si([rt.common,rt.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Vt.distance_vert,fragmentShader:Vt.distance_frag},shadow:{uniforms:Si([rt.lights,rt.fog,{color:{value:new je(0)},opacity:{value:1}}]),vertexShader:Vt.shadow_vert,fragmentShader:Vt.shadow_frag}};_r.physical={uniforms:Si([_r.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new zt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new zt},clearcoatNormalScale:{value:new _e(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new zt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new zt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new zt},sheen:{value:0},sheenColor:{value:new je(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new zt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new zt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new zt},transmissionSamplerSize:{value:new _e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new zt},attenuationDistance:{value:0},attenuationColor:{value:new je(0)},specularColor:{value:new je(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new zt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new zt},anisotropyVector:{value:new _e},anisotropyMap:{value:null},anisotropyMapTransform:{value:new zt}}]),vertexShader:Vt.meshphysical_vert,fragmentShader:Vt.meshphysical_frag};const Zu={r:0,b:0,g:0},la=new Li,bT=new It;function TT(r,e,t,n,i,s,a){const o=new je(0);let u=s===!0?0:1,h,f,d=null,p=0,g=null;function v(E){let w=E.isScene===!0?E.background:null;return w&&w.isTexture&&(w=(E.backgroundBlurriness>0?t:e).get(w)),w}function A(E){let w=!1;const B=v(E);B===null?_(o,u):B&&B.isColor&&(_(B,1),w=!0);const P=r.xr.getEnvironmentBlendMode();P==="additive"?n.buffers.color.setClear(0,0,0,1,a):P==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||w)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function y(E,w){const B=v(w);B&&(B.isCubeTexture||B.mapping===Wo)?(f===void 0&&(f=new ot(new Mi(1,1,1),new Bn({name:"BackgroundCubeMaterial",uniforms:Ho(_r.backgroundCube.uniforms),vertexShader:_r.backgroundCube.vertexShader,fragmentShader:_r.backgroundCube.fragmentShader,side:Hn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,D,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),la.copy(w.backgroundRotation),la.x*=-1,la.y*=-1,la.z*=-1,B.isCubeTexture&&B.isRenderTargetTexture===!1&&(la.y*=-1,la.z*=-1),f.material.uniforms.envMap.value=
vendor: 14,024 bytes, line 3613
3613B,f.material.uniforms.flipEnvMap.value=B.isCubeTexture&&B.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(bT.makeRotationFromEuler(la)),f.material.toneMapped=nn.getTransfer(B.colorSpace)!==dn,(d!==B||p!==B.version||g!==r.toneMapping)&&(f.material.needsUpdate=!0,d=B,p=B.version,g=r.toneMapping),f.layers.enableAll(),E.unshift(f,f.geometry,f.material,0,0,null)):B&&B.isTexture&&(h===void 0&&(h=new ot(new ki(2,2),new Bn({name:"BackgroundMaterial",uniforms:Ho(_r.background.uniforms),vertexShader:_r.background.vertexShader,fragmentShader:_r.background.fragmentShader,side:Mr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(h)),h.material.uniforms.t2D.value=B,h.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,h.material.toneMapped=nn.getTransfer(B.colorSpace)!==dn,B.matrixAutoUpdate===!0&&B.updateMatrix(),h.material.uniforms.uvTransform.value.copy(B.matrix),(d!==B||p!==B.version||g!==r.toneMapping)&&(h.material.needsUpdate=!0,d=B,p=B.version,g=r.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null))}function _(E,w){E.getRGB(Zu,Vx(r)),n.buffers.color.setClear(Zu.r,Zu.g,Zu.b,w,a)}function M(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,w=1){o.set(E),u=w,_(o,u)},getClearAlpha:function(){return u},setClearAlpha:function(E){u=E,_(o,u)},render:A,addToRenderList:y,dispose:M}}function CT(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=p(null);let s=i,a=!1;function o(C,U,V,J,Q){let oe=!1;const q=d(J,V,U);s!==q&&(s=q,h(s.object)),oe=g(C,J,V,Q),oe&&v(C,J,V,Q),Q!==null&&e.update(Q,r.ELEMENT_ARRAY_BUFFER),(oe||a)&&(a=!1,w(C,U,V,J),Q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(Q).buffer))}function u(){return r.createVertexArray()}function h(C){return r.bindVertexArray(C)}function f(C){return r.deleteVertexArray(C)}function d(C,U,V){const J=V.wireframe===!0;let Q=n[C.id];Q===void 0&&(Q={},n[C.id]=Q);let oe=Q[U.id];oe===void 0&&(oe={},Q[U.id]=oe);let q=oe[J];return q===void 0&&(q=p(u()),oe[J]=q),q}function p(C){const U=[],V=[],J=[];for(let Q=0;Q<t;Q++)U[Q]=0,V[Q]=0,J[Q]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:V,attributeDivisors:J,object:C,attributes:{},index:null}}function g(C,U,V,J){const Q=s.attributes,oe=U.attributes;let q=0;const ue=V.getAttributes();for(const z in ue)if(ue[z].location>=0){const Y=Q[z];let se=oe[z];if(se===void 0&&(z==="instanceMatrix"&&C.instanceMatrix&&(se=C.instanceMatrix),z==="instanceColor"&&C.instanceColor&&(se=C.instanceColor)),Y===void 0||Y.attribute!==se||se&&Y.data!==se.data)return!0;q++}return s.attributesNum!==q||s.index!==J}function v(C,U,V,J){const Q={},oe=U.attributes;let q=0;const ue=V.getAttributes();for(const z in ue)if(ue[z].location>=0){let Y=oe[z];Y===void 0&&(z==="instanceMatrix"&&C.instanceMatrix&&(Y=C.instanceMatrix),z==="instanceColor"&&C.instanceColor&&(Y=C.instanceColor));const se={};se.attribute=Y,Y&&Y.data&&(se.data=Y.data),Q[z]=se,q++}s.attributes=Q,s.attributesNum=q,s.index=J}function A(){const C=s.newAttributes;for(let U=0,V=C.length;U<V;U++)C[U]=0}function y(C){_(C,0)}function _(C,U){const V=s.newAttributes,J=s.enabledAttributes,Q=s.attributeDivisors;V[C]=1,J[C]===0&&(r.enableVertexAttribArray(C),J[C]=1),Q[C]!==U&&(r.vertexAttribDivisor(C,U),Q[C]=U)}function M(){const C=s.newAttributes,U=s.enabledAttributes;for(let V=0,J=U.length;V<J;V++)U[V]!==C[V]&&(r.disableVertexAttribArray(V),U[V]=0)}function E(C,U,V,J,Q,oe,q){q===!0?r.vertexAttribIPointer(C,U,V,Q,oe):r.vertexAttribPointer(C,U,V,J,Q,oe)}function w(C,U,V,J){A();const Q=J.attributes,oe=V.getAttributes(),q=U.defaultAttributeValues;for(const ue in oe){const z=oe[ue];if(z.location>=0){let ne=Q[ue];if(ne===void 0&&(ue==="instanceMatrix"&&C.instanceMatrix&&(ne=C.instanceMatrix),ue==="instanceColor"&&C.instanceColor&&(ne=C.instanceColor)),ne!==void 0){const Y=ne.normalized,se=ne.itemSize,pe=e.get(ne);if(pe===void 0)continue;const we=pe.buffer,$=pe.type,xt=pe.bytesPerElement,le=$===r.INT||$===r.UNSIGNED_INT||ne.gpuType===nf;if(ne.isInterleavedBufferAttribute){const Ae=ne.data,Qe=Ae.stride,yt=ne.offset;if(Ae.isInstancedInterleavedBuffer){for(let st=0;st<z.locationSize;st++)_(z.location+st,Ae.meshPerAttribute);C.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=Ae.meshPerAttribute*Ae.count)}else for(let st=0;st<z.locationSize;st++)y(z.location+st);r.bindBuffer(r.ARRAY_BUFFER,we);for(let st=0;st<z.locationSize;st++)E(z.location+st,se/z.locationSize,$,Y,Qe*xt,(yt+se/z.locationSize*st)*xt,le)}else{if(ne.isInstancedBufferAttribute){for(let Ae=0;Ae<z.locationSize;Ae++)_(z.location+Ae,ne.meshPerAttribute);C.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ae=0;Ae<z.locationSize;Ae++)y(z.location+Ae);r.bindBuffer(r.ARRAY_BUFFER,we);for(let Ae=0;Ae<z.locationSize;Ae++)E(z.location+Ae,se/z.locationSize,$,Y,se*xt,se/z.locationSize*Ae*xt,le)}}else if(q!==void 0){const Y=q[ue];if(Y!==void 0)switch(Y.length){case 2:r.vertexAttrib2fv(z.location,Y);break;case 3:r.vertexAttrib3fv(z.location,Y);break;case 4:r.vertexAttrib4fv(z.location,Y);break;default:r.vertexAttrib1fv(z.location,Y)}}}}M()}function B(){F();for(const C in n){const U=n[C];for(const V in U){const J=U[V];for(const Q in J)f(J[Q].object),delete J[Q];delete U[V]}delete n[C]}}function P(C){if(n[C.id]===void 0)return;const U=n[C.id];for(const V in U){const J=U[V];for(const Q in J)f(J[Q].object),delete J[Q];delete U[V]}delete n[C.id]}function D(C){for(const U in n){const V=n[U];if(V[C.id]===void 0)continue;const J=V[C.id];for(const Q in J)f(J[Q].object),delete J[Q];delete V[C.id]}}function F(){b(),a=!0,s!==i&&(s=i,h(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:F,resetDefaultState:b,dispose:B,releaseStatesOfGeometry:P,releaseStatesOfProgram:D,initAttributes:A,enableAttribute:y,disableUnusedAttributes:M}}function RT(r,e,t){let n;function i(h){n=h}function s(h,f){r.drawArrays(n,h,f),t.update(f,n,1)}function a(h,f,d){d!==0&&(r.drawArraysInstanced(n,h,f,d),t.update(f,n,d))}function o(h,f,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,f,0,d);let g=0;for(let v=0;v<d;v++)g+=f[v];t.update(g,n,1)}function u(h,f,d,p){if(d===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let v=0;v<h.length;v++)a(h[v],f[v],p[v]);else{g.multiDrawArraysInstancedWEBGL(n,h,0,f,0,p,0,d);let v=0;for(let A=0;A<d;A++)v+=f[A]*p[A];t.update(v,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=u}function IT(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(D){return!(D!==ni&&n.convert(D)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(D){const F=D===Vn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==Rn&&n.convert(D)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==In&&!F)}function u(D){if(D==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const f=u(h);f!==h&&(nt("WebGLRenderer:",h,"not supported, using",f,"instead."),h=f);const d=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),g=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),v=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),A=r.getParameter(r.MAX_TEXTURE_SIZE),y=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),_=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),B=r.getParameter(r.MAX_SAMPLES),P=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:a,textureTypeReadable:o,precision:h,logarithmicDepthBuffer:d,reversedDepthBuffer:p,maxTextures:g,maxVertexTextures:v,maxTextureSize:A,maxCubemapSize:y,maxAttributes:_,maxVertexUniforms:M,maxVaryings:E,maxFragmentUniforms:w,maxSamples:B,samples:P}}function BT(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new $r,o=new zt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(d,p){const g=d.length!==0||p||n!==0||i;return i=p,n=d.length,g},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,p){t=f(d,p,0)},this.setState=function(d,p,g){const v=d.clippingPlanes,A=d.clipIntersection,y=d.clipShadows,_=r.get(d);if(!i||v===null||v.length===0||s&&!y)s?f(null):h();else{const M=s?0:n,E=M*4;let w=_.clippingState||null;u.value=w,w=f(v,p,E,g);for(let B=0;B!==E;++B)w[B]=t[B];_.clippingState=w,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=M}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(d,p,g,v){const A=d!==null?d.length:0;let y=null;if(A!==0){if(y=u.value,v!==!0||y===null){const _=g+A*4,M=p.matrixWorldInverse;o.getNormalMatrix(M),(y===null||y.length<_)&&(y=new Float32Array(_));for(let E=0,w=g;E!==A;++E,w+=4)a.copy(d[E]).applyMatrix4(M,o),a.normal.toArray(y,w),y[w+3]=a.constant}u.value=y,u.needsUpdate=!0}return e.numPlanes=A,e.numIntersection=0,y}}function PT(r){let e=new WeakMap;function t(a,o){return o===Yl?a.mapping=Or:o===Kl&&(a.mapping=Ps),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Yl||o===Kl)if(e.has(a)){const u=e.get(a).texture;return t(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const h=new Fm(u.height);return h.fromEquirectangularTexture(r,a),e.set(a,h),a.addEventListener("dispose",i),t(h.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const u=e.get(o);u!==void 0&&(e.delete(o),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Rs=4,t_=[.125,.215,.35,.446,.526,.582],pa=20,DT=256,bl=new Sr,n_=new je;let Ap=null,Sp=0,Mp=0,Ep=!1;const LT=new N;class am{constructor(e){this._renderer=e,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(e,t=0,n=.1,i=100,s={}){const{size:a=256,position:o=LT}=s;Ap=this._renderer.getRenderTarget(),Sp=this._renderer.getActiveCubeFace(),Mp=this._renderer.getActiveMipmapLevel(),Ep=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,o),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=s_(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=r_(),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(e){this._lodMax=Math.floor(Math.log2(e)),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 e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ap,Sp,Mp),this._renderer.xr.enabled=Ep,e.scissorTest=!1,So(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Or||e.mapping===Ps?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ap=this._renderer.getRenderTarget(),Sp=this._renderer.getActiveCubeFace(),Mp=this._renderer.getActiveMipmapLevel(),Ep=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:rn,minFilter:rn,generateMipmaps:!1,type:Vn,format:ni,colorSpace:as,depthBuffer:!1},i=i_(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=i_(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=FT(s)),this._blurMaterial=NT(s,e,t),this._ggxMaterial=UT(s,e,t)}return i}_compileMaterial(e){const t=new ot(new Lt,e);this._renderer.compile(t,bl)}_sceneToCubeUV(e,t,n,i,s){const u=new En(90,1,t,n),h=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],d=this._renderer,p=d.autoClear,g=d.toneMapping;d.getClearColor(n_),d.toneMapping=Wi,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(i),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new ot(new Mi,new bi({name:"PMREM.Backgroun
3613d",side:Hn,depthWrite:!1,depthTest:!1})));const A=this._backgroundBox,y=A.material;let _=!1;const M=e.background;M?M.isColor&&(y.color.copy(M),e.background=null,_=!0):(y.color.copy(n_),_=!0);for(let E=0;E<6;E++){const w=E%3;w===0?(u.up.set(0,h[E],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x+f[E],s.y,s.z)):w===1?(u.up.set(0,0,h[E]),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y+f[E],s.z)):(u.up.set(0,h[E],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y,s.z+f[E]));const B=this._cubeSize;So(i,w*B,E>2?B:0,B,B),d.setRenderTarget(i),_&&d.render(A,u),d.render(e,u)}d.toneMapping=g,d.autoClear=p,e.background=M}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Or||e.mapping===Ps;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=s_()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=r_());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const u=this._cubeSize;So(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,bl)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const u=a.uniforms,h=n/(this._lodMeshes.length-1),f=t/(this._lodMeshes.length-1),d=Math.sqrt(h*h-f*f),p=0+h*1.25,g=d*p,{_lodMax:v}=this,A=this._sizeLods[n],y=3*A*(n>v-Rs?n-v+Rs:0),_=4*(this._cubeSize-A);u.envMap.value=e.texture,u.roughness.value=g,u.mipInt.value=v-t,So(s,y,_,3*A,2*A),i.setRenderTarget(s),i.render(o,bl),u.envMap.value=s.texture,u.roughness.value=0,u.mipInt.value=v-n,So(e,y,_,3*A,2*A),i.setRenderTarget(e),i.render(o,bl)}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&bt("blur direction must be either latitudinal or longitudinal!");const f=3,d=this._lodMeshes[i];d.material=h;const p=h.uniforms,g=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*pa-1),A=s/v,y=isFinite(s)?1+Math.floor(f*A):pa;y>pa&&nt(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${pa}`);const _=[];let M=0;for(let D=0;D<pa;++D){const F=D/A,b=Math.exp(-F*F/2);_.push(b),D===0?M+=b:D<y&&(M+=2*b)}for(let D=0;D<_.length;D++)_[D]=_[D]/M;p.envMap.value=e.texture,p.samples.value=y,p.weights.value=_,p.latitudinal.value=a==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:E}=this;p.dTheta.value=v,p.mipInt.value=E-n;const w=this._sizeLods[i],B=3*w*(i>E-Rs?i-E+Rs:0),P=4*(this._cubeSize-w);So(t,B,P,3*w,2*w),u.setRenderTarget(t),u.render(d,bl)}}function FT(r){const e=[],t=[],n=[];let i=r;const s=r-Rs+1+t_.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let u=1/o;a>r-Rs?u=t_[a-r+Rs-1]:a===0&&(u=0),t.push(u);const h=1/(o-2),f=-h,d=1+h,p=[f,f,d,f,d,d,f,f,d,d,f,d],g=6,v=6,A=3,y=2,_=1,M=new Float32Array(A*v*g),E=new Float32Array(y*v*g),w=new Float32Array(_*v*g);for(let P=0;P<g;P++){const D=P%3*2/3-1,F=P>2?0:-1,b=[D,F,0,D+2/3,F,0,D+2/3,F+1,0,D,F,0,D+2/3,F+1,0,D,F+1,0];M.set(b,A*v*P),E.set(p,y*v*P);const C=[P,P,P,P,P,P];w.set(C,_*v*P)}const B=new Lt;B.setAttribute("position",new sn(M,A)),B.setAttribute("uv",new sn(E,y)),B.setAttribute("faceIndex",new sn(w,_)),n.push(new ot(B,null)),i>Rs&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function i_(r,e,t){const n=new bn(r,e,t);return n.texture.mapping=Wo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function So(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function UT(r,e,t){return new Bn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:DT,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Pf(),fragmentShader:` 3614 3615 precision highp float; 3616 precision highp int; 3617 3618 varying vec3 vOutputDirection; 3619 3620 uniform sampler2D envMap; 3621 uniform float roughness; 3622 uniform float mipInt; 3623 3624 #define ENVMAP_TYPE_CUBE_UV 3625 #include <cube_uv_reflection_fragment> 3626 3627 #define PI 3.14159265359 3628 3629 // Van der Corput radical inverse 3630 float radicalInverse_VdC(uint bits) { 3631 bits = (bits << 16u) | (bits >> 16u); 3632 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3633 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3634 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3635 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3636 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3637 } 3638 3639 // Hammersley sequence 3640 vec2 hammersley(uint i, uint N) { 3641 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3642 } 3643 3644 // GGX VNDF importance sampling (Eric Heitz 2018) 3645 // "Sampling the GGX Distribution of Visible Normals" 3646 // https://jcgt.org/published/0007/04/01/ 3647 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3648 float alpha = roughness * roughness; 3649 3650 // Section 3.2: Transform view direction to hemisphere configuration 3651 vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); 3652 3653 // Section 4.1: Orthonormal basis 3654 float lensq = Vh.x * Vh.x + Vh.y * Vh.y; 3655 vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); 3656 vec3 T2 = cross(Vh, T1); 3657 3658 // Section 4.2: Parameterization of projected area 3659 float r = sqrt(Xi.x); 3660 float phi = 2.0 * PI * Xi.y; 3661 float t1 = r * cos(phi); 3662 float t2 = r * sin(phi); 3663 float s = 0.5 * (1.0 + Vh.z); 3664 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3665 3666 // Section 4.3: Reprojection onto hemisphere 3667 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; 3668 3669 // Section 3.4: Transform back to ellipsoid configuration 3670 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3671 } 3672 3673 void main() { 3674 vec3 N = normalize(vOutputDirection); 3675 vec3 V = N; // Assume view direction equals normal for pre-filtering 3676 3677 vec3 prefilteredColor = vec3(0.0); 3678 float totalWeight = 0.0; 3679 3680 // For very low roughness, just sample the environment directly 3681 if (roughness < 0.001) { 3682 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3683 return; 3684 } 3685 3686 // Tangent space basis for VNDF sampling 3687 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3688 vec3 tangent = normalize(cross(up, N)); 3689 vec3 bitangent = cross(N, tangent); 3690
3691 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3692 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3693 3694 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3695 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3696 3697 // Transform H back to world space 3698 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3699 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3700 3701 float NdotL = max(dot(N, L), 0.0); 3702 3703 if(NdotL > 0.0) { 3704 // Sample environment at fixed mip level 3705 // VNDF importance sampling handles the distribution filtering 3706 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3707 3708 // Weight by NdotL for the split-sum approximation 3709 // VNDF PDF naturally accounts for the visible microfacet distribution 3710 prefilteredColor += sampleColor * NdotL; 3711 totalWeight += NdotL; 3712 } 3713 } 3714 3715 if (totalWeight > 0.0) { 3716 prefilteredColor = prefilteredColor / totalWeight; 3717 } 3718 3719 gl_FragColor = vec4(prefilteredColor, 1.0); 3720 } 3721 `,blending:ii,depthTest:!1,depthWrite:!1})}function NT(r,e,t){const n=new Float32Array(pa),i=new N(0,1,0);return new Bn({name:"SphericalGaussianBlur",defines:{n:pa,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Pf(),fragmentShader:` 3722 3723 precision mediump float; 3724 precision mediump int; 3725 3726 varying vec3 vOutputDirection; 3727 3728 uniform sampler2D envMap; 3729 uniform int samples; 3730 uniform float weights[ n ]; 3731 uniform bool latitudinal; 3732 uniform float dTheta; 3733 uniform float mipInt; 3734 uniform vec3 poleAxis; 3735 3736 #define ENVMAP_TYPE_CUBE_UV 3737 #include <cube_uv_reflection_fragment> 3738 3739 vec3 getSample( float theta, vec3 axis ) { 3740 3741 float cosTheta = cos( theta ); 3742 // Rodrigues' axis-angle rotation 3743 vec3 sampleDirection = vOutputDirection * cosTheta 3744 + cross( axis, vOutputDirection ) * sin( theta ) 3745 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3746 3747 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3748 3749 } 3750 3751 void main() { 3752 3753 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3754 3755 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3756 3757 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3758 3759 } 3760 3761 axis = normalize( axis ); 3762 3763 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3764 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3765 3766 for ( int i = 1; i < n; i++ ) { 3767 3768 if ( i >= samples ) { 3769 3770 break; 3771 3772 } 3773 3774 float theta = dTheta * float( i ); 3775 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3776 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3777 3778 } 3779 3780 } 3781 `,blending:ii,depthTest:!1,depthWrite:!1})}function r_(){return new Bn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Pf(),fragmentShader:` 3782 3783 precision mediump float; 3784 precision mediump int; 3785 3786 varying vec3 vOutputDirection; 3787 3788 uniform sampler2D envMap; 3789 3790 #include <common> 3791 3792 void main() { 3793 3794 vec3 outputDirection = normalize( vOutputDirection ); 3795 vec2 uv = equirectUv( outputDirection ); 3796 3797 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3798 3799 } 3800 `,blending:ii,depthTest:!1,depthWrite:!1})}function s_(){return new Bn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Pf(),fragmentShader:` 3801 3802 precision mediump float; 3803 precision mediump int; 3804 3805 uniform float flipEnvMap; 3806 3807 varying vec3 vOutputDirection; 3808 3809 uniform samplerCube envMap; 3810 3811 void main() { 3812 3813 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3814 3815 } 3816 `,blending:ii,depthTest:!1,depthWrite:!1})}function Pf(){return` 3817 3818 precision mediump float; 3819 precision mediump int; 3820 3821 attribute float faceIndex; 3822 3823 varying vec3 vOutputDirection; 3824 3825 // RH coordinate system; PMREM face-indexing convention 3826 vec3 getDirection( vec2 uv, float face ) { 3827 3828 uv = 2.0 * uv - 1.0; 3829 3830 vec3 direction = vec3( uv, 1.0 ); 3831 3832 if ( face == 0.0 ) { 3833 3834 direction = direction.zyx; // ( 1, v, u ) pos x 3835 3836 } else if ( face == 1.0 ) { 3837 3838 direction = direction.xzy; 3839 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3840 3841 } else if ( face == 2.0 ) { 3842 3843 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3844 3845 } else if ( face == 3.0 ) { 3846 3847 direction = direction.zyx; 3848 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3849 3850 } else if ( face == 4.0 ) { 3851 3852 direction = direction.xzy; 3853 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3854 3855 } else if ( face == 5.0 ) { 3856 3857 direction.z *= -1.0; // ( u, v, -1 ) neg z 3858 3859 } 3860 3861 return direction; 3862 3863 } 3864 3865 void main() { 3866 3867 vOutputDirection = getDirection( uv, faceIndex ); 3868 gl_Position = vec4( position, 1.0 ); 3869 3870 } 3871 `}function OT(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const u=o.mapping,h=u===Yl||u===Kl,f=u===Or||u===Ps;if(h||f){let d=e.get(o);const p=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return t===null&&(t=new am(r)),d=h?t.fromEquirectangular(o,d):t.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const g=o.image;return h&&g&&g.height>0||f&&g&&i(g)?(t===null&&(t=new am(r)),d=h?t.fromEquirectangular(o):t.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function i(o){let u=0;const h=6;for(let f=0;f<h;f++)o[f]!==void 0&&u++;return u===h}function s(o){const u=o.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function GT(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Oo("WebGLRenderer: "+n+" extension not supported."),i}}}function HT(r,e,t,n){const i={},s=new WeakMap;function a(d){const p=d.target;p.index!==null&&e.remove(p.index);for(const v in p.attributes)e.remove(p.attributes[v]);p.removeEventListener("dispose",a),delete i[p.id];const g=s.get(p);g&&(e.remove(g),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function o(d,p){return i[p.id]===!0||(p.addEventListener("dispose",a),i[p.id]=!0,t.memory.geometries++),p}function u(d){const p=d.attributes;for(const g in p)e.update(p[g],r.ARRAY_BUFFER)}function h(d){const p=[],g=d.index,v=d.attributes.position;let A=0;if(g!==null){const M=g.array;A=g.version;for(let E=0,w=M.length;E<w;E+=3){const B=M[E+0],P=M[E+1],D=M[E+2];p.push(B,P,P,D,D,B)}}else if(v!==void 0){const M=v.array;A=v.version;for(let E=0,w=M.length/3-1;E<w;E+=3){const B=E+0,P=E+1,D=E+2;p.push(B,P,P,D,D,B)}}else return;const y=new(Nx(p)?Dm:Pm)(p,1);y.version=A;const _=s.get(d);_&&e.remove(_),s.set(d,y)}function f(d){const p=s.get(d);if(p){const g=d.index;g!==null&&p.version<g.version&&h(d)}else h(d);return s.get(d)}return{get:o,update:u,getWireframeAttribute:f}}function zT(r,e,t){let n;function i(p){n=p}let s,a;function o(p){s=p.type,a=p.bytesPerElement}function u(p,g){r.drawElements(n,g,s,p*a),t.update(g,n,1)}function h(p,g,v){v!==0&&(r.drawElementsInstanced(n,g,s,p*a,v),t.update(g,n,v))}function f(p,g,v){if(v===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,g,0,s,p,0,v);let y=0;for(let _=0;_<v;_++)y+=g[_];t.update(y,n,1)}function d(p,g,v,A){if(v===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let _=0;_<p.length;_++)h(p[_]/a,g[_],A[_]);
vendor: 20,713 bytes, lines 3871-3952
3871else{y.multiDrawElementsInstancedWEBGL(n,g,0,s,p,0,A,0,v);let _=0;for(let M=0;M<v;M++)_+=g[M]*A[M];t.update(_,n,1)}}this.setMode=i,this.setIndex=o,this.render=u,this.renderInstances=h,this.renderMultiDraw=f,this.renderMultiDrawInstances=d}function kT(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:bt("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function VT(r,e,t){const n=new WeakMap,i=new gn;function s(a,o,u){const h=a.morphTargetInfluences,f=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=f!==void 0?f.length:0;let p=n.get(o);if(p===void 0||p.count!==d){let b=function(){D.dispose(),n.delete(o),o.removeEventListener("dispose",b)};p!==void 0&&p.texture.dispose();const g=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,A=o.morphAttributes.color!==void 0,y=o.morphAttributes.position||[],_=o.morphAttributes.normal||[],M=o.morphAttributes.color||[];let E=0;g===!0&&(E=1),v===!0&&(E=2),A===!0&&(E=3);let w=o.attributes.position.count*E,B=1;w>e.maxTextureSize&&(B=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const P=new Float32Array(w*B*4*d),D=new hf(P,w,B,d);D.type=In,D.needsUpdate=!0;const F=E*4;for(let C=0;C<d;C++){const U=y[C],V=_[C],J=M[C],Q=w*B*4*C;for(let oe=0;oe<U.count;oe++){const q=oe*F;g===!0&&(i.fromBufferAttribute(U,oe),P[Q+q+0]=i.x,P[Q+q+1]=i.y,P[Q+q+2]=i.z,P[Q+q+3]=0),v===!0&&(i.fromBufferAttribute(V,oe),P[Q+q+4]=i.x,P[Q+q+5]=i.y,P[Q+q+6]=i.z,P[Q+q+7]=0),A===!0&&(i.fromBufferAttribute(J,oe),P[Q+q+8]=i.x,P[Q+q+9]=i.y,P[Q+q+10]=i.z,P[Q+q+11]=J.itemSize===4?i.w:1)}}p={count:d,texture:D,size:new _e(w,B)},n.set(o,p),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)u.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let g=0;for(let A=0;A<h.length;A++)g+=h[A];const v=o.morphTargetsRelative?1:1-g;u.getUniforms().setValue(r,"morphTargetBaseInfluence",v),u.getUniforms().setValue(r,"morphTargetInfluences",h)}u.getUniforms().setValue(r,"morphTargetsTexture",p.texture,t),u.getUniforms().setValue(r,"morphTargetsTextureSize",p.size)}return{update:s}}function WT(r,e,t,n){let i=new WeakMap;function s(u){const h=n.render.frame,f=u.geometry,d=e.get(u,f);if(i.get(d)!==h&&(e.update(d),i.set(d,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",o)===!1&&u.addEventListener("dispose",o),i.get(u)!==h&&(t.update(u.instanceMatrix,r.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,r.ARRAY_BUFFER),i.set(u,h))),u.isSkinnedMesh){const p=u.skeleton;i.get(p)!==h&&(p.update(),i.set(p,h))}return d}function a(){i=new WeakMap}function o(u){const h=u.target;h.removeEventListener("dispose",o),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:a}}const XT={[gm]:"LINEAR_TONE_MAPPING",[vm]:"REINHARD_TONE_MAPPING",[_m]:"CINEON_TONE_MAPPING",[$h]:"ACES_FILMIC_TONE_MAPPING",[ym]:"AGX_TONE_MAPPING",[Am]:"NEUTRAL_TONE_MAPPING",[xm]:"CUSTOM_TONE_MAPPING"};function JT(r,e,t,n,i){const s=new bn(e,t,{type:r,depthBuffer:n,stencilBuffer:i}),a=new bn(e,t,{type:Vn,depthBuffer:!1,stencilBuffer:!1}),o=new Lt;o.setAttribute("position",new pt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new pt([0,2,0,0,2,0],2));const u=new Km({uniforms:{tDiffuse:{value:null}},vertexShader:` 3872 precision highp float; 3873 3874 uniform mat4 modelViewMatrix; 3875 uniform mat4 projectionMatrix; 3876 3877 attribute vec3 position; 3878 attribute vec2 uv; 3879 3880 varying vec2 vUv; 3881 3882 void main() { 3883 vUv = uv; 3884 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3885 }`,fragmentShader:` 3886 precision highp float; 3887 3888 uniform sampler2D tDiffuse; 3889 3890 varying vec2 vUv; 3891 3892 #include <tonemapping_pars_fragment> 3893 #include <colorspace_pars_fragment> 3894 3895 void main() { 3896 gl_FragColor = texture2D( tDiffuse, vUv ); 3897 3898 #ifdef LINEAR_TONE_MAPPING 3899 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3900 #elif defined( REINHARD_TONE_MAPPING ) 3901 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3902 #elif defined( CINEON_TONE_MAPPING ) 3903 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 3904 #elif defined( ACES_FILMIC_TONE_MAPPING ) 3905 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 3906 #elif defined( AGX_TONE_MAPPING ) 3907 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 3908 #elif defined( NEUTRAL_TONE_MAPPING ) 3909 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 3910 #elif defined( CUSTOM_TONE_MAPPING ) 3911 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 3912 #endif 3913 3914 #ifdef SRGB_TRANSFER 3915 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 3916 #endif 3917 }`,depthTest:!1,depthWrite:!1}),h=new ot(o,u),f=new Sr(-1,1,1,-1,0,1);let d=null,p=null,g=!1,v,A=null,y=[],_=!1;this.setSize=function(M,E){s.setSize(M,E),a.setSize(M,E);for(let w=0;w<y.length;w++){const B=y[w];B.setSize&&B.setSize(M,E)}},this.setEffects=function(M){y=M,_=y.length>0&&y[0].isRenderPass===!0;const E=s.width,w=s.height;for(let B=0;B<y.length;B++){const P=y[B];P.setSize&&P.setSize(E,w)}},this.begin=function(M,E){if(g||M.toneMapping===Wi&&y.length===0)return!1;if(A=E,E!==null){const w=E.width,B=E.height;(s.width!==w||s.height!==B)&&this.setSize(w,B)}return _===!1&&M.setRenderTarget(s),v=M.toneMapping,M.toneMapping=Wi,!0},this.hasRenderPass=function(){return _},this.end=function(M,E){M.toneMapping=v,g=!0;let w=s,B=a;for(let P=0;P<y.length;P++){const D=y[P];if(D.enabled!==!1&&(D.render(M,B,w,E),D.needsSwap!==!1)){const F=w;w=B,B=F}}if(d!==M.outputColorSpace||p!==M.toneMapping){d=M.outputColorSpace,p=M.toneMapping,u.defines={},nn.getTransfer(d)===dn&&(u.defines.SRGB_TRANSFER="");const P=XT[p];P&&(u.defines[P]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=w.texture,M.setRenderTarget(A),M.render(h,f),A=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),u.dispose()}}const Dy=new yn,om=new Ba(1,1),Ly=new hf,Fy=new ff,Uy=new uc,a_=[],o_=[],l_=new Float32Array(16),c_=new Float32Array(9),u_=new Float32Array(4);function Ko(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=a_[i];if(s===void 0&&(s=new Float32Array(i),a_[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function Wn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Xn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Df(r,e){let t=o_[e];t===void 0&&(t=new Int32Array(e),o_[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function YT(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function KT(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wn(t,e))return;r.uniform2fv(this.addr,e),Xn(t,e)}}function ZT(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Wn(t,e))return;r.uniform3fv(this.addr,e),Xn(t,e)}}function QT(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wn(t,e))return;r.uniform4fv(this.addr,e),Xn(t,e)}}function qT(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Wn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Xn(t,e)}else{if(Wn(t,n))return;u_.set(n),r.uniformMatrix2fv(this.addr,!1,u_),Xn(t,n)}}function jT(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Wn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Xn(t,e)}else{if(Wn(t,n))return;c_.set(n),r.uniformMatrix3fv(this.addr,!1,c_),Xn(t,n)}}function $T(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Wn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Xn(t,e)}else{if(Wn(t,n))return;l_.set(n),r.uniformMatrix4fv(this.addr,!1,l_),Xn(t,n)}}function eC(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function tC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wn(t,e))return;r.uniform2iv(this.addr,e),Xn(t,e)}}function nC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Wn(t,e))return;r.uniform3iv(this.addr,e),Xn(t,e)}}function iC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wn(t,e))return;r.uniform4iv(this.addr,e),Xn(t,e)}}function rC(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function sC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wn(t,e))return;r.uniform2uiv(this.addr,e),Xn(t,e)}}function aC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Wn(t,e))return;r.uniform3uiv(this.addr,e),Xn(t,e)}}function oC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wn(t,e))return;r.uniform4uiv(this.addr,e),Xn(t,e)}}function lC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(om.compareFunction=t.isReversedDepthBuffer()?uf:cf,s=om):s=Dy,t.setTexture2D(e||s,i)}function cC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Fy,i)}function uC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Uy,i)}function hC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Ly,i)}function fC(r){switch(r){case 5126:return YT;case 35664:return KT;case 35665:return ZT;case 35666:return QT;case 35674:return qT;case 35675:return jT;case 35676:return $T;case 5124:case 35670:return eC;case 35667:case 35671:return tC;case 35668:case 35672:return nC;case 35669:case 35673:return iC;case 5125:return rC;case 36294:return sC;case 36295:return aC;case 36296:return oC;case 35678:case 36198:case 36298:case 36306:case 35682:return lC;case 35679:case 36299:case 36307:return cC;case 35680:case 36300:case 36308:case 36293:return uC;case 36289:case 36303:case 36311:case 36292:return hC}}function dC(r,e){r.uniform1fv(this.addr,e)}function pC(r,e){const t=Ko(e,this.size,2);r.uniform2fv(this.addr,t)}function mC(r,e){const t=Ko(e,this.size,3);r.uniform3fv(this.addr,t)}function gC(r,e){const t=Ko(e,this.size,4);r.uniform4fv(this.addr,t)}function vC(r,e){const t=Ko(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function _C(r,e){const t=Ko(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function xC(r,e){const t=Ko(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function yC(r,e){r.uniform1iv(this.addr,e)}function AC(r,e){r.uniform2iv(this.addr,e)}function SC(r,e){r.uniform3iv(this.addr,e)}function MC(r,e){r.uniform4iv(this.addr,e)}function EC(r,e){r.uniform1uiv(this.addr,e)}function wC(r,e){r.uniform2uiv(this.addr,e)}function bC(r,e){r.uniform3uiv(this.addr,e)}function TC(r,e){r.uniform4uiv(this.addr,e)}function CC(r,e,t){const n=this.cache,i=e.length,s=Df(t,i);Wn(n,s)||(r.uniform1iv(this.addr,s),Xn(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=om:a=Dy;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function RC(r,e,t){const n=this.cache,i=e.length,s=Df(t,i);Wn(n,s)||(r.uniform1iv(this.addr,s),Xn(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Fy,s[a])}function IC(r,e,t){const n=this.cache,i=e.length,s=Df(t,i);Wn(n,s)||(r.uniform1iv(this.addr,s),Xn(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Uy,s[a])}function BC(r,e,t){const n=this.cache,i=e.length,s=Df(t,i);Wn(n,s)||(r.uniform1iv(this.addr,s),Xn(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Ly,s[a])}function PC(r){switch(r){case 5126:return dC;case 35664:return pC;case 35665:return mC;case 35666:return gC;case 35674:return vC;case 35675:return _C;case 35676:return xC;case 5124:case 35670:return yC;case 35667:case 35671:return AC;case 35668:case 35672:return SC;case 35669:case 35673:return MC;case 5125:return EC;case 36294:return wC;case 36295:return bC;case 36296:return TC;case 35678:case 36198:case 36298:case 36306:case 35682:return CC;case 35679:case 36299:case 36307:return RC;case 35680:case 36300:case 36308:case 36293:return IC;case 36289:case 36303:case 36311:case 36292:return BC}}class DC{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=fC(t.type)}}class LC{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=PC(t.type)}}class FC{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const wp=/(\w+)(\])?(\[|\.)?/g;function h_(r,e){r.seq.push(e),r.map[e.id]=e}function UC(r,e,t){const n=r.name,i=n.length;for(wp.lastIndex=0;;){const s=wp.exec(n),a=wp.lastIndex;let o=s[1];const u=s[2]==="]",h=s[3];if(u&&(o=o|0),h===void 0||h==="["&&a+2===i){h_(t,h===void 0?new DC(o,r,e):new LC(o,r,e));break}else{let d=t.map[o];d===void 0&&(d=new FC(o),h_(t,d)),t=d}}}class rh{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),u=e.getUniformLocation(t,o.name);UC(o,u,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],u=n[o.id];u.needsUpdate!==!1&&o.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function f_(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const NC=37297;let OC=0;function GC(r,e){const t=r.split(` 3918`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 3919`)}const d_=new zt;function HC(r){nn._getMatrix(d_,nn.workingColorSpace,r);const e=`mat3( ${d_.elements.map(t=>t.toFixed(4))} )`;switch(nn.getTransfer(r)){case Ql:return[e,"LinearTransferOETF"];case dn:return[e,"sRGBTransferOETF"];default:return nt("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function p_(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` 3920 3921`+s+` 3922 3923`+GC(r.getShaderSource(e),o)}else return s}function zC(r,e){const t=HC(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3924`)}const kC={[gm]:"Linear",[vm]:"Reinhard",[_m]:"Cineon",[$h]:"ACESFilmic",[ym]:"AgX",[Am]:"Neutral",[xm]:"Custom"};function VC(r,e){const t=kC[e];return t===void 0?(nt("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Qu=new N;function WC(){nn.getLuminanceCoefficients(Qu);const r=Qu.x.toFixed(4),e=Qu.y.toFixed(4),t=Qu.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3925`)}function XC(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ul).join(` 3926`)}function JC(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3927`)}function YC(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Ul(r){return r!==""}function m_(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function g_(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const KC=/^[ \t]*#include +<([\w\d./]+)>/gm;function lm(r){return r.replace(KC,QC)}const ZC=new Map;function QC(r,e){let t=Vt[e];if(t===void 0){const n=ZC.get(e);if(n!==void 0)t=Vt[n],nt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return lm(t)}const qC=/#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 v_(r){return r.replace(qC,jC)}function jC(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function __(r){let e=`precision ${r.precision} float; 3928 precision ${r.precision} int; 3929 precision ${r.precision} sampler2D; 3930 precision ${r.precision} samplerCube; 3931 precision ${r.precision} sampler3D; 3932 precision ${r.precision} sampler2DArray; 3933 precision ${r.precision} sampler2DShadow; 3934 precision ${r.precision} samplerCubeShadow; 3935 precision ${r.precision} sampler2DArrayShadow; 3936 precision ${r.precision} isampler2D; 3937 precision ${r.precision} isampler3D; 3938 precision ${r.precision} isamplerCube; 3939 precision ${r.precision} isampler2DArray; 3940 precision ${r.precision} usampler2D; 3941 precision ${r.precision} usampler3D; 3942 precision ${r.precision} usamplerCube; 3943 precision ${r.precision} usampler2DArray; 3944 `;return r.precision==="highp"?e+=` 3945#define HIGH_PRECISION`:r.precision==="mediump"?e+=` 3946#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=` 3947#define LOW_PRECISION`),e}const $C={[Ro]:"SHADOWMAP_TYPE_PCF",[ma]:"SHADOWMAP_TYPE_VSM"};function eR(r){return $C[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const tR={[Or]:"ENVMAP_TYPE_CUBE",[Ps]:"ENVMAP_TYPE_CUBE",[Wo]:"ENVMAP_TYPE_CUBE_UV"};function nR(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":tR[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const iR={[Ps]:"ENVMAP_MODE_REFRACTION"};function rR(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":iR[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const sR={[ac]:"ENVMAP_BLENDING_MULTIPLY",[Mx]:"ENVMAP_BLENDING_MIX",[Ex]:"ENVMAP_BLENDING_ADD"};function aR(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":sR[r.combine]||"ENVMAP_BLENDING_NONE"}function oR(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function lR(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const u=eR(t),h=nR(t),f=rR(t),d=aR(t),p=oR(t),g=XC(t),v=JC(s),A=i.createProgram();let y,_,M=t.glslVersion?"#version "+t.glslVersion+` 3948`:"";t.isRawShaderMaterial?(y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Ul).join(` 3949`),y.length>0&&(y+=` 3950`),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Ul).join(` 3951`),_.length>0&&(_+=` 3952`)):(y=[__(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionCl
vendor: 6,474 bytes, lines 3952-3954
3952ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.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",` 3953`].filter(Ul).join(` 3954`),_=[__(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",t.envMap?"#define "+d:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3954IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Wi?"#define TONE_MAPPING":"",t.toneMapping!==Wi?Vt.tonemapping_pars_fragment:"",t.toneMapping!==Wi?VC("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Vt.colorspace_pars_fragment,zC("linearToOutputTexel",t.outputColorSpace),WC(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3955`].filter(Ul).join(` 3956`)),a=lm(a),a=m_(a,t),a=g_(a,t),o=lm(o),o=m_(o,t),o=g_(o,t),a=v_(a),o=v_(o),t.isRawShaderMaterial!==!0&&(M=`#version 300 es 3957`,y=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3958`)+` 3959`+y,_=["#define varying in",t.glslVersion===jp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===jp?"":"#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(` 3960`)+` 3961`+_);const E=M+y+a,w=M+_+o,B=f_(i,i.VERTEX_SHADER,E),P=f_(i,i.FRAGMENT_SHADER,w);i.attachShader(A,B),i.attachShader(A,P),t.index0AttributeName!==void 0?i.bindAttribLocation(A,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(A,0,"position"),i.linkProgram(A);function D(U){if(r.debug.checkShaderErrors){const V=i.getProgramInfoLog(A)||"",J=i.getShaderInfoLog(B)||"",Q=i.getShaderInfoLog(P)||"",oe=V.trim(),q=J.trim(),ue=Q.trim();let z=!0,ne=!0;if(i.getProgramParameter(A,i.LINK_STATUS)===!1)if(z=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,A,B,P);else{const Y=p_(i,B,"vertex"),se=p_(i,P,"fragment");bt("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(A,i.VALIDATE_STATUS)+` 3962 3963Material Name: `+U.name+` 3964Material Type: `+U.type+` 3965 3966Program Info Log: `+oe+` 3967`+Y+` 3968`+se)}else oe!==""?nt("WebGLProgram: Program Info Log:",oe):(q===""||ue==="")&&(ne=!1);ne&&(U.diagnostics={runnable:z,programLog:oe,vertexShader:{log:q,prefix:y},fragmentShader:{log:ue,prefix:_}})}i.deleteShader(B),i.deleteShader(P),F=new rh(i,A),b=YC(i,A)}let F;this.getUniforms=function(){return F===void 0&&D(this),F};let b;this.getAttributes=function(){return b===void 0&&D(this),b};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=i.getProgramParameter(A,NC)),C},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(A),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=OC++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=B,this.fragmentShader=P,this}let cR=0;class uR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new hR(e),t.set(e,n)),n}}class hR{constructor(e){this.id=cR++,this.code=e,this.usedTimes=0}}function fR(r,e,t,n,i,s,a){const o=new wa,u=new uR,h=new Set,f=[],d=new Map,p=i.logarithmicDepthBuffer;let g=i.precision;const v={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 A(b){return h.add(b),b===0?"uv":`uv${b}`}function y(b,C,U,V,J){const Q=V.fog,oe=J.geometry,q=b.isMeshStandardMaterial?V.environment:null,ue=(b.isMeshStandardMaterial?t:e).get(b.envMap||q),z=ue&&ue.mapping===Wo?ue.image.height:null,ne=v[b.type];b.precision!==null&&(g=i.getMaxPrecision(b.precision),g!==b.precision&&nt("WebGLProgram.getParameters:",b.precision,"not supported, using",g,"instead."));const Y=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,se=Y!==void 0?Y.length:0;let pe=0;oe.morphAttributes.position!==void 0&&(pe=1),oe.morphAttributes.normal!==void 0&&(pe=2),oe.morphAttributes.color!==void 0&&(pe=3);let we,$,xt,le;if(ne){const Wt=_r[ne];we=Wt.vertexShader,$=Wt.fragmentShader}else we=b.vertexShader,$=b.fragmentShader,u.update(b),xt=u.getVertexShaderID(b),le=u.getFragmentShaderID(b);const Ae=r.getRenderTarget(),Qe=r.state.buffers.depth.getReversed(),yt=J.isInstancedMesh===!0,st=J.isBatchedMesh===!0,Dt=!!b.map,Zt=!!b.matcap,_t=!!ue,Te=!!b.aoMap,Ue=!!b.lightMap,Ie=!!b.bumpMap,$e=!!b.normalMap,H=!!b.displacementMap,At=!!b.emissiveMap,tt=!!b.metalnessMap,Tt=!!b.roughnessMap,We=b.anisotropy>0,G=b.clearcoat>0,R=b.dispersion>0,ee=b.iridescence>0,me=b.sheen>0,Ce=b.transmission>0,ge=We&&!!b.anisotropyMap,ht=G&&!!b.clearcoatMap,Ye=G&&!!b.clearcoatNormalMap,ft=G&&!!b.clearcoatRoughnessMap,Rt=ee&&!!b.iridescenceMap,Pe=ee&&!!b.iridescenceThicknessMap,Ge=me&&!!b.sheenColorMap,ut=me&&!!b.sheenRoughnessMap,X=!!b.specularMap,ce=!!b.specularColorMap,De=!!b.specularIntensityMap,K=Ce&&!!b.transmissionMap,he
vendor: 30,172 bytes, lines 3968-3995
3968=Ce&&!!b.thicknessMap,Le=!!b.gradientMap,et=!!b.alphaMap,Oe=b.alphaTest>0,be=!!b.alphaHash,He=!!b.extensions;let Mt=Wi;b.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(Mt=r.toneMapping);const jt={shaderID:ne,shaderType:b.type,shaderName:b.name,vertexShader:we,fragmentShader:$,defines:b.defines,customVertexShaderID:xt,customFragmentShaderID:le,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:g,batching:st,batchingColor:st&&J._colorsTexture!==null,instancing:yt,instancingColor:yt&&J.instanceColor!==null,instancingMorph:yt&&J.morphTexture!==null,outputColorSpace:Ae===null?r.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:as,alphaToCoverage:!!b.alphaToCoverage,map:Dt,matcap:Zt,envMap:_t,envMapMode:_t&&ue.mapping,envMapCubeUVHeight:z,aoMap:Te,lightMap:Ue,bumpMap:Ie,normalMap:$e,displacementMap:H,emissiveMap:At,normalMapObjectSpace:$e&&b.normalMapType===Ix,normalMapTangentSpace:$e&&b.normalMapType===Ns,metalnessMap:tt,roughnessMap:Tt,anisotropy:We,anisotropyMap:ge,clearcoat:G,clearcoatMap:ht,clearcoatNormalMap:Ye,clearcoatRoughnessMap:ft,dispersion:R,iridescence:ee,iridescenceMap:Rt,iridescenceThicknessMap:Pe,sheen:me,sheenColorMap:Ge,sheenRoughnessMap:ut,specularMap:X,specularColorMap:ce,specularIntensityMap:De,transmission:Ce,transmissionMap:K,thicknessMap:he,gradientMap:Le,opaque:b.transparent===!1&&b.blending===Ma&&b.alphaToCoverage===!1,alphaMap:et,alphaTest:Oe,alphaHash:be,combine:b.combine,mapUv:Dt&&A(b.map.channel),aoMapUv:Te&&A(b.aoMap.channel),lightMapUv:Ue&&A(b.lightMap.channel),bumpMapUv:Ie&&A(b.bumpMap.channel),normalMapUv:$e&&A(b.normalMap.channel),displacementMapUv:H&&A(b.displacementMap.channel),emissiveMapUv:At&&A(b.emissiveMap.channel),metalnessMapUv:tt&&A(b.metalnessMap.channel),roughnessMapUv:Tt&&A(b.roughnessMap.channel),anisotropyMapUv:ge&&A(b.anisotropyMap.channel),clearcoatMapUv:ht&&A(b.clearcoatMap.channel),clearcoatNormalMapUv:Ye&&A(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ft&&A(b.clearcoatRoughnessMap.channel),iridescenceMapUv:Rt&&A(b.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&A(b.iridescenceThicknessMap.channel),sheenColorMapUv:Ge&&A(b.sheenColorMap.channel),sheenRoughnessMapUv:ut&&A(b.sheenRoughnessMap.channel),specularMapUv:X&&A(b.specularMap.channel),specularColorMapUv:ce&&A(b.specularColorMap.channel),specularIntensityMapUv:De&&A(b.specularIntensityMap.channel),transmissionMapUv:K&&A(b.transmissionMap.channel),thicknessMapUv:he&&A(b.thicknessMap.channel),alphaMapUv:et&&A(b.alphaMap.channel),vertexTangents:!!oe.attributes.tangent&&($e||We),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,pointsUvs:J.isPoints===!0&&!!oe.attributes.uv&&(Dt||et),fog:!!Q,useFog:b.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:b.flatShading===!0&&b.wireframe===!1,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:Qe,skinning:J.isSkinnedMesh===!0,morphTargets:oe.morphAttributes.position!==void 0,morphNormals:oe.morphAttributes.normal!==void 0,morphColors:oe.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:pe,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&U.length>0,shadowMapType:r.shadowMap.type,toneMapping:Mt,decodeVideoTexture:Dt&&b.map.isVideoTexture===!0&&nn.getTransfer(b.map.colorSpace)===dn,decodeVideoTextureEmissive:At&&b.emissiveMap.isVideoTexture===!0&&nn.getTransfer(b.emissiveMap.colorSpace)===dn,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===$n,flipSided:b.side===Hn,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:He&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(He&&b.extensions.multiDraw===!0||st)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return jt.vertexUv1s=h.has(1),jt.vertexUv2s=h.has(2),jt.vertexUv3s=h.has(3),h.clear(),jt}function _(b){const C=[];if(b.shaderID?C.push(b.shaderID):(C.push(b.customVertexShaderID),C.push(b.customFragmentShaderID)),b.defines!==void 0)for(const U in b.defines)C.push(U),C.push(b.defines[U]);return b.isRawShaderMaterial===!1&&(M(C,b),E(C,b),C.push(r.outputColorSpace)),C.push(b.customProgramCacheKey),C.join()}function M(b,C){b.push(C.precision),b.push(C.outputColorSpace),b.push(C.envMapMode),b.push(C.envMapCubeUVHeight),b.push(C.mapUv),b.push(C.alphaMapUv),b.push(C.lightMapUv),b.push(C.aoMapUv),b.push(C.bumpMapUv),b.push(C.normalMapUv),b.push(C.displacementMapUv),b.push(C.emissiveMapUv),b.push(C.metalnessMapUv),b.push(C.roughnessMapUv),b.push(C.anisotropyMapUv),b.push(C.clearcoatMapUv),b.push(C.clearcoatNormalMapUv),b.push(C.clearcoatRoughnessMapUv),b.push(C.iridescenceMapUv),b.push(C.iridescenceThicknessMapUv),b.push(C.sheenColorMapUv),b.push(C.sheenRoughnessMapUv),b.push(C.specularMapUv),b.push(C.specularColorMapUv),b.push(C.specularIntensityMapUv),b.push(C.transmissionMapUv),b.push(C.thicknessMapUv),b.push(C.combine),b.push(C.fogExp2),b.push(C.sizeAttenuation),b.push(C.morphTargetsCount),b.push(C.morphAttributeCount),b.push(C.numDirLights),b.push(C.numPointLights),b.push(C.numSpotLights),b.push(C.numSpotLightMaps),b.push(C.numHemiLights),b.push(C.numRectAreaLights),b.push(C.numDirLightShadows),b.push(C.numPointLightShadows),b.push(C.numSpotLightShadows),b.push(C.numSpotLightShadowsWithMaps),b.push(C.numLightProbes),b.push(C.shadowMapType),b.push(C.toneMapping),b.push(C.numClippingPlanes),b.push(C.numClipIntersection),b.push(C.depthPacking)}function E(b,C){o.disableAll(),C.instancing&&o.enable(0),C.instancingColor&&o.enable(1),C.instancingMorph&&o.enable(2),C.matcap&&o.enable(3),C.envMap&&o.enable(4),C.normalMapObjectSpace&&o.enable(5),C.normalMapTangentSpace&&o.enable(6),C.clearcoat&&o.enable(7),C.iridescence&&o.enable(8),C.alphaTest&&o.enable(9),C.vertexColors&&o.enable(10),C.vertexAlphas&&o.enable(11),C.vertexUv1s&&o.enable(12),C.vertexUv2s&&o.enable(13),C.vertexUv3s&&o.enable(14),C.vertexTangents&&o.enable(15),C.anisotropy&&o.enable(16),C.alphaHash&&o.enable(17),C.batching&&o.enable(18),C.dispersion&&o.enable(19),C.batchingColor&&o.enable(20),C.gradientMap&&o.enable(21),b.push(o.mask),o.disableAll(),C.fog&&o.enable(0),C.useFog&&o.enable(1),C.flatShading&&o.enable(2),C.logarithmicDepthBuffer&&o.enable(3),C.reversedDepthBuffer&&o.enable(4),C.skinning&&o.enable(5),C.morphTargets&&o.enable(6),C.morphNormals&&o.enable(7),C.morphColors&&o.enable(8),C.premultipliedAlpha&&o.enable(9),C.shadowMapEnabled&&o.enable(10),C.doubleSided&&o.enable(11),C.flipSided&&o.enable(12),C.useDepthPacking&&o.enable(13),C.dithering&&o.enable(14),C.transmission&&o.enable(15),C.sheen&&o.enable(16),C.opaque&&o.enable(17),C.pointsUvs&&o.enable(18),C.decodeVideoTexture&&o.enable(19),C.decodeVideoTextureEmissive&&o.enable(20),C.alphaToCoverage&&o.enable(21),b.push(o.mask)}function w(b){const C=v[b.type];let U;if(C){const V=_r[C];U=Lm.clone(V.uniforms)}else U=b.uniforms;return U}function B(b,C){let U=d.get(C);return U!==void 0?++U.usedTimes:(U=new lR(r,C,b,s),f.push(U),d.set(C,U)),U}function P(b){if(--b.usedTimes===0){const C=f.indexOf(b);f[C]=f[f.length-1],f.pop(),d.delete(b.cacheKey),b.destroy()}}function D(b){u.remove(b)}function F(){u.dispose()}return{getParameters:y,getProgramCacheKey:_,getUniforms:w,acquireProgram:B,releaseProgram:P,releaseShaderCache:D,programs:f,dispose:F}}function dR(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,u){r.get(a)[o]=u}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function pR(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function x_(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function y_(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(d,p,g,v,A,y){let _=r[e];return _===void 0?(_={id:d.id,object:d,geometry:p,material:g,groupOrder:v,renderOrder:d.renderOrder,z:A,group:y},r[e]=_):(_.id=d.id,_.object=d,_.geometry=p,_.material=g,_.groupOrder=v,_.renderOrder=d.renderOrder,_.z=A,_.group=y),e++,_}function o(d,p,g,v,A,y){const _=a(d,p,g,v,A,y);g.transmission>0?n.push(_):g.transparent===!0?i.push(_):t.push(_)}function u(d,p,g,v,A,y){const _=a(d,p,g,v,A,y);g.transmission>0?n.unshift(_):g.transparent===!0?i.unshift(_):t.unshift(_)}function h(d,p){t.length>1&&t.sort(d||pR),n.length>1&&n.sort(p||x_),i.length>1&&i.sort(p||x_)}function f(){for(let d=e,p=r.length;d<p;d++){const g=r[d];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:o,unshift:u,finish:f,sort:h}}function mR(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new y_,r.set(n,[a])):i>=s.length?(a=new y_,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function gR(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new je};break;case"SpotLight":t={position:new N,direction:new N,color:new je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new je,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new je,groundColor:new je};break;case"RectAreaLight":t={color:new je,position:new N,halfWidth:new N,halfHeight:new N};break}return r[e.id]=t,t}}}function vR(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let _R=0;function xR(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function yR(r){const e=new gR,t=vR(),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 h=0;h<9;h++)n.probe.push(new N);const i=new N,s=new It,a=new It;function o(h){let f=0,d=0,p=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let g=0,v=0,A=0,y=0,_=0,M=0,E=0,w=0,B=0,P=0,D=0;h.sort(xR);for(let b=0,C=h.length;b<C;b++){const U=h[b],V=U.color,J=U.intensity,Q=U.distance;let oe=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===Ra?oe=U.shadow.map.texture:oe=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)f+=V.r*J,d+=V.g*J,p+=V.b*J;else if(U.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(U.sh.coefficients[q],J);D++}else if(U.isDirectionalLight){const q=e.get(U);if(q.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const ue=U.shadow,z=t.get(U);z.shadowIntensity=ue.intensity,z.shadowBias=ue.bias,z.shadowNormalBias=ue.normalBias,z.shadowRadius=ue.radius,z.shadowMapSize=ue.mapSize,n.directionalShadow[g]=z,n.directionalShadowMap[g]=oe,n.directionalShadowMatrix[g]=U.shadow.matrix,M++}n.directional[g]=q,g++}else if(U.isSpotLight){const q=e.get(U);q.position.setFromMatrixPosition(U.matrixWorld),q.color.copy(V).multiplyScalar(J),q.distance=Q,q.coneCos=Math.cos(U.angle),q.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),q.decay=U.decay,n.spot[A]=q;const ue=U.shadow;if(U.map&&(n.spotLightMap[B]=U.map,B++,ue.updateMatrices(U),U.castShadow&&P++),n.spotLightMatrix[A]=ue.matrix,U.castShadow){const z=t.get(U);z.shadowIntensity=ue.intensity,z.shadowBias=ue.bias,z.shadowNormalBias=ue.normalBias,z.shadowRadius=ue.radius,z.shadowMapSize=ue.mapSize,n.spotShadow[A]=z,n.spotShadowMap[A]=oe,w++}A++}else if(U.isRectAreaLight){const q=e.get(U);q.color.copy(V).multiplyScalar(J),q.halfWidth.set(U.width*.5,0,0),q.halfHeight.set(0,U.height*.5,0),n.rectArea[y]=q,y++}else if(U.isPointLight){const q=e.get(U);if(q.color.copy(U.color).multiplyScalar(U.intensity),q.distance=U.distance,q.decay=U.decay,U.castShadow){const ue=U.shadow,z=t.get(U);z.shadowIntensity=ue.intensity,z.shadowBias=ue.bias,z.shadowNormalBias=ue.normalBias,z.shadowRadius=ue.radius,z.shadowMapSize=ue.mapSize,z.shadowCameraNear=ue.camera.near,z.shadowCameraFar=ue.camera.far,n.pointShadow[v]=z,n.pointShadowMap[v]=oe,n.pointShadowMatrix[v]=U.shadow.matrix,E++}n.point[v]=q,v++}else if(U.isHemisphereLight){const q=e.get(U);q.skyColor.copy(U.color).multiplyScalar(J),q.groundColor.copy(U.groundColor).multiplyScalar(J),n.hemi[_]=q,_++}}y>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=rt.LTC_FLOAT_1,n.rectAreaLTC2=rt.LTC_FLOAT_2):(n.rectAreaLTC1=rt.LTC_HALF_1,n.rectAreaLTC2=rt.LTC_HALF_2)),n.ambient[0]=f,n.ambient[1]=d,n.ambient[2]=p;const F=n.hash;(F.directionalLength!==g||F.pointLength!==v||F.spotLength!==A||F.rectAreaLength!==y||F.hemiLength!==_||F.numDirectionalShadows!==M||F.numPointShadows!==E||F.numSpotShadows!==w||F.numSpotMaps!==B||F.numLightProbes!==D)&&(n.directional.length=g,n.spot.length=A,n.rectArea.length=y,n.point.length=v,n.hemi.length=_,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=w+B-P,n.spotLightMap.length=B,n.numSpotLightShadowsWithMaps=P,n.numLightProbes=D,F.directionalLength=g,F.pointLength=v,F.spotLength=A,F.rectAreaLength=y,F.hemiLength=_,F.numDirectionalShadows=M,F.numPointShadows=E,F.numSpotShadows=w,F.numSpotMaps=B,F.numLightProbes=D,n.version=_R++)}function u(h,f){let d=0,p=0,g=0,v=0,A=0;const y=f.matrixWorldInverse;for(let _=0,M=h.length;_<M;_++){const E=h[_];if(E.isDirectionalLight){const w=n.directional[d];w.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(y),d++}else if(E.isSpotLight){const w=n.spot[g];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(y),w.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(y),g++}else if(E.isRectAreaLight){const w=n.rectArea[v];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(y),a.identity(),s.copy(E.matrixWorld),s.premultiply(y),a.extractRotation(s),w.halfWidth.set(E.width*.5,0,0),w.halfHeight.set(0,E.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),v++}else if(E.isPointLight){const w=n.point[p];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(y),p++}else if(E.isHemisphereLight){const w=n.hemi[A];w.direction.setFromMatrixPosition(E.matrixWorld),w.direction.transformDirection(y),A++}}}return{setup:o,setupView:u,state:n}}function A_(r){const e=new yR(r),t=[],n=[];function i(f){h.camera=f,t.length=0,n.length=0}function s(f){t.push(f)}function a(f){n.push(f)}function o(){e.setup(t)}function u(f){e.setupView(t,f)}const h={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:h,setupLights:o,setupLightsView:u,pushLight:s,pushShadow:a}}function AR(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new A_(r),e.set(i,[o])):s>=a.length?(o=new A_(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const SR=`void main() { 3969 gl_Position = vec4( position, 1.0 ); 3970}`,MR=`uniform sampler2D shadow_pass; 3971uniform vec2 resolution; 3972uniform float radius; 3973void main() { 3974 const float samples = float( VSM_SAMPLES ); 3975 float mean = 0.0; 3976 float squared_mean = 0.0; 3977 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3978 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3979 for ( float i = 0.0; i < samples; i ++ ) { 3980 float uvOffset = uvStart + i * uvStride; 3981 #ifdef HORIZONTAL_PASS 3982 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 3983 mean += distribution.x; 3984 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3985 #else 3986 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 3987 mean += depth; 3988 squared_mean += depth * depth; 3989 #endif 3990 } 3991 mean = mean / samples; 3992 squared_mean = squared_mean / samples; 3993 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 3994 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 3995}`,ER=[new N(1,0,0),new N(-1,0,0),new N(0,1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1)],wR=[new N(0,-1,0),new N(0,-1,0),new N(0,0,1),new N(0,0,-1),new N(0,-1,0),new N(0,-1,0)],S_=new It,Tl=new N,bp=new N;function bR(r,e,t){let n=new Xo;const i=new _e,s=new _e,a=new gn,o=new Qm,u=new qm,h={},f=t.maxTextureSize,d={[Mr]:Hn,[Hn]:Mr,[$n]:$n},p=new Bn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new _e},radius:{value:4}},vertexShader:SR,fragmentShader:MR}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const v=new Lt;v.setAttribute("position",new sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new ot(v,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ro;let _=this.type;this.render=function(P,D,F){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||P.length===0)return;P.type===Nl&&(nt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),P.type=Ro);const b=r.getRenderTarget(),C=r.getActiveCubeFace(),U=r.getActiveMipmapLevel(),V=r.state;V.setBlending(ii),V.buffers.depth.getReversed()===!0?V.buffers.color.setClear(0,0,0,0):V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const J=_!==this.type;J&&D.traverse(function(Q){Q.material&&(Array.isArray(Q.material)?Q.material.forEach(oe=>oe.needsUpdate=!0):Q.material.needsUpdate=!0)});for(let Q=0,oe=P.length;Q<oe;Q++){const q=P[Q],ue=q.shadow;if(ue===void 0){nt("WebGLShadowMap:",q,"has no shadow.");continue}if(ue.autoUpdate===!1&&ue.needsUpdate===!1)continue;i.copy(ue.mapSize);const z=ue.getFrameExtents();if(i.multiply(z),s.copy(ue.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(s.x=Math.floor(f/z.x),i.x=s.x*z.x,ue.mapSize.x=s.x),i.y>f&&(s.y=Math.floor(f/z.y),i.y=s.y*z.y,ue.mapSize.y=s.y)),ue.map===null||J===!0){if(ue.map!==null&&(ue.map.depthTexture!==null&&(ue.map.depthTexture.dispose(),ue.map.depthTexture=null),ue.map.dispose()),this.type===ma){if(q.isPointLight){nt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ue.map=new bn(i.x,i.y,{format:Ra,type:Vn,minFilter:rn,magFilter:rn,generateMipmaps:!1}),ue.map.texture.name=q.name+".shadowMap",ue.map.depthTexture=new Ba(i.x,i.y,In),ue.map.depthTexture.name=q.name+".shadowMapDepth",ue.map.depthTexture.format=Gr,ue.map.depthTexture.compareFunction=null,ue.map.depthTexture.minFilter=xn,ue.map.depthTexture.magFilter=xn}else{q.isPointLight?(ue.map=new Fm(i.x),ue.map.depthTexture=new Qx(i.x,Ji)):(ue.map=new bn(i.x,i.y),ue.map.depthTexture=new Ba(i.x,i.y,Ji)),ue.map.depthTexture.name=q.name+".shadowMap",ue.map.depthTexture.format=Gr;const Y=r.state.buffers.depth.getReversed();this.type===Ro?(ue.map.depthTexture.compareFunction=Y?uf:cf,ue.map.depthTexture.minFilter=rn,ue.map.depthTexture.magFilter=rn):(ue.map.depthTexture.compareFunction=null,ue.map.depthTexture.minFilter=xn,ue.map.depthTexture.magFilter=xn)}ue.camera.updateProjectionMatrix()}const ne=ue.map.isWebGLCubeRenderTarget?6:1;for(let Y=0;Y<ne;Y++){if(ue.map.isWebGLCubeRenderTarget)r.setRenderTarget(ue.map,Y),r.clear();else{Y===0&&(r.setRenderTarget(ue.map),r.clear());const se=ue.getViewport(Y);a.set(s.x*se.x,s.y*se.y,s.x*se.z,s.y*se.w),V.viewport(a)}if(q.isPointLight){const se=ue.camera,pe=ue.matrix,we=q.distance||se.far;we!==se.far&&(se.far=we,se.updateProjectionMatrix()),Tl.setFromMatrixPosition(q.matrixWorld),se.position.copy(Tl),bp.copy(se.position),bp.add(ER[Y]),se.up.copy(wR[Y]),se.lookAt(bp),se.updateMatrixWorld(),pe.makeTranslation(-Tl.x,-Tl.y,-Tl.z),S_.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),ue._frustum.setFromProjectionMatrix(S_,se.coordinateSystem,se.reversedDepth)}else ue.updateMatrices(q);n=ue.getFrustum(),w(D,F,ue.camera,q,this.type)}ue.isPointLightShadow!==!0&&this.type===ma&&M(ue,F),ue.needsUpdate=!1}_=this.type,y.needsUpdate=!1,r.setRenderTarget(b,C,U)};function M(P,D){const F=e.update(A);p.defines.VSM_SAMPLES!==P.blurSamples&&(p.defines.VSM_SAMPLES=P.blurSamples,g.defines.VSM_SAMPLES=P.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new bn(i.x,i.y,{format:Ra,type:Vn})),p.uniforms.shadow_pass.value=P.map.depthTexture,p.uniforms.resolution.value=P.mapSize,p.uniforms.radius.value=P.radius,r.setRenderTarget(P.mapPass),r.clear(),r.renderBufferDirect(D,null,F,p,A,null),g.uniforms.shadow_pass.value=P.mapPass.texture,g.uniforms.resolution.value=P.mapSize,g.uniforms.radius.value=P.radius,r.setRenderTarget(P.map),r.clear(),r.renderBufferDirect(D,null,F,g,A,null)}function E(P,D,F,b){let C=null;const U=F.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(U!==void 0)C=U;else if(C=F.isPointLight===!0?u:o,r.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const V=C.uuid,J=D.uuid;let Q=h[V];Q===void 0&&(Q={},h[V]=Q);let oe=Q[J];oe===void 0&&(oe=C.clone(),Q[J]=oe,D.addEventListener("dispose",B)),C=oe}if(C.visible=D.visible,C.wireframe=D.wireframe,b===ma?C.side=D.shadowSide!==null?D.shadowSide:D.side:C.side=D.shadowSide!==null?D.shadowSide:d[D.side],C.alphaMap=D.alphaMap,C.alphaTest=D.alphaToCoverage===!0?.5:D.alphaTest,C.map=D.map,C.clipShadows=D.clipShadows,C.clippingPlanes=D.clippingPlanes,C.clipIntersection=D.clipIntersection,C.displacementMap=D.displacementMap,C.displacementScale=D.displacementScale,C.displacementBias=D.displacementBias,C.wireframeLinewidth=D.wireframeLinewidth,C.linewidth=D.linewidth,F.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const V=r.properties.get(C);V.light=F}return C}function w(P,D,F,b,C){if(P.visible===!1)return;if(P.layers.test(D.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&C===ma)&&(!P.frustumCulled||n.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,P.matrixWorld);const J=e.update(P),Q=P.material;if(Array.isArray(Q)){const oe=J.groups;for(let q=0,ue=oe.length;q<ue;q++){const z=oe[q],ne=Q[z.materialIndex];if(ne&&ne.visible){const Y=E(P,ne,b,C);P.onBeforeShadow(r,P,D,F,J,Y,z),r.renderBufferDirect(F,null,J,Y,P,z),P.onAfterShadow(r,P,D,F,J,Y,z)}}}else if(Q.visible){const oe=E(P,Q,b,C);P.onBeforeShadow(r,P,D,F,J,oe,null),r.renderBufferDirect(F,null,J,oe,P,null),P.onAfterShadow(r,P,D,F,J,oe,null)}}const V=P.children;for(let J=0,Q=V.length;J<Q;J++)w(V[J],D,F,b,C)}function B(P){P.target.removeEventListener("dispose",B);for(const F in h){const b=h[F],C=P.target.uuid;C in b&&(b[C].dispose(),delete b[C])}}}const TR={[lh]:Jl,[ch]:fh,[uh]:dh,[Ta]:hh,[Jl]:lh,[fh]:ch,[dh]:uh,[hh]:Ta};function CR(r,e){function t(){let K=!1;const he=new gn;let Le=null;const et=new gn(0,0,0,0);return{setMask:function(Oe){Le!==Oe&&!K&&(r.colorMask(Oe,Oe,Oe,Oe),Le=Oe)},setLocked:function(Oe){K=Oe},setClear:function(Oe,be,He,Mt,jt){jt===!0&&(Oe*=Mt,be*=Mt,He*=Mt),he.set(Oe,be,He,Mt),et.equals(he)===!1&&(r.clearColor(Oe,be,He,Mt),et.copy(he))},reset:function(){K=!1,Le=null,et.set(-1,0,0,0)}}}function n(){let K=!1,he=!1,Le=null,et=null,Oe=null;return{setReversed:function(be){if(he!==be){const He=e.get("EXT_clip_control");be?He.clipControlEXT(He.LOWER_LEFT_EXT,He.ZERO_TO_ONE_EXT):He.clipControlEXT(He.LOWER_LEFT_EXT,He.NEGATIVE_ONE_TO_ONE_EXT),he=be;const Mt=Oe;Oe=null,this.setClear(Mt)}},getReversed:function(){return he},setTest:function(be){be?Ae(r.DEPTH_TEST):Qe(r.DEPTH_TEST)},setMask:function(be){Le!==be&&!K&&(r.depthMask(be),Le=be)},setFunc:function(be){if(he&&(be=TR[be]),et!==be){switch(be){case lh:r.depthFunc(r.NEVER);break;case Jl:r.depthFunc(r.ALWAYS);break;case ch:r.depthFunc(r.LESS);break;case Ta:r.depthFunc(r.LEQUAL);break;case uh:r.depthFunc(r.EQUAL);break;case hh:r.depthFunc(r.GEQUAL);break;case fh:r.depthFunc(r.GREATER);break;case dh:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}et=be}},setLocked:function(be){K=be},setClear:function(be){Oe!==be&&(he&&(be=1-be),r.clearDepth(be),Oe=be)},reset:function(){K=!1,Le=null,et=null,Oe=null,he=!1}}}function i(){let K=!1,he=null,Le=null,et=null,Oe=null,be=null,He=null,Mt=null,jt=null;return{setTest:function(Wt){K||(Wt?Ae(r.STENCIL_TEST):Qe(r.STENCIL_TEST))},setMask:function(Wt){he!==Wt&&!K&&(r.stencilMask(Wt),he=Wt)},setFunc:function(Wt,Pn,Jn){(Le!==Wt||et!==Pn||Oe!==Jn)&&(r.stencilFunc(Wt,Pn,Jn),Le=Wt,et=Pn,Oe=Jn)},setOp:function(Wt,Pn,Jn){(be!==Wt||He!==Pn||Mt!==Jn)&&(r.stencilOp(Wt,Pn,Jn),be=Wt,He=Pn,Mt=Jn)},setLocked:function(Wt){K=Wt},setClear:function(Wt){jt!==Wt&&(r.clearStencil(Wt),jt=Wt)},reset:function(){K=!1,he=null,Le=null,et=null,Oe=null,be=null,He=null,Mt=null,jt=null}}}const s=new t,a=new n,o=new i,u=new WeakMap,h=new WeakMap;let f={},d={},p=new WeakMap,g=[],v=null,A=!1,y=null,_=null,M=null,E=null,w=null,B=null,P=null,D=new je(0,0,0),F=0,b=!1,C=null,U=null,V=null,J=null,Q=null;const oe=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,ue=0;const z=r.getParameter(r.VERSION);z.indexOf("WebGL")!==-1?(ue=parseFloat(/^WebGL (\d)/.exec(z)[1]),q=ue>=1):z.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),q=ue>=2);let ne=null,Y={};const se=r.getParameter(r.SCISSOR_BOX),pe=r.getParameter(r.VIEWPORT),we=new gn().fromArray(se),$=new gn().fromArray(pe);function xt(K,he,Le,et){const Oe=new Uint8Array(4),be=r.createTexture();r.bindTexture(K,be),r.texParameteri(K,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(K,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let He=0;He<Le;He++)K===r.TEXTURE_3D||K===r.TEXTURE_2D_ARRAY?r.texImage3D(he,0,r.RGBA,1,1,et,0,r.RGBA,r.UNSIGNED_BYTE,Oe):r.texImage2D(he+He,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Oe);return be}const le={};le[r.TEXTURE_2D]=xt(r.TEXTURE_2D,r.TEXTURE_2D,1),le[r.TEXTURE_CUBE_MAP]=xt(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),le[r.TEXTURE_2D_ARRAY]=xt(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),le[r.TEXTURE_3D]=xt(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),Ae(r.DEPTH_TEST),a.setFunc(Ta),Ie(!1),$e(Jp),Ae(r.CULL_FACE),Te(ii);function Ae(K){f[K]!==!0&&(r.enable(K),f[K]=!0)}function Qe(K){f[K]!==!1&&(r.disable(K),f[K]=!1)}function yt(K,he){return d[K]!==he?(r.bindFramebuffer(K,he),d[K]=he,K===r.DRAW_FRAMEBUFFER&&(d[r.FRAMEBUFFER]=he),K===r.FRAMEBUFFER&&(d[r.DRAW_FRAMEBUFFER]=he),!0):!1}function st(K,he){let Le=g,et=!1;if(K){Le=p.get(he),Le===void 0&&(Le=[],p.set(he,Le));const Oe=K.textures;if(Le.length!==Oe.length||Le[0]!==r.COLOR_ATTACHMENT0){for(let be=0,He=Oe.length;be<He;be++)Le[be]=r.COLOR_ATTACHMENT0+be;Le.length=Oe.length,et=!0}}else Le[0]!==r.BACK&&(Le[0]=r.BACK,et=!0);et&&r.drawBuffers(Le)}function Dt(K){return v!==K?(r.useProgram(K),v=K,!0):!1}const Zt={[bs]:r.FUNC_ADD,[ax]:r.FUNC_SUBTRACT,[ox]:r.FUNC_REVERSE_SUBTRACT};Zt[lx]=r.MIN,Zt[cx]=r.MAX;const _t={[ux]:r.ZERO,[hx]:r.ONE,[fx]:r.SRC_COLOR,[ah]:r.SRC_ALPHA,[_x]:r.SRC_ALPHA_SATURATE,[gx]:r.DST_COLOR,[px]:r.DST_ALPHA,[dx]:r.ONE_MINUS_SRC_COLOR,[oh]:r.ONE_MINUS_SRC_ALPHA,[vx]:r.ONE_MINUS_DST_COLOR,[mx]:r.ONE_MINUS_DST_ALPHA,[xx]:r.CONSTANT_COLOR,[yx]:r.ONE_MINUS_CONSTANT_COLOR,[Ax]:r.CONSTANT_ALPHA,[Sx]:r.ONE_MINUS_CONSTANT_ALPHA};function Te(K,he,Le,et,Oe,be,He,Mt,jt,Wt){if(K===ii){A===!0&&(Qe(r.BLEND),A=!1);return}if(A===!1&&(Ae(r.BLEND),A=!0),K!==sx){if(K!==y||Wt!==b){if((_!==bs||w!==bs)&&(r.blendEquation(r.FUNC_ADD),_=bs,w=bs),Wt)switch(K){case Ma:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Yp:r.blendFunc(r.ONE,r.ONE);break;case Kp:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Zp:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:bt("WebGLState: Invalid blending: ",K);break}else switch(K){case Ma:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Yp:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Kp:bt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Zp:bt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:bt("WebGLState: Invalid blending: ",K);break}M=null,E=null,B=null,P=null,D.set(0,0,0),F=0,y=K,b=Wt}return}Oe=Oe||he,be=be||Le,He=He||et,(he!==_||Oe!==w)&&(r.blendEquationSeparate(Zt[he],Zt[Oe]),_=he,w=Oe),(Le!==M||et!==E||be!==B||He!==P)&&(r.blendFuncSeparate(_t[Le],_t[et],_t[be],_t[He]),M=Le,E=et,B=be,P=He),(Mt.equals(D)===!1||jt!==F)&&(r.blendColor
vendor: 1,510 bytes, line 3995
3995(Mt.r,Mt.g,Mt.b,jt),D.copy(Mt),F=jt),y=K,b=!1}function Ue(K,he){K.side===$n?Qe(r.CULL_FACE):Ae(r.CULL_FACE);let Le=K.side===Hn;he&&(Le=!Le),Ie(Le),K.blending===Ma&&K.transparent===!1?Te(ii):Te(K.blending,K.blendEquation,K.blendSrc,K.blendDst,K.blendEquationAlpha,K.blendSrcAlpha,K.blendDstAlpha,K.blendColor,K.blendAlpha,K.premultipliedAlpha),a.setFunc(K.depthFunc),a.setTest(K.depthTest),a.setMask(K.depthWrite),s.setMask(K.colorWrite);const et=K.stencilWrite;o.setTest(et),et&&(o.setMask(K.stencilWriteMask),o.setFunc(K.stencilFunc,K.stencilRef,K.stencilFuncMask),o.setOp(K.stencilFail,K.stencilZFail,K.stencilZPass)),At(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),K.alphaToCoverage===!0?Ae(r.SAMPLE_ALPHA_TO_COVERAGE):Qe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ie(K){C!==K&&(K?r.frontFace(r.CW):r.frontFace(r.CCW),C=K)}function $e(K){K!==nx?(Ae(r.CULL_FACE),K!==U&&(K===Jp?r.cullFace(r.BACK):K===ix?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Qe(r.CULL_FACE),U=K}function H(K){K!==V&&(q&&r.lineWidth(K),V=K)}function At(K,he,Le){K?(Ae(r.POLYGON_OFFSET_FILL),(J!==he||Q!==Le)&&(r.polygonOffset(he,Le),J=he,Q=Le)):Qe(r.POLYGON_OFFSET_FILL)}function tt(K){K?Ae(r.SCISSOR_TEST):Qe(r.SCISSOR_TEST)}function Tt(K){K===void 0&&(K=r.TEXTURE0+oe-1),ne!==K&&(r.activeTexture(K),ne=K)}function We(K,he,Le){Le===void 0&&(ne===null?Le=r.TEXTURE0+oe-1:Le=ne);let et=Y[Le];et===void 0&&(et={type:void 0,texture:void 0},Y[Le]=et),(et.type!==K||et.texture!==he)&&(ne!==Le&&(r.activeTexture(Le),ne=Le),r.b
vendor: 46,646 bytes, lines 3995-4019
3995indTexture(K,he||le[K]),et.type=K,et.texture=he)}function G(){const K=Y[ne];K!==void 0&&K.type!==void 0&&(r.bindTexture(K.type,null),K.type=void 0,K.texture=void 0)}function R(){try{r.compressedTexImage2D(...arguments)}catch(K){bt("WebGLState:",K)}}function ee(){try{r.compressedTexImage3D(...arguments)}catch(K){bt("WebGLState:",K)}}function me(){try{r.texSubImage2D(...arguments)}catch(K){bt("WebGLState:",K)}}function Ce(){try{r.texSubImage3D(...arguments)}catch(K){bt("WebGLState:",K)}}function ge(){try{r.compressedTexSubImage2D(...arguments)}catch(K){bt("WebGLState:",K)}}function ht(){try{r.compressedTexSubImage3D(...arguments)}catch(K){bt("WebGLState:",K)}}function Ye(){try{r.texStorage2D(...arguments)}catch(K){bt("WebGLState:",K)}}function ft(){try{r.texStorage3D(...arguments)}catch(K){bt("WebGLState:",K)}}function Rt(){try{r.texImage2D(...arguments)}catch(K){bt("WebGLState:",K)}}function Pe(){try{r.texImage3D(...arguments)}catch(K){bt("WebGLState:",K)}}function Ge(K){we.equals(K)===!1&&(r.scissor(K.x,K.y,K.z,K.w),we.copy(K))}function ut(K){$.equals(K)===!1&&(r.viewport(K.x,K.y,K.z,K.w),$.copy(K))}function X(K,he){let Le=h.get(he);Le===void 0&&(Le=new WeakMap,h.set(he,Le));let et=Le.get(K);et===void 0&&(et=r.getUniformBlockIndex(he,K.name),Le.set(K,et))}function ce(K,he){const et=h.get(he).get(K);u.get(he)!==et&&(r.uniformBlockBinding(he,et,K.__bindingPointIndex),u.set(he,et))}function De(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),f={},ne=null,Y={},d={},p=new WeakMap,g=[],v=null,A=!1,y=null,_=null,M=null,E=null,w=null,B=null,P=null,D=new je(0,0,0),F=0,b=!1,C=null,U=null,V=null,J=null,Q=null,we.set(0,0,r.canvas.width,r.canvas.height),$.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:Ae,disable:Qe,bindFramebuffer:yt,drawBuffers:st,useProgram:Dt,setBlending:Te,setMaterial:Ue,setFlipSided:Ie,setCullFace:$e,setLineWidth:H,setPolygonOffset:At,setScissorTest:tt,activeTexture:Tt,bindTexture:We,unbindTexture:G,compressedTexImage2D:R,compressedTexImage3D:ee,texImage2D:Rt,texImage3D:Pe,updateUBOMapping:X,uniformBlockBinding:ce,texStorage2D:Ye,texStorage3D:ft,texSubImage2D:me,texSubImage3D:Ce,compressedTexSubImage2D:ge,compressedTexSubImage3D:ht,scissor:Ge,viewport:ut,reset:De}}function RR(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new _e,f=new WeakMap;let d;const p=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(G,R){return g?new OffscreenCanvas(G,R):jl("canvas")}function A(G,R,ee){let me=1;const Ce=We(G);if((Ce.width>ee||Ce.height>ee)&&(me=ee/Math.max(Ce.width,Ce.height)),me<1)if(typeof HTMLImageElement<"u"&&G instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&G instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&G instanceof ImageBitmap||typeof VideoFrame<"u"&&G instanceof VideoFrame){const ge=Math.floor(me*Ce.width),ht=Math.floor(me*Ce.height);d===void 0&&(d=v(ge,ht));const Ye=R?v(ge,ht):d;return Ye.width=ge,Ye.height=ht,Ye.getContext("2d").drawImage(G,0,0,ge,ht),nt("WebGLRenderer: Texture has been resized from ("+Ce.width+"x"+Ce.height+") to ("+ge+"x"+ht+")."),Ye}else return"data"in G&&nt("WebGLRenderer: Image in DataTexture is too big ("+Ce.width+"x"+Ce.height+")."),G;return G}function y(G){return G.generateMipmaps}function _(G){r.generateMipmap(G)}function M(G){return G.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:G.isWebGL3DRenderTarget?r.TEXTURE_3D:G.isWebGLArrayRenderTarget||G.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function E(G,R,ee,me,Ce=!1){if(G!==null){if(r[G]!==void 0)return r[G];nt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+G+"'")}let ge=R;if(R===r.RED&&(ee===r.FLOAT&&(ge=r.R32F),ee===r.HALF_FLOAT&&(ge=r.R16F),ee===r.UNSIGNED_BYTE&&(ge=r.R8)),R===r.RED_INTEGER&&(ee===r.UNSIGNED_BYTE&&(ge=r.R8UI),ee===r.UNSIGNED_SHORT&&(ge=r.R16UI),ee===r.UNSIGNED_INT&&(ge=r.R32UI),ee===r.BYTE&&(ge=r.R8I),ee===r.SHORT&&(ge=r.R16I),ee===r.INT&&(ge=r.R32I)),R===r.RG&&(ee===r.FLOAT&&(ge=r.RG32F),ee===r.HALF_FLOAT&&(ge=r.RG16F),ee===r.UNSIGNED_BYTE&&(ge=r.RG8)),R===r.RG_INTEGER&&(ee===r.UNSIGNED_BYTE&&(ge=r.RG8UI),ee===r.UNSIGNED_SHORT&&(ge=r.RG16UI),ee===r.UNSIGNED_INT&&(ge=r.RG32UI),ee===r.BYTE&&(ge=r.RG8I),ee===r.SHORT&&(ge=r.RG16I),ee===r.INT&&(ge=r.RG32I)),R===r.RGB_INTEGER&&(ee===r.UNSIGNED_BYTE&&(ge=r.RGB8UI),ee===r.UNSIGNED_SHORT&&(ge=r.RGB16UI),ee===r.UNSIGNED_INT&&(ge=r.RGB32UI),ee===r.BYTE&&(ge=r.RGB8I),ee===r.SHORT&&(ge=r.RGB16I),ee===r.INT&&(ge=r.RGB32I)),R===r.RGBA_INTEGER&&(ee===r.UNSIGNED_BYTE&&(ge=r.RGBA8UI),ee===r.UNSIGNED_SHORT&&(ge=r.RGBA16UI),ee===r.UNSIGNED_INT&&(ge=r.RGBA32UI),ee===r.BYTE&&(ge=r.RGBA8I),ee===r.SHORT&&(ge=r.RGBA16I),ee===r.INT&&(ge=r.RGBA32I)),R===r.RGB&&(ee===r.UNSIGNED_INT_5_9_9_9_REV&&(ge=r.RGB9_E5),ee===r.UNSIGNED_INT_10F_11F_11F_REV&&(ge=r.R11F_G11F_B10F)),R===r.RGBA){const ht=Ce?Ql:nn.getTransfer(me);ee===r.FLOAT&&(ge=r.RGBA32F),ee===r.HALF_FLOAT&&(ge=r.RGBA16F),ee===r.UNSIGNED_BYTE&&(ge=ht===dn?r.SRGB8_ALPHA8:r.RGBA8),ee===r.UNSIGNED_SHORT_4_4_4_4&&(ge=r.RGBA4),ee===r.UNSIGNED_SHORT_5_5_5_1&&(ge=r.RGB5_A1)}return(ge===r.R16F||ge===r.R32F||ge===r.RG16F||ge===r.RG32F||ge===r.RGBA16F||ge===r.RGBA32F)&&e.get("EXT_color_buffer_float"),ge}function w(G,R){let ee;return G?R===null||R===Ji||R===Ca?ee=r.DEPTH24_STENCIL8:R===In?ee=r.DEPTH32F_STENCIL8:R===Lo&&(ee=r.DEPTH24_STENCIL8,nt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===Ji||R===Ca?ee=r.DEPTH_COMPONENT24:R===In?ee=r.DEPTH_COMPONENT32F:R===Lo&&(ee=r.DEPTH_COMPONENT16),ee}function B(G,R){return y(G)===!0||G.isFramebufferTexture&&G.minFilter!==xn&&G.minFilter!==rn?Math.log2(Math.max(R.width,R.height))+1:G.mipmaps!==void 0&&G.mipmaps.length>0?G.mipmaps.length:G.isCompressedTexture&&Array.isArray(G.image)?R.mipmaps.length:1}function P(G){const R=G.target;R.removeEventListener("dispose",P),F(R),R.isVideoTexture&&f.delete(R)}function D(G){const R=G.target;R.removeEventListener("dispose",D),C(R)}function F(G){const R=n.get(G);if(R.__webglInit===void 0)return;const ee=G.source,me=p.get(ee);if(me){const Ce=me[R.__cacheKey];Ce.usedTimes--,Ce.usedTimes===0&&b(G),Object.keys(me).length===0&&p.delete(ee)}n.remove(G)}function b(G){const R=n.get(G);r.deleteTexture(R.__webglTexture);const ee=G.source,me=p.get(ee);delete me[R.__cacheKey],a.memory.textures--}function C(G){const R=n.get(G);if(G.depthTexture&&(G.depthTexture.dispose(),n.remove(G.depthTexture)),G.isWebGLCubeRenderTarget)for(let me=0;me<6;me++){if(Array.isArray(R.__webglFramebuffer[me]))for(let Ce=0;Ce<R.__webglFramebuffer[me].length;Ce++)r.deleteFramebuffer(R.__webglFramebuffer[me][Ce]);else r.deleteFramebuffer(R.__webglFramebuffer[me]);R.__webglDepthbuffer&&r.deleteRenderbuffer(R.__webglDepthbuffer[me])}else{if(Array.isArray(R.__webglFramebuffer))for(let me=0;me<R.__webglFramebuffer.length;me++)r.deleteFramebuffer(R.__webglFramebuffer[me]);else r.deleteFramebuffer(R.__webglFramebuffer);if(R.__webglDepthbuffer&&r.deleteRenderbuffer(R.__webglDepthbuffer),R.__webglMultisampledFramebuffer&&r.deleteFramebuffer(R.__webglMultisampledFramebuffer),R.__webglColorRenderbuffer)for(let me=0;me<R.__webglColorRenderbuffer.length;me++)R.__webglColorRenderbuffer[me]&&r.deleteRenderbuffer(R.__webglColorRenderbuffer[me]);R.__webglDepthRenderbuffer&&r.deleteRenderbuffer(R.__webglDepthRenderbuffer)}const ee=G.textures;for(let me=0,Ce=ee.length;me<Ce;me++){const ge=n.get(ee[me]);ge.__webglTexture&&(r.deleteTexture(ge.__webglTexture),a.memory.textures--),n.remove(ee[me])}n.remove(G)}let U=0;function V(){U=0}function J(){const G=U;return G>=i.maxTextures&&nt("WebGLTextures: Trying to use "+G+" texture units while this GPU supports only "+i.maxTextures),U+=1,G}function Q(G){const R=[];return R.push(G.wrapS),R.push(G.wrapT),R.push(G.wrapR||0),R.push(G.magFilter),R.push(G.minFilter),R.push(G.anisotropy),R.push(G.internalFormat),R.push(G.format),R.push(G.type),R.push(G.generateMipmaps),R.push(G.premultiplyAlpha),R.push(G.flipY),R.push(G.unpackAlignment),R.push(G.colorSpace),R.join()}function oe(G,R){const ee=n.get(G);if(G.isVideoTexture&&tt(G),G.isRenderTargetTexture===!1&&G.isExternalTexture!==!0&&G.version>0&&ee.__version!==G.version){const me=G.image;if(me===null)nt("WebGLRenderer: Texture marked for update but no image data found.");else if(me.complete===!1)nt("WebGLRenderer: Texture marked for update but image is incomplete");else{le(ee,G,R);return}}else G.isExternalTexture&&(ee.__webglTexture=G.sourceTexture?G.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,ee.__webglTexture,r.TEXTURE0+R)}function q(G,R){const ee=n.get(G);if(G.isRenderTargetTexture===!1&&G.version>0&&ee.__version!==G.version){le(ee,G,R);return}else G.isExternalTexture&&(ee.__webglTexture=G.sourceTexture?G.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,ee.__webglTexture,r.TEXTURE0+R)}function ue(G,R){const ee=n.get(G);if(G.isRenderTargetTexture===!1&&G.version>0&&ee.__version!==G.version){le(ee,G,R);return}t.bindTexture(r.TEXTURE_3D,ee.__webglTexture,r.TEXTURE0+R)}function z(G,R){const ee=n.get(G);if(G.isCubeDepthTexture!==!0&&G.version>0&&ee.__version!==G.version){Ae(ee,G,R);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ee.__webglTexture,r.TEXTURE0+R)}const ne={[Ds]:r.REPEAT,[wi]:r.CLAMP_TO_EDGE,[Do]:r.MIRRORED_REPEAT},Y={[xn]:r.NEAREST,[tf]:r.NEAREST_MIPMAP_NEAREST,[ga]:r.NEAREST_MIPMAP_LINEAR,[rn]:r.LINEAR,[Io]:r.LINEAR_MIPMAP_NEAREST,[or]:r.LINEAR_MIPMAP_LINEAR},se={[Bx]:r.NEVER,[Ux]:r.ALWAYS,[Px]:r.LESS,[cf]:r.LEQUAL,[Dx]:r.EQUAL,[uf]:r.GEQUAL,[Lx]:r.GREATER,[Fx]:r.NOTEQUAL};function pe(G,R){if(R.type===In&&e.has("OES_texture_float_linear")===!1&&(R.magFilter===rn||R.magFilter===Io||R.magFilter===ga||R.magFilter===or||R.minFilter===rn||R.minFilter===Io||R.minFilter===ga||R.minFilter===or)&&nt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(G,r.TEXTURE_WRAP_S,ne[R.wrapS]),r.texParameteri(G,r.TEXTURE_WRAP_T,ne[R.wrapT]),(G===r.TEXTURE_3D||G===r.TEXTURE_2D_ARRAY)&&r.texParameteri(G,r.TEXTURE_WRAP_R,ne[R.wrapR]),r.texParameteri(G,r.TEXTURE_MAG_FILTER,Y[R.magFilter]),r.texParameteri(G,r.TEXTURE_MIN_FILTER,Y[R.minFilter]),R.compareFunction&&(r.texParameteri(G,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(G,r.TEXTURE_COMPARE_FUNC,se[R.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===xn||R.minFilter!==ga&&R.minFilter!==or||R.type===In&&e.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||n.get(R).__currentAnisotropy){const ee=e.get("EXT_texture_filter_anisotropic");r.texParameterf(G,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,i.getMaxAnisotropy())),n.get(R).__currentAnisotropy=R.anisotropy}}}function we(G,R){let ee=!1;G.__webglInit===void 0&&(G.__webglInit=!0,R.addEventListener("dispose",P));const me=R.source;let Ce=p.get(me);Ce===void 0&&(Ce={},p.set(me,Ce));const ge=Q(R);if(ge!==G.__cacheKey){Ce[ge]===void 0&&(Ce[ge]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,ee=!0),Ce[ge].usedTimes++;const ht=Ce[G.__cacheKey];ht!==void 0&&(Ce[G.__cacheKey].usedTimes--,ht.usedTimes===0&&b(R)),G.__cacheKey=ge,G.__webglTexture=Ce[ge].texture}return ee}function $(G,R,ee){return Math.floor(Math.floor(G/ee)/R)}function xt(G,R,ee,me){const ge=G.updateRanges;if(ge.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,R.width,R.height,ee,me,R.data);else{ge.sort((Pe,Ge)=>Pe.start-Ge.start);let ht=0;for(let Pe=1;Pe<ge.length;Pe++){const Ge=ge[ht],ut=ge[Pe],X=Ge.start+Ge.count,ce=$(ut.start,R.width,4),De=$(Ge.start,R.width,4);ut.start<=X+1&&ce===De&&$(ut.start+ut.count-1,R.width,4)===ce?Ge.count=Math.max(Ge.count,ut.start+ut.count-Ge.start):(++ht,ge[ht]=ut)}ge.length=ht+1;const Ye=r.getParameter(r.UNPACK_ROW_LENGTH),ft=r.getParameter(r.UNPACK_SKIP_PIXELS),Rt=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,R.width);for(let Pe=0,Ge=ge.length;Pe<Ge;Pe++){const ut=ge[Pe],X=Math.floor(ut.start/4),ce=Math.ceil(ut.count/4),De=X%R.width,K=Math.floor(X/R.width),he=ce,Le=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,De),r.pixelStorei(r.UNPACK_SKIP_ROWS,K),t.texSubImage2D(r.TEXTURE_2D,0,De,K,he,Le,ee,me,R.data)}G.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,Ye),r.pixelStorei(r.UNPACK_SKIP_PIXELS,ft),r.pixelStorei(r.UNPACK_SKIP_ROWS,Rt)}}function le(G,R,ee){let me=r.TEXTURE_2D;(R.isDataArrayTexture||R.isCompressedArrayTexture)&&(me=r.TEXTURE_2D_ARRAY),R.isData3DTexture&&(me=r.TEXTURE_3D);const Ce=we(G,R),ge=R.source;t.bindTexture(me,G.__webglTexture,r.TEXTURE0+ee);const ht=n.get(ge);if(ge.version!==ht.__version||Ce===!0){t.activeTexture(r.TEXTURE0+ee);const Ye=nn.getPrimaries(nn.workingColorSpace),ft=R.colorSpace===xr?null:nn.getPrimaries(R.colorSpace),Rt=R.colorSpace===xr||Ye===ft?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,R.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,R.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Rt);let Pe=A(R.image,!1,i.maxTextureSize);Pe=Tt(R,Pe);const Ge=s.convert(R.format,R.colorSpace),ut=s.convert(R.type);let X=E(R.internalFormat,Ge,ut,R.colorSpace,R.isVideoTexture);pe(me,R);let ce;const De=R.mipmaps,K=R.isVideoTexture!==!0,he=ht.__version===void 0||Ce===!0,Le=ge.dataReady,et=B(R,Pe);if(R.isDepthTexture)X=w(R.format===ts,R.type),he&&(K?t.texStorage2D(r.TEXTURE_2D,1,X,Pe.width,Pe.height):t.texImage2D(r.TEXTURE_2D,0,X,Pe.width,Pe.height,0,Ge,ut,null));else if(R.isDataTexture)if(De.length>0){K&&he&&t.texStorage2D(r.TEXTURE_2D,et,X,De[0].width,De[0].height);for(let Oe=0,be=De.length;Oe<be;Oe++)ce=De[Oe],K?Le&&t.texSubImage2D(r.TEXTURE_2D,Oe,0,0,ce.width,ce.height,Ge,ut,ce.data):t.texImage2D(r.TEXTURE_2D,Oe,X,ce.width,ce.height,0,Ge,ut,ce.data);R.generateMipmaps=!1}else K?(he&&t.texStorage2D(r.TEXTURE_2D,et,X,Pe.width,Pe.height),Le&&xt(R,Pe,Ge,ut)):t.texImage2D(r.TEXTURE_2D,0,X,Pe.width,Pe.height,0,Ge,ut,Pe.data);else if(R.isCompressedTexture)if(R.isCompressedArrayTexture){K&&he&&t.texStorage3D(r.TEXTURE_2D_ARRAY,et,X,De[0].width,De[0].height,Pe.depth);for(let Oe=0,be=De.length;Oe<be;Oe++)if(ce=De[Oe],R.format!==ni)if(Ge!==null)if(K){if(Le)if(R.layerUpdates.size>0){const He=sm(ce.width,ce.height,R.format,R.type);for(const Mt of R.layerUpdates){const jt=ce.data.subarray(Mt*He/ce.data.BYTES_PER_ELEMENT,(Mt+1)*He/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Oe,0,0,Mt,ce.width,ce.height,1,Ge,jt)}R.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Oe,0,0,0,ce.width,ce.height,Pe.depth,Ge,ce.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Oe,X,ce.width,ce.height,Pe.depth,0,ce.data,0,0);else nt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else K?Le&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Oe,0,0,0,ce.width,ce.height,Pe.depth,Ge,ut,ce.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Oe,X,ce.width,ce.height,Pe.depth,0,Ge,ut,ce.data)}else{K&&he&&t.texStorage2D(r.TEXTURE_2D,et,X,De[0].width,De[0].height);for(let Oe=0,be=De.length;Oe<be;Oe++)ce=De[Oe],R.format!==ni?Ge!==null?K?Le&&t.compressedTexSubImage2D(r.TEXTURE_2D,Oe,0,0,ce.width,ce.height,Ge,ce.data):t.compressedTexImage2D(r.TEXTURE_2D,Oe,X,ce.width,ce.height,0,ce.data):nt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):K?Le&&t.texSubImage2D(r.TEXTURE_2D,Oe,0,0,ce.width,ce.height,Ge,ut,ce.data):t.texImage2D(r.TEXTURE_2D,Oe,X,ce.width,ce.height,0,Ge,ut,ce.data)}else if(R.isDataArrayTexture)if(K){if(he&&t.texStorage3D(r.TEXTURE_2D_ARRAY,et,X,Pe.width,Pe.height,Pe.depth),Le)if(R.layerUpdates.size>0){const Oe=sm(Pe.width,Pe.height,R.format,R.type);for(const be of R.layerUpdates){const He=Pe.data.subarray(be*Oe/Pe.data.BYTES_PER_ELEMENT,(be+1)*Oe/Pe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,be,Pe.width,Pe.height,1,Ge,ut,He)}R.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Pe.width,Pe.height,Pe.depth,Ge,ut,Pe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,X,Pe.width,Pe.height,Pe.depth,0,Ge,ut,Pe.data);else if(R.isData3DTexture)K?(he&&t.texStorage3D(r.TEXTURE_3D,et,X,Pe.width,Pe.height,Pe.depth),Le&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Pe.width,Pe.height,Pe.depth,Ge,ut,Pe.data)):t.texImage3D(r.TEXTURE_3D,0,X,Pe.width,Pe.height,Pe.depth,0,Ge,ut,Pe.data);else if(R.isFramebufferTexture){if(he)if(K)t.texStorage2D(r.TEXTURE_2D,et,X,Pe.width,Pe.height);else{let Oe=Pe.width,be=Pe.height;for(let He=0;He<et;He++)t.texImage2D(r.TEXTURE_2D,He,X,Oe,be,0,Ge,ut,null),Oe>>=1,be>>=1}}else if(De.length>0){if(K&&he){const Oe=We(De[0]);t.texStorage2D(r.TEXTURE_2D,et,X,Oe.width,Oe.height)}for(let Oe=0,be=De.length;Oe<be;Oe++)ce=De[Oe],K?Le&&t.texSubImage2D(r.TEXTURE_2D,Oe,0,0,Ge,ut,ce):t.texImage2D(r.TEXTURE_2D,Oe,X,Ge,ut,ce);R.generateMipmaps=!1}else if(K){if(he){const Oe=We(Pe);t.texStorage2D(r.TEXTURE_2D,et,X,Oe.width,Oe.height)}Le&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Ge,ut,Pe)}else t.texImage2D(r.TEXTURE_2D,0,X,Ge,ut,Pe);y(R)&&_(me),ht.__version=ge.version,R.onUpdate&&R.onUpdate(R)}G.__version=R.version}function Ae(G,R,ee){if(R.image.length!==6)return;const me=we(G,R),Ce=R.source;t.bindTexture(r.TEXTURE_CUBE_MAP,G.__webglTexture,r.TEXTURE0+ee);const ge=n.get(Ce);if(Ce.version!==ge.__version||me===!0){t.activeTexture(r.TEXTURE0+ee);const ht=nn.getPrimaries(nn.workingColorSpace),Ye=R.colorSpace===xr?null:nn.getPrimaries(R.colorSpace),ft=R.colorSpace===xr||ht===Ye?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,R.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,R.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ft);const Rt=R.isCompressedTexture||R.image[0].isCompressedTexture,Pe=R.image[0]&&R.image[0].isDataTexture,Ge=[];for(let be=0;be<6;be++)!Rt&&!Pe?Ge[be]=A(R.image[be],!0,i.maxCubemapSize):Ge[be]=Pe?R.image[be].image:R.image[be],Ge[be]=Tt(R,Ge[be]);const ut=Ge[0],X=s.convert(R.format,R.colorSpace),ce=s.convert(R.type),De=E(R.internalFormat,X,ce,R.colorSpace),K=R.isVideoTexture!==!0,he=ge.__version===void 0||me===!0,Le=Ce.dataReady;let et=B(R,ut);pe(r.TEXTURE_CUBE_MAP,R);let Oe;if(Rt){K&&he&&t.texStorage2D(r.TEXTURE_CUBE_MAP,et,De,ut.width,ut.height);for(let be=0;be<6;be++){Oe=Ge[be].mipmaps;for(let He=0;He<Oe.length;He++){const Mt=Oe[He];R.format!==ni?X!==null?K?Le&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He,0,0,Mt.width,Mt.height,X,Mt.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He,De,Mt.width,Mt.height,0,Mt.data):nt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):K?Le&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He,0,0,Mt.width,Mt.height,X,ce,Mt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He,De,Mt.width,Mt.height,0,X,ce,Mt.data)}}}else{if(Oe=R.mipmaps,K&&he){Oe.length>0&&et++;const be=We(Ge[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,et,De,be.width,be.height)}for(let be=0;be<6;be++)if(Pe){K?Le&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,0,0,Ge[be].width,Ge[be].height,X,ce,Ge[be].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,De,Ge[be].width,Ge[be].height,0,X,ce,Ge[be].data);for(let He=0;He<Oe.length;He++){const jt=Oe[He].image[be].image;K?Le&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He+1,0,0,jt.width,jt.height,X,ce,jt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He+1,De,jt.width,jt.height,0,X,ce,jt.data)}}else{K?Le&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,0,0,X,ce,Ge[be]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,De,X,ce,Ge[be]);for(let He=0;He<Oe.length;He++){const Mt=Oe[He];K?Le&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He+1,0,0,X,ce,Mt.image[be]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+be,He+1,De,X,ce,Mt.image[be])}}}y(R)&&_(r.TEXTURE_CUBE_MAP),ge.__version=Ce.version,R.onUpdate&&R.onUpdate(R)}G.__version=R.version}function Qe(G,R,ee,me,Ce,ge){const ht=s.convert(ee.format,ee.colorSpace),Ye=s.convert(ee.type),ft=E(ee.internalFormat,ht,Ye,ee.colorSpace),Rt=n.get(R),Pe=n.get(ee);if(Pe.__renderTarget=R,!Rt.__hasExternalTextures){const Ge=Math.max(1,R.width>>ge),ut=Math.max(1,R.height>>ge);Ce===r.TEXTURE_3D||Ce===r.TEXTURE_2D_ARRAY?t.texImage3D(Ce,ge,ft,Ge,ut,R.depth,0,ht,Ye,null):t.texImage2D(Ce,ge,ft,Ge,ut,0,ht,Ye,null)}t.bindFramebuffer(r.FRAMEBUFFER,G),At(R)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,me,Ce,Pe.__webglTexture,0,H(R)):(Ce===r.TEXTURE_2D||Ce>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&Ce<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,me,Ce,Pe.__webglTexture,ge),t.bindFramebuffer(r.FRAMEBUFFER,null)}function yt(G,R,ee){if(r.bindRenderbuffer(r.RENDERBUFFER,G),R.depthBuffer){const me=R.depthTexture,Ce=me&&me.isDepthTexture?me.type:null,ge=w(R.stencilBuffer,Ce),ht=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;At(R)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,H(R),ge,R.width,R.height):ee?r.renderbufferStorageMultisample(r.RENDERBUFFER,H(R),ge,R.width,R.height):r.renderbufferStorage(r.RENDERBUFFER,ge,R.width,R.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,ht,r.RENDERBUFFER,G)}else{const me=R.textures;for(let Ce=0;Ce<me.length;Ce++){const ge=me[Ce],ht=s.convert(ge.format,ge.colorSpace),Ye=s.convert(ge.type),ft=E(ge.internalFormat,ht,Ye,ge.colorSpace);At(R)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,H(R),ft,R.width,R.height):ee?r.renderbufferStorageMultisample(r.RENDERBUFFER,H(R),ft,R.width,R.height):r.renderbufferStorage(r.RENDERBUFFER,ft,R.width,R.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function st(G,R,ee){const me=R.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,G),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Ce=n.get(R.depthTexture);if(Ce.__renderTarget=R,(!Ce.__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),me){if(Ce.__webglInit===void 0&&(Ce.__webglInit=!0,R.depthTexture.addEventListener("dispose",P)),Ce.__webglTexture===void 0){Ce.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,Ce.__webglTexture),pe(r.TEXTURE_CUBE_MAP,R.depthTexture);const Rt=s.convert(R.depthTexture.format),Pe=s.convert(R.depthTexture.type);let Ge;R.depthTexture.format===Gr?Ge=r.DEPTH_COMPONENT24:R.depthTexture.format===ts&&(Ge=r.DEPTH24_STENCIL8);for(let ut=0;ut<6;ut++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Ge,R.width,R.height,0,Rt,Pe,null)}}else oe(R.depthTexture,0);const ge=Ce.__webglTexture,ht=H(R),Ye=me?r.TEXTURE_CUBE_MAP_POSITIVE_X+ee:r.TEXTURE_2D,ft=R.depthTexture.format===ts?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(R.depthTexture.format===Gr)At(R)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ft,Ye,ge,0,ht):r.framebufferTexture2D(r.FRAMEBUFFER,ft,Ye,ge,0);else if(R.depthTexture.format===ts)At(R)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ft,Ye,ge,0,ht):r.framebufferTexture2D(r.FRAMEBUFFER,ft,Ye,ge,0);else throw new Error("Unknown depthTexture format")}function Dt(G){const R=n.get(G),ee=G.isWebGLCubeRenderTarget===!0;if(R.__boundDepthTexture!==G.depthTexture){const me=G.depthTexture;if(R.__depthDisposeCallback&&R.__depthDisposeCallback(),me){const Ce=()=>{delete R.__boundDepthTexture,delete R.__depthDisposeCallback,me.removeEventListener("dispose",Ce)};me.addEventListener("dispose",Ce),R.__depthDisposeCallback=Ce}R.__boundDepthTexture=me}if(G.depthTexture&&!R.__autoAllocateDepthBuffer)if(ee)for(let me=0;me<6;me++)st(R.__webglFramebuffer[me],G,me);else{const me=G.texture.mipmaps;me&&me.length>0?st(R.__webglFramebuffer[0],G,0):st(R.__webglFramebuffer,G,0)}else if(ee){R.__webglDepthbuffer=[];for(let me=0;me<6;me++)if(t.bindFramebuffer(r.FRAMEBUFFER,R.__webglFramebuffer[me]),R.__webglDepthbuffer[me]===void 0)R.__webglDepthbuffer[me]=r.createRenderbuffer(),yt(R.__webglDepthbuffer[me],G,!1);else{const Ce=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ge=R.__webglDepthbuffer[me];r.bindRenderbuffer(r.RENDERBUFFER,ge),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ce,r.RENDERBUFFER,ge)}}else{const me=G.texture.mipmaps;if(me&&me.length>0?t.bindFramebuffer(r.FRAMEBUFFER,R.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer===void 0)R.__webglDepthbuffer=r.createRenderbuffer(),yt(R.__webglDepthbuffer,G,!1);else{const Ce=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ge=R.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,ge),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ce,r.RENDERBUFFER,ge)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function Zt(G,R,ee){const me=n.get(G);R!==void 0&&Qe(me.__webglFramebuffer,G,G.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ee!==void 0&&Dt(G)}function _t(G){const R=G.texture,ee=n.get(G),me=n.get(R);G.addEventListener("dispose",D);const Ce=G.textures,ge=G.isWebGLCubeRenderTarget===!0,ht=Ce.length>1;if(ht||(me.__webglTexture===void 0&&(me.__webglTexture=r.createTexture()),me.__version=R.version,a.memory.textures++),ge){ee.__webglFramebuffer=[];for(let Ye=0;Ye<6;Ye++)if(R.mipmaps&&R.mipmaps.length>0){ee.__webglFramebuffer[Ye]=[];for(let ft=0;ft<R.mipmaps.length;ft++)ee.__webglFramebuffer[Ye][ft]=r.createFramebuffer()}else ee.__webglFramebuffer[Ye]=r.createFramebuffer()}else{if(R.mipmaps&&R.mipmaps.length>0){ee.__webglFramebuffer=[];for(let Ye=0;Ye<R.mipmaps.length;Ye++)ee.__webglFramebuffer[Ye]=r.createFramebuffer()}else ee.__webglFramebuffer=r.createFramebuffer();if(ht)for(let Ye=0,ft=Ce.length;Ye<ft;Ye++){const Rt=n.get(Ce[Ye]);Rt.__webglTexture===void 0&&(Rt.__webglTexture=r.createTexture(),a.memory.textures++)}if(G.samples>0&&At(G)===!1){ee.__webglMultisampledFramebuffer=r.createFramebuffer(),ee.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ee.__webglMultisampledFramebuffer);for(let Ye=0;Ye<Ce.length;Ye++){const ft=Ce[Ye];ee.__webglColorRenderbuffer[Ye]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ee.__webglColorRenderbuffer[Ye]);const Rt=s.convert(ft.format,ft.colorSpace),Pe=s.convert(ft.type),Ge=E(ft.internalFormat,Rt,Pe,ft.colorSpace,G.isXRRenderTarget===!0),ut=H(G);r.renderbufferStorageMultisample(r.RENDERBUFFER,ut,Ge,G.width,G.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ye,r.RENDERBUFFER,ee.__webglColorRenderbuffer[Ye])}r.bindRenderbuffer(r.RENDERBUFFER,null),G.depthBuffer&&(ee.__webglDepthRenderbuffer=r.createRenderbuffer(),yt(ee.__webglDepthRenderbuffer,G,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ge){t.bindTexture(r.TEXTURE_CUBE_MAP,me.__webglTexture),pe(r.TEXTURE_CUBE_MAP,R);for(let Ye=0;Ye<6;Ye++)if(R.mipmaps&&R.mipmaps.length>0)for(let ft=0;ft<R.mipmaps.length;ft++)Qe(ee.__webglFramebuffer[Ye][ft],G,R,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,ft);else Qe(ee.__webglFramebuffer[Ye],G,R,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,0);y(R)&&_(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ht){for(let Ye=0,ft=Ce.length;Ye<ft;Ye++){const Rt=Ce[Ye],Pe=n.get(Rt);let Ge=r.TEXTURE_2D;(G.isWebGL3DRenderTarget||G.isWebGLArrayRenderTarget)&&(Ge=G.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Ge,Pe.__webglTexture),pe(Ge,Rt),Qe(ee.__webglFramebuffer,G,Rt,r.COLOR_ATTACHMENT0+Ye,Ge,0),y(Rt)&&_(Ge)}t.unbindTexture()}else{let Ye=r.TEXTURE_2D;if((G.isWebGL3DRenderTarget||G.isWebGLArrayRenderTarget)&&(Ye=G.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Ye,me.__webglTexture),pe(Ye,R),R.mipmaps&&R.mipmaps.length>0)for(let ft=0;ft<R.mipmaps.length;ft++)Qe(ee.__webglFramebuffer[ft],G,R,r.COLOR_ATTACHMENT0,Ye,ft);else Qe(ee.__webglFramebuffer,G,R,r.COLOR_ATTACHMENT0,Ye,0);y(R)&&_(Ye),t.unbindTexture()}G.depthBuffer&&Dt(G)}function Te(G){const R=G.textures;for(let ee=0,me=R.length;ee<me;ee++){const Ce=R[ee];if(y(Ce)){const ge=M(G),ht=n.get(Ce).__webglTexture;t.bindTexture(ge,ht),_(ge),t.unbindTexture()}}}const Ue=[],Ie=[];function $e(G){if(G.samples>0){if(At(G)===!1){const R=G.textures,ee=G.width,me=G.height;let Ce=r.COLOR_BUFFER_BIT;const ge=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ht=n.get(G),Ye=R.length>1;if(Ye)for(let Rt=0;Rt<R.length;Rt++)t.bindFramebuffer(r.FRAMEBUFFER,ht.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Rt,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,ht.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Rt,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,ht.__webglMultisampledFramebuffer);const ft=G.texture.mipmaps;ft&&ft.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,ht.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,ht.__webglFramebuffer);for(let Rt=0;Rt<R.length;Rt++){if(G.resolveDepthBuffer&&(G.depthBuffer&&(Ce|=r.DEPTH_BUFFER_BIT),G.stencilBuffer&&G.resolveStencilBuffer&&(Ce|=r.STENCIL_BUFFER_BIT)),Ye){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,ht.__webglColorRenderbuffer[Rt]);const Pe=n.get(R[Rt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Pe,0)}r.blitFramebuffer(0,0,ee,me,0,0,ee,me,Ce,r.NEAREST),u===!0&&(Ue.length=0,Ie.length=0,Ue.push(r.COLOR_ATTACHMENT0+Rt),G.depthBuffer&&G.resolveDepthBuffer===!1&&(Ue.push(ge),Ie.push(ge),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Ie)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Ue))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ye)for(let Rt=0;Rt<R.length;Rt++){t.bindFramebuffer(r.FRAMEBUFFER,ht.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Rt,r.RENDERBUFFER,ht.__webglColorRenderbuffer[Rt]);const Pe=n.get(R[Rt]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,ht.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Rt,r.TEXTURE_2D,Pe,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,ht.__webglMultisampledFramebuffer)}else if(G.depthBuffer&&G.resolveDepthBuffer===!1&&u){const R=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[R])}}}function H(G){return Math.min(i.maxSamples,G.samples)}function At(G){const R=n.get(G);return G.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function tt(G){const R=a.render.frame;f.get(G)!==R&&(f.set(G,R),G.update())}function Tt(G,R){const ee=G.colorSpace,me=G.format,Ce=G.type;return G.isCompressedTexture===!0||G.isVideoTexture===!0||ee!==as&&ee!==xr&&(nn.getTransfer(ee)===dn?(me!==ni||Ce!==Rn)&&nt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):bt("WebGLTextures: Unsupported texture color space:",ee)),R}function We(G){return typeof HTMLImageElement<"u"&&G instanceof HTMLImageElement?(h.width=G.naturalWidth||G.width,h.height=G.naturalHeight||G.height):typeof VideoFrame<"u"&&G instanceof VideoFrame?(h.width=G.displayWidth,h.height=G.displayHeight):(h.width=G.width,h.height=G.height),h}this.allocateTextureUnit=J,this.resetTextureUnits=V,this.setTexture2D=oe,this.setTexture2DArray=q,this.setTexture3D=ue,this.setTextureCube=z,this.rebindTextures=Zt,this.setupRenderTarget=_t,this.updateRenderTargetMipmap=Te,this.updateMultisampleRenderTarget=$e,this.setupDepthRenderbuffer=Dt,this.setupFrameBufferTexture=Qe,this.useMultisampledRTT=At,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Ny(r,e){function t(n,i=xr){let s;const a=nn.getTransfer(i);if(n===Rn)return r.UNSIGNED_BYTE;if(n===rf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===sf)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Em)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===wm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Sm)return r.BYTE;if(n===Mm)return r.SHORT;if(n===Lo)return r.UNSIGNED_SHORT;if(n===nf)return r.INT;if(n===Ji)return r.UNSIGNED_INT;if(n===In)return r.FLOAT;if(n===Vn)return r.HALF_FLOAT;if(n===bm)return r.ALPHA;if(n===Tm)return r.RGB;if(n===ni)return r.RGBA;if(n===Gr)return r.DEPTH_COMPONENT;if(n===ts)return r.DEPTH_STENCIL;if(n===oc)return r.RED;if(n===lc)return r.RED_INTEGER;if(n===Ra)return r.RG;if(n===af)return r.RG_INTEGER;if(n===of)return r.RGBA_INTEGER;if(n===Ol||n===Gl||n===Hl||n===zl)if(a===dn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ol)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Gl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Hl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===zl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ol)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Gl)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Hl)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===zl)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ph||n===mh||n===gh||n===vh)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ph)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===mh)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===gh)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===vh)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_h||n===xh||n===yh||n===Ah||n===Sh||n===Mh||n===Eh)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_h||n===xh)return a===dn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===yh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ah)return s.COMPRESSED_R11_EAC;if(n===Sh)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Mh)return s.COMPRESSED_RG11_EAC;if(n===Eh)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===wh||n===bh||n===Th||n===Ch||n===Rh||n===Ih||n===Bh||n===Ph||n===Dh||n===Lh||n===Fh||n===Uh||n===Nh||n===Oh)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===wh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===bh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Th)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ch)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Rh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ih)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Bh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ph)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Dh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Lh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Fh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Uh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Nh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Oh)return a===dn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Gh||n===Hh||n===zh)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Gh)return a===dn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Hh)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===zh)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===kh||n===Vh||n===Wh||n===Xh)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===kh)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Vh)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Xh)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ca?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const IR=` 3996void main() { 3997 3998 gl_Position = vec4( position, 1.0 ); 3999 4000}`,BR=` 4001uniform sampler2DArray depthColor; 4002uniform float depthWidth; 4003uniform float depthHeight; 4004 4005void main() { 4006 4007 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4008 4009 if ( coord.x >= 1.0 ) { 4010 4011 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4012 4013 } else { 4014 4015 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4016 4017 } 4018 4019}`;class PR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new zm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Bn({vertexShader:IR,fragmentShader:BR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ot(new ki(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class DR extends Ki{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",u=1,h=null,f=null,d=null,p=null,g=null,v=null;const A=typeof XRWebGLBinding<"u",y=new PR,_={},M=t.getContextAttributes();let E=null,w=null;const B=[],P=[],D=new _e;let F=null;const b=new En;b.viewport=new gn;const C=new En;C.viewport=new gn;const U=[b,C],V=new Ty;let J=null,Q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ae=B[le];return Ae===void 0&&(Ae=new ih,B[le]=Ae),Ae.getTargetRaySpace()},this.getControllerGrip=function(le){let Ae=B[le];return Ae===void 0&&(Ae=new ih,B[le]=Ae),Ae.getGripSpace()},this.getHand=function(le){let Ae=B[le];return Ae===void 0&&(Ae=new ih,B[le]=Ae),Ae.getHandSpace()};function oe(le){const Ae=P.indexOf(le.inputSource);if(Ae===-1)return;const Qe=B[Ae];Qe!==void 0&&(Qe.update(le.inputSource,le.frame,h||a),Qe.dispatchEvent({type:le.type,data:le.inputSource}))}function q(){i.removeEventListener("select",oe),i.removeEventListener("selectstart",oe),i.removeEventListener("selectend",oe),i.removeEventListener("squeeze",oe),i.removeEventListener("squeezestart",oe),i.removeEventListener("squeezeend",oe),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",ue);for(let le=0;le<B.length;le++){const Ae=P[le];Ae!==null&&(P[le]=null,B[le].disconnect(Ae))}J=null,Q=null,y.reset();for(const le in _)delete _[le];e.setRenderTarget(E),g=null,p=null,d=null,i=null,w=null,xt.stop(),n.isPresenting=!1,e.setPixelRatio(F),e.setSize(D.width,D.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){s=le,n.isPresenting===!0&&nt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){o=le,n.isPresenting===!0&&nt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(le){h=le},this.getBaseLayer=function(){return p!==null?p:g},this.getBinding=function(){return d===null&&A&&(d=new XRWebGLBinding(i,t)),d},this.getFrame=function(){return v},this.getSession=function(){return i},this.setSession=async function(le){if(i=le,i!==null){if(E=e.getRenderTarget(),i.addEventListener("select",oe),i.addEventListener("selectstart",oe),i.addEventListener("selectend",oe),i.addEventListener("squeeze",oe),i.addEventListener("squeezestart",oe),i.addEventListener("squeezeend",oe),i.addEventListener("end",q),i.addEventListener("inputsourceschange",ue),M.xrCompatible!==!0&&await t.makeXRCompatible(),F=e.getPixelRatio(),e.getSize(D),A&&"createProjectionLayer"in XRWebGLBinding.prototype){let Qe=null,yt=null,st=null;M.depth&&(st=M.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Qe=M.stencil?ts:Gr,yt=M.stencil?Ca:Ji);const Dt={colorFormat:t.RGBA8,depthFormat:st,scaleFactor:s};d=this.getBinding(),p=d.createProjectionLayer(Dt),i.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),w=new bn(p.textureWidth,p.textureHeight,{format:ni,type:Rn,depthTexture:new Ba(p.textureWidth,p.textureHeight,yt,void 0,void 0,void 0,void 0,void 0,void 0,Qe),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const Qe={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,Qe),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),w=new bn(g.framebufferWidth,g.framebufferHeight,{format:ni,type:Rn,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(u),h=null,a=await i.requestReferenceSpace(o),xt.setContext(i),xt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function ue(le){for(let Ae=0;Ae<le.removed.length;Ae++){const Qe=le.removed[Ae],yt=P.indexOf(Qe);yt>=0&&(P[yt]=null,B[yt].disconnect(Qe))}for(let Ae=0;Ae<le.added.length;Ae++){const Qe=le.added[Ae];let yt=P.indexOf(Qe);if(yt===-1){for(let Dt=0;Dt<B.length;Dt++)if(Dt>=P.length){P.push(Qe),yt=Dt;break}else if(P[Dt]===null){P[Dt]=Qe,yt=Dt;break}if(yt===-1)break}const st=B[yt];st&&st.connect(Qe)}}const z=new N,ne=new N;function Y(le,Ae,Qe){z.setFromMatrixPosition(Ae.matrixWorld),ne.setFromMatrixPosition(Qe.matrixWorld);const yt=z.distanceTo(ne),st=Ae.projectionMatrix.elements,Dt=Qe.projectionMatrix.elements,Zt=st[14]/(st[10]-1),_t=st[14]/(st[10]+1),Te=(st[9]+1)/st[5],Ue=(st[9]-1)/st[5],Ie=(st[8]-1)/st[0],$e=(Dt[8]+1)/Dt[0],H=Zt*Ie,At=Zt*$e,tt=yt/(-Ie+$e),Tt=tt*-Ie;if(Ae.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(Tt),le.translateZ(tt),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),st[10]===-1)le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse);else{const We=Zt+tt,G=_t+tt,R=H-Tt,ee=At+(yt-Tt),me=Te*_t/G*We,Ce=Ue*_t/G*We;le.projectionMatrix.makePerspective(R,ee,me,Ce,We,G),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function se(le,Ae){Ae===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ae.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ae=le.near,Qe=le.far;y.texture!==null&&(y.depthNear>0&&(Ae=y.depthNear),y.depthFar>0&&(Qe=y.depthFar)),V.near=C.near=b.near=Ae,V.far=C.far=b.far=Qe,(J!==V.near||Q!==V.far)&&(i.updateRenderState({depthNear:V.near,depthFar:V.far}),J=V.near,Q=V.far),V.layers.mask=le.layers.mask|6,b.layers.mask=V.layers.mask&3,C.layers.mask=V.layers.mask&5;const yt=le.parent,st=V.cameras;se(V,yt);for(let Dt=0;Dt<st.length;Dt++)se(st[Dt],yt);st.length===2?Y(V,b,C):V.projectionMatrix.copy(b.projectionMatrix),pe(le,V,yt)};function pe(le,Ae,Qe){Qe===null?le.matrix.copy(Ae.matrixWorld):(le.matrix.copy(Qe.matrixWorld),le.matrix.invert(),le.matrix.multiply(Ae.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(Ae.projectionMatrix),le.projectionMatrixInverse.copy(Ae.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=Go*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(p===null&&g===null))return u},this.setFoveation=function(le){u=le,p!==null&&(p.fixedFoveation=le),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=le)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(V)},this.getCameraTexture=function(le){return _[le]};let we=null;function $(le,Ae){if(f=Ae.getViewerPose(h||a),v=Ae,f!==null){const Qe=f.views;g!==null&&(e.setRenderTargetFramebuffer(w,g.framebuffer),e.setRenderTarget(w));let yt=!1;Qe.length!==V.cameras.length&&(V.cameras.length=0,yt=!0);for(let _t=0;_t<Qe.length;_t++){const Te=Qe[_t];let Ue=null;if(g!==null)Ue=g.getViewport(Te);else{const $e=d.getViewSubImage(p,Te);Ue=$e.viewport,_t===0&&(e.setRenderTargetTextures(w,$e.colorTexture,$e.depthStencilTexture),e.setRenderTarget(w))}let Ie=U[_t];Ie===void 0&&(Ie=new En,Ie.layers.enable(_t),Ie.viewport=new gn,U[_t]=Ie),Ie.matrix.fromArray(Te.transform.matrix),Ie.matrix.decompose(Ie.position,Ie.quaternion,Ie.scale),Ie.projectionMatrix.fromArray(Te.projectionMatrix),Ie.projectionMatrixInverse.copy(Ie.projectionMatrix).invert(),Ie.viewport.set(Ue.x,Ue.y,Ue.width,Ue.height),_t===0&&(V.matrix.copy(Ie.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),yt===!0&&V.cameras.push(Ie)}const st=i.enabledFeatures;if(st&&st.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&A){d=n.getBinding();const _t=d.getDepthInformation(Qe[0]);_t&&_t.isValid&&_t.texture&&y.init(_t,i.renderState)}if(st&&st.includes("camera-access")&&A){e.state.unbindTexture(),d=n.getBinding();for(let _t=0;_t<Qe.length;_t++){const Te=Qe[_t].camera;if(Te){let Ue=_[Te];Ue||(Ue=new zm,_[Te]=Ue);const Ie=d.getCameraImage(Te);Ue.sourceTexture=Ie}}}}for(let Qe=0;Qe<B.length;Qe++){const yt=P[Qe],st=B[Qe];yt!==null&&st!==void 0&&st.update(yt,Ae,h||a)}we&&we(le,Ae),Ae.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ae}),v=null}const xt=new Py;xt.setAnimationLoop($),this.setAnimationLoop=function(le){we=le},this.dispose=function(){}}}const ca=new Li,LR=new It;function FR(r,e){function t(y,_){y.matrixAutoUpdate===!0&&y.updateMatrix(),_.value.copy(y.matrix
vendor: 2,315 bytes, line 4019
4019)}function n(y,_){_.color.getRGB(y.fogColor.value,Vx(r)),_.isFog?(y.fogNear.value=_.near,y.fogFar.value=_.far):_.isFogExp2&&(y.fogDensity.value=_.density)}function i(y,_,M,E,w){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(y,_):_.isMeshToonMaterial?(s(y,_),d(y,_)):_.isMeshPhongMaterial?(s(y,_),f(y,_)):_.isMeshStandardMaterial?(s(y,_),p(y,_),_.isMeshPhysicalMaterial&&g(y,_,w)):_.isMeshMatcapMaterial?(s(y,_),v(y,_)):_.isMeshDepthMaterial?s(y,_):_.isMeshDistanceMaterial?(s(y,_),A(y,_)):_.isMeshNormalMaterial?s(y,_):_.isLineBasicMaterial?(a(y,_),_.isLineDashedMaterial&&o(y,_)):_.isPointsMaterial?u(y,_,M,E):_.isSpriteMaterial?h(y,_):_.isShadowMaterial?(y.color.value.copy(_.color),y.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(y,_){y.opacity.value=_.opacity,_.color&&y.diffuse.value.copy(_.color),_.emissive&&y.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.bumpMap&&(y.bumpMap.value=_.bumpMap,t(_.bumpMap,y.bumpMapTransform),y.bumpScale.value=_.bumpScale,_.side===Hn&&(y.bumpScale.value*=-1)),_.normalMap&&(y.normalMap.value=_.normalMap,t(_.normalMap,y.normalMapTransform),y.normalScale.value.copy(_.normalScale),_.side===Hn&&y.normalScale.value.negate()),_.displacementMap&&(y.displacementMap.value=_.displacementMap,t(_.displacementMap,y.displacementMapTransform),y.displacementScale.value=_.displacementScale,y.displacementBias.value=_.displacementBias),_.emissiveMap&&(y.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,y.emissiveMapTransform)),_.specularMap&&(y.specularMap.value=_.specularMap,t(_.specularMap,y.specularMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest);const M=e.get(_),E=M.envMap,w=M.envMapRotation;E&&(y.envMap.value=E,ca.copy(w),ca.x*=-1,ca.y*=-1,ca.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),y.envMapRotation.value.setFromMatrix4(LR.makeRotationFromEuler(ca)),y.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=_.reflectivity,y.ior.value=_.ior,y.refractionRatio.value=_.refractionRatio),_.lightMap&&(y.lightMap.value=_.lightMap,y.lightMapIntensity.value=_.lightMapIntensity,t(_.lightMap,y.lightMapTransform)),_.ao
vendor: 47,505 bytes, line 4019
4019Map&&(y.aoMap.value=_.aoMap,y.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,y.aoMapTransform))}function a(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform))}function o(y,_){y.dashSize.value=_.dashSize,y.totalSize.value=_.dashSize+_.gapSize,y.scale.value=_.scale}function u(y,_,M,E){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.size.value=_.size*M,y.scale.value=E*.5,_.map&&(y.map.value=_.map,t(_.map,y.uvTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function h(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.rotation.value=_.rotation,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function f(y,_){y.specular.value.copy(_.specular),y.shininess.value=Math.max(_.shininess,1e-4)}function d(y,_){_.gradientMap&&(y.gradientMap.value=_.gradientMap)}function p(y,_){y.metalness.value=_.metalness,_.metalnessMap&&(y.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,y.metalnessMapTransform)),y.roughness.value=_.roughness,_.roughnessMap&&(y.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,y.roughnessMapTransform)),_.envMap&&(y.envMapIntensity.value=_.envMapIntensity)}function g(y,_,M){y.ior.value=_.ior,_.sheen>0&&(y.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),y.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(y.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,y.sheenColorMapTransform)),_.sheenRoughnessMap&&(y.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,y.sheenRoughnessMapTransform))),_.clearcoat>0&&(y.clearcoat.value=_.clearcoat,y.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(y.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,y.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(y.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===Hn&&y.clearcoatNormalScale.value.negate())),_.dispersion>0&&(y.dispersion.value=_.dispersion),_.iridescence>0&&(y.iridescence.value=_.iridescence,y.iridescenceIOR.value=_.iridescenceIOR,y.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(y.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,y.iridescenceMapTransform)),_.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),_.transmission>0&&(y.transmission.value=_.transmission,y.transmissionSamplerMap.value=M.texture,y.transmissionSamplerSize.value.set(M.width,M.height),_.transmissionMap&&(y.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,y.transmissionMapTransform)),y.thickness.value=_.thickness,_.thicknessMap&&(y.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=_.attenuationDistance,y.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(y.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(y.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=_.specularIntensity,y.specularColor.value.copy(_.specularColor),_.specularColorMap&&(y.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,y.specularColorMapTransform)),_.specularIntensityMap&&(y.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,y.specularIntensityMapTransform))}function v(y,_){_.matcap&&(y.matcap.value=_.matcap)}function A(y,_){const M=e.get(_).light;y.referencePosition.value.setFromMatrixPosition(M.matrixWorld),y.nearDistance.value=M.shadow.camera.near,y.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function UR(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function u(M,E){const w=E.program;n.uniformBlockBinding(M,w)}function h(M,E){let w=i[M.id];w===void 0&&(v(M),w=f(M),i[M.id]=w,M.addEventListener("dispose",y));const B=E.program;n.updateUBOMapping(M,B);const P=e.render.frame;s[M.id]!==P&&(p(M),s[M.id]=P)}function f(M){const E=d();M.__bindingPointIndex=E;const w=r.createBuffer(),B=M.__size,P=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,B,P),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,E,w),w}function d(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return bt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(M){const E=i[M.id],w=M.uniforms,B=M.__cache;r.bindBuffer(r.UNIFORM_BUFFER,E);for(let P=0,D=w.length;P<D;P++){const F=Array.isArray(w[P])?w[P]:[w[P]];for(let b=0,C=F.length;b<C;b++){const U=F[b];if(g(U,P,b,B)===!0){const V=U.__offset,J=Array.isArray(U.value)?U.value:[U.value];let Q=0;for(let oe=0;oe<J.length;oe++){const q=J[oe],ue=A(q);typeof q=="number"||typeof q=="boolean"?(U.__data[0]=q,r.bufferSubData(r.UNIFORM_BUFFER,V+Q,U.__data)):q.isMatrix3?(U.__data[0]=q.elements[0],U.__data[1]=q.elements[1],U.__data[2]=q.elements[2],U.__data[3]=0,U.__data[4]=q.elements[3],U.__data[5]=q.elements[4],U.__data[6]=q.elements[5],U.__data[7]=0,U.__data[8]=q.elements[6],U.__data[9]=q.elements[7],U.__data[10]=q.elements[8],U.__data[11]=0):(q.toArray(U.__data,Q),Q+=ue.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,U.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(M,E,w,B){const P=M.value,D=E+"_"+w;if(B[D]===void 0)return typeof P=="number"||typeof P=="boolean"?B[D]=P:B[D]=P.clone(),!0;{const F=B[D];if(typeof P=="number"||typeof P=="boolean"){if(F!==P)return B[D]=P,!0}else if(F.equals(P)===!1)return F.copy(P),!0}return!1}function v(M){const E=M.uniforms;let w=0;const B=16;for(let D=0,F=E.length;D<F;D++){const b=Array.isArray(E[D])?E[D]:[E[D]];for(let C=0,U=b.length;C<U;C++){const V=b[C],J=Array.isArray(V.value)?V.value:[V.value];for(let Q=0,oe=J.length;Q<oe;Q++){const q=J[Q],ue=A(q),z=w%B,ne=z%ue.boundary,Y=z+ne;w+=ne,Y!==0&&B-Y<ue.storage&&(w+=B-Y),V.__data=new Float32Array(ue.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=w,w+=ue.storage}}}const P=w%B;return P>0&&(w+=B-P),M.__size=w,M.__cache={},this}function A(M){const E={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(E.boundary=4,E.storage=4):M.isVector2?(E.boundary=8,E.storage=8):M.isVector3||M.isColor?(E.boundary=16,E.storage=12):M.isVector4?(E.boundary=16,E.storage=16):M.isMatrix3?(E.boundary=48,E.storage=48):M.isMatrix4?(E.boundary=64,E.storage=64):M.isTexture?nt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):nt("WebGLRenderer: Unsupported uniform value type.",M),E}function y(M){const E=M.target;E.removeEventListener("dispose",y);const w=a.indexOf(E.__bindingPointIndex);a.splice(w,1),r.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function _(){for(const M in i)r.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:u,update:h,dispose:_}}const NR=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,14942,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]);let Ur=null;function OR(){return Ur===null&&(Ur=new Ar(NR,16,16,Ra,Vn),Ur.name="DFG_LUT",Ur.minFilter=rn,Ur.magFilter=rn,Ur.wrapS=wi,Ur.wrapT=wi,Ur.generateMipmaps=!1,Ur.needsUpdate=!0),Ur}class Oy{constructor(e={}){const{canvas:t=Gx(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:p=!1,outputBufferType:g=Rn}=e;this.isWebGLRenderer=!0;let v;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=n.getContextAttributes().alpha}else v=a;const A=g,y=new Set([of,af,lc]),_=new Set([Rn,Ji,Lo,Ca,rf,sf]),M=new Uint32Array(4),E=new Int32Array(4);let w=null,B=null;const P=[],D=[];let F=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Wi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const b=this;let C=!1;this._outputColorSpace=pn;let U=0,V=0,J=null,Q=-1,oe=null;const q=new gn,ue=new gn;let z=null;const ne=new je(0);let Y=0,se=t.width,pe=t.height,we=1,$=null,xt=null;const le=new gn(0,0,se,pe),Ae=new gn(0,0,se,pe);let Qe=!1;const yt=new Xo;let st=!1,Dt=!1;const Zt=new It,_t=new N,Te=new gn,Ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ie=!1;function $e(){return J===null?we:1}let H=n;function At(L,W){return t.getContext(L,W)}try{const L={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:f,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ua}`),t.addEventListener("webglcontextlost",Mt,!1),t.addEventListener("webglcontextrestored",jt,!1),t.addEventListener("webglcontextcreationerror",Wt,!1),H===null){const W="webgl2";if(H=At(W,L),H===null)throw At(W)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(L){throw bt("WebGLRenderer: "+L.message),L}let tt,Tt,We,G,R,ee,me,Ce,ge,ht,Ye,ft,Rt,Pe,Ge,ut,X,ce,De,K,he,Le,et,Oe;function be(){tt=new GT(H),tt.init(),Le=new Ny(H,tt),Tt=new IT(H,tt,e,Le),We=new CR(H,tt),Tt.reversedDepthBuffer&&p&&We.buffers.depth.setReversed(!0),G=new kT(H),R=new dR,ee=new RR(H,tt,We,R,Tt,Le,G),me=new PT(b),Ce=new OT(b),ge=new J1(H),et=new CT(H,ge),ht=new HT(H,ge,G,et),Ye=new WT(H,ht,ge,G),De=new VT(H,Tt,ee),ut=new BT(R),ft=new fR(b,me,Ce,tt,Tt,et,ut),Rt=new FR(b,R),Pe=new mR,Ge=new AR(tt),ce=new TT(b,me,Ce,We,Ye,v,u),X=new bR(b,Ye,Tt),Oe=new UR(H,G,Tt,We),K=new RT(H,tt,G),he=new zT(H,tt,G),G.programs=ft.programs,b.capabilities=Tt,b.extensions=tt,b.properties=R,b.renderLists=Pe,b.shadowMap=X,b.state=We,b.info=G}be(),A!==Rn&&(F=new JT(A,t.width,t.height,i,s));const He=new DR(b,H);this.xr=He,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const L=tt.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=tt.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return we},this.setPixelRatio=function(L){L!==void 0&&(we=L,this.setSize(se,pe,!1))},this.getSize=function(L){return L.set(se,pe)},this.setSize=function(L,W,te=!0){if(He.isPresenting){nt("WebGLRenderer: Can't change size while VR device is presenting.");return}se=L,pe=W,t.width=Math.floor(L*we),t.height=Math.floor(W*we),te===!0&&(t.style.width=L+"px",t.style.height=W+"px"),F!==null&&F.setSize(t.width,t.height),this.setViewport(0,0,L,W)},this.getDrawingBufferSize=function(L){return L.set(se*we,pe*we).floor()},this.setDrawingBufferSize=function(L,W,te){se=L,pe=W,we=te,t.width=Math.floor(L*te),t.height=Math.floor(W*te),this.setViewport(0,0,L,W)},this.setEffects=function(L){if(A===Rn){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(L){for(let W=0;W<L.length;W++)if(L[W].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}F.setEffects(L||[])},this.getCurrentViewport=function(L){return L.copy(q)},this.getViewport=function(L){return L.copy(le)},this.setViewport=function(L,W,te,ie){L.isVector4?le.set(L.x,L.y,L.z,L.w):le.set(L,W,te,ie),We.viewport(q.copy(le).multiplyScalar(we).round())},this.getScissor=function(L){return L.copy(Ae)},this.setScissor=function(L,W,te,ie){L.isVector4?Ae.set(L.x,L.y,L.z,L.w):Ae.set(L,W,te,ie),We.scissor(ue.copy(Ae).multiplyScalar(we).round())},this.getScissorTest=function(){return Qe},this.setScissorTest=function(L){We.setScissorTest(Qe=L)},this.setOpaqueSort=function(L){$=L},this.setTransparentSort=function(L){xt=L},this.getClearColor=function(L){return L.copy(ce.getClearColor())},this.setClearColor=function(){ce.setClearColor(...arguments)},this.getClearAlpha=function(){return ce.getClearAlpha()},this.setClearAlpha=function(){ce.setClearAlpha(...arguments)},this.clear=function(L=!0,W=!0,te=!0){let ie=0;if(L){let j=!1;if(J!==null){const Re=J.texture.format;j=y.has(Re)}if(j){const Re=J.texture.type,Fe=_.has(Re),Ee=ce.getClearColor(),Be=ce.getClearAlpha(),ze=Ee.r,it=Ee.g,ke=Ee.b;Fe?(M[0]=ze,M[1]=it,M[2]=ke,M[3]=Be,H.clearBufferuiv(H.COLOR,0,M)):(E[0]=ze,E[1]=it,E[2]=ke,E[3]=Be,H.clearBufferiv(H.COLOR,0,E))}else ie|=H.COLOR_BUFFER_BIT}W&&(ie|=H.DEPTH_BUFFER_BIT),te&&(ie|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Mt,!1),t.removeEventListener("webglcontextrestored",jt,!1),t.removeEventListener("webglcontextcreationerror",Wt,!1),ce.dispose(),Pe.dispose(),Ge.dispose(),R.dispose(),me.dispose(),Ce.dispose(),Ye.dispose(),et.dispose(),Oe.dispose(),ft.dispose(),He.dispose(),He.removeEventListener("sessionstart",br),He.removeEventListener("sessionend",Ti),Ut.stop()};function Mt(L){L.preventDefault(),$l("WebGLRenderer: Context Lost."),C=!0}function jt(){$l("WebGLRenderer: Context Restored."),C=!1;const L=G.autoReset,W=X.enabled,te=X.autoUpdate,ie=X.needsUpdate,j=X.type;be(),G.autoReset=L,X.enabled=W,X.autoUpdate=te,X.needsUpdate=ie,X.type=j}function Wt(L){bt("WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function Pn(L){const W=L.target;W.removeEventListener("dispose",Pn),Jn(W)}function Jn(L){Zo(L),R.remove(L)}function Zo(L){const W=R.get(L).programs;W!==void 0&&(W.forEach(function(te){ft.releaseProgram(te)}),L.isShaderMaterial&&ft.releaseShaderCache(L))}this.renderBufferDirect=function(L,W,te,ie,j,Re){W===null&&(W=Ue);const Fe=j.isMesh&&j.matrixWorld.determinant()<0,Ee=Ve(L,W,te,ie,j);We.setMaterial(ie,Fe);let Be=te.index,ze=1;if(ie.wireframe===!0){if(Be=ht.getWireframeAttribute(te),Be===void 0)return;ze=2}const it=te.drawRange,ke=te.attributes.position;let mt=it.start*ze,Nt=(it.start+it.count)*ze;Re!==null&&(mt=Math.max(mt,Re.start*ze),Nt=Math.min(Nt,(Re.start+Re.count)*ze)),Be!==null?(mt=Math.max(mt,0),Nt=Math.min(Nt,Be.count)):ke!=null&&(mt=Math.max(mt,0),Nt=Math.min(Nt,ke.count));const Ot=Nt-mt;if(Ot<0||Ot===1/0)return;et.setup(j,ie,Ee,te,Be);let Xt,Et=K;if(Be!==null&&(Xt=ge.get(Be),Et=he,Et.setIndex(Xt)),j.isMesh)ie.wireframe===!0?(We.setLineWidth(ie.wireframeLinewidth*$e()),Et.setMode(H.LINES)):Et.setMode(H.TRIANGLES);else if(j.isLine){let lt=ie.linewidth;lt===void 0&&(lt=1),We.setLineWidth(lt*$e()),j.isLineSegments?Et.setMode(H.LINES):j.isLineLoop?Et.setMode(H.LINE_LOOP):Et.setMode(H.LINE_STRIP)}else j.isPoints?Et.setMode(H.POINTS):j.isSprite&&Et.setMode(H.TRIANGLES);if(j.isBatchedMesh)if(j._multiDrawInstances!==null)Oo("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Et.renderMultiDrawInstances(j._multiDrawStarts,j._multiDrawCounts,j._multiDrawCount,j._multiDrawInstances);else if(tt.get("WEBGL_multi_draw"))Et.renderMultiDraw(j._multiDrawStarts,j._multiDrawCounts,j._multiDrawCount);else{const lt=j._multiDrawStarts,St=j._multiDrawCounts,gt=j._multiDrawCount,Qt=Be?ge.get(Be).bytesPerElement:1,ai=R.get(ie).currentProgram.getUniforms();for(let mn=0;mn<gt;mn++)ai.setValue(H,"_gl_DrawID",mn),Et.render(lt[mn]/Qt,St[mn])}else if(j.isInstancedMesh)Et.renderInstances(mt,Ot,j.count);else if(te.isInstancedBufferGeometry){const lt=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,St=Math.min(te.instanceCount,lt);Et.renderInstances(mt,Ot,St)}else Et.render(mt,Ot)};function za(L,W,te){L.transparent===!0&&L.side===$n&&L.forceSinglePass===!1?(L.side=Hn,L.needsUpdate=!0,fe(L,W,te),L.side=Mr,L.needsUpdate=!0,fe(L,W,te),L.side=$n):fe(L,W,te)}this.compile=function(L,W,te=null){te===null&&(te=L),B=Ge.get(te),B.init(W),D.push(B),te.traverseVisible(function(j){j.isLight&&j.layers.test(W.layers)&&(B.pushLight(j),j.castShadow&&B.pushShadow(j))}),L!==te&&L.traverseVisible(function(j){j.isLight&&j.layers.test(W.layers)&&(B.pushLight(j),j.castShadow&&B.pushShadow(j))}),B.setupLights();const ie=new Set;return L.traverse(function(j){if(!(j.isMesh||j.isPoints||j.isLine||j.isSprite))return;const Re=j.material;if(Re)if(Array.isArray(Re))for(let Fe=0;Fe<Re.length;Fe++){const Ee=Re[Fe];za(Ee,te,j),ie.add(Ee)}else za(Re,te,j),ie.add(Re)}),B=D.pop(),ie},this.compileAsync=function(L,W,te=null){const ie=this.compile(L,W,te);return new Promise(j=>{function Re(){if(ie.forEach(function(Fe){R.get(Fe).currentProgram.isReady()&&ie.delete(Fe)}),ie.size===0){j(L);return}setTimeout(Re,10)}tt.get("KHR_parallel_shader_compile")!==null?Re():setTimeout(Re,10)})};let ur=null;function Hs(L){ur&&ur(L)}function br(){Ut.stop()}function Ti(){Ut.start()}const Ut=new Py;Ut.setAnimationLoop(Hs),typeof self<"u"&&Ut.setContext(self),this.setAnimationLoop=function(L){ur=L,He.setAnimationLoop(L),L===null?Ut.stop():Ut.start()},He.addEventListener("sessionstart",br),He.addEventListener("sessionend",Ti),this.render=function(L,W){if(W!==void 0&&W.isCamera!==!0){bt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;const te=He.enabled===!0&&He.isPresenting===!0,ie=F!==null&&(J===null||te)&&F.begin(b,J);if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),He.enabled===!0&&He.isPresenting===!0&&(F===null||F.isCompositing()===!1)&&(He.cameraAutoUpdate===!0&&He.updateCamera(W),W=He.getCamera()),L.isScene===!0&&L.onBeforeRender(b,L,W,J),B=Ge.get(L,D.length),B.init(W),D.push(B),Zt.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),yt.setFromProjectionMatrix(Zt,Vi,W.reversedDepth),Dt=this.localClippingEnabled,st=ut.init(this.clippingPlanes,Dt),w=Pe.get(L,P.length),w.init(),P.push(w),He.enabled===!0&&He.isPresenting===!0){const Fe=b.xr.getDepthSensingMesh();Fe!==null&&os(Fe,W,-1/0,b.sortObjects)}os(L,W,0,b.sortObjects),w.finish(),b.sortObjects===!0&&w.sort($,xt),Ie=He.enabled===!1||He.isPresenting===!1||He.hasDepthSensing()===!1,Ie&&ce.addToRenderList(w,L),this.info.render.frame++,st===!0&&ut.beginShadows();const j=B.state.shadowsArray;if(X.render(j,L,W),st===!0&&ut.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ie&&F.hasRenderPass())===!1){const Fe=w.opaque,Ee=w.transmissive;if(B.setupLights(),W.isArrayCamera){const Be=W.cameras;if(Ee.length>0)for(let ze=0,it=Be.length;ze<it;ze++){const ke=Be[ze];I(Fe,Ee,L,ke)}Ie&&ce.render(L);for(let ze=0,it=Be.length;ze<it;ze++){const ke=Be[ze];ka(w,L,ke,ke.viewport)}}else Ee.length>0&&I(Fe,Ee,L,W),Ie&&ce.render(L),ka(w,L,W)}J!==null&&V===0&&(ee.updateMultisampleRenderTarget(J),ee.updateRenderTargetMipmap(J)),ie&&F.end(b),L.isScene===!0&&L.onAfterRender(b,L,W),et.resetDefaultState(),Q=-1,oe=null,D.pop(),D.length>0?(B=D[D.length-1],st===!0&&ut.setGlobalState(b.clippingPlanes,B.state.camera)):B=null,P.pop(),P.length>0?w=P[P.length-1]:w=null};function os(L,W,te,ie){if(L.visible===!1)return;if(L.layers.test(W.layers)){if(L.isGroup)te=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(W);else if(L.isLight)B.pushLight(L),L.castShadow&&B.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||yt.intersectsSprite(L)){ie&&Te.setFromMatrixPosition(L.matrixWorld).applyMatrix4(Zt);const Fe=Ye.update(L),Ee=L.material;Ee.visible&&w.push(L,Fe,Ee,te,Te.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(!L.frustumCulled||yt.intersectsObject(L))){const Fe=Ye.update(L),Ee=L.material;if(ie&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),Te.copy(L.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),Te.copy(Fe.boundingSphere.center)),Te.applyMatrix4(L.matrixWorld).applyMatrix4(Zt)),Array.isArray(Ee)){const Be=Fe.groups;for(let ze=0,it=Be.length;ze<it;ze++){const ke=Be[ze],mt=Ee[ke.materialIndex];mt&&mt.visible&&w.push(L,Fe,mt,te,Te.z,ke)}}else Ee.visible&&w.push(L,Fe,Ee,te,Te.z,null)}}const Re=L.children;for(let Fe=0,Ee=Re.length;Fe<Ee;Fe++)os(Re[Fe],W,te,ie)}function ka(L,W,te,ie){const{opaque:j,transmissive:Re,transparent:Fe}=L;B.setupLightsView(te),st===!0&&ut.setGlobalState(b.clippingPlanes,te),ie&&We.viewport(q.copy(ie)),j.length>0&&O(j,W,te),Re.length>0&&O(Re,W,te),Fe.length>0&&O(Fe,W,te),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function I(L,W,te,ie){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;if(B.state.transmissionRenderTarget[ie.id]===void 0){const mt=tt.has("EXT_color_buffer_half_float")||tt.has("EXT_color_buffer_float");B.state.transmissionRenderTarget[ie.id]=new bn(1,1,{generateMipmaps:!0,type:mt?Vn:Rn,minFilter:or,samples:Tt.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:nn.workingColorSpace})}const Re=B.state.transmissionRenderTarget[ie.id],Fe=ie.viewport||q;Re.setSize(Fe.z*b.transmissionResolutionScale,Fe.w*b.transmissionResolutionScale);const Ee=b.getRenderTarget(),Be=b.getActiveCubeFace(),ze=b.getActiveMipmapLevel();b.setRenderTarget(Re),b.getClearColor(ne),Y=b.getClearAlpha(),Y<1&&b.setClearColor(16777215,.5),b.clear(),Ie&&ce.render(te);const it=b.toneMapping;b.toneMapping=Wi;const ke=ie.viewport;if(ie.viewport!==void 0&&(ie.viewport=void 0),B.setupLightsView(ie),st===!0&&ut.setGlobalState(b.clippingPlanes,ie),O(L,te,ie),ee.updateMultisampleRenderTarget(Re),ee.updateRenderTargetMipmap(Re),tt.has("WEBGL_multisampled_render_to_texture")===!1){let mt=!1;for(let Nt=0,Ot=W.length;Nt<Ot;Nt++){const Xt=W[Nt],{object:Et,geometry:lt,material:St,group:gt}=Xt;if(St.side===$n&&Et.layers.test(ie.layers)){const Qt=St.side;St.side=Hn,St.needsUpdate=!0,Z(Et,te,ie,lt,St,gt),St.side=Qt,St.needsUpdate=!0,mt=!0}}mt===!0&&(ee.updateMultisampleRenderTarget(Re),ee.updateRenderTargetMipmap(Re))}b.setRenderTarget(Ee,Be,ze),b.setClearColor(ne,Y),ke!==void 0&&(ie.viewport=ke),b.toneMapping=it}function O(L,W,te){const ie=W.isScene===!0?W.overrideMaterial:null;for(let j=0,Re=L.length;j<Re;j++){const Fe=L[j],{object:Ee,geometry:Be,group:ze}=Fe;let it=Fe.material;it.allowOverride===!0&&ie!==null&&(it=ie),Ee.layers.test(te.layers)&&Z(Ee,W,te,Be,it,ze)}}function Z(L,W,te,ie,j,Re){L.onBeforeRender(b,W,te,ie,j,Re),L.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),j.onBeforeRender(b,W,te,ie,L,Re),j.transparent===!0&&j.side===$n&&j.forceSinglePass===!1?(j.side=Hn,j.needsUpdate=!0,b.renderBufferDirect(te,W,ie,j,L,Re),j.side=Mr,j.needsUpdate=!0,b.renderBufferDirect(te,W,ie,j,L,Re),j.side=$n):b.renderBufferDirect(te,W,ie,j,L,Re),L.onAfterRender(b,W,te,ie,j,Re)}function fe(L,W,te){W.isScene!==!0&&(W=Ue);const ie=R.get(L),j=B.state.lights,Re=B.state.shadowsArray,Fe=j.state.version,Ee=ft.getParameters(L,j.state,Re,W,te),Be=ft.getProgramCacheKey(Ee);let ze=ie.programs;ie.environment=L.isMeshStandardMaterial?W.environment:null,ie.fog=W.fog,ie.envMap=(L.isMeshStandardMaterial?Ce:me).get(L.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&L.envMap===null?W.environmentRotation:L.envMapRotation,ze===void 0&&(L.addEventListener("dispose",Pn),ze=new Map,ie.programs=ze);let it=ze.get(Be);if(it!==void 0){if(ie.currentProgram===it&&ie.lightsStateVersion===Fe)return ye(L,Ee),it}else Ee.uniforms=ft.getUniforms(L),L.onBeforeCompile(Ee,b),it=ft.acquireProgram(Ee,Be),ze.set(Be,it),ie.uniforms=Ee.uniforms;const ke=ie.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(ke.clippingPlanes=ut.uniform),ye(L,Ee),ie.needsLights=Ze(L),ie.lightsStateVersion=Fe,ie.needsLights&&(ke.ambientLightColor.value=j.state.ambient,ke.lightProbe.value=j.state.probe,ke.directionalLights.value=j.state.directional,ke.directionalLightShadows.value=j.state.directionalShadow,ke.spotLights.value=j.state.spot,ke.spotLightShadows.value=j.state.spotShadow,ke.rectAreaLights.value=j.state.rectArea,ke.ltc_1.value=j.state.rectAreaLTC1,ke.ltc_2.value=j.state.rectAreaLTC2,ke.pointLights.value=j.state.point,ke.pointLightShadows.value=j.state.pointShadow,ke.hemisphereLights.value=j.state.hemi,ke.directionalShadowMap.value=j.state.directionalShadowMap,ke.directionalShadowMatrix.value=j.state.directionalShadowMatrix,ke.spotShadowMap.value=j.state.spotShadowMap,ke.spotLightMatrix.value=j.state.spotLightMatrix,ke.spotLightMap.value=j.state.spotLightMap,ke.pointShadowMap.value=j.state.pointShadowMap,ke.pointShadowMatrix.value=j.state.pointShadowMatrix),ie.currentProgram=it,ie.uniformsList=null,it}function xe(L){if(L.uniformsList===null){const W=L.currentProgram.getUniforms();L.uniformsList=rh.seqWithValue(W.seq,L.uniforms)}return L.uniformsList}function ye(L,W){const te=R.get(L);te.outputColorSpace=W.outputColorSpace,te.batching=W.batching,te.batchingColor=W.batchingColor,te.instancing=W.instancing,te.instancingColor=W.instancingColor,te.instancingMorph=W.instancingMorph,te.skinning=W.skinning,te.morphTargets=W.morphTargets,te.morphNormals=W.morphNormals,te.morphColors=W.morphColors,te.morphTargetsCount=W.morphTargetsCount,te.numClippingPlanes=W.numClippingPlanes,te.numIntersection=W.numClipIntersection,te.vertexAlphas=W.vertexAlphas,te.vertexTangents=W.vertexTangents,te.toneMapping=W.toneMapping}function Ve(L,W,te,ie,j){W.isScene!==!0&&(W=Ue),ee.resetTextureUnits();const Re=W.fog,Fe=ie.isMeshStandardMaterial?W.environment:null,Ee=J===null?b.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:as,Be=(ie.isMeshStandardMaterial?Ce:me).get(ie.envMap||Fe),ze=ie.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,it=!!te.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),ke=!!te.morphAttributes.position,mt=!!te.morphAttributes.normal,Nt=!!te.morphAttributes.color;let Ot=Wi;ie.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(Ot=b.toneMapping);const Xt=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Et=Xt!==void 0?Xt.length:0,lt=R.get(ie),St=B.state.lights;if(st===!0&&(Dt===!0||L!==oe)){const Un=L===oe&&ie.id===Q;ut.setState(ie,L,Un)}let gt=!1;ie.version===lt.__version?(lt.needsLights&<.lightsStateVersion!==St.state.version||lt.outputColorSpace!==Ee||j.isBatchedMesh&<.batching===!1||!j.isBatchedMesh&<.batching===!0||j.isBatchedMesh&<.batchingColor===!0&&j.colorTexture===null||j.isBatchedMesh&<.batchingColor===!1&&j.colorTexture!==null||j.isInstancedMesh&<.instancing===!1||!j.isInstancedMesh&<.instancing===!0||j.isSkinnedMesh&<.skinning===!1||!j.isSkinnedMesh&<.skinning===!0||j.isInstancedMesh&<.instancingColor===!0&&j.instanceColor===null||j.isInstancedMesh&<.instancingColor===!1&&j.instanceColor!==null||j.isInstancedMesh&<.instancingMorph===!0&&j.morphTexture===null||j.isInstancedMesh&<.instancingMorph===!1&&j.morphTexture!==null||lt.envMap!==Be||ie.fog===!0&<.fog!==Re||lt.numClippingPlanes!==void 0&&(lt.numClippingPlanes!==ut.numPlanes||lt.numIntersection!==ut.numIntersection)||lt.vertexAlphas!==ze||lt.vertexTangents!==it||lt.morphTargets!==ke||lt.morphNormals!==mt||lt.morphColors!==Nt||lt.toneMapping!==Ot||lt.morphTargetsCount!==Et)&&(gt=!0):(gt=!0,lt.__version=ie.version);let Qt=lt.currentProgram;gt===!0&&(Qt=fe(ie,W,j));let ai=!1,mn=!1,oi=!1;const fn=Qt.getUniforms(),zn=lt.uniforms;if(We.useProgram(Qt.program)&&(ai=!0,mn=!0,oi=!0),ie.id!==Q&&(Q=ie.id,mn=!0),ai||oe!==L){We.buffers.depth.getReversed()&&L.reversedDepth!==!0&&(L._reversedDepth=!0,L.updateProjectionMatrix()),fn.setValue(H,"projectionMatrix",L.projectionMatrix),fn.setValue(H,"viewMatrix",L.matrixWorldInverse);const li=fn.map.cameraPosition;li!==void 0&&li.setValue(H,_t.setFromMatrixPosition(L.matrixWorld)),Tt.logarithmicDepthBuffer&&fn.setValue(H,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&fn.setValue(H,"isOrthographic",L.isOrthographicCamera===!0),oe!==L&&(oe=L,mn=!0,oi=!0)}if(lt.needsLights&&(St.state.directionalShadowMap.length>0&&fn.setValue(H,"directionalShadowMap",St.state.directionalShadowMap,ee),St.state.spotShadowMap.length>0&&fn.setValue(H,"spotShadowMap",St.state.spotShadowMap,ee),St.state.pointShadowMap.length>0&&fn.setValue(H,"pointShadowMap",St.state.pointShadowMap,ee)),j.isSkinnedMesh){fn.setOptional(H,j,"bindMatrix"),fn.setOptional(H,j,"bindMatrixInverse");const Un=j.skeleton;Un&&(Un.boneTexture===null&&Un.computeBoneTexture(),fn.setValue(H,"boneTexture",Un.boneTexture,ee))}j.isBatchedMesh&&(fn.setOptional(H,j,"batchingTexture"),fn.setValue(H,"batchingTexture",j._matricesTexture,ee),fn.setOptional(H,j,"batchingIdTexture"),fn.setValue(H,"batchingIdTexture",j._indirectTexture,ee),fn.setOptional(H,j,"batchingColorTexture"),j._colorsTexture!==null&&fn.setValue(H,"batchingColorTexture",j._colorsTexture,ee));const Yn=te.morphAttributes;if((Yn.position!==void 0||Yn.normal!==void 0||Yn.color!==void 0)&&De.update(j,te,Qt),(mn||lt.receiveShadow!==j.receiveShadow)&&(lt.receiveShadow=j.receiveShadow,fn.setValue(H,"receiveShadow",j.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(zn.envMap.value=Be,zn.flipEnvMap.value=Be.isCubeTexture&&Be.isRenderTargetTexture===!1?-1:1),ie.isMeshStandardMaterial&&ie.envMap===null&&W.environment!==null&&(zn.envMapIntensity.value=W.environmentIntensity),zn.dfgLUT!==void 0&&(zn.dfgLUT.value=OR()),mn&&(fn.setValue(H,"toneMappingExposure",b.toneMappingExposure),lt.needsLights&&Ne(zn,oi),Re&&ie.fog===!0&&Rt.refreshFogUniforms(zn,Re),Rt.refreshMaterialUniforms(zn,ie,we,pe,B.state.transmissionRenderTarget[L.id]),rh.upload(H,xe(lt),zn,ee)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(rh.upload(H,xe(lt),zn,ee),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&fn.setValue(H,"center",j.center),fn.setValue(H,"modelViewMatrix",j.modelViewMatrix),fn.setValue(H,"normalMatrix",j.normalMatrix),fn.setValue(H,"modelMatrix",j.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Un=ie.uniformsGroups;for(let li=0,Qo=Un.length;li<Qo;li++){const hr=Un[li];Oe.update(hr,Qt),Oe.bind(hr,Qt)}}return Qt}function Ne(L,W){L.ambientLightColor.needsUpdate=W,L.lightProbe.needsUpdate=W,L.directionalLights.needsUpdate=W,L.directionalLightShadows.needsUpdate=W,L.pointLights.needsUpdate=W,L.pointLightShadows.needsUpdate=W,L.spotLights.needsUpdate=W,L.spotLightShadows.needsUpdate=W,L.rectAreaLights.needsUpdate=W,L.hemisphereLights.needsUpdate=W}function Ze(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(L,W,te){const ie=R.get(L);ie.__autoAllocateDepthBuffer=L.resolveDepthBuffer===!1,ie.__autoAllocateDepthBuffer===!1&&(ie.__useRenderToTexture=!1),R.get(L.texture).__webglTexture=W,R.get(L.depthTexture).__webglTexture=ie.__autoAllocateDepthBuffer?void 0:te,ie.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(L,W){const te=R.get(L);te.__webglFramebuffer=W,te.__useDefaultFramebuffer=W===void 0};const Ke=H.createFramebuffer();this.setRenderTarget=function(L,W=0,te=0){J=L,U=W,V=te;let ie=null,j=!1,Re=!1;if(L){const Ee=R.get(L);if(Ee.__useDefaultFramebuffer!==void 0){We.bindFramebuffer(H.FRAMEBUFFER,Ee.__webglFramebuffer),q.copy(L.viewport),ue.copy(L.scissor),z=L.scissorTest,We.viewport(q),We.scissor(ue),We.setScissorTest(z),Q=-1;return}else if(Ee.__webglFramebuffer===void 0)ee.setupRenderTarget(L);else if(Ee.__hasExternalTextures)ee.rebindTextures(L,R.get(L.texture).__webglTexture,R.get(L.depthTexture).__webglTexture);else if(L.depthBuffer){const it=L.depthTexture;if(Ee.__boundDepthTexture!==it){if(it!==null&&R.has(it)&&(L.width!==it.image.width||L.height!==it.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ee.setupDepthRenderbuffer(L)}}const Be=L.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(Re=!0);const ze=R.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray(ze[W])?ie=ze[W][te]:ie=ze[W],j=!0):L.samples>0&&ee.useMultisampledRTT(L)===!1?ie=R.get(L).__webglMultisampledFramebuffer:Array.isArray(ze)?ie=ze[te]:ie=ze,q.copy(L.viewport),ue.copy(L.scissor),z=L.scissorTest}else q.copy(le).multiplyScalar(we).floor(),ue.copy(Ae).multiplyScalar(we).floor(),z=Qe;if(te!==0&&(ie=Ke),We.bindFramebuffer(H.FRAMEBUFFER,ie)&&We.drawBuffers(L,ie),We.viewport(q),We.scissor(ue),We.setScissorTest(z),j){const Ee=R.get(L.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+W,Ee.__webglTexture,te)}else if(Re){const Ee=W;for(let Be=0;Be<L.textures.length;Be++){const ze=R.get(L.textures[Be]);H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0+Be,ze.__webglTexture,te,Ee)}}else if(L!==null&&te!==0){const Ee=R.get(L.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Ee.__webglTexture,te)}Q=-1},this.readRenderTargetPixels=function(L,W,te,ie,j,Re,Fe,Ee=0){if(!(L&&L.isWebGLRenderTarget)){bt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Be=R.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Fe!==void 0&&(Be=Be[Fe]),Be){We.bindFramebuffer(H.FRAMEBUFFER,Be);try{const ze=L.textures[Ee],it=ze.format,ke=ze.type;if(!Tt.textureFormatReadable(it)){bt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Tt.textureTypeReadable(ke)){bt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=L.width-ie&&te>=0&&te<=L.height-j&&(L.textures.length>1&&H.readBuffer(H.COLOR_ATTACHMENT0+Ee),H.readPixels(W,te,ie,j,Le.convert(it),Le.convert(ke),Re))}finally{const ze=J!==null?R.get(J).__webglFramebuffer:null;We.bindFramebuffer(H.FRAMEBUFFER,ze)}}},this.readRenderTargetPixelsAsync=async function(L,W,te,ie,j,Re,Fe,Ee=0){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Be=R.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Fe!==void 0&&(Be=Be[Fe]),Be)if(W>=0&&W<=L.width-ie&&te>=0&&te<=L.height-j){We.bindFramebuffer(H.FRAMEBUFFER,Be);const ze=L.textures[Ee],it=ze.format,ke=ze.type;if(!Tt.textureFormatReadable(it))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Tt.textureTypeReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const mt=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,mt),H.bufferData(H.PIXEL_PACK_BUFFER,Re.byteLength,H.STREAM_READ),L.textures.length>1&&H.readBuffer(H.COLOR_ATTACHMENT0+Ee),H.readPixels(W,te,ie,j,Le.convert(it),Le.convert(ke),0);const Nt=J!==null?R.get(J).__webglFramebuffer:null;We.bindFramebuffer(H.FRAMEBUFFER,Nt);const Ot=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);return H.flush(),await jS(H,Ot,4),H.bindBuffer(H.PIXEL_PACK_BUFFER,mt),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,Re),H.deleteBuffer(mt),H.deleteSync(Ot),Re}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(L,W=null,te=0){const ie=Math.pow(2,-te),j=Math.floor(L.image.width*ie),Re=Math.floor(L.image.height*ie),Fe=W!==null?W.x:0,Ee=W!==null?W.y:0;ee.setTexture2D(L,0),H.copyTexSubImage2D(H.TEXTURE_2D,te,0,0,Fe,Ee,j,Re),We.unbindTexture()};const qe=H.createFramebuffer(),Xe=H.createFramebuffer();this.copyTextureToTexture=function(L,W,te=null,ie=null,j=0,Re=null){Re===null&&(j!==0?(Oo("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Re=j,j=0):Re=0);let Fe,Ee,Be,ze,it,ke,mt,Nt,Ot;const Xt=L.isCompressedTexture?L.mipmaps[Re]:L.image;if(te!==null)Fe=te.max.x-te.min.x,Ee=te.max.y-te.min.y,Be=te.isBox3?te.max.z-te.min.z:1,ze=te.min.x,it=te.min.y,ke=te.isBox3?te.min.z:0;else{const Yn=Math.pow(2,-j);Fe=Math.floor(Xt.width*Yn),Ee=Math.floor(Xt.height*Yn),L.isDataArrayTexture?Be=Xt.depth:L.isData3DTexture?Be=Math.floor(Xt.depth*Yn):Be=1,ze=0,it=0,ke=0}ie!==null?(mt=ie.x,Nt=ie.y,Ot=ie.z):(mt=0,Nt=0,Ot=0);const Et=Le.convert(W.format),lt=Le.convert(W.type);let St;W.isData3DTexture?(ee.setTexture3D(W,0),St=H.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(ee.setTexture2DArray(W,0),St=H.TEXTURE_2D_ARRAY):(ee.setTexture2D(W,0),St=H.TEXTURE_2D),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,W.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,W.unpackAlignment);const gt=H.getParameter(H.UNPACK_ROW_LENGTH),Qt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),ai=H.getParameter(H.UNPACK_SKIP_PIXELS),mn=H.getParameter(H.UNPACK_SKIP_ROWS),oi=H.getParameter(H.UNPACK_SKIP_IMAGES);H.pixelStorei(H.UNPACK_ROW_LENGTH,Xt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Xt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,ze),H.pixelStorei(H.UNPACK_SKIP_ROWS,it),H.pixelStorei(H.UNPACK_SKIP_IMAGES,ke);const fn=L.isDataArrayTexture||L.isData3DTexture,zn=W.isDataArrayTexture||W.isData3DTexture;if(L.isDepthTexture){const Yn=R.get(L),Un=R.get(W),li=R.get(Yn.__renderTarget),Qo=R.get(Un.__renderTarget);We.bindFramebuffer(H.READ_FRAMEBUFFER,li.__webglFramebuffer),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,Qo.__webglFramebuffer);for(let hr=0;hr<Be;hr++)fn&&(H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,R.get(L).__webglTexture,j,ke+hr),H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,R.get(W).__webglTexture,Re,Ot+hr)),H.blitFramebuffer(ze,it,Fe,Ee,mt,Nt,Fe,Ee,H.DEPTH_BUFFER_BIT,H.NEAREST);We.bindFramebuffer(H.READ_FRAMEBUFFER,null),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else if(j!==0||L.isRenderTargetTexture||R.has(L)){const Yn=R.get(L),Un=R.get(W);We.bindFramebuffer(H.READ_FRAMEBUFFER,qe),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,Xe);for(let li=0;li<Be;li++)fn?H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Yn.__webglTexture,j,ke+li):H.framebufferTexture2D(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Yn.__webglTexture,j),zn?H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Un.__webglTexture,Re,Ot+li):H.framebufferTexture2D(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Un.__webglTexture,Re),j!==0?H.blitFramebuffer(ze,it,Fe,Ee,mt,Nt,Fe,Ee,H.COLOR_BUFFER_BIT,H.NEAREST):zn?H.copyTexSubImage3D(St,Re,mt,Nt,Ot+li,ze,it,Fe,Ee):H.copyTexSubImage2D(St,Re,mt,Nt,ze,it,Fe,Ee);We.bindFramebuffer(H.READ_FRAMEBUFFER,null),We.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else zn?L.isDataTexture||L.isData3DTexture?H.texSubImage3D(St,Re,mt,Nt,Ot,Fe,Ee,Be,Et,lt,Xt.data):W.isCompressedArrayTexture?H.compressedTexSubImage3D(St,Re,mt,Nt,Ot,Fe,Ee,Be,Et,Xt.data):H.texSubImage3D(St,Re,mt,Nt,Ot,Fe,Ee,Be,Et,lt,Xt):L.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,Re,mt,Nt,Fe,Ee,Et,lt,Xt.data):L.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,Re,mt,Nt,Xt.width,Xt.height,Et,Xt.data):H.texSubImage2D(H.TEXTURE_2D,Re,mt,Nt,Fe,Ee,Et,lt,Xt);H.pixelStorei(H.UNPACK_ROW_LENGTH,gt),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Qt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,ai),H.pixelStorei(H.UNPACK_SKIP_ROWS,mn),H.pixelStorei(H.UNPACK_SKIP_IMAGES,oi),Re===0&&W.generateMipmaps&&H.generateMipmap(St),We.unbindTexture()},this.initRenderTarget=function(L){R.get(L).__webglFramebuffer===void 0&&ee.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?ee.setTextureCube(L,0):L.isData3DTexture?ee.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?ee.setTexture2DArray(L,0):ee.setTexture2D(L,0),We.unbindTexture()},this.resetState=function(){U=0,V=0,J=null,We.reset(),et.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Vi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=nn._getDrawingBufferColorSpace(e),t.unpackColorSpace=nn._getUnpackColorSpace()}}const GR=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:$h,AddEquation:bs,AddOperation:Ex,AdditiveAnimationBlendMode:Cm,AdditiveBlending:Yp,AgXToneMapping:ym,AlphaFormat:bm,AlwaysCompare:Ux,AlwaysDepth:Jl,AlwaysStencilFunc:qp,AmbientLight:Ay,AnimationAction:Iy,AnimationClip:ko,AnimationLoader:HE,AnimationMixer:f1,AnimationObjectGroup:u1,AnimationUtils:UE,ArcCurve:jx,ArrayCamera:Ty,ArrowHelper:N1,AttachedBindMode:Qp,Audio:Cy,AudioAnalyser:e1,AudioContext:lg,AudioListener:qE,AudioLoader:KE,AxesHelper:O1,BackSide:Hn,BasicDepthPacking:Us,BasicShadowMap:rx,BatchedMesh:Kx,Bone:mf,BooleanKeyframeTrack:Oa,Box2:A1,Box3:ri,Box3Helper:F1,BoxGeometry:Mi,BoxHelper:L1,BufferAttribute:sn,BufferGeometry:Lt,BufferGeometryLoader:wy,ByteType:Sm,Cache:Nr,Camera:cc,CameraHelper:D1,CanvasTexture:sE,CapsuleGeometry:xf,CatmullRomCurve3:$x,CineonToneMapping:_m,CircleGeometry:yf,ClampToEdgeWrapping:wi,Clock:cg,Color:je,ColorKeyframeTrack:eg,ColorManagement:nn,CompressedArrayTexture:iE,CompressedCubeTexture:rE,CompressedTexture:_f,CompressedTextureLoader:zE,ConeGeometry:dc,ConstantAlphaFactor:Ax,ConstantColorFactor:xx,Controls:H1,CubeCamera:Wx,CubeDepthTexture:Qx,CubeReflectionMapping:Or,CubeRefractionMapping:Ps,CubeTexture:uc,CubeTextureLoader:kE,CubeUVReflectionMapping:Wo,CubicBezierCurve:Vm,CubicBezierCurve3:ey,CubicInterpolant:my,CullFaceBack:Jp,CullFaceFront:ix,CullFaceFrontBack:hS,CullFaceNone:nx,Curve:wr,CurvePath:ny,CustomBlending:sx,CustomToneMapping:xm,CylinderGeometry:gi,Cylindrical:y1,Data3DTexture:ff,DataArrayTexture:hf,DataTexture:Ar,DataTextureLoader:ng,DataUtils:xa,DecrementStencilOp:bS,DecrementWrapStencilOp:CS,DefaultLoadingManager:_y,DepthFormat:Gr,DepthStencilFormat:ts,DepthTexture:Ba,DetachedBindMode:wx,DirectionalLight:ag,DirectionalLightHelper:P1,DiscreteInterpolant:gy,DodecahedronGeometry:Af,DoubleSide:$n,DstAlphaFactor:px,DstColorFactor:gx,DynamicCopyUsage:VS,DynamicDrawUsage:NS,DynamicReadUsage:HS,EdgesGeometry:qx,EllipseCurve:Sf,EqualCompare:Dx,EqualDepth:uh,EqualStencilFunc:PS,EquirectangularReflectionMapping:Yl,EquirectangularRefractionMapping:Kl,Euler:Li,EventDispatcher:Ki,ExternalTexture:zm,ExtrudeGeometry:Mf,FileLoader:Yi,Float16BufferAttribute:FM,Float32BufferAttribute:pt,FloatType:In,Fog:pf,FogExp2:df,FramebufferTexture:nE,FrontSide:Mr,Frustum:Xo,FrustumArray:gf,GLBufferAttribute:v1,GLSL1:XS,GLSL3:jp,GreaterCompare:Lx,GreaterDepth:fh,GreaterEqualCompare:uf,GreaterEqualDepth:hh,GreaterEqualStencilFunc:US,GreaterStencilFunc:LS,GridHelper:I1,Group:ns,HalfFloatType:Vn,HemisphereLight:yy,HemisphereLightHelper:R1,IcosahedronGeometry:pc,ImageBitmapLoader:by,ImageLoader:rc,ImageUtils:zx,IncrementStencilOp:wS,IncrementWrapStencilOp:TS,InstancedBufferAttribute:Ia,InstancedBufferGeometry:Ey,InstancedInterleavedBuffer:g1,InstancedMesh:Om,Int16BufferAttribute:DM,Int32BufferAttribute:LM,Int8BufferAttribute:IM,IntType:nf,InterleavedBuffer:hc,InterleavedBufferAttribute:Fs,Interpolant:Yo,InterpolateDiscrete:Fo,InterpolateLinear:Uo,InterpolateSmooth:nh,InterpolationSamplingMode:KS,InterpolationSamplingType:YS,InvertStencilOp:RS,KeepStencilOp:da,KeyframeTrack:cr,LOD:Yx,LatheGeometry:Ef,Layers:wa,LessCompare:Px,LessDepth:ch,LessEqualCompare:cf,LessEqualDepth:Ta,LessEqualStencilFunc:DS,LessStencilFunc:BS,Light:Gs,LightProbe:My,Line:Yt,Line3:E1,LineBasicMaterial:si,LineCurve:Wm,LineCurve3:ty,LineDashedMaterial:dy,LineLoop:Gm,LineSegments:Er,LinearFilter:rn,LinearInterpolant:$m,LinearMipMapLinearFilter:mS,LinearMipMapNearestFilter:pS,LinearMipmapLinearFilter:or,LinearMipmapNearestFilter:Io,LinearSRGBColorSpace:as,LinearToneMapping:gm,LinearTransfer:Ql,Loader:_i,LoaderUtils:Bs,LoadingManager:tg,L
4019oopOnce:bx,LoopPingPong:Cx,LoopRepeat:Tx,MOUSE:ha,Material:Fn,MaterialLoader:If,MathUtils:Hx,Matrix2:fg,Matrix3:zt,Matrix4:It,MaxEquation:cx,Mesh:ot,MeshBasicMaterial:bi,MeshDepthMaterial:Qm,MeshDistanceMaterial:qm,MeshLambertMaterial:hy,MeshMatcapMaterial:fy,MeshNormalMaterial:Zm,MeshPhongMaterial:cy,MeshPhysicalMaterial:lr,MeshStandardMaterial:mc,MeshToonMaterial:uy,MinEquation:lx,MirroredRepeatWrapping:Do,MixOperation:Mx,MultiplyBlending:Zp,MultiplyOperation:ac,NearestFilter:xn,NearestMipMapLinearFilter:dS,NearestMipMapNearestFilter:fS,NearestMipmapLinearFilter:ga,NearestMipmapNearestFilter:tf,NeutralToneMapping:Am,NeverCompare:Bx,NeverDepth:lh,NeverStencilFunc:IS,NoBlending:ii,NoColorSpace:xr,NoNormalPacking:yS,NoToneMapping:Wi,NormalAnimationBlendMode:lf,NormalBlending:Ma,NormalGAPacking:SS,NormalRGPacking:AS,NotEqualCompare:Fx,NotEqualDepth:dh,NotEqualStencilFunc:FS,NumberKeyframeTrack:Da,Object3D:qt,ObjectLoader:JE,ObjectSpaceNormalMap:Ix,OctahedronGeometry:sr,OneFactor:hx,OneMinusConstantAlphaFactor:Sx,OneMinusConstantColorFactor:yx,OneMinusDstAlphaFactor:mx,OneMinusDstColorFactor:vx,OneMinusSrcAlphaFactor:oh,OneMinusSrcColorFactor:dx,OrthographicCamera:Sr,PCFShadowMap:Ro,PCFSoftShadowMap:Nl,PMREMGenerator:am,Path:Qh,PerspectiveCamera:En,Plane:$r,PlaneGeometry:ki,PlaneHelper:U1,PointLight:sg,PointLightHelper:T1,Points:Hm,PointsMaterial:vf,PolarGridHelper:B1,PolyhedronGeometry:Os,PositionalAudio:$E,PropertyBinding:an,PropertyMixer:Ry,QuadraticBezierCurve:Xm,QuadraticBezierCurve3:Jm,Quaternion:on,QuaternionKeyframeTrack:La,QuaternionLinearInterpolant:vy,R11_EAC_Format:Ah,RED_GREEN_RGTC2_Format:Wh,RED_RGTC1_Format:kh,REVISION:Ua,RG11_EAC_Format:Mh,RGBADepthPacking:vS,RGBAFormat:ni,RGBAIntegerFormat:of,RGBA_ASTC_10x10_Format:Uh,RGBA_ASTC_10x5_Format:Dh,RGBA_ASTC_10x6_Format:Lh,RGBA_ASTC_10x8_Format:Fh,RGBA_ASTC_12x10_Format:Nh,RGBA_ASTC_12x12_Format:Oh,RGBA_ASTC_4x4_Format:wh,RGBA_ASTC_5x4_Format:bh,RGBA_ASTC_5x5_Format:Th,RGBA_ASTC_6x5_Format:Ch,RGBA_ASTC_6x6_Format:Rh,RGBA_ASTC_8x5_Format:Ih,RGBA_ASTC_8x6_Format:Bh,RGBA_ASTC_8x8_Format:Ph,RGBA_BPTC_Format:Gh,RGBA_ETC2_EAC_Format:yh,RGBA_PVRTC_2BPPV1_Format:vh,RGBA_PVRTC_4BPPV1_Format:gh,RGBA_S3TC_DXT1_Format:Gl,RGBA_S3TC_DXT3_Format:Hl,RGBA_S3TC_DXT5_Format:zl,RGBDepthPacking:_S,RGBFormat:Tm,RGBIntegerFormat:gS,RGB_BPTC_SIGNED_Format:Hh,RGB_BPTC_UNSIGNED_Format:zh,RGB_ETC1_Format:_h,RGB_ETC2_Format:xh,RGB_PVRTC_2BPPV1_Format:mh,RGB_PVRTC_4BPPV1_Format:ph,RGB_S3TC_DXT1_Format:Ol,RGDepthPacking:xS,RGFormat:Ra,RGIntegerFormat:af,RawShaderMaterial:Km,Ray:Na,Raycaster:Bf,RectAreaLight:Sy,RedFormat:oc,RedIntegerFormat:lc,ReinhardToneMapping:vm,RenderTarget:Bm,RenderTarget3D:d1,RepeatWrapping:Ds,ReplaceStencilOp:ES,ReverseSubtractEquation:ox,RingGeometry:wf,SIGNED_R11_EAC_Format:Sh,SIGNED_RED_GREEN_RGTC2_Format:Xh,SIGNED_RED_RGTC1_Format:Vh,SIGNED_RG11_EAC_Format:Eh,SRGBColorSpace:pn,SRGBTransfer:dn,Scene:ec,ShaderChunk:Vt,ShaderLib:_r,ShaderMaterial:Bn,ShadowMaterial:ly,Shape:ba,ShapeGeometry:bf,ShapePath:G1,ShapeUtils:yr,ShortType:Mm,Skeleton:fc,SkeletonHelper:b1,SkinnedMesh:Nm,Source:Ts,Sphere:ei,SphereGeometry:Jo,Spherical:rm,SphericalHarmonics3:og,SplineCurve:Ym,SpotLight:rg,SpotLightHelper:w1,Sprite:Jx,SpriteMaterial:Um,SrcAlphaFactor:ah,SrcAlphaSaturateFactor:_x,SrcColorFactor:fx,StaticCopyUsage:kS,StaticDrawUsage:ql,StaticReadUsage:GS,StereoCamera:ZE,StreamCopyUsage:WS,StreamDrawUsage:OS,StreamReadUsage:zS,StringKeyframeTrack:Ga,SubtractEquation:ax,SubtractiveBlending:Kp,TOUCH:fa,TangentSpaceNormalMap:Ns,TetrahedronGeometry:Tf,Texture:yn,TextureLoader:xy,TextureUtils:X1,Timer:_1,TimestampQuery:JS,TorusGeometry:Cs,TorusKnotGeometry:Cf,Triangle:Di,TriangleFanDrawMode:Jh,TriangleStripDrawMode:Rm,TrianglesDrawMode:Rx,TubeGeometry:Rf,UVMapping:ef,Uint16BufferAttribute:Pm,Uint32BufferAttribute:Dm,Uint8BufferAttribute:BM,Uint8ClampedBufferAttribute:PM,Uniform:en,UniformsGroup:m1,UniformsLib:rt,UniformsUtils:Lm,UnsignedByteType:Rn,UnsignedInt101111Type:wm,UnsignedInt248Type:Ca,UnsignedInt5999Type:Em,UnsignedIntType:Ji,UnsignedShort4444Type:rf,UnsignedShort5551Type:sf,UnsignedShortType:Lo,VSMShadowMap:ma,Vector2:_e,Vector3:N,Vector4:gn,VectorKeyframeTrack:Fa,VideoFrameTexture:tE,VideoTexture:Zx,WebGL3DRenderTarget:xM,WebGLArrayRenderTarget:_M,WebGLCoordinateSystem:Vi,WebGLCubeRen
vendor: 119,786 bytes, lines 4019-4061
4019derTarget:Fm,WebGLRenderTarget:bn,WebGLRenderer:Oy,WebGLUtils:Ny,WebGPUCoordinateSystem:No,WebXRController:ih,WireframeGeometry:oy,WrapAroundEnding:Zl,ZeroCurvatureEnding:va,ZeroFactor:ux,ZeroSlopeEnding:_a,ZeroStencilOp:MS,createCanvasElement:Gx,error:bt,getConsoleFunction:qS,log:$l,setConsoleFunction:QS,warn:nt,warnOnce:Oo},Symbol.toStringTag,{value:"Module"}));var Gy={exports:{}},Ha={};/** 4020 * @license React 4021 * react-reconciler-constants.production.min.js 4022 * 4023 * Copyright (c) Facebook, Inc. and its affiliates. 4024 * 4025 * This source code is licensed under the MIT license found in the 4026 * LICENSE file in the root directory of this source tree. 4027 */Ha.ConcurrentRoot=1;Ha.ContinuousEventPriority=4;Ha.DefaultEventPriority=16;Ha.DiscreteEventPriority=1;Ha.IdleEventPriority=536870912;Ha.LegacyRoot=0;Gy.exports=Ha;var Co=Gy.exports;function HR(r){let e;const t=new Set,n=(h,f)=>{const d=typeof h=="function"?h(e):h;if(d!==e){const p=e;e=f?d:Object.assign({},e,d),t.forEach(g=>g(e,p))}},i=()=>e,s=(h,f=i,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=f(e);function g(){const v=f(e);if(!d(p,v)){const A=p;h(p=v,A)}}return t.add(g),()=>t.delete(g)},u={setState:n,getState:i,subscribe:(h,f,d)=>f||d?s(h,f,d):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=r(n,i,u),u}const zR=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),M_=zR?dt.useEffect:dt.useLayoutEffect;function Hy(r){const e=typeof r=="function"?HR(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=dt.useReducer(y=>y+1,0),a=e.getState(),o=dt.useRef(a),u=dt.useRef(n),h=dt.useRef(i),f=dt.useRef(!1),d=dt.useRef();d.current===void 0&&(d.current=n(a));let p,g=!1;(o.current!==a||u.current!==n||h.current!==i||f.current)&&(p=n(a),g=!i(d.current,p)),M_(()=>{g&&(d.current=p),o.current=a,u.current=n,h.current=i,f.current=!1});const v=dt.useRef(a);M_(()=>{const y=()=>{try{const M=e.getState(),E=u.current(M);h.current(d.current,E)||(o.current=M,d.current=E,s())}catch{f.current=!0,s()}},_=e.subscribe(y);return e.getState()!==v.current&&y(),_},[]);const A=g?p:d.current;return dt.useDebugValue(A),A};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}const kR=r=>typeof r=="object"&&typeof r.then=="function",Aa=[];function zy(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i<n;i++)if(!t(r[i],e[i]))return!1;return!0}function ky(r,e=null,t=!1,n={}){e===null&&(e=[r]);for(const s of Aa)if(zy(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return n.lifespan&&n.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Aa.indexOf(i);s!==-1&&Aa.splice(s,1)},promise:(kR(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Aa.push(i),!t)throw i.promise}const VR=(r,e,t)=>ky(r,e,!1,t),WR=(r,e,t)=>void ky(r,e,!0,t),XR=r=>{if(r===void 0||r.length===0)Aa.splice(0,Aa.length);else{const e=Aa.find(t=>zy(r,t.keys,t.equal));e&&e.remove()}};var Vy={exports:{}},Tp={exports:{}},Cp={};/** 4028 * @license React 4029 * scheduler.production.min.js 4030 * 4031 * Copyright (c) Facebook, Inc. and its affiliates. 4032 * 4033 * This source code is licensed under the MIT license found in the 4034 * LICENSE file in the root directory of this source tree. 4035 */var E_;function JR(){return E_||(E_=1,function(r){function e(z,ne){var Y=z.length;z.push(ne);e:for(;0<Y;){var se=Y-1>>>1,pe=z[se];if(0<i(pe,ne))z[se]=ne,z[Y]=pe,Y=se;else break e}}function t(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var ne=z[0],Y=z.pop();if(Y!==ne){z[0]=Y;e:for(var se=0,pe=z.length,we=pe>>>1;se<we;){var $=2*(se+1)-1,xt=z[$],le=$+1,Ae=z[le];if(0>i(xt,Y))le<pe&&0>i(Ae,xt)?(z[se]=Ae,z[le]=Y,se=le):(z[se]=xt,z[$]=Y,se=$);else if(le<pe&&0>i(Ae,Y))z[se]=Ae,z[le]=Y,se=le;else break e}}return ne}function i(z,ne){var Y=z.sortIndex-ne.sortIndex;return Y!==0?Y:z.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();r.unstable_now=function(){return a.now()-o}}var u=[],h=[],f=1,d=null,p=3,g=!1,v=!1,A=!1,y=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(z){for(var ne=t(h);ne!==null;){if(ne.callback===null)n(h);else if(ne.startTime<=z)n(h),ne.sortIndex=ne.expirationTime,e(u,ne);else break;ne=t(h)}}function w(z){if(A=!1,E(z),!v)if(t(u)!==null)v=!0,q(B);else{var ne=t(h);ne!==null&&ue(w,ne.startTime-z)}}function B(z,ne){v=!1,A&&(A=!1,_(F),F=-1),g=!0;var Y=p;try{for(E(ne),d=t(u);d!==null&&(!(d.expirationTime>ne)||z&&!U());){var se=d.callback;if(typeof se=="function"){d.callback=null,p=d.priorityLevel;var pe=se(d.expirationTime<=ne);ne=r.unstable_now(),typeof pe=="function"?d.callback=pe:d===t(u)&&n(u),E(ne)}else n(u);d=t(u)}if(d!==null)var we=!0;else{var $=t(h);$!==null&&ue(w,$.startTime-ne),we=!1}return we}finally{d=null,p=Y,g=!1}}var P=!1,D=null,F=-1,b=5,C=-1;function U(){return!(r.unstable_now()-C<b)}function V(){if(D!==null){var z=r.unstable_now();C=z;var ne=!0;try{ne=D(!0,z)}finally{ne?J():(P=!1,D=null)}}else P=!1}var J;if(typeof M=="function")J=function(){M(V)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,oe=Q.port2;Q.port1.onmessage=V,J=function(){oe.postMessage(null)}}else J=function(){y(V,0)};function q(z){D=z,P||(P=!0,J())}function ue(z,ne){F=y(function(){z(r.unstable_now())},ne)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(z){z.callback=null},r.unstable_continueExecution=function(){v||g||(v=!0,q(B))},r.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<z?Math.floor(1e3/z):5},r.unstable_getCurrentPriorityLevel=function(){return p},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(z){switch(p){case 1:case 2:case 3:var ne=3;break;default:ne=p}var Y=p;p=ne;try{return z()}finally{p=Y}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(z,ne){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Y=p;p=z;try{return ne()}finally{p=Y}},r.unstable_scheduleCallback=function(z,ne,Y){var se=r.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?se+Y:se):Y=se,z){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=Y+pe,z={id:f++,callback:ne,priorityLevel:z,startTime:Y,expirationTime:pe,sortIndex:-1},Y>se?(z.sortIndex=Y,e(h,z),t(u)===null&&z===t(h)&&(A?(_(F),F=-1):A=!0,ue(w,Y-se))):(z.sortIndex=pe,e(u,z),v||g||(v=!0,q(B))),z},r.unstable_shouldYield=U,r.unstable_wrapCallback=function(z){var ne=p;return function(){var Y=p;p=ne;try{return z.apply(this,arguments)}finally{p=Y}}}}(Cp)),Cp}var w_;function YR(){return w_||(w_=1,Tp.exports=JR()),Tp.exports}/** 4036 * @license React 4037 * react-reconciler.production.min.js 4038 * 4039 * Copyright (c) Facebook, Inc. and its affiliates. 4040 * 4041 * This source code is licensed under the MIT license found in the 4042 * LICENSE file in the root directory of this source tree. 4043 */var KR=function(e){var t={},n=dt,i=YR(),s=Object.assign;function a(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),h=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),v=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),B=Symbol.iterator;function P(l){return l===null||typeof l!="object"?null:(l=B&&l[B]||l["@@iterator"],typeof l=="function"?l:null)}function D(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case f:return"Fragment";case h:return"Portal";case p:return"Profiler";case d:return"StrictMode";case y:return"Suspense";case _:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case v:return(l.displayName||"Context")+".Consumer";case g:return(l._context.displayName||"Context")+".Provider";case A:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case M:return c=l.displayName||null,c!==null?c:D(l.type)||"Memo";case E:c=l._payload,l=l._init;try{return D(l(c))}catch{}}return null}function F(l){var c=l.type;switch(l.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=c.render,l=l.displayName||l.name||"",c.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(c);case 8:return c===d?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function b(l){var c=l,m=l;if(l.alternate)for(;c.return;)c=c.return;else{l=c;do c=l,c.flags&4098&&(m=c.return),l=c.return;while(l)}return c.tag===3?m:null}function C(l){if(b(l)!==l)throw Error(a(188))}function U(l){var c=l.alternate;if(!c){if(c=b(l),c===null)throw Error(a(188));return c!==l?null:l}for(var m=l,x=c;;){var S=m.return;if(S===null)break;var T=S.alternate;if(T===null){if(x=S.return,x!==null){m=x;continue}break}if(S.child===T.child){for(T=S.child;T;){if(T===m)return C(S),l;if(T===x)return C(S),c;T=T.sibling}throw Error(a(188))}if(m.return!==x.return)m=S,x=T;else{for(var k=!1,re=S.child;re;){if(re===m){k=!0,m=S,x=T;break}if(re===x){k=!0,x=S,m=T;break}re=re.sibling}if(!k){for(re=T.child;re;){if(re===m){k=!0,m=T,x=S;break}if(re===x){k=!0,x=T,m=S;break}re=re.sibling}if(!k)throw Error(a(189))}}if(m.alternate!==x)throw Error(a(190))}if(m.tag!==3)throw Error(a(188));return m.stateNode.current===m?l:c}function V(l){return l=U(l),l!==null?J(l):null}function J(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=J(l);if(c!==null)return c;l=l.sibling}return null}function Q(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){if(l.tag!==4){var c=Q(l);if(c!==null)return c}l=l.sibling}return null}var oe=Array.isArray,q=e.getPublicInstance,ue=e.getRootHostContext,z=e.getChildHostContext,ne=e.prepareForCommit,Y=e.resetAfterCommit,se=e.createInstance,pe=e.appendInitialChild,we=e.finalizeInitialChildren,$=e.prepareUpdate,xt=e.shouldSetTextContent,le=e.createTextInstance,Ae=e.scheduleTimeout,Qe=e.cancelTimeout,yt=e.noTimeout,st=e.isPrimaryRenderer,Dt=e.supportsMutation,Zt=e.supportsPersistence,_t=e.supportsHydration,Te=e.getInstanceFromNode,Ue=e.preparePortalMount,Ie=e.getCurrentEventPriority,$e=e.detachDeletedInstance,H=e.supportsMicrotasks,At=e.scheduleMicrotask,tt=e.supportsTestSelectors,Tt=e.findFiberRoot,We=e.getBoundingRect,G=e.getTextContent,R=e.isHiddenSubtree,ee=e.matchAccessibilityRole,me=e.setFocusIfFocusable,Ce=e.setupIntersectionObserver,ge=e.appendChild,ht=e.appendChildToContainer,Ye=e.commitTextUpdate,ft=e.commitMount,Rt=e.commitUpdate,Pe=e.insertBefore,Ge=e.insertInContainerBefore,ut=e.removeChild,X=e.removeChildFromContainer,ce=e.resetTextContent,De=e.hideInstance,K=e.hideTextInstance,he=e.unhideInstance,Le=e.unhideTextInstance,et=e.clearContainer,Oe=e.cloneInstance,be=e.createContainerChildSet,He=e.appendChildToContainerChildSet,Mt=e.finalizeContainerChildren,jt=e.replaceContainerChildren,Wt=e.cloneHiddenInstance,Pn=e.cloneHiddenTextInstance,Jn=e.canHydrateInstance,Zo=e.canHydrateTextInstance,za=e.canHydrateSuspenseInstance,ur=e.isSuspenseInstancePending,Hs=e.isSuspenseInstanceFallback,br=e.registerSuspenseInstanceRetry,Ti=e.getNextHydratableSibling,Ut=e.getFirstHydratableChild,os=e.getFirstHydratableChildWithinContainer,ka=e.getFirstHydratableChildWithinSuspenseInstance,I=e.hydrateInstance,O=e.hydrateTextInstance,Z=e.hydrateSuspenseInstance,fe=e.getNextHydratableInstanceAfterSuspenseInstance,xe=e.commitHydratedContainer,ye=e.commitHydratedSuspenseInstance,Ve=e.clearSuspenseBoundary,Ne=e.clearSuspenseBoundaryFromContainer,Ze=e.shouldDeleteUnhydratedTailInstances,Ke=e.didNotMatchHydratedContainerTextInstance,qe=e.didNotMatchHydratedTextInstance,Xe;function L(l){if(Xe===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);Xe=c&&c[1]||""}return` 4044`+Xe+l}var W=!1;function te(l,c){if(!l||W)return"";W=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(Je){var x=Je}Reflect.construct(l,[],c)}else{try{c.call()}catch(Je){x=Je}l.call(c.prototype)}else{try{throw Error()}catch(Je){x=Je}l()}}catch(Je){if(Je&&x&&typeof Je.stack=="string"){for(var S=Je.stack.split(` 4045`),T=x.stack.split(` 4046`),k=S.length-1,re=T.length-1;1<=k&&0<=re&&S[k]!==T[re];)re--;for(;1<=k&&0<=re;k--,re--)if(S[k]!==T[re]){if(k!==1||re!==1)do if(k--,re--,0>re||S[k]!==T[re]){var Se=` 4047`+S[k].replace(" at new "," at ");return l.displayName&&Se.includes("<anonymous>")&&(Se=Se.replace("<anonymous>",l.displayName)),Se}while(1<=k&&0<=re);break}}}finally{W=!1,Error.prepareStackTrace=m}return(l=l?l.displayName||l.name:"")?L(l):""}var ie=Object.prototype.hasOwnProperty,j=[],Re=-1;function Fe(l){return{current:l}}function Ee(l){0>Re||(l.current=j[Re],j[Re]=null,Re--)}function Be(l,c){Re++,j[Re]=l.current,l.current=c}var ze={},it=Fe(ze),ke=Fe(!1),mt=ze;function Nt(l,c){var m=l.type.contextTypes;if(!m)return ze;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===c)return x.__reactInternalMemoizedMaskedChildContext;var S={},T;for(T in m)S[T]=c[T];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=S),S}function Ot(l){return l=l.childContextTypes,l!=null}function Xt(){Ee(ke),Ee(it)}function Et(l,c,m){if(it.current!==ze)throw Error(a(168));Be(it,c),Be(ke,m)}function lt(l,c,m){var x=l.stateNode;if(c=c.childContextTypes,typeof x.getChildContext!="function")return m;x=x.getChildContext();for(var S in x)if(!(S in c))throw Error(a(108,F(l)||"Unknown",S));return s({},m,x)}function St(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ze,mt=it.current,Be(it,l),Be(ke,ke.current),!0}function gt(l,c,m){var x=l.stateNode;if(!x)throw Error(a(169));m?(l=lt(l,c,mt),x.__reactInternalMemoizedMergedChildContext=l,Ee(ke),Ee(it),Be(it,l)):Ee(ke),Be(ke,m)}var Qt=Math.clz32?Math.clz32:oi,ai=Math.log,mn=Math.LN2;function oi(l){return l>>>=0,l===0?32:31-(ai(l)/mn|0)|0}var fn=64,zn=4194304;function Yn(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Un(l,c){var m=l.pendingLanes;if(m===0)return 0;var x=0,S=l.suspendedLanes,T=l.pingedLanes,k=m&268435455;if(k!==0){var re=k&~S;re!==0?x=Yn(re):(T&=k,T!==0&&(x=Yn(T)))}else k=m&~S,k!==0?x=Yn(k):T!==0&&(x=Yn(T));if(x===0)return 0;if(c!==0&&c!==x&&!(c&S)&&(S=x&-x,T=c&-c,S>=T||S===16&&(T&4194240)!==0))return c;if(x&4&&(x|=m&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=x;0<c;)m=31-Qt(c),S=1<<m,x|=l[m],c&=~S;return x}function li(l,c){switch(l){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qo(l,c){for(var m=l.suspendedLanes,x=l.pingedLanes,S=l.expirationTimes,T=l.pendingLanes;0<T;){var k=31-Qt(T),re=1<<k,Se=S[k];Se===-1?(!(re&m)||re&x)&&(S[k]=li(re,c)):Se<=c&&(l.expiredLanes|=re),T&=~re}}function hr(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Ff(l){for(var c=[],m=0;31>m;m++)c.push(l);return c}function qo(l,c,m){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-Qt(c),l[c]=m}function EA(l,c){var m=l.pendingLanes&~c;l.pendingLanes=c,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=c,l.mutableReadLanes&=c,l.entangledLanes&=c,c=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0<m;){var S=31-Qt(m),T=1<<S;c[S]=0,x[S]=-1,l[S]=-1,m&=~T}}function Uf(l,c){var m=l.entangledLanes|=c;for(l=l.entanglements;m;){var x=31-Qt(m),S=1<<x;S&c|l[x]&c&&(l[x]|=c),m&=~S}}var ln=0;function _g(l){return l&=-l,1<l?4<l?l&268435455?16:536870912:4:1}var Nf=i.unstable_scheduleCallback,xg=i.unstable_cancelCallback,wA=i.unstable_shouldYield,bA=i.unstable_requestPaint,Kn=i.unstable_now,Of=i.unstable_ImmediatePriority,TA=i.unstable_UserBlockingPriority,Gf=i.unstable_NormalPriority,CA=i.unstable_IdlePriority,_c=null,Tr=null;function RA(l){if(Tr&&typeof Tr.onCommitFiberRoot=="function")try{Tr.onCommitFiberRoot(_c,l,void 0,(l.current.flags&128)===128)}catch{}}function IA(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var Cr=typeof Object.is=="function"?Object.is:IA,Hr=null,xc=!1,Hf=!1;function yg(l){Hr===null?Hr=[l]:Hr.push(l)}function BA(l){xc=!0,yg(l)}function Rr(){if(!Hf&&Hr!==null){Hf=!0;var l=0,c=ln;try{var m=Hr;for(ln=1;l<m.length;l++){var x=m[l];do x=x(!0);while(x!==null)}Hr=null,xc=!1}catch(S){throw Hr!==null&&(Hr=Hr.slice(l+1)),Nf(Of,Rr),S}finally{ln=c,Hf=!1}}return null}var PA=o.ReactCurrentBatchConfig;function yc(l,c){if(Cr(l,c))return!0;if(typeof l!="object"||l===null||typeof c!="object"||c===null)return!1;var m=Object.keys(l),x=Object.keys(c);if(m.length!==x.length)return!1;for(x=0;x<m.length;x++){var S=m[x];if(!ie.call(c,S)||!Cr(l[S],c[S]))return!1}return!0}function DA(l){switch(l.tag){case 5:return L(l.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return l=te(l.type,!1),l;case 11:return l=te(l.type.render,!1),l;case 1:return l=te(l.type,!0),l;default:return""}}function fr(l,c){if(l&&l.defaultProps){c=s({},c),l=l.defaultProps;for(var m in l)c[m]===void 0&&(c[m]=l[m]);return c}return c}var Ac=Fe(null),Sc=null,Va=null,zf=null;function kf(){zf=Va=Sc=null}function Ag(l,c,m){st?(Be(Ac,c._currentValue),c._currentValue=m):(Be(Ac,c._currentValue2),c._currentValue2=m)}function Vf(l){var c=Ac.current;Ee(Ac),st?l._currentValue=c:l._currentValue2=c}function Wf(l,c,m){for(;l!==null;){var x=l.alternate;if((l.childLanes&c)!==c?(l.childLanes|=c,x!==null&&(x.childLanes|=c)):x!==null&&(x.childLanes&c)!==c&&(x.childLanes|=c),l===m)break;l=l.return}}function Wa(l,c){Sc=l,zf=Va=null,l=l.dependencies,l!==null&&l.firstContext!==null&&(l.lanes&c&&(Oi=!0),l.firstContext=null)}function Zi(l){var c=st?l._currentValue:l._currentValue2;if(zf!==l)if(l={context:l,memoizedValue:c,next:null},Va===null){if(Sc===null)throw Error(a(308));Va=l,Sc.dependencies={lanes:0,firstContext:l}}else Va=Va.next=l;return c}var Ir=null,ls=!1;function Xf(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sg(l,c){l=l.updateQueue,c.updateQueue===l&&(c.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function zr(l,c){return{eventTime:l,lane:c,tag:0,payload:null,callback:null,next:null}}function cs(l,c){var m=l.updateQueue;m!==null&&(m=m.shared,Nn!==null&&l.mode&1&&!(Kt&2)?(l=m.interleaved,l===null?(c.next=c,Ir===null?Ir=[m]:Ir.push(m)):(c.next=l.next,l.next=c),m.interleaved=c):(l=m.pending,l===null?c.next=c:(c.next=l.next,l.next=c),m.pending=c))}function Mc(l,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var x=c.lanes;x&=l.pendingLanes,m|=x,c.lanes=m,Uf(l,m)}}function Mg(l,c){var m=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,m===x)){var S=null,T=null;if(m=m.firstBaseUpdate,m!==null){do{var k={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};T===null?S=T=k:T=T.next=k,m=m.next}while(m!==null);T===null?S=T=c:T=T.next=c}else S=T=c;m={baseState:x.baseState,firstBaseUpdate:S,lastBaseUpdate:T,shared:x.shared,effects:x.effects},l.updateQueue=m;return}l=m.lastBaseUpdate,l===null?m.firstBaseUpdate=c:l.next=c,m.lastBaseUpdate=c}function Ec(l,c,m,x){var S=l.updateQueue;ls=!1;var T=S.firstBaseUpdate,k=S.lastBaseUpdate,re=S.shared.pending;if(re!==null){S.shared.pending=null;var Se=re,Je=Se.next;Se.next=null,k===null?T=Je:k.next=Je,k=Se;var vt=l.alternate;vt!==null&&(vt=vt.updateQueue,re=vt.lastBaseUpdate,re!==k&&(re===null?vt.firstBaseUpdate=Je:re.next=Je,vt.lastBaseUpdate=Se))}if(T!==null){var Gt=S.baseState;k=0,vt=Je=Se=null,re=T;do{var Bt=re.lane,vn=re.eventTime;if((x&Bt)===Bt){vt!==null&&(vt=vt.next={eventTime:vn,lane:0,tag:re.tag,payload:re.payload,callback:re.callback,next:null});e:{var Ct=l,fi=re;switch(Bt=c,vn=m,fi.tag){case 1:if(Ct=fi.payload,typeof Ct=="function"){Gt=Ct.call(vn,Gt,Bt);break e}Gt=Ct;break e;case 3:Ct.flags=Ct.flags&-65537|128;case 0:if(Ct=fi.payload,Bt=typeof Ct=="function"?Ct.call(vn,Gt,Bt):Ct,Bt==null)break e;Gt=s({},Gt,Bt);break e;case 2:ls=!0}}re.callback!==null&&re.lane!==0&&(l.flags|=64,Bt=S.effects,Bt===null?S.effects=[re]:Bt.push(re))}else vn={eventTime:vn,lane:Bt,tag:re.tag,payload:re.payload,callback:re.callback,next:null},vt===null?(Je=vt=vn,Se=Gt):vt=vt.next=vn,k|=Bt;if(re=re.next,re===null){if(re=S.shared.pending,re===null)break;Bt=re,re=Bt.next,Bt.next=null,S.lastBaseUpdate=Bt,S.shared.pending=null}}while(!0);if(vt===null&&(Se=Gt),S.baseState=Se,S.firstBaseUpdate=Je,S.lastBaseUpdate=vt,c=S.shared.interleaved,c!==null){S=c;do k|=S.lane,S=S.next;while(S!==c)}else T===null&&(S.shared.lanes=0);$a|=k,l.lanes=k,l.memoizedState=Gt}}function Eg(l,c,m){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var x=l[c],S=x.callback;if(S!==null){if(x.callback=null,x=m,typeof S!="function")throw Error(a(191,S));S.call(x)}}}var wg=new n.Component().refs;function Jf(l,c,m,x){c=l.memoizedState,m=m(x,c),m=m==null?c:s({},c,m),l.memoizedState=m,l.lanes===0&&(l.updateQueue.baseState=m)}var wc={isMounted:function(l){return(l=l._reactInternals)?b(l)===l:!1},enqueueSetState:function(l,c,m){l=l._reactInternals;var x=yi(),S=fs(l),T=zr(x,S);T.payload=c,m!=null&&(T.callback=m),cs(l,T),c=er(l,S,x),c!==null&&Mc(c,l,S)},enqueueReplaceState:function(l,c,m){l=l._reactInternals;var x=yi(),S=fs(l),T=zr(x,S);T.tag=1,T.payload=c,m!=null&&(T.callback=m),cs(l,T),c=er(l,S,x),c!==null&&Mc(c,l,S)},enqueueForceUpdate:function(l,c){l=l._reactInternals;var m=yi(),x=fs(l),S=zr(m,x);S.tag=2,c!=null&&(S.callback=c),cs(l,S),c=er(l,x,m),c!==null&&Mc(c,l,x)}};function bg(l,c,m,x,S,T,k){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(x,T,k):c.prototype&&c.prototype.isPureReactComponent?!yc(m,x)||!yc(S,T):!0}function Tg(l,c,m){var x=!1,S=ze,T=c.contextType;return typeof T=="object"&&T!==null?T=Zi(T):(S=Ot(c)?mt:it.current,x=c.contextTypes,T=(x=x!=null)?Nt(l,S):ze),c=new c(m,T),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=wc,l.stateNode=c,c._reactInternals=l,x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=S,l.__reactInternalMemoizedMaskedChildContext=T),c}function Cg(l,c,m,x){l=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,x),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,x),c.state!==l&&wc.enqueueReplaceState(c,c.state,null)}function Yf(l,c,m,x){var S=l.stateNode;S.props=m,S.state=l.memoizedState,S.refs=wg,Xf(l);var T=c.contextType;typeof T=="object"&&T!==null?S.context=Zi(T):(T=Ot(c)?mt:it.current,S.context=Nt(l,T)),S.state=l.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(Jf(l,c,T,m),S.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(c=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),c!==S.state&&wc.enqueueReplaceState(S,S.state,null),Ec(l,m,S,x),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308)}var Xa=[],Ja=0,bc=null,Tc=0,Qi=[],qi=0,zs=null,kr=1,Vr="";function ks(l,c){Xa[Ja++]=Tc,Xa[Ja++]=bc,bc=l,Tc=c}function Rg(l,c,m){Qi[qi++]=kr,Qi[qi++]=Vr,Qi[qi++]=zs,zs=l;var x=kr;l=Vr;var S=32-Qt(x)-1;x&=~(1<<S),m+=1;var T=32-Qt(c)+S;if(30<T){var k=S-S%5;T=(x&(1<<k)-1).toString(32),x>>=k,S-=k,kr=1<<32-Qt(c)+S|m<<S|x,Vr=T+l}else kr=1<<T|m<<S|x,Vr=l}function Kf(l){l.return!==null&&(ks(l,1),Rg(l,1,0))}function Zf(l){for(;l===bc;)bc=Xa[--Ja],Xa[Ja]=null,Tc=Xa[--Ja],Xa[Ja]=null;for(;l===zs;)zs=Qi[--qi],Qi[qi]=null,Vr=Qi[--qi],Qi[qi]=null,kr=Qi[--qi],Qi[qi]=null}var Ui=null,Ni=null,Sn=!1,jo=!1,dr=null;function Ig(l,c){var m=tr(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=l,c=l.deletions,c===null?(l.deletions=[m],l.flags|=16):c.push(m)}function Bg(l,c){switch(l.tag){case 5:return c=Jn(c,l.type,l.pendingProps),c!==null?(l.stateNode=c,Ui=l,Ni=Ut(c),!0):!1;case 6:return c=Zo(c,l.pendingProps),c!==null?(l.stateNode=c,Ui=l,Ni=null,!0):!1;case 13:if(c=za(c),c!==null){var m=zs!==null?{id:kr,overflow:Vr}:null;return l.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=tr(18,null,null,0),m.stateNode=c,m.return=l,l.child=m,Ui=l,Ni=null,!0}return!1;default:return!1}}function Qf(l){return(l.mode&1)!==0&&(l.flags&128)===0}function qf(l){if(Sn){var c=Ni;if(c){var m=c;if(!Bg(l,c)){if(Qf(l))throw Error(a(418));c=Ti(m);var x=Ui;c&&Bg(l,c)?Ig(x,m):(l.flags=l.flags&-4097|2,Sn=!1,Ui=l)}}else{if(Qf(l))throw Error(a(418));l.flags=l.flags&-4097|2,Sn=!1,Ui=l}}}function Pg(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;Ui=l}function $o(l){if(!_t||l!==Ui)return!1;if(!Sn)return Pg(l),Sn=!0,!1;if(l.tag!==3&&(l.tag!==5||Ze(l.type)&&!xt(l.type,l.memoizedProps))){var c=Ni;if(c){if(Qf(l)){for(l=Ni;l;)l=Ti(l);throw Error(a(418))}for(;c;)Ig(l,c),c=Ti(c)}}if(Pg(l),l.tag===13){if(!_t)throw Error(a(316));if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(a(317));Ni=fe(l)}else Ni=Ui?Ti(l.stateNode):null;return!0}function Ya(){_t&&(Ni=Ui=null,jo=Sn=!1)}function jf(l){dr===null?dr=[l]:dr.push(l)}function el(l,c,m){if(l=m.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(a(309));var x=m.stateNode}if(!x)throw Error(a(147,l));var S=x,T=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===T?c.ref:(c=function(k){var re=S.refs;re===wg&&(re=S.refs={}),k===null?delete re[T]:re[T]=k},c._stringRef=T,c)}if(typeof l!="string")throw Error(a(284));if(!m._owner)throw Error(a(290,l))}return l}function Cc(l,c){throw l=Object.prototype.toString.call(c),Error(a(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function Dg(l){var c=l._init;return c(l._payload)}function Lg(l){function c(de,ae){if(l){var ve=de.deletions;ve===null?(de.deletions=[ae],de.flags|=16):ve.push(ae)}}function m(de,ae){if(!l)return null;for(;ae!==null;)c(de,ae),ae=ae.sibling;return null}function x(de,ae){for(de=new Map;ae!==null;)ae.key!==null?de.set(ae.key,ae):de.set(ae.index,ae),ae=ae.sibling;return de}function S(de,ae){return de=ps(de,ae),de.index=0,de.sibling=null,de}function T(de,ae,ve){return de.index=ve,l?(ve=de.alternate,ve!==null?(ve=ve.index,ve<ae?(de.flags|=2,ae):ve):(de.flags|=2,ae)):(de.flags|=1048576,ae)}function k(de){return l&&de.alternate===null&&(de.flags|=2),de}function re(de,ae,ve,ct){return ae===null||ae.tag!==6?(ae=Fd(ve,de.mode,ct),ae.return=de,ae):(ae=S(ae,ve),ae.return=de,ae)}function Se(de,ae,ve,ct){var wt=ve.type;return wt===f?vt(de,ae,ve.props.children,ct,ve.key):ae!==null&&(ae.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===E&&Dg(wt)===ae.type)?(ct=S(ae,ve.props),ct.ref=el(de,ae,ve),ct.return=de,ct):(ct=su(ve.type,ve.key,ve.props,null,de.mode,ct),ct.ref=el(de,ae,ve),ct.return=de,ct)}function Je(de,ae,ve,ct){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==ve.containerInfo||ae.stateNode.implementation!==ve.implementation?(ae=Ud(ve,de.mode,ct),ae.return=de,ae):(ae=S(ae,ve.children||[]),ae.return=de,ae)}function vt(de,ae,ve,ct,wt){return ae===null||ae.tag!==7?(ae=Zs(ve,de.mode,ct,wt),ae.return=de,ae):(ae=S(ae,ve),ae.return=de,ae)}function Gt(de,ae,ve){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=Fd(""+ae,de.mode,ve),ae.return=de,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case u:return ve=su(ae.type,ae.key,ae.props,null,de.mode,ve),ve.ref=el(de,null,ae),ve.return=de,ve;case h:return ae=Ud(ae,de.mode,ve),ae.return=de,ae;case E:var ct=ae._init;return Gt(de,ct(ae._payload),ve)}if(oe(ae)||P(ae))return ae=Zs(ae,de.mode,ve,null),ae.return=de,ae;Cc(de,ae)}return null}function Bt(de,ae,ve,ct){var wt=ae!==null?ae.key:null;if(typeof ve=="string"&&ve!==""||typeof ve=="number")return wt!==null?null:re(de,ae,""+ve,ct);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case u:return ve.key===wt?Se(de,ae,ve,ct):null;case h:return ve.key===wt?Je(de,ae,ve,ct):null;case E:return wt=ve._init,Bt(de,ae,wt(ve._payload),ct)}if(oe(ve)||P(ve))return wt!==null?null:vt(de,ae,ve,ct,null);Cc(de,ve)}return null}function vn(de,ae,ve,ct,wt){if(typeof ct=="string"&&ct!==""||typeof ct=="number")return de=de.get(ve)||null,re(ae,de,""+ct,wt);if(typeof ct=="object"&&ct!==null){switch(ct.$$typeof){case u:return de=de.get(ct.key===null?ve:ct.key)||null,Se(ae,de,ct,wt);case h:return de=de.get(ct.key===null?ve:ct.key)||null,Je(ae,de,ct,wt);case E:var Jt=ct._init;return vn(de,ae,ve,Jt(ct._payload),wt)}if(oe(ct)||P(ct))return de=de.get(ve)||null,vt(ae,de,ct,wt,null);Cc(ae,ct)}return null}function Ct(de,ae,ve,ct){for(var wt=null,Jt=null,Ht=ae,cn=ae=0,Qn=null;Ht!==null&&cn<ve.length;cn++){Ht.index>cn?(Qn=Ht,Ht=null):Qn=Ht.sibling;var un=Bt(de,Ht,ve[cn],ct);if(un===null){Ht===null&&(Ht=Qn);break}l&&Ht&&un.alternate===null&&c(de,Ht),ae=T(un,ae,cn),Jt===null?wt=un:Jt.sibling=un,Jt=un,Ht=Qn}if(cn===ve.length)return m(de,Ht),Sn&&ks(de,cn),wt;if(Ht===null){for(;cn<ve.length;cn++)Ht=Gt(de,ve[cn],ct),Ht!==null&&(ae=T(Ht,ae,cn),Jt===null?wt=Ht:Jt.sibling=Ht,Jt=Ht);return Sn&&ks(de,cn),wt}for(Ht=x(de,Ht);cn<ve.length;cn++)Qn=vn(Ht,de,cn,ve[cn],ct),Qn!==null&&(l&&Qn.alternate!==null&&Ht.delete(Qn.key===null?cn:Qn.key),ae=T(Qn,ae,cn),Jt===null?wt=Qn:Jt.sibling=Qn,Jt=Qn);return l&&Ht.forEach(function(ms){return c(de,ms)}),Sn&&ks(de,cn),wt}function fi(de,ae,ve,ct){var wt=P(ve);if(typeof wt!="function")throw Error(a(150));if(ve=wt.call(ve),ve==null)throw Error(a(151));for(var Jt=wt=null,Ht=ae,cn=ae=0,Qn=null,un=ve.next();Ht!==null&&!un.done;cn++,un=ve.next()){Ht.index>cn?(Qn=Ht,Ht=null):Qn=Ht.sibling;var ms=Bt(de,Ht,un.value,ct);if(ms===null){Ht===null&&(Ht=Qn);break}l&&Ht&&ms.alternate===null&&c(de,Ht),ae=T(ms,ae,cn),Jt===null?wt=ms:Jt.sibling=ms,Jt=ms,Ht=Qn}if(un.done)return m(de,Ht),Sn&&ks(de,cn),wt;if(Ht===null){for(;!un.done;cn++,un=ve.next())un=Gt(de,un.value,ct),un!==null&&(ae=T(un,ae,cn),Jt===null?wt=un:Jt.sibling=un,Jt=un);return Sn&&ks(de,cn),wt}for(Ht=x(de,Ht);!un.done;cn++,un=ve.next())un=vn(Ht,de,cn,un.value,ct),un!==null&&(l&&un.alternate!==null&&Ht.delete(un.key===null?cn:un.key),ae=T(un,ae,cn),Jt===null?wt=un:Jt.sibling=un,Jt=un);return l&&Ht.forEach(function(cS){return c(de,cS)}),Sn&&ks(de,cn),wt}function nr(de,ae,ve,ct){if(typeof ve=="object"&&ve!==null&&ve.type===f&&ve.key===null&&(ve=ve.props.children),typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case u:e:{for(var wt=ve.key,Jt=ae;Jt!==null;){if(Jt.key===wt){if(wt=ve.type,wt===f){if(Jt.tag===7){m(de,Jt.sibling),ae=S(Jt,ve.props.children),ae.return=de,de=ae;break e}}else if(Jt.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===E&&Dg(wt)===Jt.type){m(de,Jt.sibling),ae=S(Jt,ve.props),ae.ref=el(de,Jt,ve),ae.return=de,de=ae;break e}m(de,Jt);break}else c(de,Jt);Jt=Jt.sibling}ve.type===f?(ae=Zs(ve.props.children,de.mode,ct,ve.key),ae.return=de,de=ae):(ct=su(ve.type,ve.key,ve.props,null,de.mode,ct),ct.ref=el(de,ae,ve),ct.return=de,de=ct)}return k(de);case h:e:{for(Jt=ve.key;ae!==null;){if(ae.key===Jt)if(ae.tag===4&&ae.stateNode.containerInfo===ve.containerInfo&&ae.stateNode.implementation===ve.implementation){m(de,ae.sibling),ae=S(ae,ve.children||[]),ae.return=de,de=ae;break e}else{m(de,ae);break}else c(de,ae);ae=ae.sibling}ae=Ud(ve,de.mode,ct),ae.return=de,de=ae}return k(de);case E:return Jt=ve._init,nr(de,ae,Jt(ve._payload),ct)}if(oe(ve))return Ct(de,ae,ve,ct);if(P(ve))return fi(de,ae,ve,ct);Cc(de,ve)}return typeof ve=="string"&&ve!==""||typeof ve=="number"?(ve=""+ve,ae!==null&&ae.tag===6?(m(de,ae.sibling),ae=S(ae,ve),ae.return=de,de=ae):(m(de,ae),ae=Fd(ve,de.mode,ct),ae.return=de,de=ae),k(de)):m(de,ae)}return nr}var Ka=Lg(!0),Fg=Lg(!1),tl={},ji=Fe(tl),nl=Fe(tl),Za=Fe(tl);function Br(l){if(l===tl)throw Error(a(174));return l}function $f(l,c){Be(Za,c),Be(nl,l),Be(ji,tl),l=ue(c),Ee(ji),Be(ji,l)}function Qa(){Ee(ji),Ee(nl),Ee(Za)}function Ug(l){var c=Br(Za.current),m=Br(ji.current);c=z(m,l.type,c),m!==c&&(Be(nl,l),Be(ji,c))}function ed(l){nl.current===l&&(Ee(ji),Ee(nl))}var Mn=Fe(0);function Rc(l){for(var c=l;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||ur(m)||Hs(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if(c.flags&128)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var td=[];function nd(){for(var l=0;l<td.length;l++){var c=td[l];st?c._workInProgressVersionPrimary=null:c._workInProgressVersionSecondary=null}td.length=0}var Ic=o.ReactCurrentDispatcher,$i=o.ReactCurrentBatchConfig,qa=0,Tn=null,ci=null,Zn=null,Bc=!1,il=!1,rl=0,LA=0;function ui(){throw Error(a(321))}function id(l,c){if(c===null)return!1;for(var m=0;m<c.length&&m<l.length;m++)if(!Cr(l[m],c[m]))return!1;return!0}function rd(l,c,m,x,S,T){if(qa=T,Tn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Ic.current=l===null||l.memoizedState===null?OA:GA,l=m(x,S),il){T=0;do{if(il=!1,rl=0,25<=T)throw Error(a(301));T+=1,Zn=ci=null,c.updateQueue=null,Ic.current=HA,l=m(x,S)}while(il)}if(Ic.current=Uc,c=ci!==null&&ci.next!==null,qa=0,Zn=ci=Tn=null,Bc=!1,c)throw Error(a(300));return l}function sd(){var l=rl!==0;return rl=0,l}function Wr(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zn===null?Tn.memoizedState=Zn=l:Zn=Zn.next=l,Zn}function Pr(){if(ci===null){var l=Tn.alternate;l=l!==null?l.memoizedState:null}else l=ci.next;var c=Zn===null?Tn.memoizedState:Zn.next;if(c!==null)Zn=c,ci=l;else{if(l===null)throw Error(a(310));ci=l,l={memoizedState:ci.memoizedState,baseState:ci.baseState,baseQueue:ci.baseQueue,queue:ci.queue,next:null},Zn===null?Tn.memoizedState=Zn=l:Zn=Zn.next=l}return Zn}function Vs(l,c){return typeof c=="function"?c(l):c}function Pc(l){var c=Pr(),m=c.queue;if(m===null)throw Error(a(311));m.lastRenderedReducer=l;var x=ci,S=x.baseQueue,T=m.pending;if(T!==null){if(S!==null){var k=S.next;S.next=T.next,T.next=k}x.baseQueue=S=T,m.pending=null}if(S!==null){T=S.next,x=x.baseState;var re=k=null,Se=null,Je=T;do{var vt=Je.lane;if((qa&vt)===vt)Se!==null&&(Se=Se.next={lane:0,action:Je.action,hasEagerState:Je.hasEagerState,eagerState:Je.eagerState,next:null}),x=Je.hasEagerState?Je.eagerState:l(x,Je.action);else{var Gt={lane:vt,action:Je.action,hasEagerState:Je.hasEagerState,eagerState:Je.eagerState,next:null};Se===null?(re=Se=Gt,k=x):Se=Se.next=Gt,Tn.lanes|=vt,$a|=vt}Je=Je.next}while(Je!==null&&Je!==T);Se===null?k=x:Se.next=re,Cr(x,c.memoizedState)||(Oi=!0),c.memoizedState=x,c.baseState=k,c.baseQueue=Se,m.lastRenderedState=x}if(l=m.interleaved,l!==null){S=l;do T=S.lane,Tn.lanes|=T,$a|=T,S=S.next;while(S!==l)}else S===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function Dc(l){var c=Pr(),m=c.queue;if(m===null)throw Error(a(311));m.lastRenderedReducer=l;var x=m.dispatch,S=m.pending,T=c.memoizedState;if(S!==null){m.pending=null;var k=S=S.next;do T=l(T,k.action),k=k.next;while(k!==S);Cr(T,c.memoizedState)||(Oi=!0),c.memoizedState=T,c.baseQueue===null&&(c.baseState=T),m.lastRenderedState=T}return[T,x]}function Ng(){}function Og(l,c){var m=Tn,x=Pr(),S=c(),T=!Cr(x.memoizedState,S);if(T&&(x.memoizedState=S,Oi=!0),x=x.queue,al(zg.bind(null,m,x,l),[l]),x.getSnapshot!==c||T||Zn!==null&&Zn.memoizedState.tag&1){if(m.flags|=2048,sl(9,Hg.bind(null,m,x,S,c),void 0,null),Nn===null)throw Error(a(349));qa&30||Gg(m,c,S)}return S}function Gg(l,c,m){l.flags|=16384,l={getSnapshot:c,value:m},c=Tn.updateQueue,c===null?(c={lastEffect:null,stores:null},Tn.updateQueue=c,c.stores=[l]):(m=c.stores,m===null?c.stores=[l]:m.push(l))}function Hg(l,c,m,x){c.value=m,c.getSnapshot=x,kg(c)&&er(l,1,-1)}function zg(l,c,m){return m(function(){kg(c)&&er(l,1,-1)})}function kg(l){var c=l.getSnapshot;l=l.value;try{var m=c();return!Cr(l,m)}catch{return!0}}function ad(l){var c=Wr();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vs,lastRenderedState:l},c.queue=l,l=l.dispatch=NA.bind(null,Tn,l),[c.memoizedState,l]}function sl(l,c,m,x){return l={tag:l,create:c,destroy:m,deps:x,next:null},c=Tn.updateQueue,c===null?(c={lastEffect:null,stores:null},Tn.updateQueue=c,c.lastEffect=l.next=l):(m=c.lastEffect,m===null?c.lastEffect=l.next=l:(x=m.next,m.next=l,l.next=x,c.lastEffect=l)),l}function Vg(){return Pr().memoizedState}function Lc(l,c,m,x){var S=Wr();Tn.flags|=l,S.memoizedState=sl(1|c,m,void 0,x===void 0?null:x)}function Fc(l,c,m,x){var S=Pr();x=x===void 0?null:x;var T=void 0;if(ci!==null){var k=ci.memoizedState;if(T=k.destroy,x!==null&&id(x,k.deps)){S.memoizedState=sl(c,m,T,x);return}}Tn.flags|=l,S.memoizedState=sl(1|c,m,T,x)}function od(l,c){return Lc(8390656,8,l,c)}function al(l,c){return Fc(2048,8,l,c)}function Wg(l,c){return Fc(4,2,l,c)}function Xg(l,c){return Fc(4,4,l,c)}function Jg(l,c){if(typeof c=="function")return l=l(),c(l),function(){c(null)};if(c!=null)return l=l(),c.current=l,function(){c.current=null}}function Yg(l,c,m){return m=m!=null?m.concat([l]):null,Fc(4,4,Jg.bind(null,c,l),m)}function ld(){}function Kg(l,c){var m=Pr();c=c===void 0?null:c;var x=m.memoizedState;return x!==null&&c!==null&&id(c,x[1])?x[0]:(m.memoizedState=[l,c],l)}function Zg(l,c){var m=Pr();c=c===void 0?null:c;var x=m.memoizedState;return x!==null&&c!==null&&id(c,x[1])?x[0]:(l=l(),m.memoizedState=[l,c],l)}function FA(l,c){var m=ln;ln=m!==0&&4>m?m:4,l(!0);var x=$i.transition;$i.transition={};try{l(!1),c()}finally{ln=m,$i.transition=x}}function Qg(){return Pr().memoizedState}function UA(l,c,m){var x=fs(l);m={lane:x,action:m,hasEagerState:!1,eagerState:null,next:null},qg(l)?jg(c,m):($g(l,c,m),m=yi(),l=er(l,x,m),l!==null&&e0(l,c,x))}function NA(l,c,m){var x=fs(l),S={lane:x,action:m,hasEagerState:!1,eagerState:null,next:null};if(qg(l))jg(c,S);else{$g(l,c,S);var T=l.alternate;if(l.lanes===0&&(T===null||T.lanes===0)&&(T=c.lastRenderedReducer,T!==null))try{var k=c.lastRenderedState,re=T(k,m);if(S.hasEagerState=!0,S.eagerState=re,Cr(re,k))return}catch{}finally{}m=yi(),l=er(l,x,m),l!==null&&e0(l,c,x)}}function qg(l){var c=l.alternate;return l===Tn||c!==null&&c===Tn}function jg(l,c){il=Bc=!0;var m=l.pending;m===null?c.next=c:(c.next=m.next,m.next=c),l.pending=c}function $g(l,c,m){Nn!==null&&l.mode&1&&!(Kt&2)?(l=c.interleaved,l===null?(m.next=m,Ir===null?Ir=[c]:Ir.push(c)):(m.next=l.next,l.next=m),c.interleaved=m):(l=c.pending,l===null?m.next=m:(m.next=l.next,l.next=m),c.pending=m)}function e0(l,c,m){if(m&4194240){var x=c.lanes;x&=l.pendingLanes,m|=x,c.lanes=m,Uf(l,m)}}var Uc={readContext:Zi,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useInsertionEffect:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useDeferredValue:ui,useTransition:ui,useMutableSource:ui,useSyncExternalStore:ui,useId:ui,unstable_isNewReconciler:!1},OA={readContext:Zi,useCallback:function(l,c){return Wr().memoizedState=[l,c===void 0?null:c],l},useContext:Zi,useEffect:od,useImperativeHandle:function(l,c,m){return m=m!=null?m.concat([l]):null,Lc(4194308,4,Jg.bind(null,c,l),m)},useLayoutEffect:function(l,c){return Lc(4194308,4,l,c)},useInsertionEffect:function(l,c){return Lc(4,2,l,c)},useMemo:function(l,c){var m=Wr();return c=c===void 0?null:c,l=l(),m.memoizedState=[l,c],l},useReducer:function(l,c,m){var x=Wr();return c=m!==void 0?m(c):c,x.memoizedState=x.baseState=c,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:c},x.queue=l,l=l.dispatch=UA.bind(null,Tn,l),[x.memoizedState,l]},useRef:function(l){var c=Wr();return l={current:l},c.memoizedState=l},useState:ad,useDebugValue:ld,useDeferredValue:function(l){var c=ad(l),m=c[0],x=c[1];return od(function(){var S=$i.transition;$i.transition={};try{x(l)}finally{$i.transition=S}},[l]),m},useTransition:function(){var l=ad(!1),c=l[0];return l=FA.bind(null,l[1]),Wr().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,m){var x=Tn,S=Wr();if(Sn){if(m===void 0)throw Error(a(407));m=m()}else{if(m=c(),Nn===null)throw Error(a(349));qa&30||Gg(x,c,m)}S.memoizedState=m;var T={value:m,getSnapshot:c};return S.queue=T,od(zg.bind(null,x,T,l),[l]),x.flags|=2048,sl(9,Hg.bind(null,x,T,m,c),void 0,null),m},useId:function(){var l=Wr(),c=Nn.identifierPrefix;if(Sn){var m=Vr,x=kr;m=(x&~(1<<32-Qt(x)-1)).toString(32)+m,c=":"+c+"R"+m,m=rl++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=LA++,c=":"+c+"r"+m.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},GA={readContext:Zi,useCallback:Kg,useContext:Zi,useEffect:al,useImperativeHandle:Yg,useInsertionEffect:Wg,useLayoutEffect:Xg,useMemo:Zg,useReducer:Pc,useRef:Vg,useState:function(){return Pc(Vs)},useDebugValue:ld,useDeferredValue:function(l){var c=Pc(Vs),m=c[0],x=c[1];return al(function(){var S=$i.transition;$i.transition={};try{x(l)}finally{$i.transition=S}},[l]),m},useTransition:function(){var l=Pc(Vs)[0],c=Pr().memoizedState;return[l,c]},useMutableSource:Ng,useSyncExternalStore:Og,useId:Qg,unstable_isNewReconciler:!1},HA={readContext:Zi,useCallback:Kg,useContext:Zi,useEffect:al,useImperativeHandle:Yg,useInsertionEffect:Wg,useLayoutEffect:Xg,useMemo:Zg,useReducer:Dc,useRef:Vg,useState:function(){return Dc(Vs)},useDebugValue:ld,useDeferredValue:function(l){var c=Dc(Vs),m=c[0],x=c[1];return al(function(){var S=$i.transition;$i.transition={};try{x(l)}finally{$i.transition=S}},[l]),m},useTransition:function(){var l=Dc(Vs)[0],c=Pr().memoizedState;return[l,c]},useMutableSource:Ng,useSyncExternalStore:Og,useId:Qg,unstable_isNewReconciler:!1};function cd(l,c){try{var m="",x=c;do m+=DA(x),x=x.return;while(x);var S=m}catch(T){S=` 4048Error generating stack: `+T.message+` 4049`+T.stack}return{value:l,source:c,stack:S}}function ud(l,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var zA=typeof WeakMap=="function"?WeakMap:Map;function t0(l,c,m){m=zr(-1,m),m.tag=3,m.payload={element:null};var x=c.value;return m.callback=function(){jc||(jc=!0,Cd=x),ud(l,c)},m}function n0(l,c,m){m=zr(-1,m),m.tag=3;var x=l.type.getDerivedStateFromError;if(typeof x=="function"){var S=c.value;m.payload=function(){return x(S)},m.callback=function(){ud(l,c)}}var T=l.stateNode;return T!==null&&typeof T.componentDidCatch=="function"&&(m.callback=function(){ud(l,c),typeof x!="function"&&(us===null?us=new Set([this]):us.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})}),m}function i0(l,c,m){var x=l.pingCache;if(x===null){x=l.pingCache=new zA;var S=new Set;x.set(c,S)}else S=x.get(c),S===void 0&&(S=new Set,x.set(c,S));S.has(m)||(S.add(m),l=tS.bind(null,l,c,m),c.then(l,l))}function r0(l){do{var c;if((c=l.tag===13)&&(c=l.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return l;l=l.return}while(l!==null);return null}function s0(l,c,m,x,S){return l.mode&1?(l.flags|=65536,l.lanes=S,l):(l===c?l.flags|=65536:(l.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=zr(-1,1),c.tag=2,cs(m,c))),m.lanes|=1),l)}function Dr(l){l.flags|=4}function a0(l,c){if(l!==null&&l.child===c.child)return!0;if(c.flags&16)return!1;for(l=c.child;l!==null;){if(l.flags&12854||l.subtreeFlags&12854)return!1;l=l.sibling}return!0}var ol,ll,Nc,Oc;if(Dt)ol=function(l,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)pe(l,m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===c)break;for(;m.sibling===null;){if(m.return===null||m.return===c)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},ll=function(){},Nc=function(l,c,m,x,S){if(l=l.memoizedProps,l!==x){var T=c.stateNode,k=Br(ji.current);m=$(T,m,l,x,S,k),(c.updateQueue=m)&&Dr(c)}},Oc=function(l,c,m,x){m!==x&&Dr(c)};else if(Zt){ol=function(l,c,m,x){for(var S=c.child;S!==null;){if(S.tag===5){var T=S.stateNode;m&&x&&(T=Wt(T,S.type,S.memoizedProps,S)),pe(l,T)}else if(S.tag===6)T=S.stateNode,m&&x&&(T=Pn(T,S.memoizedProps,S)),pe(l,T);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)T=S.child,T!==null&&(T.return=S),ol(l,S,!0,!0);else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===c)break;for(;S.sibling===null;){if(S.return===null||S.return===c)return;S=S.return}S.sibling.return=S.return,S=S.sibling}};var o0=function(l,c,m,x){for(var S=c.child;S!==null;){if(S.tag===5){var T=S.stateNode;m&&x&&(T=Wt(T,S.type,S.memoizedProps,S)),He(l,T)}else if(S.tag===6)T=S.stateNode,m&&x&&(T=Pn(T,S.memoizedProps,S)),He(l,T);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)T=S.child,T!==null&&(T.return=S),o0(l,S,!0,!0);else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===c)break;for(;S.sibling===null;){if(S.return===null||S.return===c)return;S=S.return}S.sibling.return=S.return,S=S.sibling}};ll=function(l,c){var m=c.stateNode;if(!a0(l,c)){l=m.containerInfo;var x=be(l);o0(x,c,!1,!1),m.pendingChildren=x,Dr(c),Mt(l,x)}},Nc=function(l,c,m,x,S){var T=l.stateNode,k=l.memoizedProps;if((l=a0(l,c))&&k===x)c.stateNode=T;else{var re=c.stateNode,Se=Br(ji.current),Je=null;k!==x&&(Je=$(re,m,k,x,S,Se)),l&&Je===null?c.stateNode=T:(T=Oe(T,Je,m,k,x,c,l,re),we(T,m,x,S,Se)&&Dr(c),c.stateNode=T,l?Dr(c):ol(T,c,!1,!1))}},Oc=function(l,c,m,x){m!==x?(l=Br(Za.current),m=Br(ji.current),c.stateNode=le(x,l,m,c),Dr(c)):c.stateNode=l.stateNode}}else ll=function(){},Nc=function(){},Oc=function(){};function cl(l,c){if(!Sn)switch(l.tailMode){case"hidden":c=l.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?l.tail=null:m.sibling=null;break;case"collapsed":m=l.tail;for(var x=null;m!==null;)m.alternate!==null&&(x=m),m=m.sibling;x===null?c||l.tail===null?l.tail=null:l.tail.sibling=null:x.sibling=null}}function hi(l){var c=l.alternate!==null&&l.alternate.child===l.child,m=0,x=0;if(c)for(var S=l.child;S!==null;)m|=S.lanes|S.childLanes,x|=S.subtreeFlags&14680064,x|=S.flags&14680064,S.return=l,S=S.sibling;else for(S=l.child;S!==null;)m|=S.lanes|S.childLanes,x|=S.subtreeFlags,x|=S.flags,S.return=l,S=S.sibling;return l.subtreeFlags|=x,l.childLanes=m,c}function kA(l,c,m){var x=c.pendingProps;switch(Zf(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hi(c),null;case 1:return Ot(c.type)&&Xt(),hi(c),null;case 3:return x=c.stateNode,Qa(),Ee(ke),Ee(it),nd(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(l===null||l.child===null)&&($o(c)?Dr(c):l===null||l.memoizedState.isDehydrated&&!(c.flags&256)||(c.flags|=1024,dr!==null&&(Bd(dr),dr=null))),ll(l,c),hi(c),null;case 5:ed(c),m=Br(Za.current);var S=c.type;if(l!==null&&c.stateNode!=null)Nc(l,c,S,x,m),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!x){if(c.stateNode===null)throw Error(a(166));return hi(c),null}if(l=Br(ji.current),$o(c)){if(!_t)throw Error(a(175));l=I(c.stateNode,c.type,c.memoizedProps,m,l,c,!jo),c.updateQueue=l,l!==null&&Dr(c)}else{var T=se(S,x,m,l,c);ol(T,c,!1,!1),c.stateNode=T,we(T,S,x,m,l)&&Dr(c)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return hi(c),null;case 6:if(l&&c.stateNode!=null)Oc(l,c,l.memoizedProps,x);else{if(typeof x!="string"&&c.stateNode===null)throw Error(a(166));if(l=Br(Za.current),m=Br(ji.current),$o(c)){if(!_t)throw Error(a(176));if(l=c.stateNode,x=c.memoizedProps,(m=O(l,x,c,!jo))&&(S=Ui,S!==null))switch(T=(S.mode&1)!==0,S.tag){case 3:Ke(S.stateNode.containerInfo,l,x,T);break;case 5:qe(S.type,S.memoizedProps,S.stateNode,l,x,T)}m&&Dr(c)}else c.stateNode=le(x,l,m,c)}return hi(c),null;case 13:if(Ee(Mn),x=c.memoizedState,Sn&&Ni!==null&&c.mode&1&&!(c.flags&128)){for(l=Ni;l;)l=Ti(l);return Ya(),c.flags|=98560,c}if(x!==null&&x.dehydrated!==null){if(x=$o(c),l===null){if(!x)throw Error(a(318));if(!_t)throw Error(a(344));if(l=c.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(a(317));Z(l,c)}else Ya(),!(c.flags&128)&&(c.memoizedState=null),c.flags|=4;return hi(c),null}return dr!==null&&(Bd(dr),dr=null),c.flags&128?(c.lanes=m,c):(x=x!==null,m=!1,l===null?$o(c):m=l.memoizedState!==null,x&&!m&&(c.child.flags|=8192,c.mode&1&&(l===null||Mn.current&1?kn===0&&(kn=3):Dd())),c.updateQueue!==null&&(c.flags|=4),hi(c),null);case 4:return Qa(),ll(l,c),l===null&&Ue(c.stateNode.containerInfo),hi(c),null;case 10:return Vf(c.type._context),hi(c),null;case 17:return Ot(c.type)&&Xt(),hi(c),null;case 19:if(Ee(Mn),S=c.memoizedState,S===null)return hi(c),null;if(x=(c.flags&128)!==0,T=S.rendering,T===null)if(x)cl(S,!1);else{if(kn!==0||l!==null&&l.flags&128)for(l=c.child;l!==null;){if(T=Rc(l),T!==null){for(c.flags|=128,cl(S,!1),l=T.updateQueue,l!==null&&(c.updateQueue=l,c.flags|=4),c.subtreeFlags=0,l=m,x=c.child;x!==null;)m=x,S=l,m.flags&=14680066,T=m.alternate,T===null?(m.childLanes=0,m.lanes=S,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=T.childLanes,m.lanes=T.lanes,m.child=T.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=T.memoizedProps,m.memoizedState=T.memoizedState,m.updateQueue=T.updateQueue,m.type=T.type,S=T.dependencies,m.dependencies=S===null?null:{lanes:S.lanes,firstContext:S.firstContext}),x=x.sibling;return Be(Mn,Mn.current&1|2),c.child}l=l.sibling}S.tail!==null&&Kn()>Td&&(c.flags|=128,x=!0,cl(S,!1),c.lanes=4194304)}else{if(!x)if(l=Rc(T),l!==null){if(c.flags|=128,x=!0,l=l.updateQueue,l!==null&&(c.updateQueue=l,c.flags|=4),cl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!T.alternate&&!Sn)return hi(c),null}else 2*Kn()-S.renderingStartTime>Td&&m!==1073741824&&(c.flags|=128,x=!0,cl(S,!1),c.lanes=4194304);S.isBackwards?(T.sibling=c.child,c.child=T):(l=S.last,l!==null?l.sibling=T:c.child=T,S.last=T)}return S.tail!==null?(c=S.tail,S.rendering=c,S.tail=c.sibling,S.renderingStartTime=Kn(),c.sibling=null,l=Mn.current,Be(Mn,x?l&1|2:l&1),c):(hi(c),null);case 22:case 23:return Pd(),x=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(c.flags|=8192),x&&c.mode&1?Gi&1073741824&&(hi(c),Dt&&c.subtreeFlags&6&&(c.flags|=8192)):hi(c),null;case 24:return null;case 25:return null}throw Error(a(156,c.tag))}var VA=o.ReactCurrentOwner,Oi=!1;function xi(l,c,m,x){c.child=l===null?Fg(c,null,m,x):Ka(c,l.child,m,x)}function l0(l,c,m,x,S){m=m.render;var T=c.ref;return Wa(c,S),x=rd(l,c,m,x,T,S),m=sd(),l!==null&&!Oi?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~S,Xr(l,c,S)):(Sn&&m&&Kf(c),c.flags|=1,xi(l,c,x,S),c.child)}function c0(l,c,m,x,S){if(l===null){var T=m.type;return typeof T=="function"&&!Ld(T)&&T.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=T,u0(l,c,T,x,S)):(l=su(m.type,null,x,c,c.mode,S),l.ref=c.ref,l.return=c,c.child=l)}if(T=l.child,!(l.lanes&S)){var k=T.memoizedProps;if(m=m.compare,m=m!==null?m:yc,m(k,x)&&l.ref===c.ref)return Xr(l,c,S)}return c.flags|=1,l=ps(T,x),l.ref=c.ref,l.return=c,c.child=l}function u0(l,c,m,x,S){if(l!==null&&yc(l.memoizedProps,x)&&l.ref===c.ref)if(Oi=!1,(l.lanes&S)!==0)l.flags&131072&&(Oi=!0);else return c.lanes=l.lanes,Xr(l,c,S);return hd(l,c,m,x,S)}function h0(l,c,m){var x=c.pendingProps,S=x.children,T=l!==null?l.memoizedState:null;if(x.mode==="hidden")if(!(c.mode&1))c.memoizedState={baseLanes:0,cachePool:null},Be(ja,Gi),Gi|=m;else if(m&1073741824)c.memoizedState={baseLanes:0,cachePool:null},x=T!==null?T.baseLanes:m,Be(ja,Gi),Gi|=x;else return l=T!==null?T.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:l,cachePool:null},c.updateQueue=null,Be(ja,Gi),Gi|=l,null;else T!==null?(x=T.baseLanes|m,c.memoizedState=null):x=m,Be(ja,Gi),Gi|=x;return xi(l,c,S,m),c.child}function f0(l,c){var m=c.ref;(l===null&&m!==null||l!==null&&l.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function hd(l,c,m,x,S){var T=Ot(m)?mt:it.current;return T=Nt(c,T),Wa(c,S),m=rd(l,c,m,x,T,S),x=sd(),l!==null&&!Oi?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~S,Xr(l,c,S)):(Sn&&x&&Kf(c),c.flags|=1,xi(l,c,m,S),c.child)}function d0(l,c,m,x,S){if(Ot(m)){var T=!0;St(c)}else T=!1;if(Wa(c,S),c.stateNode===null)l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),Tg(c,m,x),Yf(c,m,x,S),x=!0;else if(l===null){var k=c.stateNode,re=c.memoizedProps;k.props=re;var Se=k.context,Je=m.contextType;typeof Je=="object"&&Je!==null?Je=Zi(Je):(Je=Ot(m)?mt:it.current,Je=Nt(c,Je));var vt=m.getDerivedStateFromProps,Gt=typeof vt=="function"||typeof k.getSnapshotBeforeUpdate=="function";Gt||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(re!==x||Se!==Je)&&Cg(c,k,x,Je),ls=!1;var Bt=c.memoizedState;k.state=Bt,Ec(c,x,k,S),Se=c.memoizedState,re!==x||Bt!==Se||ke.current||ls?(typeof vt=="function"&&(Jf(c,m,vt,x),Se=c.memoizedState),(re=ls||bg(c,m,re,x,Bt,Se,Je))?(Gt||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(c.flags|=4194308)):(typeof k.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=x,c.memoizedState=Se),k.props=x,k.state=Se,k.context=Je,x=re):(typeof k.componentDidMount=="function"&&(c.flags|=4194308),x=!1)}else{k=c.stateNode,Sg(l,c),re=c.memoizedProps,Je=c.type===c.elementType?re:fr(c.type,re),k.props=Je,Gt=c.pendingProps,Bt=k.context,Se=m.contextType,typeof Se=="object"&&Se!==null?Se=Zi(Se):(Se=Ot(m)?mt:it.current,Se=Nt(c,Se));var vn=m.getDerivedStateFromProps;(vt=typeof vn=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(re!==Gt||Bt!==Se)&&Cg(c,k,x,Se),ls=!1,Bt=c.memoizedState,k.state=Bt,Ec(c,x,k,S);var Ct=c.memoizedState;re!==Gt||Bt!==Ct||ke.current||ls?(typeof vn=="function"&&(Jf(c,m,vn,x),Ct=c.memoizedState),(Je=ls||bg(c,m,Je,x,Bt,Ct,Se)||!1)?(vt||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(x,Ct,Se),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(x,Ct,Se)),typeof k.componentDidUpdate=="function"&&(c.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof k.componentDidUpdate!="function"||re===l.memoizedProps&&Bt===l.memoizedState||(c.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||re===l.memoizedProps&&Bt===l.memoizedState||(c.flags|=1024),c.memoizedProps=x,c.memoizedState=Ct),k.props=x,k.state=Ct,k.context=Se,x=Je):(typeof k.componentDidUpdate!="function"||re===l.memoizedProps&&Bt===l.memoizedState||(c.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||re===l.memoizedProps&&Bt===l.memoizedState||(c.flags|=1024),x=!1)}return fd(l,c,m,x,T,S)}function fd(l,c,m,x,S,T){f0(l,c);var k=(c.flags&128)!==0;if(!x&&!k)return S&>(c,m,!1),Xr(l,c,T);x=c.stateNode,VA.current=c;var re=k&&typeof m.getDerivedStateFromError!="function"?null:x.render();return c.flags|=1,l!==null&&k?(c.child=Ka(c,l.child,null,T),c.child=Ka(c,null,re,T)):xi(l,c,re,T),c.memoizedState=x.state,S&>(c,m,!0),c.child}function p0(l){var c=l.stateNode;c.pendingContext?Et(l,c.pendingContext,c.pendingContext!==c.context):c.context&&Et(l,c.context,!1),$f(l,c.containerInfo)}function m0(l,c,m,x,S){return Ya(),jf(S),c.flags|=256,xi(l,c,m,x),c.child}var Gc={dehydrated:null,treeContext:null,retryLane:0};function Hc(l){return{baseLanes:l,cachePool:null}}function g0(l,c,m){var x=c.pendingProps,S=Mn.current,T=!1,k=(c.flags&128)!==0,re;if((re=k)||(re=l!==null&&l.memoizedState===null?!1:(S&2)!==0),re?(T=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(S|=1),Be(Mn,S&1),l===null)return qf(c),l=c.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?(c.mode&1?Hs(l)?c.lanes=8:c.lanes=1073741824:c.lanes=1,null):(S=x.children,l=x.fallback,T?(x=c.mode,T=c.child,S={mode:"hidden",children:S},!(x&1)&&T!==null?(T.childLanes=0,T.pendingProps=S):T=au(S,x,0,null),l=Zs(l,x,m,null),T.return=c,l.return=c,T.sibling=l,c.child=T,c.child.memoizedState=Hc(m),c.memoizedState=Gc,l):dd(c,S));if(S=l.memoizedState,S!==null){if(re=S.dehydrated,re!==null){if(k)return c.flags&256?(c.flags&=-257,zc(l,c,m,Error(a(422)))):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(T=x.fallback,S=c.mode,x=au({mode:"visible",children:x.children},S,0,null),T=Zs(T,S,m,null),T.flags|=2,x.return=c,T.return=c,x.sibling=T,c.child=x,c.mode&1&&Ka(c,l.child,null,m),c.child.memoizedState=Hc(m),c.memoizedState=Gc,T);if(!(c.mode&1))c=zc(l,c,m,null);else if(Hs(re))c=zc(l,c,m,Error(a(419)));else if(x=(m&l.childLanes)!==0,Oi||x){if(x=Nn,x!==null){switch(m&-m){case 4:T=2;break;case 16:T=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:T=32;break;case 536870912:T=268435456;break;default:T=0}x=T&(x.suspendedLanes|m)?0:T,x!==0&&x!==S.retryLane&&(S.retryLane=x,er(l,x,-1))}Dd(),c=zc(l,c,m,Error(a(421)))}else ur(re)?(c.flags|=128,c.child=l.child,c=nS.bind(null,l),br(re,c),c=null):(m=S.treeContext,_t&&(Ni=ka(re),Ui=c,Sn=!0,dr=null,jo=!1,m!==null&&(Qi[qi++]=kr,Qi[qi++]=Vr,Qi[qi++]=zs,kr=m.id,Vr=m.overflow,zs=c)),c=dd(c,c.pendingProps.children),c.flags|=4096);return c}return T?(x=_0(l,c,x.children,x.fallback,m),T=c.child,S=l.child.memoizedState,T.memoizedState=S===null?Hc(m):{baseLanes:S.baseLanes|m,cachePool:null},T.childLanes=l.childLanes&~m,c.memoizedState=Gc,x):(m=v0(l,c,x.children,m),c.memoizedState=null,m)}return T?(x=_0(l,c,x.children,x.fallback,m),T=c.child,S=l.child.memoizedState,T.memoizedState=S===null?Hc(m):{baseLanes:S.baseLanes|m,cachePool:null},T.childLanes=l.childLanes&~m,c.memoizedState=Gc,x):(m=v0(l,c,x.children,m),c.memoizedState=null,m)}function dd(l,c){return c=au({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function v0(l,c,m,x){var S=l.child;return l=S.sibling,m=ps(S,{mode:"visible",children:m}),!(c.mode&1)&&(m.lanes=x),m.return=c,m.sibling=null,l!==null&&(x=c.deletions,x===null?(c.deletions=[l],c.flags|=16):x.push(l)),c.child=m}function _0(l,c,m,x,S){var T=c.mode;l=l.child;var k=l.sibling,re={mode:"hidden",children:m};return!(T&1)&&c.child!==l?(m=c.child,m.childLanes=0,m.pendingProps=re,c.deletions=null):(m=ps(l,re),m.subtreeFlags=l.subtreeFlags&14680064),k!==null?x=ps(k,x):(x=Zs(x,T,S,null),x.flags|=2),x.return=c,m.return=c,m.sibling=x,c.child=m,x}function zc(l,c,m,x){return x!==null&&jf(x),Ka(c,l.child,null,m),l=dd(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function x0(l,c,m){l.lanes|=c;var x=l.alternate;x!==null&&(x.lanes|=c),Wf(l.return,c,m)}function pd(l,c,m,x,S){var T=l.memoizedState;T===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:x,tail:m,tailMode:S}:(T.isBackwards=c,T.rendering=null,T.renderingStartTime=0,T.last=x,T.tail=m,T.tailMode=S)}function y0(l,c,m){var x=c.pendingProps,S=x.revealOrder,T=x.tail;if(xi(l,c,x.children,m),x=Mn.current,x&2)x=x&1|2,c.flags|=128;else{if(l!==null&&l.flags&128)e:for(l=c.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&x0(l,m,c);else if(l.tag===19)x0(l,m,c);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===c)break e;for(;l.sibling===null;){if(l.return===null||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}x&=1}if(Be(Mn,x),!(c.mode&1))c.memoizedState=null;else switch(S){case"forwards":for(m=c.child,S=null;m!==null;)l=m.alternate,l!==null&&Rc(l)===null&&(S=m),m=m.sibling;m=S,m===null?(S=c.child,c.child=null):(S=m.sibling,m.sibling=null),pd(c,!1,S,m,T);break;case"backwards":for(m=null,S=c.child,c.child=null;S!==null;){if(l=S.alternate,l!==null&&Rc(l)===null){c.child=S;break}l=S.sibling,S.sibling=m,m=S,S=l}pd(c,!0,m,null,T);break;case"together":pd(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Xr(l,c,m){if(l!==null&&(c.dependencies=l.dependencies),$a|=c.lanes,!(m&c.childLanes))return null;if(l!==null&&c.child!==l.child)throw Error(a(153));if(c.child!==null){for(l=c.child,m=ps(l,l.pendingProps),c.child=m,m.return=c;l.sibling!==null;)l=l.sibling,m=m.sibling=ps(l,l.pendingProps),m.return=c;m.sibling=null}return c.child}function WA(l,c,m){switch(c.tag){case 3:p0(c),Ya();break;case 5:Ug(c);break;case 1:Ot(c.type)&&St(c);break;case 4:$f(c,c.stateNode.containerInfo);break;case 10:Ag(c,c.type._context,c.memoizedProps.value);break;case 13:var x=c.memoizedState;if(x!==null)return x.dehydrated!==null?(Be(Mn,Mn.current&1),c.flags|=128,null):m&c.child.childLanes?g0(l,c,m):(Be(Mn,Mn.current&1),l=Xr(l,c,m),l!==null?l.sibling:null);Be(Mn,Mn.current&1);break;case 19:if(x=(m&c.childLanes)!==0,l.flags&128){if(x)return y0(l,c,m);c.flags|=128}var S=c.memoizedState;if(S!==null&&(S.rendering=null,S.tail=null,S.lastEffect=null),Be(Mn,Mn.current),x)break;return null;case 22:case 23:return c.lanes=0,h0(l,c,m)}return Xr(l,c,m)}function XA(l,c){switch(Zf(c),c.tag){case 1:return Ot(c.type)&&Xt(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Qa(),Ee(ke),Ee(it),nd(),l=c.flags,l&65536&&!(l&128)?(c.flags=l&-65537|128,c):null;case 5:return ed(c),null;case 13:if(Ee(Mn),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(a(340));Ya()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return Ee(Mn),null;case 4:return Qa(),null;case 10:return Vf(c.type._context),null;case 22:case 23:return Pd(),null;case 24:return null;default:return null}}var kc=!1,Ws=!1,JA=typeof WeakSet=="function"?WeakSet:Set,at=null;function Vc(l,c){var m=l.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(x){Ii(l,c,x)}else m.current=null}function md(l,c,m){try{m()}catch(x){Ii(l,c,x)}}var A0=!1;function YA(l,c){for(ne(l.containerInfo),at=c;at!==null;)if(l=at,c=l.child,(l.subtreeFlags&1028)!==0&&c!==null)c.return=l,at=c;else for(;at!==null;){l=at;try{var m=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,S=m.memoizedState,T=l.stateNode,k=T.getSnapshotBeforeUpdate(l.elementType===l.type?x:fr(l.type,x),S);T.__reactInternalSnapshotBeforeUpdate=k}break;case 3:Dt&&et(l.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(re){Ii(l,l.return,re)}if(c=l.sibling,c!==null){c.return=l.return,at=c;break}at=l.return}return m=A0,A0=!1,m}function Xs(l,c,m){var x=c.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var S=x=x.next;do{if((S.tag&l)===l){var T=S.destroy;S.destroy=void 0,T!==void 0&&md(c,m,T)}S=S.next}while(S!==x)}}function ul(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&l)===l){var x=m.create;m.destroy=x()}m=m.next}while(m!==c)}}function gd(l){var c=l.ref;if(c!==null){var m=l.stateNode;switch(l.tag){case 5:l=q(m);break;default:l=m}typeof c=="function"?c(l):c.current=l}}function S0(l,c,m){if(Tr&&typeof Tr.onCommitFiberUnmount=="function")try{Tr.onCommitFiberUnmount(_c,c)}catch{}switch(c.tag){case 0:case 11:case 14:case 15:if(l=c.updateQueue,l!==null&&(l=l.lastEffect,l!==null)){var x=l=l.next;do{var S=x,T=S.destroy;S=S.tag,T!==void 0&&(S&2||S&4)&&md(c,m,T),x=x.next}while(x!==l)}break;case 1:if(Vc(c,m),l=c.stateNode,typeof l.componentWillUnmount=="function")try{l.props=c.memoizedProps,l.state=c.memoizedState,l.componentWillUnmount()}catch(k){Ii(c,m,k)}break;case 5:Vc(c,m);break;case 4:Dt?C0(l,c,m):Zt&&Zt&&(c=c.stateNode.containerInfo,m=be(c),jt(c,m))}}function M0(l,c,m){for(var x=c;;)if(S0(l,x,m),x.child===null||Dt&&x.tag===4){if(x===c)break;for(;x.sibling===null;){if(x.return===null||x.return===c)return;x=x.return}x.sibling.return=x.return,x=x.sibling}else x.child.return=x,x=x.child}function E0(l){var c=l.alternate;c!==null&&(l.alternate=null,E0(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&$e(c)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function w0(l){return l.tag===5||l.tag===3||l.tag===4}function b0(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||w0(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function T0(l){if(Dt){e:{for(var c=l.return;c!==null;){if(w0(c))break e;c=c.return}throw Error(a(160))}var m=c;switch(m.tag){case 5:c=m.stateNode,m.flags&32&&(ce(c),m.flags&=-33),m=b0(l),_d(l,m,c);break;case 3:case 4:c=m.stateNode.containerInfo,m=b0(l),vd(l,m,c);break;default:throw Error(a(161))}}}function vd(l,c,m){var x=l.tag;if(x===5||x===6)l=l.stateNode,c?Ge(m,l,c):ht(m,l);else if(x!==4&&(l=l.child,l!==null))for(vd(l,c,m),l=l.sibling;l!==null;)vd(l,c,m),l=l.sibling}function _d(l,c,m){var x=l.tag;if(x===5||x===6)l=l.stateNode,c?Pe(m,l,c):ge(m,l);else if(x!==4&&(l=l.child,l!==null))for(_d(l,c,m),l=l.sibling;l!==null;)_d(l,c,m),l=l.sibling}function C0(l,c,m){for(var x=c,S=!1,T,k;;){if(!S){S=x.return;e:for(;;){if(S===null)throw Error(a(160));switch(T=S.stateNode,S.tag){case 5:k=!1;break e;case 3:T=T.containerInfo,k=!0;break e;case 4:T=T.containerInfo,k=!0;break e}S=S.return}S=!0}if(x.tag===5||x.tag===6)M0(l,x,m),k?X(T,x.stateNode):ut(T,x.stateNode);else if(x.tag===18)k?Ne(T,x.stateNode):Ve(T,x.stateNode);else if(x.tag===4){if(x.child!==null){T=x.stateNode.containerInfo,k=!0,x.child.return=x,x=x.child;continue}}else if(S0(l,x,m),x.child!==null){x.child.return=x,x=x.child;continue}if(x===c)break;for(;x.sibling===null;){if(x.return===null||x.return===c)return;x=x.return,x.tag===4&&(S=!1)}x.sibling.return=x.return,x=x.sibling}}function xd(l,c){if(Dt){switch(c.tag){case 0:case 11:case 14:case 15:Xs(3,c,c.return),ul(3,c),Xs(5,c,c.return);return;case 1:return;case 5:var m=c.stateNode;if(m!=null){var x=c.memoizedProps;l=l!==null?l.memoizedProps:x;var S=c.type,T=c.updateQueue;c.updateQueue=null,T!==null&&Rt(m,T,S,l,x,c)}return;case 6:if(c.stateNode===null)throw Error(a(162));m=c.memoizedProps,Ye(c.stateNode,l!==null?l.memoizedProps:m,m);return;case 3:_t&&l!==null&&l.memoizedState.isDehydrated&&xe(c.stateNode.containerInfo);return;case 12:return;case 13:Wc(c);return;case 19:Wc(c);return;case 17:return}throw Error(a(163))}switch(c.tag){case 0:case 11:case 14:case 15:Xs(3,c,c.return),ul(3,c),Xs(5,c,c.return);return;case 12:return;case 13:Wc(c);return;case 19:Wc(c);return;case 3:_t&&l!==null&&l.memoizedState.isDehydrated&&xe(c.stateNode.containerInfo);break;case 22:case 23:return}e:if(Zt){switch(c.tag){case 1:case 5:case 6:break e;case 3:case 4:c=c.stateNode,jt(c.containerInfo,c.pendingChildren);break e}throw Error(a(163))}}function Wc(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var m=l.stateNode;m===null&&(m=l.stateNode=new JA),c.forEach(function(x){var S=iS.bind(null,l,x);m.has(x)||(m.add(x),x.then(S,S))})}}function KA(l,c){for(at=c;at!==null;){c=at;var m=c.deletions;if(m!==null)for(var x=0;x<m.length;x++){var S=m[x];try{var T=l;Dt?C0(T,S,c):M0(T,S,c);var k=S.alternate;k!==null&&(k.return=null),S.return=null}catch(wt){Ii(S,c,wt)}}if(m=c.child,c.subtreeFlags&12854&&m!==null)m.return=c,at=m;else for(;at!==null;){c=at;try{var re=c.flags;if(re&32&&Dt&&ce(c.stateNode),re&512){var Se=c.alternate;if(Se!==null){var Je=Se.ref;Je!==null&&(typeof Je=="function"?Je(null):Je.current=null)}}if(re&8192)switch(c.tag){case 13:if(c.memoizedState!==null){var vt=c.alternate;(vt===null||vt.memoizedState===null)&&(bd=Kn())}break;case 22:var Gt=c.memoizedState!==null,Bt=c.alternate,vn=Bt!==null&&Bt.memoizedState!==null;if(m=c,Dt){e:if(x=m,S=Gt,T=null,Dt)for(var Ct=x;;){if(Ct.tag===5){if(T===null){T=Ct;var fi=Ct.stateNode;S?De(fi):he(Ct.stateNode,Ct.memoizedProps)}}else if(Ct.tag===6){if(T===null){var nr=Ct.stateNode;S?K(nr):Le(nr,Ct.memoizedProps)}}else if((Ct.tag!==22&&Ct.tag!==23||Ct.memoizedState===null||Ct===x)&&Ct.child!==null){Ct.child.return=Ct,Ct=Ct.child;continue}if(Ct===x)break;for(;Ct.sibling===null;){if(Ct.return===null||Ct.return===x)break e;T===Ct&&(T=null),Ct=Ct.return}T===Ct&&(T=null),Ct.sibling.return=Ct.return,Ct=Ct.sibling}}if(Gt&&!vn&&m.mode&1){at=m;for(var de=m.child;de!==null;){for(m=at=de;at!==null;){x=at;var ae=x.child;switch(x.tag){case 0:case 11:case 14:case 15:Xs(4,x,x.return);break;case 1:Vc(x,x.return);var ve=x.stateNode;if(typeof ve.componentWillUnmount=="function"){var ct=x.return;try{ve.props=x.memoizedProps,ve.state=x.memoizedState,ve.componentWillUnmount()}catch(wt){Ii(x,ct,wt)}}break;case 5:Vc(x,x.return);break;case 22:if(x.memoizedState!==null){B0(m);continue}}ae!==null?(ae.return=x,at=ae):B0(m)}de=de.sibling}}}switch(re&4102){case 2:T0(c),c.flags&=-3;break;case 6:T0(c),c.flags&=-3,xd(c.alternate,c);break;case 4096:c.flags&=-4097;break;case 4100:c.flags&=-4097,xd(c.alternate,c);break;case 4:xd(c.alternate,c)}}catch(wt){Ii(c,c.return,wt)}if(m=c.sibling,m!==null){m.return=c.return,at=m;break}at=c.return}}}function ZA(l,c,m){at=l,R0(l)}function R0(l,c,m){for(var x=(l.mode&1)!==0;at!==null;){var S=at,T=S.child;if(S.tag===22&&x){var k=S.memoizedState!==null||kc;if(!k){var re=S.alternate,Se=re!==null&&re.memoizedState!==null||Ws;re=kc;var Je=Ws;if(kc=k,(Ws=Se)&&!Je)for(at=S;at!==null;)k=at,Se=k.child,k.tag===22&&k.memoizedState!==null?P0(S):Se!==null?(Se.return=k,at=Se):P0(S);for(;T!==null;)at=T,R0(T),T=T.sibling;at=S,kc=re,Ws=Je}I0(l)}else S.subtreeFlags&8772&&T!==null?(T.return=S,at=T):I0(l)}}function I0(l){for(;at!==null;){var c=at;if(c.flags&8772){var m=c.alternate;try{if(c.flags&8772)switch(c.tag){case 0:case 11:case 15:Ws||ul(5,c);break;case 1:var x=c.stateNode;if(c.flags&4&&!Ws)if(m===null)x.componentDidMount();else{var S=c.elementType===c.type?m.memoizedProps:fr(c.type,m.memoizedProps);x.componentDidUpdate(S,m.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var T=c.updateQueue;T!==null&&Eg(c,T,x);break;case 3:var k=c.updateQueue;if(k!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=q(c.child.stateNode);break;case 1:m=c.child.stateNode}Eg(c,k,m)}break;case 5:var re=c.stateNode;m===null&&c.flags&4&&ft(re,c.type,c.memoizedProps,c);break;case 6:break;case 4:break;case 12:break;case 13:if(_t&&c.memoizedState===null){var Se=c.alternate;if(Se!==null){var Je=Se.memoizedState;if(Je!==null){var vt=Je.dehydrated;vt!==null&&ye(vt)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(a(163))}Ws||c.flags&512&&gd(c)}catch(Gt){Ii(c,c.return,Gt)}}if(c===l){at=null;break}if(m=c.sibling,m!==null){m.return=c.return,at=m;break}at=c.return}}function B0(l){for(;at!==null;){var c=at;if(c===l){at=null;break}var m=c.sibling;if(m!==null){m.return=c.return,at=m;break}at=c.return}}function P0(l){for(;at!==null;){var c=at;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{ul(4,c)}catch(Se){Ii(c,m,Se)}break;case 1:var x=c.stateNode;if(typeof x.componentDidMount=="function"){var S=c.return;try{x.componentDidMount()}catch(Se){Ii(c,S,Se)}}var T=c.return;try{gd(c)}catch(Se){Ii(c,T,Se)}break;case 5:var k=c.return;try{gd(c)}catch(Se){Ii(c,k,Se)}}}catch(Se){Ii(c,c.return,Se)}if(c===l){at=null;break}var re=c.sibling;if(re!==null){re.return=c.return,at=re;break}at=c.return}}var Xc=0,Jc=1,Yc=2,Kc=3,Zc=4;if(typeof Symbol=="function"&&Symbol.for){var hl=Symbol.for;Xc=hl("selector.component"),Jc=hl("selector.has_pseudo_class"),Yc=hl("selector.role"),Kc=hl("selector.test_id"),Zc=hl("selector.text")}function yd(l){var c=Te(l);if(c!=null){if(typeof c.memoizedProps["data-testname"]!="string")throw Error(a(364));return c}if(l=Tt(l),l===null)throw Error(a(362));return l.stateNode.current}function Ad(l,c){switch(c.$$typeof){case Xc:if(l.type===c.value)return!0;break;case Jc:e:{c=c.value,l=[l,0];for(var m=0;m<l.length;){var x=l[m++],S=l[m++],T=c[S];if(x.tag!==5||!R(x)){for(;T!=null&&Ad(x,T);)S++,T=c[S];if(S===c.length){c=!0;break e}else for(x=x.child;x!==null;)l.push(x,S),x=x.sibling}}c=!1}return c;case Yc:if(l.tag===5&&ee(l.stateNode,c.value))return!0;break;case Zc:if((l.tag===5||l.tag===6)&&(l=G(l),l!==null&&0<=l.indexOf(c.value)))return!0;break;case Kc:if(l.tag===5&&(l=l.memoizedProps["data-testname"],typeof l=="string"&&l.toLowerCase()===c.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function Sd(l){switch(l.$$typeof){case Xc:return"<"+(D(l.value)||"Unknown")+">";case Jc:return":has("+(Sd(l)||"")+")";case Yc:return'[role="'+l.value+'"]';case Zc:return'"'+l.value+'"';case Kc:return'[data-testname="'+l.value+'"]';default:throw Error(a(365))}}function D0(l,c){var m=[];l=[l,0];for(var x=0;x<l.length;){var S=l[x++],T=l[x++],k=c[T];if(S.tag!==5||!R(S)){for(;k!=null&&Ad(S,k);)T++,k=c[T];if(T===c.length)m.push(S);else for(S=S.child;S!==null;)l.push(S,T),S=S.sibling}}return m}function Md(l,c){if(!tt)throw Error(a(363));l=yd(l),l=D0(l,c),c=[],l=Array.from(l);for(var m=0;m<l.length;){var x=l[m++];if(x.tag===5)R(x)||c.push(x.stateNode);else for(x=x.child;x!==null;)l.push(x),x=x.sibling}return c}var QA=Math.ceil,Qc=o.ReactCurrentDispatcher,Ed=o.ReactCurrentOwner,Dn=o.ReactCurrentBatchConfig,Kt=0,Nn=null,On=null,ti=0,Gi=0,ja=Fe(0),kn=0,fl=null,$a=0,qc=0,wd=0,dl=null,Ci=null,bd=0,Td=1/0;function eo(){Td=Kn()+500}var jc=!1,Cd=null,us=null,$c=!1,hs=null,eu=0,pl=0,Rd=null,tu=-1,nu=0;function yi(){return Kt&6?Kn():tu!==-1?tu:tu=Kn()}function fs(l){return l.mode&1?Kt&2&&ti!==0?ti&-ti:PA.transition!==null?(nu===0&&(l=fn,fn<<=1,!(fn&4194240)&&(fn=64),nu=l),nu):(l=ln,l!==0?l:Ie()):1}function er(l,c,m){if(50<pl)throw pl=0,Rd=null,Error(a(185));var x=iu(l,c);return x===null?null:(qo(x,c,m),(!(Kt&2)||x!==Nn)&&(x===Nn&&(!(Kt&2)&&(qc|=c),kn===4&&ds(x,ti)),Ri(x,m),c===1&&Kt===0&&!(l.mode&1)&&(eo(),xc&&Rr())),x)}function iu(l,c){l.lanes|=c;var m=l.alternate;for(m!==null&&(m.lanes|=c),m=l,l=l.return;l!==null;)l.childLanes|=c,m=l.alternate,m!==null&&(m.childLanes|=c),m=l,l=l.return;return m.tag===3?m.stateNode:null}function Ri(l,c){var m=l.callbackNode;Qo(l,c);var x=Un(l,l===Nn?ti:0);if(x===0)m!==null&&xg(m),l.callbackNode=null,l.callbackPriority=0;else if(c=x&-x,l.callbackPriority!==c){if(m!=null&&xg(m),c===1)l.tag===0?BA(F0.bind(null,l)):yg(F0.bind(null,l)),H?At(function(){Kt===0&&Rr()}):Nf(Of,Rr),m=null;else{switch(_g(x)){case 1:m=Of;break;case 4:m=TA;break;case 16:m=Gf;break;case 536870912:m=CA;break;default:m=Gf}m=W0(m,L0.bind(null,l))}l.callbackPriority=c,l.callbackNode=m}}function L0(l,c){if(tu=-1,nu=0,Kt&6)throw Error(a(327));var m=l.callbackNode;if(Ks()&&l.callbackNode!==m)return null;var x=Un(l,l===Nn?ti:0);if(x===0)return null;if(x&30||x&l.expiredLanes||c)c=ru(l,x);else{c=x;var S=Kt;Kt|=2;var T=O0();(Nn!==l||ti!==c)&&(eo(),Js(l,c));do try{$A();break}catch(re){N0(l,re)}while(!0);kf(),Qc.current=T,Kt=S,On!==null?c=0:(Nn=null,ti=0,c=kn)}if(c!==0){if(c===2&&(S=hr(l),S!==0&&(x=S,c=Id(l,S))),c===1)throw m=fl,Js(l,0),ds(l,x),Ri(l,Kn()),m;if(c===6)ds(l,x);else{if(S=l.current.alternate,!(x&30)&&!qA(S)&&(c=ru(l,x),c===2&&(T=hr(l),T!==0&&(x=T,c=Id(l,T))),c===1))throw m=fl,Js(l,0),ds(l,x),Ri(l,Kn()),m;switch(l.finishedWork=S,l.finishedLanes=x,c){case 0:case 1:throw Error(a(345));case 2:Ys(l,Ci);break;case 3:if(ds(l,x),(x&130023424)===x&&(c=bd+500-Kn(),10<c)){if(Un(l,0)!==0)break;if(S=l.suspendedLanes,(S&x)!==x){yi(),l.pingedLanes|=l.suspendedLanes&S;break}l.timeoutHandle=Ae(Ys.bind(null,l,Ci),c);break}Ys(l,Ci);break;case 4:if(ds(l,x),(x&4194240)===x)break;for(c=l.eventTimes,S=-1;0<x;){var k=31-Qt(x);T=1<<k,k=c[k],k>S&&(S=k),x&=~T}if(x=S,x=Kn()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*QA(x/1960))-x,10<x){l.timeoutHandle=Ae(Ys.bind(null,l,Ci),x);break}Ys(l,Ci);break;case 5:Ys(l,Ci);break;default:throw Error(a(329))}}}return Ri(l,Kn()),l.callbackNode===m?L0.bind(null,l):null}function Id(l,c){var m=dl;return l.current.memoizedState.isDehydrated&&(Js(l,c).flags|=256),l=ru(l,c),l!==2&&(c=Ci,Ci=m,c!==null&&Bd(c)),l}function Bd(l){Ci===null?Ci=l:Ci.push.apply(Ci,l)}function qA(l){for(var c=l;;){if(c.flags&16384){var m=c.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var x=0;x<m.length;x++){var S=m[x],T=S.getSnapshot;S=S.value;try{if(!Cr(T(),S))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function ds(l,c){for(c&=~wd,c&=~qc,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var m=31-Qt(c),x=1<<m;l[m]=-1,c&=~x}}function F0(l){if(Kt&6)throw Error(a(327));Ks();var c=Un(l,0);if(!(c&1))return Ri(l,Kn()),null;var m=ru(l,c);if(l.tag!==0&&m===2){var x=hr(l);x!==0&&(c=x,m=Id(l,x))}if(m===1)throw m=fl,Js(l,0),ds(l,c),Ri(l,Kn()),m;if(m===6)throw Error(a(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,Ys(l,Ci),Ri(l,Kn()),null}function U0(l){hs!==null&&hs.tag===0&&!(Kt&6)&&Ks();var c=Kt;Kt|=1;var m=Dn.transition,x=ln;try{if(Dn.transition=null,ln=1,l)return l()}finally{ln=x,Dn.transition=m,Kt=c,!(Kt&6)&&Rr()}}function Pd(){Gi=ja.current,Ee(ja)}function Js(l,c){l.finishedWork=null,l.finishedLanes=0;var m=l.timeoutHandle;if(m!==yt&&(l.timeoutHandle=yt,Qe(m)),On!==null)for(m=On.return;m!==null;){var x=m;switch(Zf(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&Xt();break;case 3:Qa(),Ee(ke),Ee(it),nd();break;case 5:ed(x);break;case 4:Qa();break;case 13:Ee(Mn);break;case 19:Ee(Mn);break;case 10:Vf(x.type._context);break;case 22:case 23:Pd()}m=m.return}if(Nn=l,On=l=ps(l.current,null),ti=Gi=c,kn=0,fl=null,wd=qc=$a=0,Ci=dl=null,Ir!==null){for(c=0;c<Ir.length;c++)if(m=Ir[c],x=m.interleaved,x!==null){m.interleaved=null;var S=x.next,T=m.pending;if(T!==null){var k=T.next;T.next=S,x.next=k}m.pending=x}Ir=null}return l}function N0(l,c){do{var m=On;try{if(kf(),Ic.current=Uc,Bc){for(var x=Tn.memoizedState;x!==null;){var S=x.queue;S!==null&&(S.pending=null),x=x.next}Bc=!1}if(qa=0,Zn=ci=Tn=null,il=!1,rl=0,Ed.current=null,m===null||m.return===null){kn=1,fl=c,On=null;break}e:{var T=l,k=m.return,re=m,Se=c;if(c=ti,re.flags|=32768,Se!==null&&typeof Se=="object"&&typeof Se.then=="function"){var Je=Se,vt=re,Gt=vt.tag;if(!(vt.mode&1)&&(Gt===0||Gt===11||Gt===15)){var Bt=vt.alternate;Bt?(vt.updateQueue=Bt.updateQueue,vt.memoizedState=Bt.memoizedState,vt.lanes=Bt.lanes):(vt.updateQueue=null,vt.memoizedState=null)}var vn=r0(k);if(vn!==null){vn.flags&=-257,s0(vn,k,re,T,c),vn.mode&1&&i0(T,Je,c),c=vn,Se=Je;var Ct=c.updateQueue;if(Ct===null){var fi=new Set;fi.add(Se),c.updateQueue=fi}else Ct.add(Se);break e}else{if(!(c&1)){i0(T,Je,c),Dd();break e}Se=Error(a(426))}}else if(Sn&&re.mode&1){var nr=r0(k);if(nr!==null){!(nr.flags&65536)&&(nr.flags|=256),s0(nr,k,re,T,c),jf(Se);break e}}T=Se,kn!==4&&(kn=2),dl===null?dl=[T]:dl.push(T),Se=cd(Se,re),re=k;do{switch(re.tag){case 3:re.flags|=65536,c&=-c,re.lanes|=c;var de=t0(re,Se,c);Mg(re,de);break e;case 1:T=Se;var ae=re.type,ve=re.stateNode;if(!(re.flags&128)&&(typeof ae.getDerivedStateFromError=="function"||ve!==null&&typeof ve.componentDidCatch=="function"&&(us===null||!us.has(ve)))){re.flags|=65536,c&=-c,re.lanes|=c;var ct=n0(re,T,c);Mg(re,ct);break e}}re=re.return}while(re!==null)}H0(m)}catch(wt){c=wt,On===m&&m!==null&&(On=m=m.return);continue}break}while(!0)}function O0(){var l=Qc.current;return Qc.current=Uc,l===null?Uc:l}function Dd(){(kn===0||kn===3||kn===2)&&(kn=4),Nn===null||!($a&268435455)&&!(qc&268435455)||ds(Nn,ti)}function ru(l,c){var m=Kt;Kt|=2;var x=O0();Nn===l&&ti===c||Js(l,c);do try{jA();break}catch(S){N0(l,S)}while(!0);if(kf(),Kt=m,Qc.current=x,On!==null)throw Error(a(261));return Nn=null,ti=0,kn}function jA(){for(;On!==null;)G0(On)}function $A(){for(;On!==null&&!wA();)G0(On)}function G0(l){var c=V0(l.alternate,l,Gi);l.memoizedProps=l.pendingProps,c===null?H0(l):On=c,Ed.current=null}function H0(l){var c=l;do{var m=c.alternate;if(l=c.return,c.flags&32768){if(m=XA(m,c),m!==null){m.flags&=32767,On=m;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{kn=6,On=null;return}}else if(m=kA(m,c,Gi),m!==null){On=m;return}if(c=c.sibling,c!==null){On=c;return}On=c=l}while(c!==null);kn===0&&(kn=5)}function Ys(l,c){var m=ln,x=Dn.transition;try{Dn.transition=null,ln=1,eS(l,c,m)}finally{Dn.transition=x,ln=m}return null}function eS(l,c,m){do Ks();while(hs!==null);if(Kt&6)throw Error(a(327));var x=l.finishedWork,S=l.finishedLanes;if(x===null)return null;if(l.finishedWork=null,l.finishedLanes=0,x===l.current)throw Error(a(177));l.callbackNode=null,l.callbackPriority=0;var T=x.lanes|x.childLanes;if(EA(l,T),l===Nn&&(On=Nn=null,ti=0),!(x.subtreeFlags&2064)&&!(x.flags&2064)||$c||($c=!0,W0(Gf,function(){return Ks(),null})),T=(x.flags&15990)!==0,x.subtreeFlags&15990||T){T=Dn.transition,Dn.transition=null;var k=ln;ln=1;var re=Kt;Kt|=4,Ed.current=null,YA(l,x),KA(l,x),Y(l.containerInfo),l.current=x,ZA(x),bA(),Kt=re,ln=k,Dn.transition=T}else l.current=x;if($c&&($c=!1,hs=l,eu=S),T=l.pendingLanes,T===0&&(us=null),RA(x.stateNode),Ri(l,Kn()),c!==null)for(m=l.onRecoverableError,x=0;x<c.length;x++)m(c[x]);if(jc)throw jc=!1,l=Cd,Cd=null,l;return eu&1&&l.tag!==0&&Ks(),T=l.pendingLanes,T&1?l===Rd?pl++:(pl=0,Rd=l):pl=0,Rr(),null}function Ks(){if(hs!==null){var l=_g(eu),c=Dn.transition,m=ln;try{if(Dn.transition=null,ln=16>l?16:l,hs===null)var x=!1;else{if(l=hs,hs=null,eu=0,Kt&6)throw Error(a(331));var S=Kt;for(Kt|=4,at=l.current;at!==null;){var T=at,k=T.child;if(at.flags&16){var re=T.deletions;if(re!==null){for(var Se=0;Se<re.length;Se++){var Je=re[Se];for(at=Je;at!==null;){var vt=at;switch(vt.tag){case 0:case 11:case 15:Xs(8,vt,T)}var Gt=vt.child;if(Gt!==null)Gt.return=vt,at=Gt;else for(;at!==null;){vt=at;var Bt=vt.sibling,vn=vt.return;if(E0(vt),vt===Je){at=null;break}if(Bt!==null){Bt.return=vn,at=Bt;break}at=vn}}}var Ct=T.alternate;if(Ct!==null){var fi=Ct.child;if(fi!==null){Ct.child=null;do{var nr=fi.sibling;fi.sibling=null,fi=nr}while(fi!==null)}}at=T}}if(T.subtreeFlags&2064&&k!==null)k.return=T,at=k;else e:for(;at!==null;){if(T=at,T.flags&2048)switch(T.tag){case 0:case 11:case 15:Xs(9,T,T.return)}var de=T.sibling;if(de!==null){de.return=T.return,at=de;break e}at=T.return}}var ae=l.current;for(at=ae;at!==null;){k=at;var ve=k.child;if(k.subtreeFlags&2064&&ve!==null)ve.return=k,at=ve;else e:for(k=ae;at!==null;){if(re=at,re.flags&2048)try{switch(re.tag){case 0:case 11:case 15:ul(9,re)}}catch(wt){Ii(re,re.return,wt)}if(re===k){at=null;break e}var ct=re.sibling;if(ct!==null){ct.return=re.return,at=ct;break e}at=re.return}}if(Kt=S,Rr(),Tr&&typeof Tr.onPostCommitFiberRoot=="function")try{Tr.onPostCommitFiberRoot(_c,l)}catch{}x=!0}return x}finally{ln=m,Dn.transition=c}}return!1}function z0(l,c,m){c=cd(m,c),c=t0(l,c,1),cs(l,c),c=yi(),l=iu(l,1),l!==null&&(qo(l,1,c),Ri(l,c))}function Ii(l,c,m){if(l.tag===3)z0(l,l,m);else for(;c!==null;){if(c.tag===3){z0(c,l,m);break}else if(c.tag===1){var x=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(us===null||!us.has(x))){l=cd(m,l),l=n0(c,l,1),cs(c,l),l=yi(),c=iu(c,1),c!==null&&(qo(c,1,l),Ri(c,l));break}}c=c.return}}function tS(l,c,m){var x=l.pingCache;x!==null&&x.delete(c),c=yi(),l.pingedLanes|=l.suspendedLanes&m,Nn===l&&(ti&m)===m&&(kn===4||kn===3&&(ti&130023424)===ti&&500>Kn()-bd?Js(l,0):wd|=m),Ri(l,c)}function k0(l,c){c===0&&(l.mode&1?(c=zn,zn<<=1,!(zn&130023424)&&(zn=4194304)):c=1);var m=yi();l=iu(l,c),l!==null&&(qo(l,c,m),Ri(l,m))}function nS(l){var c=l.memoizedState,m=0;c!==null&&(m=c.retryLane),k0(l,m)}function iS(l,c){var m=0;switch(l.tag){case 13:var x=l.stateNode,S=l.memoizedState;S!==null&&(m=S.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(a(314))}x!==null&&x.delete(c),k0(l,m)}var V0;V0=function(l,c,m){if(l!==null)if(l.memoizedProps!==c.pendingProps||ke.current)Oi=!0;else{if(!(l.lanes&m)&&!(c.flags&128))return Oi=!1,WA(l,c,m);Oi=!!(l.flags&131072)}else Oi=!1,Sn&&c.flags&1048576&&Rg(c,Tc,c.index);switch(c.lanes=0,c.tag){case 2:var x=c.type;l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),l=c.pendingProps;var S=Nt(c,it.current);Wa(c,m),S=rd(null,c,x,l,S,m);var T=sd();return c.flags|=1,typeof S=="object"&&S!==null&&typeof S.render=="function"&&S.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Ot(x)?(T=!0,St(c)):T=!1,c.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,Xf(c),S.updater=wc,c.stateNode=S,S._reactInternals=c,Yf(c,x,l,m),c=fd(null,c,x,!0,T,m)):(c.tag=0,Sn&&T&&Kf(c),xi(null,c,S,m),c=c.child),c;case 16:x=c.elementType;e:{switch(l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),l=c.pendingProps,S=x._init,x=S(x._payload),c.type=x,S=c.tag=sS(x),l=fr(x,l),S){case 0:c=hd(null,c,x,l,m);break e;case 1:c=d0(null,c,x,l,m);break e;case 11:c=l0(null,c,x,l,m);break e;case 14:c=c0(null,c,x,fr(x.type,l),m);break e}throw Error(a(306,x,""))}return c;case 0:return x=c.type,S=c.pendingProps,S=c.elementType===x?S:fr(x,S),hd(l,c,x,S,m);case 1:return x=c.type,S=c.pendingProps,S=c.elementType===x?S:fr(x,S),d0(l,c,x,S,m);case 3:e:{if(p0(c),l===null)throw Error(a(387));x=c.pendingProps,T=c.memoizedState,S=T.element,Sg(l,c),Ec(c,x,null,m);var k=c.memoizedState;if(x=k.element,_t&&T.isDehydrated)if(T={element:x,isDehydrated:!1,cache:k.cache,transitions:k.transitions},c.updateQueue.baseState=T,c.memoizedState=T,c.flags&256){S=Error(a(423)),c=m0(l,c,x,m,S);break e}else if(x!==S){S=Error(a(424)),c=m0(l,c,x,m,S);break e}else for(_t&&(Ni=os(c.stateNode.containerInfo),Ui=c,Sn=!0,dr=null,jo=!1),m=Fg(c,null,x,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Ya(),x===S){c=Xr(l,c,m);break e}xi(l,c,x,m)}c=c.child}return c;case 5:return Ug(c),l===null&&qf(c),x=c.type,S=c.pendingProps,T=l!==null?l.memoizedProps:null,k=S.children,xt(x,S)?k=null:T!==null&&xt(x,T)&&(c.flags|=32),f0(l,c),xi(l,c,k,m),c.child;case 6:return l===null&&qf(c),null;case 13:return g0(l,c,m);case 4:return $f(c,c.stateNode.containerInfo),x=c.pendingProps,l===null?c.child=Ka(c,null,x,m):xi(l,c,x,m),c.child;case 11:return x=c.type,S=c.pendingProps,S=c.elementType===x?S:fr(x,S),l0(l,c,x,S,m);case 7:return xi(l,c,c.pendingProps,m),c.child;case 8:return xi(l,c,c.pendingProps.children,m),c.child;case 12:return xi(l,c,c.pendingProps.children,m),c.child;case 10:e:{if(x=c.type._context,S=c.pendingProps,T=c.memoizedProps,k=S.value,Ag(c,x,k),T!==null)if(Cr(T.value,k)){if(T.children===S.children&&!ke.current){c=Xr(l,c,m);break e}}else for(T=c.child,T!==null&&(T.return=c);T!==null;){var re=T.dependencies;if(re!==null){k=T.child;for(var Se=re.firstContext;Se!==null;){if(Se.context===x){if(T.tag===1){Se=zr(-1,m&-m),Se.tag=2;var Je=T.updateQueue;if(Je!==null){Je=Je.shared;var vt=Je.pending;vt===null?Se.next=Se:(Se.next=vt.next,vt.next=Se),Je.pending=Se}}T.lanes|=m,Se=T.alternate,Se!==null&&(Se.lanes|=m),Wf(T.return,m,c),re.lanes|=m;break}Se=Se.next}}else if(T.tag===10)k=T.type===c.type?null:T.child;else if(T.tag===18){if(k=T.return,k===null)throw Error(a(341));k.lanes|=m,re=k.alternate,re!==null&&(re.lanes|=m),Wf(k,m,c),k=T.sibling}else k=T.child;if(k!==null)k.return=T;else for(k=T;k!==null;){if(k===c){k=null;break}if(T=k.sibling,T!==null){T.return=k.return,k=T;break}k=k.return}T=k}xi(l,c,S.children,m),c=c.child}return c;case 9:return S=c.type,x=c.pendingProps.children,Wa(c,m),S=Zi(S),x=x(S),c.flags|=1,xi(l,c,x,m),c.child;case 14:return x=c.type,S=fr(x,c.pendingProps),S=fr(x.type,S),c0(l,c,x,S,m);case 15:return u0(l,c,c.type,c.pendingProps,m);case 17:return x=c.type,S=c.pendingProps,S=c.elementType===x?S:fr(x,S),l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2),c.tag=1,Ot(x)?(l=!0,St(c)):l=!1,Wa(c,m),Tg(c,x,S),Yf(c,x,S,m),fd(null,c,x,!0,l,m);case 19:return y0(l,c,m);case 22:return h0(l,c,m)}throw Error(a(156,c.tag))};function W0(l,c){return Nf(l,c)}function rS(l,c,m,x){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tr(l,c,m,x){return new rS(l,c,m,x)}function Ld(l){return l=l.prototype,!(!l||!l.isReactComponent)}function sS(l){if(typeof l=="function")return Ld(l)?1:0;if(l!=null){if(l=l.$$typeof,l===A)return 11;if(l===M)return 14}return 2}function ps(l,c){var m=l.alternate;return m===null?(m=tr(l.tag,c,l.key,l.mode),m.elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=c,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=l.flags&14680064,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,c=l.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m}function su(l,c,m,x,S,T){var k=2;if(x=l,typeof l=="function")Ld(l)&&(k=1);else if(typeof l=="string")k=5;else e:switch(l){case f:return Zs(m.children,S,T,c);case d:k=8,S|=8;break;case p:return l=tr(12,m,c,S|2),l.elementType=p,l.lanes=T,l;case y:return l=tr(13,m,c,S),l.elementType=y,l.lanes=T,l;case _:return l=tr(19,m,c,S),l.elementType=_,l.lanes=T,l;case w:return au(m,S,T,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case g:k=10;break e;case v:k=9;break e;case A:k=11;break e;case M:k=14;break e;case E:k=16,x=null;break e}throw Error(a(130,l==null?l:typeof l,""))}return c=tr(k,m,c,S),c.elementType=l,c.type=x,c.lanes=T,c}function Zs(l,c,m,x){return l=tr(7,l,x,c),l.lanes=m,l}function au(l,c,m,x){return l=tr(22,l,x,c),l.elementType=w,l.lanes=m,l.stateNode={},l}function Fd(l,c,m){return l=tr(6,l,null,c),l.lanes=m,l}function Ud(l,c,m){return c=tr(4,l.children!==null?l.children:[],l.key,c),c.lanes=m,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function aS(l,c,m,x,S){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=yt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ff(0),this.expirationTimes=Ff(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ff(0),this.identifierPrefix=x,this.onRecoverableError=S,_t&&(this.mutableSourceEagerHydrationData=null)}function X0(l,c,m,x,S,T,k,re,Se){return l=new aS(l,c,m,re,Se),c===1?(c=1,T===!0&&(c|=8)):c=0,T=tr(3,null,null,c),l.current=T,T.stateNode=l,T.memoizedState={element:x,isDehydrated:m,cache:null,transitions:null},Xf(T),l}function J0(l){if(!l)return ze;l=l._reactInternals;e:{if(b(l)!==l||l.tag!==1)throw Error(a(170));var c=l;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Ot(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(a(171))}if(l.tag===1){var m=l.type;if(Ot(m))return lt(l,m,c)}return c}function Y0(l){var c=l._reactInternals;if(c===void 0)throw typeof l.render=="function"?Error(a(188)):(l=Object.keys(l).join(","),Error(a(268,l)));return l=V(c),l===null?null:l.stateNode}function K0(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var m=l.retryLane;l.retryLane=m!==0&&m<c?m:c}}function Nd(l,c){K0(l,c),(l=l.alternate)&&K0(l,c)}function oS(l){return l=V(l),l===null?null:l.stateNode}function lS(){return null}return t.attemptContinuousHydration=function(l){if(l.tag===13){var c=yi();er(l,134217728,c),Nd(l,134217728)}},t.attemptHydrationAtCurrentPriority=function(l){if(l.tag===13){var c=yi(),m=fs(l);er(l,m,c),Nd(l,m)}},t.attemptSynchronousHydration=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var m=Yn(c.pendingLanes);m!==0&&(Uf(c,m|1),Ri(c,Kn()),!(Kt&6)&&(eo(),Rr()))}break;case 13:var x=yi();U0(function(){return er(l,1,x)}),Nd(l,1)}},t.batchedUpdates=function(l,c){var m=Kt;Kt|=1;try{return l(c)}finally{Kt=m,Kt===0&&(eo(),xc&&Rr())}},t.createComponentSelector=function(l){return{$$typeof:Xc,value:l}},t.createContainer=function(l,c,m,x,S,T,k){return X0(l,c,!1,null,m,x,S,T,k)},t.createHasPseudoClassSelector=function(l){return{$$typeof:Jc,value:l}},t.createHydrationContainer=function(l,c,m,x,S,T,k,re,Se){return l=X0(m,x,!0,l,S,T,k,re,Se),l.context=J0(null),m=l.current,x=yi(),S=fs(m),T=zr(x,S),T.callback=c??null,cs(m,T),l.current.lanes=S,qo(l,S,x),Ri(l,x),l},t.createPortal=function(l,c,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:x==null?null:""+x,children:l,containerInfo:c,implementation:m}},t.createRoleSelector=function(l){return{$$typeof:Yc,value:l}},t.createTestNameSelector=function(l){return{$$typeof:Kc,value:l}},t.createTextSelector=function(l){return{$$typeof:Zc,value:l}},t.deferredUpdates=function(l){var c=ln,m=Dn.transition;try{return Dn.transition=null,ln=16,l()}finally{ln=c,Dn.transition=m}},t.discreteUpdates=function(l,c,m,x,S){var T=ln,k=Dn.transition;try{return Dn.transition=null,ln=1,l(c,m,x,S)}finally{ln=T,Dn.transition=k,Kt===0&&eo()}},t.findAllNodes=Md,t.findBoundingRects=function(l,c){if(!tt)throw Error(a(363));c=Md(l,c),l=[];for(var m=0;m<c.length;m++)l.push(We(c[m]));for(c=l.length-1;0<c;c--){m=l[c];for(var x=m.x,S=x+m.width,T=m.y,k=T+m.height,re=c-1;0<=re;re--)if(c!==re){var Se=l[re],Je=Se.x,vt=Je+Se.width,Gt=Se.y,Bt=Gt+Se.height;if(x>=Je&&T>=Gt&&S<=vt&&k<=Bt){l.splice(c,1);break}else if(x!==Je||m.width!==Se.width||Bt<T||Gt>k){if(!(T!==Gt||m.height!==Se.height||vt<x||Je>S)){Je>x&&(Se.width+=Je-x,Se.x=x),vt<S&&(Se.width=S-Je),l.splice(c,1);break}}else{Gt>T&&(Se.height+=Gt-T,Se.y=T),Bt<k&&(Se.height=k-Gt),l.splice(c,1);break}}}return l},t.findHostInstance=Y0,t.findHostInstanceWithNoPortals=function(l){return l=U(l),l=l!==null?Q(l):null,l===null?null:l.stateNode},t.findHostInstanceWithWarning=function(l){return Y0(l)},t.flushControlled=function(l){var c=Kt;Kt|=1;var m=Dn.transition,x=ln;try{Dn.transition=null,ln=1,l()}finally{ln=x,Dn.transition=m,Kt=c,Kt===0&&(eo(),Rr())}},t.flushPassiveEffects=Ks,t.flushSync=U0,t.focusWithin=function(l,c){if(!tt)throw Error(a(363));for(l=yd(l),c=D0(l,c),c=Array.from(c),l=0;l<c.length;){var m=c[l++];if(!R(m)){if(m.tag===5&&me(m.stateNode))return!0;for(m=m.child;m!==null;)c.push(m),m=m.sibling}}return!1},t.getCurrentUpdatePriority=function(){return ln},t.getFindAllNodesFailureDescription=function(l,c){if(!tt)throw Error(a(363));var m=0,x=[];l=[yd(l),0];for(var S=0;S<l.length;){var T=l[S++],k=l[S++],re=c[k];if((T.tag!==5||!R(T))&&(Ad(T,re)&&(x.push(Sd(re)),k++,k>m&&(m=k)),k<c.length))for(T=T.child;T!==null;)l.push(T,k),T=T.sibling}if(m<c.length){for(l=[];m<c.length;m++)l.push(Sd(c[m]));return`findAllNodes was able to match part of the selector: 4050 `+(x.join(" > ")+` 4051 4052No matching component was found for: 4053 `)+l.join(" > ")}return null},t.getPublicRootInstance=function(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return q(l.child.stateNode);default:return l.child.stateNode}},t.injectIntoDevTools=function(l){if(l={bundleType:l.bundleType,version:l.version,rendererPackageName:l.rendererPackageName,rendererConfig:l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:o.ReactCurrentDispatcher,findHostInstanceByFiber:oS,findFiberByHostInstance:l.findFiberByHostInstance||lS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")l=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)l=!0;else{try{_c=c.inject(l),Tr=c}catch{}l=!!c.checkDCE}}return l},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(l,c,m,x){if(!tt)throw Error(a(363));l=Md(l,c);var S=Ce(l,m,x).disconnect;return{disconnect:function(){S()}}},t.registerMutableSourceForHydration=function(l,c){var m=c._getVersion;m=m(c._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[c,m]:l.mutableSourceEagerHydrationData.push(c,m)},t.runWithPriority=function(l,c){var m=ln;try{return ln=l,c()}finally{ln=m}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(l,c,m,x){var S=c.current,T=yi(),k=fs(S);return m=J0(m),c.context===null?c.context=m:c.pendingContext=m,c=zr(T,k),c.payload={element:l},x=x===void 0?null:x,x!==null&&(c.callback=x),cs(S,c),l=er(S,k,T),l!==null&&Mc(l,S,k),k},t};Vy.exports=KR;var ZR=Vy.exports;const QR=uS(ZR);var Wy={exports:{}},Xy={};/** 4054 * @license React 4055 * scheduler.production.min.js 4056 * 4057 * Copyright (c) Facebook, Inc. and its affiliates. 4058 * 4059 * This source code is licensed under the MIT license found in the 4060 * LICENSE file in the root directory of this source tree. 4061 */(function(r){function e(z,ne){var Y=z.length;z.push(ne);e:for(;0<Y;){var se=Y-1>>>1,pe=z[se];if(0<i(pe,ne))z[se]=ne,z[Y]=pe,Y=se;else break e}}function t(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var ne=z[0],Y=z.pop();if(Y!==ne){z[0]=Y;e:for(var se=0,pe=z.length,we=pe>>>1;se<we;){var $=2*(se+1)-1,xt=z[$],le=$+1,Ae=z[le];if(0>i(xt,Y))le<pe&&0>i(Ae,xt)?(z[se]=Ae,z[le]=Y,se=le):(z[se]=xt,z[$]=Y,se=$);else if(le<pe&&0>i(Ae,Y))z[se]=Ae,z[le]=Y,se=le;else break e}}return ne}function i(z,ne){var Y=z.sortIndex-ne.sortIndex;return Y!==0?Y:z.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();r.unstable_now=function(){return a.now()-o}}var u=[],h=[],f=1,d=null,p=3,g=!1,v=!1,A=!1,y=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(z){for(var ne=t(h);ne!==null;){if(ne.callback===null)n(h);else if(ne.startTime<=z)n(h),ne.sortIndex=ne.expirationTime,e(u,ne);else break;ne=t(h)}}function w(z){if(A=!1,E(z),!v)if(t(u)!==null)v=!0,q(B);else{var ne=t(h);ne!==null&&ue(w,ne.startTime-z)}}function B(z,ne){v=!1,A&&(A=!1,_(F),F=-1),g=!0;var Y=p;try{for(E(ne),d=t(u);d!==null&&(!(d.expirationTime>ne)||z&&!U());){var se=d.callback;if(typeof se=="function"){d.callback=null,p=d.priorityLevel;var pe=se(d.expirationTime<=ne);ne=r.unstable_now(),typeof pe=="function"?d.callback=pe:d===t(u)&&n(u),E(ne)}else n(u);d=t(u)}if(d!==null)var we=!0;else{var $=t(h);$!==null&&ue(w,$.startTime-ne),we=!1}return we}finally{d=null,p=Y,g=!1}}var P=!1,D=null,F=-1,b=5,C=-1;function U(){return!(r.unstable_now()-C<b)}function V(){if(D!==null){var z=r.unstable_now();C=z;var ne=!0;try{ne=D(!0,z)}finally{ne?J():(P=!1,D=null)}}else P=!1}var J;if(typeof M=="function")J=function(){M(V)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,oe=Q.port2;Q.port1.onmessage=V,J=function(){oe.postMessage(null)}}else J=function(){y(V,0)};function q(z){D=z,P||(P=!0,J())}function ue(z,ne){F=y(function(){z(r.unstable_now())},ne)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(z){z.callback=null},r.unstable_continueExecution=function(){v||g||(v=!0,q(B))},r.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<z?Math.floor(1e3/z):5},r.unstable_getCurrentPriorityLevel=function(){return p},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(z){switch(p){case 1:case 2:case 3:var ne=3;break;default:ne=p}var Y=p;p=ne;try{return z()}finally{p=Y}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(z,ne){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Y=p;p=z;try{return ne()}finally{p=Y}},r.unstable_scheduleCallback=function(z,ne,Y){var se=r.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?se+Y:se):Y=se,z){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=Y+pe,z={id:f++,callback:ne,priorityLevel:z,startTime:Y,expirationTime:pe,sortIndex:-1},Y>se?(z.sortIndex=Y,e(h,z),t(u)===null&&z===t(h)&&(A?(_(F),F=-1):A=!0,ue(w,Y-se))):(z.sortIndex=pe,e(u,z),v||g||(v=!0,q(B))),z},r.unstable_shouldYield=U,r.unstable_wrapCallback=function(z){var ne=p;return function(){var Y=p;p=ne;try{return z.apply(this,arguments)}finally{p=Y}}}})(Xy);Wy.exports=Xy;var b_=Wy.exports;const dg={},Jy=r=>void Object.assign(dg,r);function qR(r,e){function t(f,{args:d=[],attach:p,...g},v){let A=`${f[0].toUpperCase()}${f.slice(1)}`,y;if(f==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=g.object;y=wo(_,{type:f,root:v,attach:p,primitive:!0})}else{const _=dg[A];if(!_)throw new Error(`R3F: ${A} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");y=wo(new _(...d),{type:f,root:v,attach:p,memoizedProps:{args:d}})}return y.__r3f.attach===void 0&&(y.isBufferGeometry?y.__r3f.attach="geometry":y.isMaterial&&(y.__r3f.attach="material")),A!=="inject"&&Bp(y,g),y}function n(f,d){let p=!1;if(d){var g,v;(g=d.__r3f)!=null&&g.attach?Ip(f,d,d.__r3f.attach):d.isObject3D&&f.isObject3D&&(f.add(d),p=!0),p||(v=f.__r3f)==null||v.objects.push(d),d.__r3f||wo(d,{}),d.__r3f.parent=f,um(d),bo(d)}}function i(f,d,p){let g=!1;if(d){var v,A;if((v=d.__r3f)!=null&&v.attach)Ip(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){d.parent=f,d.dispatchEvent({type:"added"}),f.dispatchEvent({type:"childadded",child:d});const y=f.children.filter(M=>M!==d),_=y.indexOf(p);f.children=[...y.slice(0,_),d,...y.slice(_)],g=!0}g||(A=f.__r3f)==null||A.objects.push(d),d.__r3f||wo(d,{}),d.__r3f.parent=f,um(d),bo(d)}}function s(f,d,p=!1){f&&[...f].forEach(g=>a(d,g,p))}function a(f,d,p){if(d){var g,v,A;if(d.__r3f&&(d.__r3f.parent=null),(g=f.__r3f)!=null&&g.objects&&(f.__r3f.objects=f.__r3f.objects.filter(w=>w!==d)),(v=d.__r3f)!=null&&v.attach)B_(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){var y;f.remove(d),(y=d.__r3f)!=null&&y.root&&rI(sh(d),d)}const M=(A=d.__r3f)==null?void 0:A.primitive,E=!M&&(p===void 0?d.dispose!==null:p);if(!M){var _;s((_=d.__r3f)==null?void 0:_.objects,d,E),s(d.children,d,E)}if(delete d.__r3f,E&&d.dispose&&d.type!=="Scene"){const w=()=>{try{d.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?b_.unstable_scheduleCallback(b_.unstable_IdlePriority,w):w()}bo(f)}}function o(f,d,p,g){var v;const A=(v=f.__r3f)==null?void 0:v.parent;if(!A)return;const y=t(d,p,f.__r3f.root);if(f.children){for(const _ of f.children)_.__r3f&&n(y,_);f.children=f.children.filter(_=>!_.__r3f)}f.__r3f.objects.forEach(_=>n(y,_)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||a(A,f),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),n(A,y),y.raycast&&y.__r3f.eventCount&&sh(y).getState().internal.interaction.push(y),[g,g.alternate].forEach(_=>{_!==null&&(_.stateNode=y,_.ref&&(typeof _.ref=="function"?_.ref(y):_.ref.current=y))})}const u=()=>{};return{reconciler:QR({createInstance:t,removeChild:a,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(f,d)=>{if(!d)return;const p=f.getState().scene;p.__r3f&&(p.__r3f.root=f,n(p,d))},removeChildFromContainer:(f,d)=>{d&&a(f.getState().scene,d)},insertInContainerBefore:(f,d,p)=>{if(!d||!p)return;const g=f.getState().scene;g.__r3f&&i(g,d,p)},getRootHostContext:()=>null,getChildHostContext:f=>f,finalizeInitialChildren(f){var d;return!!((d=f?.__r3f)!=null?d:{}).handlers},prepareUpdate(f,d,p,g){var v;if(((v=f?.__r3f)!=null?v:{}).primitive&&g.object&&g.object!==f)return[!0];{const{args:y=[],children:_,...M}=g,{args:E=[],children:w,...B}=p;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((D,F)=>D!==E[F]))return[!0];const P=$y(f,M,B,!0);return P.changes.length?[!1,P]:null}},commitUpdate(f,[d,p],g,v,A,y){d?o(f,g,A,y):Bp(f,p)},commitMount(f,d,p,g){var v;const A=(v=f.__r3f)!=null?v:{};f.raycast&&A.handlers&&A.eventCount&&sh(f).getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>wo(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var d;const{attach:p,parent:g}=(d=f.__r3f)!=null?d:{};p&&g&&B_(g,f,p),f.isObject3D&&(f.visible=!1),bo(f)},unhideInstance(f,d){var p;const{attach:g,parent:v}=(p=f.__r3f)!=null?p:{};g&&v&&Ip(v,f,g),(f.isObject3D&&d.visible==null||d.visible)&&(f.visible=!0),bo(f)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Co.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&_n.fun(performance.now)?performance.now:_n.fun(Date.now)?Date.now:()=>0,scheduleTimeout:_n.fun(setTimeout)?setTimeout:void 0,cancelTimeout:_n.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Bp}}var T_,C_;const Rp=r=>"colorSpace"in r||"outputColorSpace"in r,Yy=()=>{var r;return(r=dg.ColorManagement)!=null?r:null},Ky=r=>r&&r.isOrthographicCamera,jR=r=>r&&r.hasOwnProperty("current"),gc=typeof window<"u"&&((T_=window.document)!=null&&T_.createElement||((C_=window.navigator)==null?void 0:C_.product)==="ReactNative")?dt.useLayoutEffect:dt.useEffect;function Zy(r){const e=dt.useRef(r);return gc(()=>void(e.current=r),[r]),e}function $R({set:r}){return gc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class Qy extends dt.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}Qy.getDerivedStateFromError=()=>({error:!0});const qy="__default",R_=new Map,eI=r=>r&&!!r.memoized&&!!r.changes;function jy(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const Cl=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function sh(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const _n={obj:r=>r===Object(r)&&!_n.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(_n.str(r)||_n.num(r)||_n.boo(r))return r===e;const s=_n.obj(r);if(s&&n==="reference")return r===e;const a=_n.arr(r);if(a&&t==="reference")return r===e;if((a||s)&&r===e)return!0;let o;for(o in r)if(!(o in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(o in i?e:r)if(!_n.equ(r[o],e[o],{strict:i,objects:"reference"}))return!1}else for(o in i?e:r)if(r[o]!==e[o])return!1;if(_n.und(o)){if(a&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function tI(r){const e={nodes:{},materials:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function nI(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function wo(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function cm(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,a)=>s[a],r),{target:t,key:i}}else return{target:t,key:e}}const I_=/-\d+$/;function Ip(r,e,t){if(_n.str(t)){if(I_.test(t)){const s=t.replace(I_,""),{target:a,key:o}=cm(r,s);Array.isArray(a[o])||(a[o]=[])}const{target:n,key:i}=cm(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function B_(r,e,t){var n,i;if(_n.str(t)){const{target:s,key:a}=cm(r,t),o=e.__r3f.previousAttach;o===void 0?delete s[a]:s[a]=o}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function $y(r,{children:e,key:t,ref:n,...i},{children:s,key:a,ref:o,...u}={},h=!1){const f=r.__r3f,d=Object.entries(i),p=[];if(h){const v=Object.keys(u);for(let A=0;A<v.length;A++)i.hasOwnProperty(v[A])||d.unshift([v[A],qy+"remove"])}d.forEach(([v,A])=>{var y;if((y=r.__r3f)!=null&&y.primitive&&v==="object"||_n.equ(A,u[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return p.push([v,A,!0,[]]);let _=[];v.includes("-")&&(_=v.split("-")),p.push([v,A,!1,_]);for(const M in i){const E=i[M];M.startsWith(`${v}-`)&&p.push([M,E,!1,M.split("-")])}});const g={...i};return f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.args&&(g.args=f.memoizedProps.args),f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.attach&&(g.attach=f.memoizedProps.attach),{memoized:g,changes:p}}function Bp(r,e){var t;const n=r.__r3f,i=n?.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:a,changes:o}=eI(e)?e:$y(r,e),u=n?.eventCount;r.__r3f&&(r.__r3f.memoizedProps=a);for(let p=0;p<o.length;p++){let[g,v,A,y]=o[p];if(Rp(r)){const w="srgb",B="srgb-linear";g==="encoding"?(g="colorSpace",v=v===3001?w:B):g==="outputEncoding"&&(g="outputColorSpace",v=v===3001?w:B)}let _=r,M=_[g];if(y.length&&(M=y.reduce((E,w)=>E[w],r),!(M&&M.set))){const[E,...w]=y.reverse();_=w.reverse().reduce((B,P)=>B[P],r),g=E}if(v===qy+"remove")if(_.constructor){let E=R_.get(_.constructor);E||(E=new _.constructor,R_.set(_.constructor,E)),v=E[g]}else v=0;if(A&&n)v?n.handlers[g]=v:delete n.handlers[g],n.eventCount=Object.keys(n.handlers).length;else if(M&&M.set&&(M.copy||M instanceof wa)){if(Array.isArray(v))M.fromArray?M.fromArray(v):M.set(...v);else if(M.copy&&v&&v.constructor&&M.constructor===v.constructor)M.copy(v);else if(v!==void 0){var h;const E=(h=M)==null?void 0:h.isColor;!E&&M.setScalar?M.setScalar(v):M instanceof wa&&v instanceof wa?M.mask=v.mask:M.set(v),!Yy()&&s&&!s.linear&&E&&M.convertSRGBToLinear()}}else{var f;if(_[g]=v,(f=_[g])!=null&&f.isTexture&&_[g].format===ni&&_[g].type===Rn&&s){const E=_[g];Rp(E)&&Rp(s.gl)?E.colorSpace=s.gl.outputColorSpace:E.encoding=s.gl.outputEncoding}}bo(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const p=sh(r).getState().internal,g=p.interaction.indexOf(r);g>-1&&p.interaction.splice(g,1),n.eventCount&&p.interaction.push(r)}return!(o.length===1&&o[0][0]==="onUpdate")&&o.length&&(t=r.__r3f)!=null&&t.parent&&um(r),r}function bo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function um(r){r.onUpdate==null||r.onUpdate(r)}function eA(r,e){r.manual||(Ky(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function qu(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function iI(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Co.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Co.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Co.ContinuousEventPriority;default:return Co.DefaultEventPriority}}function tA(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function rI(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{tA(t.capturedMap,e,n,i)})}function sI(r){function e(u){const{internal:h}=r.getState(),f=u.offsetX-h.initialClick[0],d=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(f*f+d*d))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(f=>{var d;return(d=h.__r3f)==null?void 0:d.handlers["onPointer"+f]}))}function n(u,h){const f=r.getState(),d=new Set,p=[],g=h?h(f.internal.interaction):f.internal.interaction;for(let _=0;_<g.length;_++){const M=Cl(g[_]);M&&(M.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(u,f);function v(_){const M=Cl(_);if(!M||!M.events.enabled||M.raycaster.camera===null)return[];if(M.raycaster.camera===void 0){var E;M.events.compute==null||M.events.compute(u,M,(E=M.previousRoot)==null?void 0:E.getState()),M.raycaster.camera===void 0&&(M.raycaster.camera=null)}return M.raycaster.camera?M.raycaster.intersectObject(_,!0):[]}let A=g.flatMap(v).sort((_,M)=>{const E=Cl(_.object),w=Cl(M.object);return!E||!w?_.distance-M.distance:w.events.priority-E.events.priority||_.distance-M.distance}).filter(_=>{const M=qu(_);return d.has(M)?!1:(d.add(M),!0)});f.events.filter&&(A=f.events.filter(A,f));for(const _ of A){let M=_.object;for(;M;){var y;(y=M.__r3f)!=null&&y.eventCount&&p.push({..._,eventObject:M}),M=M.parent}}if("pointerId"in u&&f.internal.capturedMap.has(u.pointerId))for(let _ of f.internal.capturedMap.get(u.pointerId).values())d.has(qu(_.intersection))||p.push(_.intersection);return p}function i(u,h,f,d){const p=r.getState();if(u.length){const g={stopped:!1};for(const v of u){const A=Cl(v.object)||p,{raycaster:y,pointer:_,camera:M,internal:E}=A,w=new N(_.x,_.y,0).unproject(M),B=C=>{var U,V;return(U=(V=E.capturedMap.get(C))==null?void 0:V.has(v.eventObject))!=null?U:!1},P=C=>{const U={intersection:v,target:h.target};E.capturedMap.has(C)?E.capturedMap.get(C).set(v.eventObject,U):E.capturedMap.set(C,new Map([[v.eventObject,U]])),h.target.setPointerCapture(C)},D=C=>{const U=E.capturedMap.get(C);U&&tA(E.capturedMap,v.eventObject,U,C)};let F={};for(let C in h){let U=h[C];typeof U!="function"&&(F[C]=U)}let b={...v,...F,pointer:_,intersections:u,stopped:g.stopped,delta:f,unprojectedPoint:w,ray:y.ray,camera:M,stopPropagation(){const C="pointerId"in h&&E.capturedMap.get(h.pointerId);if((!C||C.has(v.eventObject))&&(b.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(U=>U.eventObject===v.eventObject))){const U=u.slice(0,u.indexOf(v));s([...U,v])}},target:{hasPointerCapture:B,setPointerCapture:P,releasePointerCapture:D},currentTarget:{hasPointerCapture:B,setPointerCapture:P,releasePointerCapture:D},nativeEvent:h};if(d(b),g.stopped===!0)break}}return u}function s(u){const{internal:h}=r.getState();for(const f of h.hovered.values())if(!u.length||!u.find(d=>d.object===f.object&&d.index===f.index&&d.instanceId===f.instanceId)){const p=f.eventObject.__r3f,g=p?.handlers;if(h.hovered.delete(qu(f)),p!=null&&p.eventCount){const v={...f,intersections:u};g.onPointerOut==null||g.onPointerOut(v),g.onPointerLeave==null||g.onPointerLeave(v)}}}function a(u,h){for(let f=0;f<h.length;f++){const d=h[f].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(u)}}function o(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:f}=r.getState();"pointerId"in h&&f.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(h.pointerId)&&(f.capturedMap.delete(h.pointerId),s([]))})}}return function(f){const{onPointerMissed:d,internal:p}=r.getState();p.lastEvent.current=f;const g=u==="onPointerMove",v=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",y=n(f,g?t:void 0),_=v?e(f):0;u==="onPointerDown"&&(p.initialClick=[f.offsetX,f.offsetY],p.initialHits=y.map(E=>E.eventObject)),v&&!y.length&&_<=2&&(a(f,p.interaction),d&&d(f)),g&&s(y);function M(E){const w=E.eventObject,B=w.__r3f,P=B?.handlers;if(B!=null&&B.eventCount)if(g){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const D=qu(E),F=p.hovered.get(D);F?F.stopped&&E.stopPropagation():(p.hovered.set(D,E),P.onPointerOver==null||P.onPointerOver(E),P.onPointerEnter==null||P.onPointerEnter(E))}P.onPointerMove==null||P.onPointerMove(E)}else{const D=P[u];D?(!v||p.initialHits.includes(w))&&(a(f,p.interaction.filter(F=>!p.initialHits.includes(F))),D(E)):v&&p.initialHits.includes(w)&&a(f,p.interaction.filter(F=>!p.initialHits.includes(F)))}}i(y,f,_,M)}}return{handlePointer:o}}const aI=["set","get","setSize","setFrameloop","setDpr","events","invali
4061date","advance","size","viewport"],nA=r=>!!(r!=null&&r.render),pg=dt.createContext(null),oI=(r,e)=>{const t=Hy((o,u)=>{const h=new N,f=new N,d=new N;function p(_=u().camera,M=f,E=u().size){const{width:w,height:B,top:P,left:D}=E,F=w/B;M.isVector3?d.copy(M):d.set(...M);const b=_.getWorldPosition(h).distanceTo(d);if(Ky(_))return{width:w/_.zoom,height:B/_.zoom,top:P,left:D,factor:1,distance:b,aspect:F};{const C=_.fov*Math.PI/180,U=2*Math.tan(C/2)*b,V=U*(w/B);return{width:V,height:U,top:P,left:D,factor:w/V,distance:b,aspect:F}}}let g;const v=_=>o(M=>({performance:{...M.performance,current:_}})),A=new _e;return{set:o,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>r(u(),_),advance:(_,M)=>e(_,M,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new cg,pointer:A,mouse:A,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=u();g&&clearTimeout(g),_.performance.current!==_.performance.min&&v(_.performance.min),g=setTimeout(()=>v(u().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:_=>o(M=>({...M,events:{...M.events,..._}})),setSize:(_,M,E,w,B)=>{const P=u().camera,D={width:_,height:M,top:w||0,left:B||0,updateStyle:E};o(F=>({size:D,viewport:{...F.viewport,...p(P,f,D)}}))},setDpr:_=>o(M=>{const E=jy(_);return{viewport:{...M.viewport,dpr:E,initialDpr:M.viewport.initialDpr||E}}}),setFrameloop:(_="always")=>{const M=u().clock;M.stop(),M.elapsedTime=0,_!=="never"&&(M.start(),M.elapsedTime=0),o(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:dt.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,M,E)=>{const w=u().internal;return w.priority=w.priority+(M>0?1:0),w.subscribers.push({ref:_,priority:M,store:E}),w.subscribers=w.subscribers.sort((B,P)=>B.priority-P.priority),()=>{const B=u().internal;B!=null&&B.subscribers&&(B.priority=B.priority-(M>0?1:0),B.subscribers=B.subscribers.filter(P=>P.ref!==_))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:o,size:u,viewport:h,gl:f,set:d}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==s){var p;i=u,s=h.dpr,eA(o,u),f.setPixelRatio(h.dpr);const g=(p=u.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(u.width,u.height,g)}o!==a&&(a=o,d(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(o)}})))}),t.subscribe(o=>r(o)),t};let ju,lI=new Set,cI=new Set,uI=new Set;function Pp(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Rl(r,e){switch(r){case"before":return Pp(lI,e);case"after":return Pp(cI,e);case"tail":return Pp(uI,e)}}let Dp,Lp;function Fp(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),Dp=e.internal.subscribers,ju=0;ju<Dp.length;ju++)Lp=Dp[ju],Lp.ref.current(Lp.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function hI(r){let e=!1,t=!1,n,i,s;function a(h){i=requestAnimationFrame(a),e=!0,n=0,Rl("before",h),t=!0;for(const d of r.values()){var f;s=d.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((f=s.gl.xr)!=null&&f.isPresenting)&&(n+=Fp(h,s))}if(t=!1,Rl("after",h),n===0)return Rl("tail",h),e=!1,cancelAnimationFrame(i)}function o(h,f=1){var d;if(!h)return r.forEach(p=>o(p.store.getState(),f));(d=h.gl.xr)!=null&&d.isPresenting||!h.internal.active||h.frameloop==="never"||(f>1?h.internal.frames=Math.min(60,h.internal.frames+f):t?h.internal.frames=2:h.internal.frames=1,e||(e=!0,requestAnimationFrame(a)))}function u(h,f=!0,d,p){if(f&&Rl("before",h),d)Fp(h,d,p);else for(const g of r.values())Fp(h,g.store.getState());f&&Rl("after",h)}return{loop:a,invalidate:o,advance:u}}function mg(){const r=dt.useContext(pg);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function iA(r=t=>t,e){return mg()(r,e)}function fI(r,e=0){const t=mg(),n=t.getState().internal.subscribe,i=Zy(r);return gc(()=>n(i,e,t),[e,n,t]),null}const P_=new WeakMap;function rA(r,e){return function(t,...n){let i=P_.get(t);
vendor: 24,334 bytes, lines 4061-4182
4061return i||(i=new t,P_.set(t,i)),r&&r(i),Promise.all(n.map(s=>new Promise((a,o)=>i.load(s,u=>{u.scene&&Object.assign(u,tI(u.scene)),a(u)},e,u=>o(new Error(`Could not load ${s}: ${u?.message}`))))))}}function sA(r,e,t,n){const i=Array.isArray(e)?e:[e],s=VR(rA(t,n),[r,...i],{equal:_n.equ});return Array.isArray(e)?s:s[0]}sA.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return WR(rA(t),[r,...n])};sA.clear=function(r,e){const t=Array.isArray(e)?e:[e];return XR([r,...t])};const Vo=new Map,{invalidate:D_,advance:L_}=hI(Vo),{reconciler:sc,applyProps:Mo}=qR(Vo,iI),Eo={objects:"shallow",strict:!1},dI=(r,e)=>{const t=typeof r=="function"?r(e):r;return nA(t)?t:new Oy({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function pI(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:a,updateStyle:o=t}=e;return{width:n,height:i,top:s,left:a,updateStyle:o}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:a}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:a,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function mI(r){const e=Vo.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||oI(D_,L_),a=t||sc.createContainer(s,Co.ConcurrentRoot,null,!1,null,"",i,null);e||Vo.set(r,{fiber:a,store:s});let o,u=!1,h;return{configure(f={}){let{gl:d,size:p,scene:g,events:v,onCreated:A,shadows:y=!1,linear:_=!1,flat:M=!1,legacy:E=!1,orthographic:w=!1,frameloop:B="always",dpr:P=[1,2],performance:D,raycaster:F,camera:b,onPointerMissed:C}=f,U=s.getState(),V=U.gl;U.gl||U.set({gl:V=dI(d,r)});let J=U.raycaster;J||U.set({raycaster:J=new Bf});const{params:Q,...oe}=F||{};if(_n.equ(oe,J,Eo)||Mo(J,{...oe}),_n.equ(Q,J.params,Eo)||Mo(J,{params:{...J.params,...Q}}),!U.camera||U.camera===h&&!_n.equ(h,b,Eo)){h=b;const Y=b instanceof cc,se=Y?b:w?new Sr(0,0,0,0,.1,1e3):new En(75,0,.1,1e3);Y||(se.position.z=5,b&&(Mo(se,b),("aspect"in b||"left"in b||"right"in b||"bottom"in b||"top"in b)&&(se.manual=!0,se.updateProjectionMatrix())),!U.camera&&!(b!=null&&b.rotation)&&se.lookAt(0,0,0)),U.set({camera:se}),J.camera=se}if(!U.scene){let Y;g!=null&&g.isScene?Y=g:(Y=new ec,g&&Mo(Y,g)),U.set({scene:wo(Y)})}if(!U.xr){var q;const Y=(we,$)=>{const xt=s.getState();xt.frameloop!=="never"&&L_(we,!0,xt,$)},se=()=>{const we=s.getState();we.gl.xr.enabled=we.gl.xr.isPresenting,we.gl.xr.setAnimationLoop(we.gl.xr.isPresenting?Y:null),we.gl.xr.isPresenting||D_(we)},pe={connect(){const we=s.getState().gl;we.xr.addEventListener("sessionstart",se),we.xr.addEventListener("sessionend",se)},disconnect(){const we=s.getState().gl;we.xr.removeEventListener("sessionstart",se),we.xr.removeEventListener("sessionend",se)}};typeof((q=V.xr)==null?void 0:q.addEventListener)=="function"&&pe.connect(),U.set({xr:pe})}if(V.shadowMap){const Y=V.shadowMap.enabled,se=V.shadowMap.type;if(V.shadowMap.enabled=!!y,_n.boo(y))V.shadowMap.type=Nl;else if(_n.str(y)){var ue;const pe={basic:rx,percentage:Ro,soft:Nl,variance:ma};V.shadowMap.type=(ue=pe[y])!=null?ue:Nl}else _n.obj(y)&&Object.assign(V.shadowMap,y);(Y!==V.shadowMap.enabled||se!==V.shadowMap.type)&&(V.shadowMap.needsUpdate=!0)}const z=Yy();z&&("enabled"in z?z.enabled=!E:"legacyMode"in z&&(z.legacyMode=E)),u||Mo(V,{outputEncoding:_?3e3:3001,toneMapping:M?Wi:$h}),U.legacy!==E&&U.set(()=>({legacy:E})),U.linear!==_&&U.set(()=>({linear:_})),U.flat!==M&&U.set(()=>({flat:M})),d&&!_n.fun(d)&&!nA(d)&&!_n.equ(d,V,Eo)&&Mo(V,d),v&&!U.events.handlers&&U.set({events:v(s)});const ne=pI(r,p);return _n.equ(ne,U.size,Eo)||U.setSize(ne.width,ne.height,ne.updateStyle,ne.top,ne.left),P&&U.viewport.dpr!==jy(P)&&U.setDpr(P),U.frameloop!==B&&U.setFrameloop(B),U.onPointerMissed||U.set({onPointerMissed:C}),D&&!_n.equ(D,U.performance,Eo)&&U.set(Y=>({performance:{...Y.performance,...D}})),o=A,u=!0,this},render(f){return u||this.configure(),sc.updateContainer(jn.jsx(gI,{store:s,children:f,onCreated:o,rootElement:r}),a,null,()=>{}),s},unmount(){aA(r)}}}function gI({store:r,children:e,onCreated:t,rootElement:n}){return gc(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),jn.jsx(pg.Provider,{value:r,children:e})}function aA(r,e){const t=Vo.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),sc.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,a,o,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=i.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),nI(i),Vo.delete(r)}catch{}},500)})}}function p2(r,e,t){return jn.jsx(vI,{children:r,container:e,state:t},e.uuid)}function vI({state:r={},children:e,container:t}){const{events:n,size:i,...s}=r,a=mg(),[o]=dt.useState(()=>new Bf),[u]=dt.useState(()=>new _e),h=dt.useCallback((d,p)=>{const g={...d};Object.keys(d).forEach(A=>{(aI.includes(A)||d[A]!==p[A]&&p[A])&&delete g[A]});let v;if(p&&i){const A=p.camera;v=d.viewport.getCurrentViewport(A,new N,i),A!==d.camera&&eA(A,i)}return{...g,scene:t,raycaster:o,pointer:u,mouse:u,previousRoot:a,events:{...d.events,...p?.events,...n},size:{...d.size,...i},viewport:{...d.viewport,...v},...s}},[r]),[f]=dt.useState(()=>{const d=a.getState();return Hy((g,v)=>({...d,scene:t,raycaster:o,pointer:u,mouse:u,previousRoot:a,events:{...d.events,...n},size:{...d.size,...i},...s,set:g,get:v,setEvents:A=>g(y=>({...y,events:{...y.events,...A}}))}))});return dt.useEffect(()=>{const d=a.subscribe(p=>f.setState(g=>h(p,g)));return()=>{d()}},[h]),dt.useEffect(()=>{f.setState(d=>h(a.getState(),d))},[h]),dt.useEffect(()=>()=>{f.destroy()},[]),jn.jsx(jn.Fragment,{children:sc.createPortal(jn.jsx(pg.Provider,{value:f,children:e}),f,null)})}sc.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:dt.version});const Up={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function _I(r){const{handlePointer:e}=sI(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Up).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(a=>({events:{...a.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([a,o])=>{const[u,h]=Up[a];t.addEventListener(u,o,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,a])=>{if(n&&n.connected instanceof HTMLElement){const[o]=Up[s];n.connected.removeEventListener(o,a)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function F_(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function xI({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=dt.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=dt.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,h=r?typeof r=="number"?r:r.resize:null,f=dt.useRef(!1);dt.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[d,p,g]=dt.useMemo(()=>{const _=()=>{if(!o.current.element)return;const{left:M,top:E,width:w,height:B,bottom:P,right:D,x:F,y:b}=o.current.element.getBoundingClientRect(),C={left:M,top:E,width:w,height:B,bottom:P,right:D,x:F,y:b};o.current.element instanceof HTMLElement&&n&&(C.height=o.current.element.offsetHeight,C.width=o.current.element.offsetWidth),Object.freeze(C),f.current&&!MI(o.current.lastBounds,C)&&a(o.current.lastBounds=C)};return[_,h?F_(_,h):_,u?F_(_,u):_]},[a,n,u,h]);function v(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function A(){o.current.element&&(o.current.resizeObserver=new i(g),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const y=_=>{!_||_===o.current.element||(v(),o.current.element=_,o.current.scrollContainers=oA(_),A())};return AI(g,!!e),yI(p),dt.useEffect(()=>{v(),A()},[e,g,p]),dt.useEffect(()=>v,[]),[y,s,d]}function yI(r){dt.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function AI(r,e){dt.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function oA(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...oA(r.parentElement)]}const SI=["x","y","top","bottom","left","right","width","height"],MI=(r,e)=>SI.every(t=>r[t]===e[t]);var EI=Object.defineProperty,wI=Object.defineProperties,bI=Object.getOwnPropertyDescriptors,U_=Object.getOwnPropertySymbols,TI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,N_=(r,e,t)=>e in r?EI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,O_=(r,e)=>{for(var t in e||(e={}))TI.call(e,t)&&N_(r,t,e[t]);if(U_)for(var t of U_(e))CI.call(e,t)&&N_(r,t,e[t]);return r},RI=(r,e)=>wI(r,bI(e)),G_,H_;typeof window<"u"&&((G_=window.document)!=null&&G_.createElement||((H_=window.navigator)==null?void 0:H_.product)==="ReactNative")?dt.useLayoutEffect:dt.useEffect;function lA(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=lA(n,e,t);if(i)return i;n=n.sibling}}function cA(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const z_=console.error;console.error=function(){const r=[...arguments].join("");if(r?.startsWith("Warning:")&&r.includes("useContext")){console.error=z_;return}return z_.apply(this,arguments)};const gg=cA(dt.createContext(null));class uA extends dt.Component{render(){return dt.createElement(gg.Provider,{value:this._reactInternals},this.props.children)}}function II(){const r=dt.useContext(gg);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=dt.useId();return dt.useMemo(()=>{for(const n of[r,r?.alternate]){if(!n)continue;const i=lA(n,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e])}function BI(){const r=II(),[e]=dt.useState(()=>new Map);e.clear();let t=r;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==gg&&!e.has(i)&&e.set(i,dt.useContext(cA(i)))}t=t.return}return e}function PI(){const r=BI();return dt.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>dt.createElement(e,null,dt.createElement(t.Provider,RI(O_({},n),{value:r.get(t)}))),e=>dt.createElement(uA,O_({},e))),[r])}const DI=dt.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:a=_I,eventSource:o,eventPrefix:u,shadows:h,linear:f,flat:d,legacy:p,orthographic:g,frameloop:v,dpr:A,performance:y,raycaster:_,camera:M,scene:E,onPointerMissed:w,onCreated:B,...P},D){dt.useMemo(()=>Jy(GR),[]);const F=PI(),[b,C]=xI({scroll:!0,debounce:{scroll:50,resize:0},...n}),U=dt.useRef(null),V=dt.useRef(null);dt.useImperativeHandle(D,()=>U.current);const J=Zy(w),[Q,oe]=dt.useState(!1),[q,ue]=dt.useState(!1);if(Q)throw Q;if(q)throw q;const z=dt.useRef(null);gc(()=>{const Y=U.current;C.width>0&&C.height>0&&Y&&(z.current||(z.current=mI(Y)),z.current.configure({gl:s,events:a,shadows:h,linear:f,flat:d,legacy:p,orthographic:g,frameloop:v,dpr:A,performance:y,raycaster:_,camera:M,scene:E,size:C,onPointerMissed:(...se)=>J.current==null?void 0:J.current(...se),onCreated:se=>{se.events.connect==null||se.events.connect(o?jR(o)?o.current:o:V.current),u&&se.setEvents({compute:(pe,we)=>{const $=pe[u+"X"],xt=pe[u+"Y"];we.pointer.set($/we.size.width*2-1,-(xt/we.size.height)*2+1),we.raycaster.setFromCamera(we.pointer,we.camera)}}),B?.(se)}}),z.current.render(jn.jsx(F,{children:jn.jsx(Qy,{set:ue,children:jn.jsx(dt.Suspense,{fallback:jn.jsx($R,{set:oe}),children:e??null})})})))}),dt.useEffect(()=>{const Y=U.current;if(Y)return()=>aA(Y)},[]);const ne=o?"none":"auto";return jn.jsx("div",{ref:V,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ne,...i},...P,children:jn.jsx("div",{ref:b,style:{width:"100%",height:"100%"},children:jn.jsx("canvas",{ref:U,style:{display:"block"},children:t})})})}),m2=dt.forwardRef(function(e,t){return jn.jsx(uA,{children:jn.jsx(DI,{...e,ref:t})})});let Il;function LI(){var r;if(Il!==void 0)return Il;try{let e;const t=document.createElement("canvas");return Il=!!(window.WebGL2RenderingContext&&(e=t.getContext("webgl2"))),e&&((r=e.getExtension("WEBGL_lose_context"))==null||r.loseContext()),Il}catch{return Il=!1}}const Lf=parseInt(Ua.replace(/\D+/g,""));function k_(r,e){if(e===Rx)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Jh||e===Rm){let t=r.getIndex();if(t===null){const a=[],o=r.getAttribute("position");if(o!==void 0){for(let u=0;u<o.count;u++)a.push(u);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(t)if(e===Jh)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var ar=Uint8Array,Is=Uint16Array,hm=Uint32Array,hA=new ar([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fA=new ar([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),FI=new ar([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dA=function(r,e){for(var t=new Is(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new hm(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},pA=dA(hA,2),mA=pA[0],UI=pA[1];mA[28]=258,UI[258]=28;var NI=dA(fA,0),OI=NI[0],fm=new Is(32768);for(var An=0;An<32768;++An){var Ms=(An&43690)>>>1|(An&21845)<<1;Ms=(Ms&52428)>>>2|(Ms&13107)<<2,Ms=(Ms&61680)>>>4|(Ms&3855)<<4,fm[An]=((Ms&65280)>>>8|(Ms&255)<<8)>>>1}var Xl=function(r,e,t){for(var n=r.length,i=0,s=new Is(e);i<n;++i)++s[r[i]-1];var a=new Is(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(t){o=new Is(1<<e);var u=15-e;for(i=0;i<n;++i)if(r[i])for(var h=i<<4|r[i],f=e-r[i],d=a[r[i]-1]++<<f,p=d|(1<<f)-1;d<=p;++d)o[fm[d]>>>u]=h}else for(o=new Is(n),i=0;i<n;++i)r[i]&&(o[i]=fm[a[r[i]-1]++]>>>15-r[i]);return o},vc=new ar(288);for(var An=0;An<144;++An)vc[An]=8;for(var An=144;An<256;++An)vc[An]=9;for(var An=256;An<280;++An)vc[An]=7;for(var An=280;An<288;++An)vc[An]=8;var gA=new ar(32);for(var An=0;An<32;++An)gA[An]=5;var GI=Xl(vc,9,1),HI=Xl(gA,5,1),Np=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},vr=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},Op=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},zI=function(r){return(r/8|0)+(r&7&&1)},kI=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof Is?Is:r instanceof hm?hm:ar)(t-e);return n.set(r.subarray(e,t)),n},VI=function(r,e,t){var n=r.length;if(!n||t&&!t.l&&n<5)return e||new ar(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new ar(n*3));var a=function(le){var Ae=e.length;if(le>Ae){var Qe=new ar(Math.max(Ae*2,le));Qe.set(e),e=Qe}},o=t.f||0,u=t.p||0,h=t.b||0,f=t.l,d=t.d,p=t.m,g=t.n,v=n*8;do{if(!f){t.f=o=vr(r,u,1);var A=vr(r,u+1,3);if(u+=3,A)if(A==1)f=GI,d=HI,p=9,g=5;else if(A==2){var E=vr(r,u,31)+257,w=vr(r,u+10,15)+4,B=E+vr(r,u+5,31)+1;u+=14;for(var P=new ar(B),D=new ar(19),F=0;F<w;++F)D[FI[F]]=vr(r,u+F*3,7);u+=w*3;for(var b=Np(D),C=(1<<b)-1,U=Xl(D,b,1),F=0;F<B;){var V=U[vr(r,u,C)];u+=V&15;var y=V>>>4;if(y<16)P[F++]=y;else{var J=0,Q=0;for(y==16?(Q=3+vr(r,u,3),u+=2,J=P[F-1]):y==17?(Q=3+vr(r,u,7),u+=3):y==18&&(Q=11+vr(r,u,127),u+=7);Q--;)P[F++]=J}}var oe=P.subarray(0,E),q=P.subarray(E);p=Np(oe),g=Np(q),f=Xl(oe,p,1),d=Xl(q,g,1)}else throw"invalid block type";else{var y=zI(u)+4,_=r[y-4]|r[y-3]<<8,M=y+_;if(M>n){if(s)throw"unexpected EOF";break}i&&a(h+_),e.set(r.subarray(y,M),h),t.b=h+=_,t.p=u=M*8;continue}if(u>v){if(s)throw"unexpected EOF";break}}i&&a(h+131072);for(var ue=(1<<p)-1,z=(1<<g)-1,ne=u;;ne=u){var J=f[Op(r,u)&ue],Y=J>>>4;if(u+=J&15,u>v){if(s)throw"unexpected EOF";break}if(!J)throw"invalid length/literal";if(Y<256)e[h++]=Y;else if(Y==256){ne=u,f=null;break}else{var se=Y-254;if(Y>264){var F=Y-257,pe=hA[F];se=vr(r,u,(1<<pe)-1)+mA[F],u+=pe}var we=d[Op(r,u)&z],$=we>>>4;if(!we)throw"invalid distance";u+=we&15;var q=OI[$];if($>3){var pe=fA[$];q+=Op(r,u)&(1<<pe)-1,u+=pe}if(u>v){if(s)throw"unexpected EOF";break}i&&a(h+131072);for(var xt=h+se;h<xt;h+=4)e[h]=e[h-q],e[h+1]=e[h+1-q],e[h+2]=e[h+2-q],e[h+3]=e[h+3-q];h=xt}}t.l=f,t.p=ne,t.b=h,f&&(o=1,t.m=p,t.d=d,t.n=g)}while(!o);return h==e.length?e:kI(e,0,h)},WI=new ar(0),XI=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function $u(r,e){return VI((XI(r),r.subarray(2,-4)),e)}var JI=typeof TextDecoder<"u"&&new TextDecoder,YI=0;try{JI.decode(WI,{stream:!0}),YI=1}catch{}var KI=Object.defineProperty,ZI=(r,e,t)=>e in r?KI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V_=(r,e,t)=>(ZI(r,typeof e!="symbol"?e+"":e,t),t);const g2=(()=>{const r={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new N},up:{value:new N(0,1,0)}},vertexShader:` 4062 uniform vec3 sunPosition; 4063 uniform float rayleigh; 4064 uniform float turbidity; 4065 uniform float mieCoefficient; 4066 uniform vec3 up; 4067 4068 varying vec3 vWorldPosition; 4069 varying vec3 vSunDirection; 4070 varying float vSunfade; 4071 varying vec3 vBetaR; 4072 varying vec3 vBetaM; 4073 varying float vSunE; 4074 4075 // constants for atmospheric scattering 4076 const float e = 2.71828182845904523536028747135266249775724709369995957; 4077 const float pi = 3.141592653589793238462643383279502884197169; 4078 4079 // wavelength of used primaries, according to preetham 4080 const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); 4081 // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: 4082 // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) 4083 const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); 4084 4085 // mie stuff 4086 // K coefficient for the primaries 4087 const float v = 4.0; 4088 const vec3 K = vec3( 0.686, 0.678, 0.666 ); 4089 // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K 4090 const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); 4091 4092 // earth shadow hack 4093 // cutoffAngle = pi / 1.95; 4094 const float cutoffAngle = 1.6110731556870734; 4095 const float steepness = 1.5; 4096 const float EE = 1000.0; 4097 4098 float sunIntensity( float zenithAngleCos ) { 4099 zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); 4100 return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); 4101 } 4102 4103 vec3 totalMie( float T ) { 4104 float c = ( 0.2 * T ) * 10E-18; 4105 return 0.434 * c * MieConst; 4106 } 4107 4108 void main() { 4109 4110 vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); 4111 vWorldPosition = worldPosition.xyz; 4112 4113 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4114 gl_Position.z = gl_Position.w; // set z to camera.far 4115 4116 vSunDirection = normalize( sunPosition ); 4117 4118 vSunE = sunIntensity( dot( vSunDirection, up ) ); 4119 4120 vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); 4121 4122 float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); 4123 4124 // extinction (absorbtion + out scattering) 4125 // rayleigh coefficients 4126 vBetaR = totalRayleigh * rayleighCoefficient; 4127 4128 // mie coefficients 4129 vBetaM = totalMie( turbidity ) * mieCoefficient; 4130 4131 } 4132 `,fragmentShader:` 4133 varying vec3 vWorldPosition; 4134 varying vec3 vSunDirection; 4135 varying float vSunfade; 4136 varying vec3 vBetaR; 4137 varying vec3 vBetaM; 4138 varying float vSunE; 4139 4140 uniform float mieDirectionalG; 4141 uniform vec3 up; 4142 4143 const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); 4144 4145 // constants for atmospheric scattering 4146 const float pi = 3.141592653589793238462643383279502884197169; 4147 4148 const float n = 1.0003; // refractive index of air 4149 const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) 4150 4151 // optical length at zenith for molecules 4152 const float rayleighZenithLength = 8.4E3; 4153 const float mieZenithLength = 1.25E3; 4154 // 66 arc seconds -> degrees, and the cosine of that 4155 const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; 4156 4157 // 3.0 / ( 16.0 * pi ) 4158 const float THREE_OVER_SIXTEENPI = 0.05968310365946075; 4159 // 1.0 / ( 4.0 * pi ) 4160 const float ONE_OVER_FOURPI = 0.07957747154594767; 4161 4162 float rayleighPhase( float cosTheta ) { 4163 return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); 4164 } 4165 4166 float hgPhase( float cosTheta, float g ) { 4167 float g2 = pow( g, 2.0 ); 4168 float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); 4169 return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); 4170 } 4171 4172 void main() { 4173 4174 vec3 direction = normalize( vWorldPosition - cameraPos ); 4175 4176 // optical length 4177 // cutoff angle at 90 to avoid singularity in next formula. 4178 float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); 4179 float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); 4180 float sR = rayleighZenithLength * inverse; 4181 float sM = mieZenithLength * inverse; 4182
4183 // combined extinction factor 4184 vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); 4185 4186 // in scattering 4187 float cosTheta = dot( direction, vSunDirection ); 4188 4189 float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); 4190 vec3 betaRTheta = vBetaR * rPhase; 4191 4192 float mPhase = hgPhase( cosTheta, mieDirectionalG ); 4193 vec3 betaMTheta = vBetaM * mPhase; 4194 4195 vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); 4196 Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); 4197 4198 // nightsky 4199 float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] 4200 float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] 4201 vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); 4202 vec3 L0 = vec3( 0.1 ) * Fex; 4203 4204 // composition + solar disc 4205 float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); 4206 L0 += ( vSunE * 19000.0 * Fex ) * sundisk; 4207 4208 vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); 4209 4210 vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); 4211 4212 gl_FragColor = vec4( retColor, 1.0 ); 4213 4214 #include <tonemapping_fragment> 4215 #include <${Lf>=154?"colorspace_fragment":"encodings_fragment"}> 4216 4217 } 4218 `},e=new Bn({name:"SkyShader",fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:Lm.clone(r.uniforms),side:Hn,depthWrite:!1});class t extends ot{constructor(){super(new Mi(1,1,1),e)}}return V_(t,"SkyShader",r),V_(t,"material",e),t})(),QI=r=>r&&r.isCubeTexture;class v2 extends ot{constructor(e,t){var n,i;const s=QI(e),o=((i=s?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?i:1024)/4,u=Math.floor(Math.log2(o)),h=Math.pow(2,u),f=3*Math.max(h,16*7),d=4*h,p=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/f}`,`#define CUBEUV_TEXEL_HEIGHT ${1/d}`,`#define CUBEUV_MAX_MIP ${u}.0`],g=` 4219 varying vec3 vWorldPosition; 4220 void main() 4221 { 4222 vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); 4223 vWorldPosition = worldPosition.xyz; 4224 4225 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4226 } 4227 `,v=p.join(` 4228`)+` 4229 #define ENVMAP_TYPE_CUBE_UV 4230 varying vec3 vWorldPosition; 4231 uniform float radius; 4232 uniform float height; 4233 uniform float angle; 4234 #ifdef ENVMAP_TYPE_CUBE 4235 uniform samplerCube map; 4236 #else 4237 uniform sampler2D map; 4238 #endif 4239 // From: https://www.shadertoy.com/view/4tsBD7 4240 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 4241 { 4242 float d = dot ( rd, n ); 4243 4244 if( d > 0.0 ) { return 1e6; } 4245 4246 vec3 o = ro - c; 4247 float t = - dot( n, o ) / d; 4248 vec3 q = o + rd * t; 4249 4250 return ( dot( q, q ) < r * r ) ? t : 1e6; 4251 } 4252 // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm 4253 float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 4254 { 4255 vec3 oc = ro - ce; 4256 float b = dot( oc, rd ); 4257 float c = dot( oc, oc ) - ra * ra; 4258 float h = b * b - c; 4259 4260 if( h < 0.0 ) { return -1.0; } 4261 4262 h = sqrt( h ); 4263 4264 return - b + h; 4265 } 4266 vec3 project() 4267 { 4268 vec3 p = normalize( vWorldPosition ); 4269 vec3 camPos = cameraPosition; 4270 camPos.y -= height; 4271 float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); 4272 if( intersection > 0.0 ) { 4273 4274 vec3 h = vec3( 0.0, - height, 0.0 ); 4275 float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); 4276 p = ( camPos + min( intersection, intersection2 ) * p ) / radius; 4277 } else { 4278 p = vec3( 0.0, 1.0, 0.0 ); 4279 } 4280 return p; 4281 } 4282 #include <common> 4283 #include <cube_uv_reflection_fragment> 4284 void main() 4285 { 4286 vec3 projectedWorldPosition = project(); 4287 4288 #ifdef ENVMAP_TYPE_CUBE 4289 vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; 4290 #else 4291 vec3 direction = normalize( projectedWorldPosition ); 4292 vec2 uv = equirectUv( direction ); 4293 vec3 outcolor = texture2D( map, uv ).rgb; 4294 #endif 4295 gl_FragColor = vec4( outcolor, 1.0 ); 4296 #include <tonemapping_fragment> 4297 #include <${Lf>=154?"colorspace_fragment":"encodings_fragment"}> 4298 } 4299 `,A={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},y=new pc(1,16),_=new Bn({uniforms:A,fragmentShader:v,vertexShader:g,side:$n});super(y,_)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var qI=Object.defineProperty,jI=(r,e,t)=>e in r?qI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$I=(r,e,t)=>(jI(r,e+"",t),t);class eB{constructor(){$I(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var tB=Object.defineProperty,nB=(r,e,t)=>e in r?tB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Me=(r,e,t)=>(nB(r,typeof e!="symbol"?e+"":e,t),t);class _2 extends qt{constructor(e,t){super(),Me(this,"isTransformControls",!0),Me(this,"visible",!1),Me(this,"domElement"),Me(this,"raycaster",new Bf),Me(this,"gizmo"),Me(this,"plane"),Me(this,"tempVector",new
4299N),Me(this,"tempVector2",new N),Me(this,"tempQuaternion",new on),Me(this,"unit",{X:new N(1,0,0),Y:new N(0,1,0),Z:new N(0,0,1)}),Me(this,"pointStart",new N),Me(this,"pointEnd",new N),Me(this,"offset",new N),Me(this,"rotationAxis",new N),Me(this,"startNorm",new N),Me(this,"endNorm",new N),Me(this,"rotationAngle",0),Me(this,"cameraPosition",new N),Me(this,"cameraQuaternion",new on),Me(this,"cameraScale",new N),Me(this,"parentPosition",new N),Me(this,"parentQuaternion",new on),Me(this,"parentQuaternionInv",new on),Me(this,"parentScale",new N),Me(this,"worldPositionStart",new N),Me(this,"worldQuaternionStart",new on),Me(this,"worldScaleStart",new N),Me(this,"worldPosition",new N),Me(this,"worldQuaternion",new on),Me(this,"worldQuaternionInv",new on),Me(this,"worldScale",new N),Me(this,"eye",new N),Me(this,"positionStart",new N),Me(this,"quaternionStart",new on),Me(this,"scaleStart",new N),Me(this,"camera"),Me(this,"object"),Me(this,"enabled",!0),Me(this,"axis",null),Me(this,"mode","translate"),Me(this,"translationSnap",null),Me(this,"rotationSnap",null),Me(this,"scaleSnap",null),Me(this,"space","world"),Me(this,"size",1),Me(this,"dragging",!1),Me(this,"showX",!0),Me(this,"showY",!0),Me(this,"showZ",!0),Me(this,"changeEvent",{type:"change"}),Me(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),Me(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),Me(this,"objectChangeEvent",{type:"objectChange"}),Me(this,"intersectObjectWithRay",(i,s,a)=>{const o=s.intersectObject(i,!0);for(let u=0;u<o.length;u++)if(o[u].object.visible||a)return o[u];return!1}),Me(this,"attach",i=>(this.object=i,this.visible=!0,this)),Me(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),Me(this,"reset",()=>this.enabled?(this.dragging&&this.object!==void 0&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this),Me(this,"updateMatrixWorld",()=>{this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),Me(this,"pointerHover",i=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(i,this.camera);const s=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);s?this.axis=s.object.name:this.axis=null}),Me(this,"pointerDown",i=>{if(!(this.object===void 0||this.dragging===!0||i.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(i,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){let a=this.space;if(this.mode==="scale"?a="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(a="world"),a==="local"&&this.mode==="rotate"){const o=this.rotationSnap;this.axis==="X"&&o&&(this.object.rotation.x=Math.round(this.object.rotation.x/o)*o),this.axis==="Y"&&o&&(this.object.rotation.y=Math.round(this.object.rotation.y/o)*o),this.axis==="Z"&&o&&(this.object.rotation.z=Math.round(this.object.rotation.z/o)*o)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(s.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),Me(this,"pointerMove",i=>{const s=this.axis,a=this.mode,o=this.object;let u=this.space;if(a==="scale"?u="local":(s==="E"||s==="XYZE"||s==="XYZ")&&(u="world"),o===void 0||s===null||this.dragging===!1||i.button!==-1)return;this.raycaster.setFromCamera(i,this.camera);const h=this.intersectObjectWithRay(this.plane,this.raycaster,!0);
4299if(h){if(this.pointEnd.copy(h.point).sub(this.worldPositionStart),a==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),u==="local"&&s!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),s.indexOf("X")===-1&&(this.offset.x=0),s.indexOf("Y")===-1&&(this.offset.y=0),s.indexOf("Z")===-1&&(this.offset.z=0),u==="local"&&s!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),o.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(u==="local"&&(o.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),s.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this.quaternionStart)),u==="world"&&(o.parent&&o.position.add(this.tempVector.setFromMatrixPosition(o.parent.matrixWorld)),s.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(this.tempVector.setFromMatrixPosition(o.parent.matrixWorld))));else if(a==="scale"){if(s.search("XYZ")!==-1){let f=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(f*=-1),this.tempVector2.set(f,f,f)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),s.search("X")===-1&&(this.tempVector2.x=1),s.search("Y")===-1&&(this.tempVector2.y=1),s.search("Z")===-1&&(this.tempVector2.z=1);o.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(s.search("X")!==-1&&(this.object.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Y")!==-1&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Z")!==-1&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(a==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const f=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));s==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):s==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*f):(s==="X"||s==="Y"||s==="Z")&&(this.rotationAxis.copy(this.unit[s]),this.tempVector.copy(this.unit[s]),u==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*f),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),u==="local"&&s!=="E"&&s!=="XYZE"?(o.quaternion.copy(this.quaternionStart),o.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),o.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),Me(this,"pointerUp",i=>{i.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),Me(this,"getPointer",i=>{var s;if(this.domElement&&((s=this.domElement.ownerDocument)!=null&&s.pointerLockElement))return{x:0,y:0,button:i.button};{const a=i.changedTouches?i.changedTouches[0]:i,o=this.domElement.getBoundingClientRect();return{x:(a.clientX-o.left)/o.width*2-1,y:-(a.clientY-o.top)/o.height*2+1,button:i.button}}}),Me(this,"onPointerHover",i=>{if(this.enabled)switch(i.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(i));break}}),Me(this,"onPointerDown",i=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(i)),this.pointerDown(this.getPointer(i)))}),Me(this,"onPointerMove",i=>{this.enabled&&this.pointerMove(this.getPointer(i))}),Me(this,"onPointerUp",i=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(i)))}),Me(this,"getMode",()=>this.mode),Me(this,"setMode",i=>{this.mode=i}),Me(this,"setTranslationSnap",i=>{this.translationSnap=i}),Me(this,"setRotationSnap",i=>{this.rotationSnap=i}),Me(this,"setScaleSnap",i=>{this.scaleSnap=i}),Me(this,"setSize",i=>{this.size=i}),Me(this,"setSpace",i=>{this.space=i}),Me(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),Me(this,"connect",i=>{i===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=i,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),Me(this,"dispose",()=>{var i,s,a,o,u,h;(i=this.domElement)==null||i.removeEventListener("pointerdown",this.onPointerDown),(s=this.domElement)==null||s.removeEventListener("pointermove",this.onPointerHover),(o=(a=this.domElement)==null?void 0:a.ownerDocument)==null||o.removeEventListener("pointermove",this.onPointerMove),(h=(u=this.domElement)==null?void 0:u.ownerDocument)==null||h.removeEventListener("pointerup",this.onPointerUp),this.traverse(f=>{const d=f;d.geometry&&d.geometry.dispose(),d.material&&d.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new iB,this.add(this.gizmo),this.plane=new rB,this.add(this.plane);const n=(i,s)=>{let a=s;Object.defineProperty(this,i,{get:function(){return a!==void 0?a:s},set:function(o){a!==o&&(a=o,this.plane[i]=o,this.gizmo[i]=o,this.dispatchEvent({type:i+"-changed",value:o}),this.dispatchEvent(this.changeEvent))}}),this[i]=s,this.plane[i]=s,this.gizmo[i]=s};n("camera",this.camera),n("object",this.object),n("enabled",this.enabled),n("axis",this.axis),n("mode",this.mode),n("translationSnap",this.translationSnap),n("rotationSnap",this.rotationSnap),n("scaleSnap",this.scaleSnap),n("space",this.space),n("size",this.size),n("dragging",this.dragging),n("showX",this.showX),n("showY",this.showY),n("showZ",this.showZ),n("worldPosition",this.worldPosition),n("worldPositionStart",this.worldPositionStart),n("worldQuaternion",this.worldQuaternion),n("worldQuaternionStart",this.worldQuaternionStart),n("cameraPosition",this.cameraPosition),n("cameraQuaternion",this.cameraQuaternion),n("pointStart",this.pointStart),n("pointEnd",this.pointEnd),n("rotationAxis",this.rotationAxis),n("rotationAngle",this.rotationAngle),n("eye",this.eye),t!==void 0&&this.connect(t)}}class iB extends qt{constructor(){super(),Me(this,"isTransformControlsGizmo",!0),Me(this,"type","TransformControlsGizmo"),Me(this,"tempVector",new
4299N(0,0,0)),Me(this,"tempEuler",new Li),Me(this,"alignVector",new N(0,1,0)),Me(this,"zeroVector",new N(0,0,0)),Me(this,"lookAtMatrix",new It),Me(this,"tempQuaternion",new on),Me(this,"tempQuaternion2",new on),Me(this,"identityQuaternion",new on),Me(this,"unitX",new N(1,0,0)),Me(this,"unitY",new N(0,1,0)),Me(this,"unitZ",new N(0,0,1)),Me(this,"gizmo"),Me(this,"picker"),Me(this,"helper"),Me(this,"rotationAxis",new N),Me(this,"cameraPosition",new N),Me(this,"worldPositionStart",new N),Me(this,"worldQuaternionStart",new on),Me(this,"worldPosition",new N),Me(this,"worldQuaternion",new on),Me(this,"eye",new N),Me(this,"camera",null),Me(this,"enabled",!0),Me(this,"axis",null),Me(this,"mode","translate"),Me(this,"space","world"),Me(this,"size",1),Me(this,"dragging",!1),Me(this,"showX",!0),Me(this,"showY",!0),Me(this,"showZ",!0),Me(this,"updateMatrixWorld",()=>{let Y=this.space;this.mode==="scale"&&(Y="local");const se=Y==="local"?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let pe=[];pe=pe.concat(this.picker[this.mode].children),pe=pe.concat(this.gizmo[this.mode].children),pe=pe.concat(this.helper[this.mode].children);for(let we=0;we<pe.length;we++){const $=pe[we];$.visible=!0,$.rotation.set(0,0,0),$.position.copy(this.worldPosition);let xt;if(this.camera.isOrthographicCamera?xt=(this.camera.top-this.camera.bottom)/this.camera.zoom:xt=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),$.scale.set(1,1,1).multiplyScalar(xt*this.size/7),$.tag==="helper"){$.visible=!1,$.name==="AXIS"?($.position.copy(this.worldPositionStart),$.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),$.quaternion.copy(se).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(se).dot(this.eye))>.9&&($.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),$.quaternion.copy(se).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(se).dot(this.eye))>.9&&($.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),$.quaternion.copy(se).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(se).dot(this.eye))>.9&&($.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),$.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),$.quaternion.multiply(this.tempQuaternion),$.visible=this.dragging),this.axis==="E"&&($.visible=!1)):$.name==="START"?($.position.copy(this.worldPositionStart),$.visible=this.dragging):$.name==="END"?($.position.copy(this.worldPosition),$.visible=this.dragging):$.name==="DELTA"?($.position.copy(this.worldPositionStart),$.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,
42991e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),$.scale.copy(this.tempVector),$.visible=this.dragging):($.quaternion.copy(se),this.dragging?$.position.copy(this.worldPositionStart):$.position.copy(this.worldPosition),this.axis&&($.visible=this.axis.search($.name)!==-1));continue}$.quaternion.copy(se),this.mode==="translate"||this.mode==="scale"?(($.name==="X"||$.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(se).dot(this.eye))>.99&&($.scale.set(1e-10,1e-10,1e-10),$.visible=!1),($.name==="Y"||$.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(se).dot(this.eye))>.99&&($.scale.set(1e-10,1e-10,1e-10),$.visible=!1),($.name==="Z"||$.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(se).dot(this.eye))>.99&&($.scale.set(1e-10,1e-10,1e-10),$.visible=!1),$.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(se).dot(this.eye))<.2&&($.scale.set(1e-10,
42991e-10,1e-10),$.visible=!1),$.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(se).dot(this.eye))<.2&&($.scale.set(1e-10,1e-10,1e-10),$.visible=!1),$.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(se).dot(this.eye))<.2&&($.scale.set(1e-10,1e-10,1e-10),$.visible=!1),$.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(se).dot(this.eye)<0?$.tag==="fwd"?$.visible=!1:$.scale.x*=-1:$.tag==="bwd"&&($.visible=!1)),$.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(se).dot(this.eye)<0?$.tag==="fwd"?$.visible=!1:$.scale.y*=-1:$.tag==="bwd"&&($.visible=!1)),$.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(se).dot(this.eye)<0?$.tag==="fwd"?$.visible=!1:$.scale.z*=-1:$.tag==="bwd"&&($.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(se),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(se).invert()),$.name.search("E")!==-1&&$.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),$.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),$.quaternion.copy(this.tempQuaternion)),$.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),$.quaternion.copy(this.tempQuaternion)),$.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),$.quaternion.copy(this.tempQuaternion))),$.visible=$.visible&&($.name.indexOf("X")===-1||this.showX),$.visible=$.visible&&($.name.indexOf("Y")===-1||this.showY),$.visible=$.visible&&($.name.indexOf("Z")===-1||this.showZ),$.visible=$.visible&&($.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),$.material.tempOpacity=$.material.tempOpacity||$.material.opacity,$.material.tempColor=$.material.tempColor||$.material.color.clone(),$.material.color.copy($.material.tempColor),$.material.opacity=$.material.tempOpacity,this.enabled?this.axis&&($.name===this.axis?($.material.opacity=1,$.material.color.lerp(new je(1,1,1),.5)):this.axis.split("").some(function(le){return $.name===le})?($.material.opacity=1,$.material.color.lerp(new je(1,1,1),.5)):($.material.opacity*=.25,$.material.color.lerp(new je(1,1,1),.5))):($.material.opacity*=.5,$.material.color.lerp(new je(1,1,1),.5))}super.updateMatrixWorld()});const e=new bi({depthTest:!1,depthWrite:!1,transparent:!0,side:$n,fog:!1,toneMapped:!1}),t=new si({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),n=e.clone();n.opacity=.15;const i=e.clone();i.opacity=.33;const s=e.clone();s.color.set(16711680);const a=e.clone();a.color.set(65280);const o=e.clone();o.color.set(255);const u=e.clone();u.opacity=.25;const h=u.clone();h.color.set(16776960);const f=u.clone();f.color.set(65535);const d=u.clone();d.color.set(16711935),e.clone().color.set(16776960);const g=t.clone();g.color.set(16711680);const v=t.clone();v.color.set(65280);const A=t.clone();A.color.set(255);const y=t.clone();y.color.set(65535);const _=t.clone();_.color.set(16711935);const M=t.clone();M.color.set(16776960);const E=t.clone();E.color.set(7895160);const w=M.clone();w.opacity=.25;const B=new gi(0,.05,.2,12,1,!1),P=new Mi(.125,.125,.125),D=new Lt;D.setAttribute("position",new pt([0,0,0,1,0,0],3));const F=(Y,se)=>{const pe=new Lt,we=[];for(let $=0;$<=64*se;++$)we.push(0,Math.cos($/32*Math.PI)*Y,Math.sin($/32*Math.PI)*Y);return pe.setAttribute("position",new pt(we,3)),pe},b=()=>{const Y=new Lt;return Y.setAttribute("position",new pt([0,0,0,1,1,1],3)),Y},C={X:[[new ot(B,s),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new ot(B,s),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new Yt(D,g)]],Y:[[new ot(B,a),[0,1,0],null,null,"fwd"],[new ot(B,a),[0,1,0],[Math.PI,0,0],null,"bwd"],[new Yt(D,v),null,[0,0,Math.PI/2]]],Z:[[new ot(B,o),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new ot(B,o),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new Yt(D,A),null,[0,-Math.PI/2,0]]],XYZ:[[new ot(new sr(.1,0),u.clone()),[0,0,0],[0,0,0]]],XY:[[new ot(new ki(.295,.295),h.clone()),[.15,.15,0]],[new Yt(D,M),[.18,.3,0],null,[.125,1,1]],[new Yt(D,M),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new ot(new ki(.295,.295),f.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new Yt(D,y),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new Yt(D,y),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new ot(new ki(.295,.295),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new Yt(D,_),[.18,0,.3],null,[.125,1,1]],[new Yt(D,_),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},U={X:[[new ot(new gi(.2,0,1,4,1,!1),n),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new ot(new gi(.2,0,1,4,1,!1),n),[0,.6,0]]],Z:[[new ot(new gi(.2,0,1,4,1,!1),n),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new ot(new sr(.2,0),n)]],XY:[[new ot(new ki(.4,.4),n),[.2,.2,0]]],YZ:[[new ot(new ki(.4,.4),n),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new ot(new ki(.4,.4),n),[.2,0,.2],[-Math.PI/2,0,0]]]},V={START:[[new ot(new sr(.01,2),i),null,null,null,"helper"]],END:[[new ot(new sr(.01,2),i),null,null,null,"helper"]],DELTA:[[new Yt(b(),i),null,null,null,"helper"]],X:[[new Yt(D,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Yt(D,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Yt(D,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},J={X:[[new Yt(F(1,.5),g)],[new ot(new sr(.04,0),s),[0,0,.99],null,[1,3,1]]],Y:[[new Yt(F(1,.5),v),null,[0,0,-Math.PI/2]],[new ot(new sr(.04,0),a),[0,0,.99],null,[3,1,1]]],Z:[[new Yt(F(1,.5),A),null,[0,Math.PI/2,0]],[new ot(new sr(.04,0),o),[.99,0,0],null,[1,3,1]]],E:[[new Yt(F(1.25,1),w),null,[0,Math.PI/2,0]],[new ot(new gi(.03,0,.15,4,1,!1),w),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new ot(new gi(.03,0,.15,4,1,!1),w),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new ot(new gi(.03,0,.15,4,1,!1),w),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new ot(new gi(.03,0,.15,4,1,!1),w),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new Yt(F(1,1),E),null,[0,Math.PI/2,0]]]},Q={AXIS:[[new Yt(D,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},oe={X:[[new ot(new Cs(1,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new ot(new Cs(1,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new ot(new Cs(1,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new ot(new Cs(1.25,.1,2,24),n)]],XYZE:[[new ot(new Jo(.7,10,8),n)]]},q={X:[[new ot(P,s),[.8,0,0],[0,0,-Math.PI/2]],[new Yt(D,g),null,null,[.8,1,1]]],Y:[[new ot(P,a),[0,.8,0]],[new Yt(D,v),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new ot(P,o),[0,0,.8],[Math.PI/2,0,0]],[new Yt(D,A),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new ot(P,h),[.85,.85,0],null,[2,2,.2]],[new Yt(D,M),[.855,.98,0],null,[.125,1,1]],[new Yt(D,M),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new ot(P,f),[0,.85,.85],null,[.2,2,2]],[new Yt(D,y),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new Yt(D,y),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new ot(P,d),[.85,0,.85],null,[2,.2,2]],[new Yt(D,_),[.855,0,.98],null,[.125,1,1]],[new Yt(D,_),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new ot(new Mi(.125,.125,.125),u.clone()),[1.1,0,0]]],XYZY:[[new ot(new Mi(.125,.125,.125),u.clone()),[0,1.1,0]]],XYZZ:[[new ot(new Mi(.125,.125,.125),u.clone()),[0,0,1.1]]]},ue={X:[[new ot(new gi(.2,0,.8,4,1,!1),n),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new ot(new gi(.2,0,.8,4,1,!1),n),[0,.5,0]]],Z:[[new ot(new gi(.2,0,.8,4,1,!1),n),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new ot(P,n),[.85,.85,0],null,[3,3,.2]]],YZ:[[new ot(P,n),[0,.85,.85],null,[.2,3,3]]],XZ:[[new ot(P,n),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new ot(new Mi(.2,.2,.2),n),[1.1,0,0]]],XYZY:[[new ot(new Mi(.2,.2,.2),n),[0,1.1,0]]],XYZZ:[[new ot(new Mi(.2,.2,.2),n),[0,0,1.1]]]},z={X:[[new Yt(D,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Yt(D,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Yt(D,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ne=Y=>{const se=new qt;for(let pe in Y)for(let we=Y[pe].length;we--;){const $=Y[pe][we][0].clone(),xt=Y[pe][we][1],le=Y[pe][we][2],Ae=Y[pe][we][3],Qe
4299=Y[pe][we][4];$.name=pe,$.tag=Qe,xt&&$.position.set(xt[0],xt[1],xt[2]),le&&$.rotation.set(le[0],le[1],le[2]),Ae&&$.scale.set(Ae[0],Ae[1],Ae[2]),$.updateMatrix();const yt=$.geometry.clone();yt.applyMatrix4($.matrix),$.geometry=yt,$.renderOrder=1/0,$.position.set(0,0,0),$.rotation.set(0,0,0),$.scale.set(1,1,1),se.add($)}return se};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=ne(C)),this.add(this.gizmo.rotate=ne(J)),this.add(this.gizmo.scale=ne(q)),this.add(this.picker.translate=ne(U)),this.add(this.picker.rotate=ne(oe)),this.add(this.picker.scale=ne(ue)),this.add(this.helper.translate=ne(V)),this.add(this.helper.rotate=ne(Q)),this.add(this.helper.scale=ne(z)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class rB extends ot{constructor(){super(new ki(1e5,1e5,2,2),new bi({visible:!1,wireframe:!0,side:$n,transparent:!0,opacity:.1,toneMapped:!1})),Me(this,"isTransformControlsPlane",!0),Me(this,"type","TransformControlsPlane"),Me(this,"unitX",new N(1,0,0)),Me(this,"unitY",new N(0,1,0)),Me(this,"unitZ",new N(0,0,1)),Me(this,"tempVector",new N),Me(this,"dirVector",new N),Me(this,"alignVector",new N),Me(this,"tempMatrix",new It),Me(this,"identityQuaternion",new on),Me(this,"cameraQuaternion",new on),Me(this,"worldPosition",new N),Me(this,"worldQuaternion",new on),Me(this,"eye",new N),Me(this,"axis",null),Me(this,"mode","translate"),Me(this,"space","world"),Me(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),this.unitX.set(1,0,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0);break}break;case"rotate":default:this.dirVector.set(0,0,0)}this.dirVector.length()===0?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}var sB=Object.defineProperty,aB=(r,e,t)=>e in r?sB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>(aB(r,typeof e!="symbol"?e+"":e,t),t);const eh=new Na,W_=new $r,oB=Math.cos(70*(Math.PI/180)),X_=(r,e)=>(r%e+e)%e;class x2 extends eB{constructor(e,t){super(),Pt(this,"object"),Pt(this,"domElement"),Pt(this,"enabled",!0),Pt(this,"target",new N),Pt(this,"minDistance",0),Pt(this,"maxDistance",1/0),Pt(this,"minZoom",0),Pt(this,"maxZoom",1/0),Pt(this,"minPolarAngle",0),Pt(this,"maxPolarAngle",Math.PI),Pt(this,"minAzimuthAngle",-1/0),Pt(this,"maxAzimuthAngle",1/0),Pt(this,"enableDamping",!1),Pt(this,"dampingFactor",.05),Pt(this,"enableZoom",!0),Pt(this,"zoomSpeed",1),Pt(this,"enableRotate",!0),Pt(this,"rotateSpeed",1),Pt(this,"enablePan",!0),Pt(this,"panSpeed",1),Pt(this,"screenSpacePanning",!0),Pt(this,"keyPanSpeed",7),Pt(this,"zoomToCursor",!1),Pt(this,"autoRotate",!1),Pt(this,"autoRotateSpeed",2),Pt(this,"reverseOrbit",!1),Pt(this,"reverseHorizontalOrbit",!1),Pt(this,"reverseVerticalOrbit",!1),Pt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Pt(this,"mouseButtons",{LEFT:ha.ROTATE,MIDDLE:ha.DOLLY,RIGHT:ha.PAN}),Pt(this,"touches",{ONE:fa.ROTATE,TWO:fa.DOLLY_PAN}),Pt(this,"target0"),Pt(this,"position0"),Pt(this,"zoom0"),Pt(this,"_domElementKeyEvents",null),Pt(this,"getPolarAngle"),Pt(this,"getAzimuthalAngle"),Pt(this,"setPolarAngle"),Pt(this,"setAzimuthalAngle"),Pt(this,"getDistance"),Pt(this,"getZoomScale"),Pt(this,"listenToKeyEvents"),Pt(this,"stopListenToKeyEvents"),Pt(this,"saveState"),Pt(this,"reset"),Pt(this,"update"),Pt(this,"connect"),Pt(this,"dispose"),Pt(this,"dollyIn"),Pt(this,"dollyOut"),Pt(this,"getScale"),Pt(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=X=>{let ce=X_(X,2*Math.PI),De=f.phi;De<0&&(De+=2*Math.PI),ce<0&&(ce+=2*Math.PI);let K=Math.abs(ce-De);2*Math.PI-K<K&&(ce<De?ce+=2*Math.PI:De+=2*Math.PI),d.phi=ce-De,n.update()},this.setAzimuthalAngle=X=>{let ce=X_(X,2*Math.PI),De=f.theta;De<0&&(De+=2*Math.PI),ce<0&&(ce+=2*Math.PI);let K=Math.abs(ce-De);2*Math.PI-K<K&&(ce<De?ce+=2*Math.PI:De+=2*Math.PI),d.theta=ce-De,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=X=>{X.addEventListener("keydown",ge),this._domElementKeyEvents=X},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ge),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=o.NONE},this.update=(()=>{const X=new N,ce=new N(0,1,0),De=new on().setFromUnitVectors(e.up,ce),K=De.clone().invert(),he=new N,Le=new on,et=2*Math.PI;return function(){const be=n.object.position;De.setFromUnitVectors(e.up,ce),K.copy(De).invert(),X.copy(be).sub(n.target),X.applyQuaternion(De),f.setFromVector3(X),n.autoRotate&&u===o.NONE&&Q(V()),n.enableDamping?(f.theta+=d.theta*n.dampingFactor,f.phi+=d.phi*n.dampingFactor):(f.theta+=d.theta,f.phi+=d.phi);let He=n.minAzimuthAngle,Mt=n.maxAzimuthAngle;isFinite(He)&&isFinite(Mt)&&(He<-Math.PI?He+=et:He>Math.PI&&(He-=et),Mt<-Math.PI?Mt+=et:Mt>Math.PI&&(Mt-=et),He<=Mt?f.theta=Math.max(He,Math.min(Mt,f.theta)):f.theta=f.theta>(He+Mt)/2?Math.max(He,f.theta):Math.min(Mt,f.theta)),f.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,f.phi)),f.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&b||n.object.isOrthographicCamera?f.radius=we(f.radius):f.radius=we(f.radius*p),X.setFromSpherical(f),X.applyQuaternion(K),be.copy(n.target).add(X),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(d.theta*=1-n.dampingFactor,d.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(d.set(0,0,0),g.set(0,0,0));let jt=!1;if(n.zoomToCursor&&b){let Wt=null;if(n.object instanceof En&&n.object.isPerspectiveCamera){const Pn=X.length();Wt=we(Pn*p);const Jn=Pn-Wt;n.object.position.addScaledVector(D,Jn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Pn=new N(F.x,F.y,0);Pn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),jt=!0;const Jn=new N(F.x,F.y,0);Jn.unproject(n.object),n.object.position.sub(Jn).add(Pn),n.object.updateMatrixWorld(),Wt=X.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Wt!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Wt).add(n.object.position):(eh.origin.copy(n.object.position),eh.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(eh.direction))<oB?e.lookAt(n.target):(W_.setFromNormalAndCoplanarPoint(n.object.up,n.target),eh.intersectPlane(W_,n.target))))}else n.object instanceof Sr&&n.object.isOrthographicCamera&&(jt=p!==1,jt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix()));return p=1,b=!1,jt||he.distanceToSquared(n.object.position)>h||8*(1-Le.dot(n.object.quaternion))>h?(n.dispatchEvent(i),he.copy(n.object.position),Le.copy(n.object.quaternion),jt=!1,!0):!1}})(),this.connect=X=>{n.domElement=X,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",ft),n.domElement.addEventListener("pointerdown",We),n.domElement.addEventListener("pointercancel",R),n.domElement.addEventListener("wheel",Ce)},this.dispose=()=>{var X,ce,De,K,he,Le;n.domElement&&(n.domElement.style.touchAction="auto"),(X=n.domElement)==null||X.removeEventListener("contextmenu",ft),(ce=n.domElement)==null||ce.removeEventListener("pointerdown",We),(De=n.domElement)==null||De.removeEventListener("pointercancel",R),(K=n.domElement)==null||K.removeEventListener("wheel",Ce),
4299(he=n.domElement)==null||he.ownerDocument.removeEventListener("pointermove",G),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointerup",R),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",ge)};const n=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=o.NONE;const h=1e-6,f=new rm,d=new rm;let p=1;const g=new N,v=new _e,A=new _e,y=new _e,_=new _e,M=new _e,E=new _e,w=new _e,B=new _e,P=new _e,D=new N,F=new _e;let b=!1;const C=[],U={};function V(){return 2*Math.PI/60/60*n.autoRotateSpeed}function J(){return Math.pow(.95,n.zoomSpeed)}function Q(X){n.reverseOrbit||n.reverseHorizontalOrbit?d.theta+=X:d.theta-=X}function oe(X){n.reverseOrbit||n.reverseVerticalOrbit?d.phi+=X:d.phi-=X}const q=(()=>{const X=new N;return function(De,K){X.setFromMatrixColumn(K,0),X.multiplyScalar(-De),g.add(X)}})(),ue=(()=>{const X=new N;return function(De,K){n.screenSpacePanning===!0?X.setFromMatrixColumn(K,1):(X.setFromMatrixColumn(K,0),X.crossVectors(n.object.up,X)),X.multiplyScalar(De),g.add(X)}})(),z=(()=>{const X=new N;return function(De,K){const he=n.domElement;if(he&&n.object instanceof En&&n.object.isPerspectiveCamera){const Le=n.object.position;X.copy(Le).sub(n.target);let et=X.length();et*=Math.tan(n.object.fov/2*Math.PI/180),q(2*De*et/he.clientHeight,n.object.matrix),ue(2*K*et/he.clientHeight,n.object.matrix)}else he&&n.object instanceof Sr&&n.object.isOrthographicCamera?(q(De*(n.object.right-n.object.left)/n.object.zoom/he.clientWidth,n.object.matrix),ue(K*(n.object.top-n.object.bottom)/n.object.zoom/he.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ne(X){n.object instanceof En&&n.object.isPerspectiveCamera||n.object instanceof Sr&&n.object.isOrthographicCamera?p=X:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Y(X){ne(p/X)}function se(X){ne(p*X)}function pe(X){if(!n.zoomToCursor||!n.domElement)return;b=!0;const ce=n.domElement.getBoundingClientRect(),De=X.clientX-ce.left,K=X.clientY-ce.top,he=ce.width,Le=ce.height;F.x=De/he*2-1,F.y=-(K/Le)*2+1,D.set(F.x,F.y,1).unproject(n.object).sub(n.object.position).normalize()}function we(X){return Math.max(n.minDistance,Math.min(n.maxDistance,X))}function $(X){v.set(X.clientX,X.clientY)}function xt(X){pe(X),w.set(X.clientX,X.clientY)}function le(X){_.set(X.clientX,X.clientY)}
4299function Ae(X){A.set(X.clientX,X.clientY),y.subVectors(A,v).multiplyScalar(n.rotateSpeed);const ce=n.domElement;ce&&(Q(2*Math.PI*y.x/ce.clientHeight),oe(2*Math.PI*y.y/ce.clientHeight)),v.copy(A),n.update()}function Qe(X){B.set(X.clientX,X.clientY),P.subVectors(B,w),P.y>0?Y(J()):P.y<0&&se(J()),w.copy(B),n.update()}function yt(X){M.set(X.clientX,X.clientY),E.subVectors(M,_).multiplyScalar(n.panSpeed),z(E.x,E.y),_.copy(M),n.update()}function st(X){pe(X),X.deltaY<0?se(J()):X.deltaY>0&&Y(J()),n.update()}function Dt(X){let ce=!1;switch(X.code){case n.keys.UP:z(0,n.keyPanSpeed),ce=!0;break;case n.keys.BOTTOM:z(0,-n.keyPanSpeed),ce=!0;break;case n.keys.LEFT:z(n.keyPanSpeed,0),ce=!0;break;case n.keys.RIGHT:z(-n.keyPanSpeed,0),ce=!0;break}ce&&(X.preventDefault(),n.update())}function Zt(){if(C.length==1)v.set(C[0].pageX,C[0].pageY);else{const X=.5*(C[0].pageX+C[1].pageX),ce=.5*(C[0].pageY+C[1].pageY);v.set(X,ce)}}function _t(){if(C.length==1)_.set(C[0].pageX,C[0].pageY);else{const X=.5*(C[0].pageX+C[1].pageX),ce=.5*(C[0].pageY+C[1].pageY);_.set(X,ce)}}function Te(){const X=C[0].pageX-C[1].pageX,ce=C[0].pageY-C[1].pageY,De=Math.sqrt(X*X+ce*ce);w.set(0,De)}function Ue(){n.enableZoom&&Te(),n.enablePan&&_t()}function Ie(){n.enableZoom&&Te(),n.enableRotate&&Zt()}function $e(X){if(C.length==1)A.set(X.pageX,X.pageY);else{const De=ut(X),K=.5*(X.pageX+De.x),he=.5*(X.pageY+De.y);A.set(K,he)}y.subVectors(A,v).multiplyScalar(n.rotateSpeed);const ce=n.domElement;ce&&(Q(2*Math.PI*y.x/ce.clientHeight),oe(2*Math.PI*y.y/ce.clientHeight)),v.copy(A)}function H(X){if(C.length==1)M.set(X.pageX,X.pageY);else{const ce=ut(X),De=.5*(X.pageX+ce.x),K=.5*(X.pageY+ce.y);M.set(De,K)}E.subVectors(M,_).multiplyScalar(n.panSpeed),z(E.x,E.y),_.copy(M)}function At(X){const ce=ut(X),De=X.pageX-ce.x,K=X.pageY-ce.y,he=Math.sqrt(De*De+K*K);B.set(0,he),P.set(0,Math.pow(B.y/w.y,n.zoomSpeed)),Y(P.y),w.copy(B)}function tt(X){n.enableZoom&&At(X),n.enablePan&&H(X)}function Tt(X){n.enableZoom&&At(X),n.enableRotate&&$e(X)}function We(X){var ce,De;n.enabled!==!1&&(C.length===0&&((ce=n.domElement)==null||ce.ownerDocument.addEventListener("pointermove",G),(De=n.domElement)==null||De.ownerDocument.addEventListener("pointerup",R)),Rt(X),X.pointerType==="touch"?ht(X):ee(X))}function G(X){n.enabled!==!1&&(X.pointerType==="touch"?Ye(X):me(X))}function R(X){var ce,De,K;Pe(X),C.length===0&&((ce=n.domElement)==null||ce.releasePointerCapture(X.pointerId),(De=n.domElement)==null||De.ownerDocument.removeEventListener("pointermove",G),(K=n.domElement)==null||K.ownerDocument.removeEventListener("pointerup",R)),n.dispatchEvent(a),u=o.NONE}function ee(X){let ce;switch(X.button){case 0:ce=n.mouseButtons.LEFT;break;case 1:ce=n.mouseButtons.MIDDLE;break;case 2:ce=n.mouseButtons.RIGHT;break;default:ce=-1}switch(ce){case ha.DOLLY:if(n.enableZoom===!1)return;xt(X),u=o.DOLLY;break;case ha.ROTATE:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enablePan===!1)return;le(X),u=o.PAN}else{if(n.enableRotate===!1)return;$(X),u=o.ROTATE}break;case ha.PAN:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enableRotate===!1)return;$(X),u=o.ROTATE}else{if(n.enablePan===!1)return;le(X),u=o.PAN}break;default:u=o.NONE}u!==o.NONE&&n.dispatchEvent(s)}function me(X){if(n.enabled!==!1)switch(u){case o.ROTATE:if(n.enableRotate===!1)return;Ae(X);break;case o.DOLLY:if(n.enableZoom===!1)return;Qe(X);break;case o.PAN:if(n.enablePan===!1)return;yt(X);break}}function Ce(X){n.enabled===!1||n.enableZoom===!1||u!==o.NONE&&u!==o.ROTATE||(X.preventDefault(),n.dispatchEvent(s),st(X),n.dispatchEvent(a))}function ge(X){n.enabled===!1||n.enablePan===!1||Dt(X)}function ht(X){switch(Ge(X),C.length){case 1:switch(n.touches.ONE){case fa.ROTATE:if(n.enableRotate===!1)return;Zt(),u=o.TOUCH_ROTATE;break;case fa.PAN:if(n.enablePan===!1)return;_t(),u=o.TOUCH_PAN;break;default:u=o.NONE}break;case 2:switch(n.touches.TWO){case fa.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ue(),u=o.TOUCH_DOLLY_PAN;break;case fa.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ie(),u=o.TOUCH_DOLLY_ROTATE;break;default:u=o.NONE}break;default:u=o.NONE}u!==o.NONE&&n.dispatchEvent(s)}function Ye(X){switch(Ge(X),u){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;$e(X),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;H(X),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;tt(X),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Tt(X),n.update();break;default:u=o.NONE}}function ft(X){n.enabled!==!1&&X.preventDefault()}function Rt(X){C.push(X)}function Pe(X){delete U[X.pointerId];for(let ce=0;ce<C.length;ce++)if(C[ce].pointerId==X.pointerId){C.splice(ce,1);return}}function Ge(X){let ce=U[X.pointerId];ce===void 0&&(ce=new _e,U[X.pointerId]=ce),ce.set(X.pageX,X.pageY)}function ut(X){const ce=X.pointerId===C[0].pointerId?C[1]:C[0];return U[ce.pointerId]}this.dollyIn=(X=J())=>{se(X),n.update()},this.dollyOut=(X=J())=>{Y(X),n.update()}
vendor: 16,384 bytes, line 4299
4299,this.getScale=()=>p,this.setScale=X=>{ne(X),n.update()},this.getZoomScale=()=>J(),t!==void 0&&this.connect(t),this.update()}}function qh(r){if(typeof TextDecoder<"u")return new TextDecoder().decode(r);let e="";for(let t=0,n=r.length;t<n;t++)e+=String.fromCharCode(r[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const Sa="srgb",rs="srgb-linear",J_=3001,lB=3e3;class y2 extends _i{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new dB(t)}),this.register(function(t){return new pB(t)}),this.register(function(t){return new MB(t)}),this.register(function(t){return new EB(t)}),this.register(function(t){return new wB(t)}),this.register(function(t){return new gB(t)}),this.register(function(t){return new vB(t)}),this.register(function(t){return new _B(t)}),this.register(function(t){return new xB(t)}),this.register(function(t){return new fB(t)}),this.register(function(t){return new yB(t)}),this.register(function(t){return new mB(t)}),this.register(function(t){return new SB(t)}),this.register(function(t){return new AB(t)}),this.register(function(t){return new uB(t)}),this.register(function(t){return new bB(t)}),this.register(function(t){return new TB(t)})}load(e,t,n,i){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const h=Bs.extractUrlBase(e);a=Bs.resolveURL(h,this.path)}else a=Bs.extractUrlBase(e);this.manager.itemStart(e);const o=function(h){i?i(h):console.error(h),s.manager.itemError(e),s.manager.itemEnd(e)},u=new Yi(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(h){try{s.parse(h,a,function(f){t(f),s.manager.itemEnd(e)},o)}catch(f){o(f)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let s;const a={},o={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(qh(new Uint8Array(e.slice(0,4)))===vA){try{a[tn.KHR_BINARY_GLTF]=new CB(e)}catch(f){i&&i(f);return}s=JSON.parse(a[tn.KHR_BINARY_GLTF].content)}else s=JSON.parse(qh(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new zB(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const f=this.pluginCallbacks[h](u);f.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[f.name]=f,a[f.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const f=s.extensionsUsed[h],d=s.extensionsRequired||[];switch(f){case tn.KHR_MATERIALS_UNLIT:a[f]=new hB;break;case tn.KHR_DRACO_MESH_COMPRESSION:a[f]=new RB(s,this.dracoLoader);break;case tn.KHR_TEXTURE_TRANSFORM:a[f]=new IB;break;case tn.KHR_MESH_QUANTIZATION:a[f]=new BB;break;default:d.indexOf(f)>=0&&o[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(a),u.setPlugins(o),u.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function cB(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const tn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class uB{constructor(e){this.parser=e,this.name=tn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,u=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let h;const f=new je(16777215);u.color!==void 0&&f.setRGB(u.color[0],u.color[1],u.color[2],rs);const d=u.range!==void 0?u.range:0;switch(u.type){case"directional":h=new ag(f),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new sg(f),h.distance=d;break;case"spot":h=new rg(f),h.distance=d,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,h.angle=u.spot.outerConeAngle,h.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return h.position.set(0,0,0),h.decay=2,jr(h,u),u.intensity!==void 0&&(h.intensity=u.intensity),h.name=t.createUniqueName(u.name||"light_"+e),i=Promise.resolve(h),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(u){return n._getNodeRef(t.cache,o,u)})}}class hB{constructor(){this.name=tn.KHR_MATERIALS_UNLIT}getMaterialType(){return bi}extendParams(e,t,n){const i=[];e.color=new je(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],rs),e.opacity=a[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,Sa))}return Promise.all(i)}}class fB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class dB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new _e(o,o)}return Promise.all(s)}}class pB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class mB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class gB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new je(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],rs)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Sa)),a.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class vB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class _B{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new je().setRGB(o[0],o[1],o[2],rs),Promise.all(s)}}class xB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class yB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new je().setRGB(o[0],o[1],o[2],rs),a.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,Sa)),Promise.all(s)}}class AB{constructor(e){this.parser=e,this.name=tn.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(s)}}class SB{constructor(e){this.parser=e,this.name=tn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:lr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class MB{constructor(e){this.parser=e,this.name=tn.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class EB{constructor(e){this.parser=e,this.name=tn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let u=n.textureLoader;if(o.uri){const h=n.options.manager.getHandler(o.uri);h!==null&&(u=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,a.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class wB{constructor(e){this.parser=e,this.name=tn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let u=n.textureLoader;if(o.uri){const h=n.options.manager.getHandler(o.uri);h!==null&&(u=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,a.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBp
4299eGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class bB{constructor(e){this.name=tn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const u=i.byteOffset||0,h=i.byteLength||0,f=i.count,d=i.byteStride,p=new Uint8Array(o,u,h);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(f,d,p,i.mode,i.filter).then(function(g){return g.buffer}):a.ready.then(function(){const g=new ArrayBuffer(f*d);return a.decodeGltfBuffer(new Uint8Array(g),f,d,p,i.mode,i.filter),g})})}else return null}}class TB{constructor(e){this.name=tn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const h of i.primitives)if(h.mode!==rr.TRIANGLES&&h.mode!==rr.TRIANGLE_STRIP&&h.mode!==rr.TRIANGLE_FAN&&h.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],u={};for(const h in a)o.push(this.parser.getDependency("accessor",a[h]).then(f=>(u[h]=f,u[h])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(h=>{const f=h.pop(),d=f.isGroup?f.children:[f],p=h[0].count,g=[];for(const v of d){const A=new It,y=new N,_=new on,M=new N(1,1,1),E=new Om(v.geometry,v.material,p);for(let w=0;w<p;w++)u.TRANSLATION&&y.fromBufferAttribute(u.TRANSLATION,w),u.ROTATION&&_.fromBufferAttribute(u.ROTATION,w),u.SCALE&&M.fromBufferAttribute(u.SCALE,w),E.setMatrixAt(w,A.compose(y,_,M));for(const w in u)if(w==="_COLOR_0"){const B=u[w];E.instanceColor=new Ia(B.array,B.itemSize,B.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&v.geometry.setAttribute(w,u[w]);qt.prototype.copy.call(E,v),this.parser.assignFinalMaterial(E),g.push(E)}return f.isGroup?(f.clear(),f.add(...g),f):g[0]}))}}const vA="glTF",Bl=12,Y_={JSON:1313821514,BIN:5130562};class CB{constructor(e){this.name=tn.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Bl);if(this.header={magic:qh(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==vA)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Bl,i=new DataView(e,Bl);let s=0;for(;s<n;){const a=i.getUint32(s,!0);s+=4;const o=i.getUint32(s,!0);if(s+=4,o===Y_.JSON){const u=new Uint8Array(e,Bl+s,a);this.content=qh(u)}else if(o===Y_.BIN){const u=Bl+s;this.body=e.slice(u,u+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class RB{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=tn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},u={},h={};for(const f in a){const d=dm[f]||f.toLowerCase();o[d]=a[f]}for(const f in e.attributes){const d=dm[f]||f.toLowerCase();if(a[f]!==void 0){const p=n.accessors[e.attributes[f]],g=Po[p.componentType];h[d]=g.name,u[d]=p.normalized===!0}}return t.getDependency("bufferView",s).then(function(f){return new Promise(function(d,p){i.decodeDracoFile(f,function(g){for(const v in g.attributes){const A=g.attributes[v],y=u[v];y!==void 0&&(A.normalized=y)}d(g)},o,h,rs,p)})})}}class IB{constructor(){this.name=tn.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}
vendor: 26,652 bytes, lines 4299-4364
4299class BB{constructor(){this.name=tn.KHR_MESH_QUANTIZATION}}class _A extends Yo{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[s+a];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,u=o*2,h=o*3,f=i-t,d=(n-t)/f,p=d*d,g=p*d,v=e*h,A=v-h,y=-2*g+3*p,_=g-p,M=1-y,E=_-p+d;for(let w=0;w!==o;w++){const B=a[A+w+o],P=a[A+w+u]*f,D=a[v+w+o],F=a[v+w]*f;s[w]=M*B+E*P+y*D+_*F}return s}}const PB=new on;class DB extends _A{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return PB.fromArray(s).normalize().toArray(s),s}}const rr={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Po={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},K_={9728:xn,9729:rn,9984:tf,9985:Io,9986:ga,9987:or},Z_={33071:wi,33648:Do,10497:Ds},Gp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},dm={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Lf>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Es={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},LB={CUBICSPLINE:void 0,LINEAR:Uo,STEP:Fo},Hp={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function FB(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new mc({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Mr})),r.DefaultMaterial}function ua(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function jr(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function UB(r,e,t){let n=!1,i=!1,s=!1;for(let h=0,f=e.length;h<f;h++){const d=e[h];if(d.POSITION!==void 0&&(n=!0),d.NORMAL!==void 0&&(i=!0),d.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(r);const a=[],o=[],u=[];for(let h=0,f=e.length;h<f;h++){const d=e[h];if(n){const p=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):r.attributes.position;a.push(p)}if(i){const p=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):r.attributes.normal;o.push(p)}if(s){const p=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):r.attributes.color;u.push(p)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(u)]).then(function(h){const f=h[0],d=h[1],p=h[2];return n&&(r.morphAttributes.position=f),i&&(r.morphAttributes.normal=d),s&&(r.morphAttributes.color=p),r.morphTargetsRelative=!0,r})}function NB(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function OB(r){let e;const t=r.extensions&&r.extensions[tn.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+zp(t.attributes):e=r.indices+":"+zp(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+zp(r.targets[n]);return e}function zp(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function pm(r){switch(r){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function GB(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const HB=new It;class zB{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new cB,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&s<98?this.textureLoader=new xy(this.options.manager):this.textureLoader=new by(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Yi(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ua(s,o,i),jr(o,i),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(o)})).then(function(){for(const u of o.scenes)u.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const a=t[i].joints;for(let o=0,u=a.length;o<u;o++)e[a[o]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),s=(a,o)=>{const u=this.associations.get(a);u!=null&&this.associations.set(o,u);for(const[h,f]of a.children.entries())s(f,o.children[h])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[tn.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,a){n.load(Bs.resolveURL(t.uri,i.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=Gp[i.type],o=Po[i.componentType],u=i.normalized===!0,h=new o(i.count*a);return Promise.resolve(new sn(h,a,u))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],u=Gp[i.type],h=Po[i.componentType],f=h.BYTES_PER_ELEMENT,d=f*u,p=i.byteOffset||0,g=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,v=i.normalized===!0;let A,y;if(g&&g!==d){const _=Math.floor(p/g),M="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+_+":"+i.count;let E=t.cache.get(M);E||(A=new h(o,_*g,i.count*g/f),E=new hc(A,g/f),t.cache.add(M,E)),y=new Fs(E,u,p%g/f,v)}else o===null?A=new h(i.count*u):A=new h(o,p,i.count*u),y=new sn(A,u,v);if(i.sparse!==void 0){const _=Gp.SCALAR,M=Po[i.sparse.indices.componentType],E=i.sparse.indices.byteOffset||0,w=i.sparse.values.byteOffset||0,B=new M(a[1],E,i.sparse.count*_),P=new h(a[2],w,i.sparse.count*u);o!==null&&(y=new sn(y.array.slice(),y.itemSize,y.normalized));for(let D=0,F=B.length;D<F;D++){const b=B[D];if(y.setX(b,P[D*u]),u>=2&&y.setY(b,P[D*u+1]),u>=3&&y.setZ(b,P[D*u+2]),u>=4&&y.setW(b,P[D*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return y})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const u=n.manager.getHandler(a.uri);u!==null&&(o=u)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const i=this,s=this.json,a=s.textures[e],o=s.images[t],u=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[u])return this.textureCache[u];const h=this.loadImageSource(t,n).then(function(f){f.flipY=!1,f.name=a.name||o.name||"",f.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(f.name=o.uri);const p=(s.samplers||{})[a.sampler]||{};return f.magFilter=K_[p.magFilter]||rn,f.minFilter=K_[p.minFilter]||or,f.wrapS=Z_[p.wrapS]||Ds,f.wrapT=Z_[p.wrapT]||Ds,i.associations.set(f,{textures:e}),f}).catch(function(){return null});return this.textureCache[u]=h,h}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const a=i.images[e],o=self.URL||self.webkitURL;let u=a.uri||"",h=!1;if(a.bufferView!==void 0)u=n.getDependency("bufferView",a.bufferView).then(function(d){h=!0;const p=new Blob([d],{type:a.mimeType});return u=o.createObjectURL(p),u});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const f=Promise.resolve(u).then(function(d){return new Promise(function(p,g){let v=p;t.isImageBitmapLoader===!0&&(v=function(A){const y=new yn(A);y.needsUpdate=!0,p(y)}),t.load(Bs.resolveURL(d,s.path),v,void 0,g)})}).then(function(d){return h===!0&&o.revokeObjectURL(u),jr(d,a),d.userData.mimeType=a.mimeType||GB(a.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),d});return this.sourceCache[e]=f,f}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[tn.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[tn.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const u=s.associations.get(a);a=s.extensions[tn.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,u)}}return i!==void 0&&(typeof i=="number"&&(i=i===J_?Sa:rs),"colorSpace"in a?a.colorSpace=i:a.encoding=i===Sa?J_:lB),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let u=this.cache.get(o);u||(u=new vf,Fn.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(o,u)),n=u}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let u=this.cache.get(o);u||(u=new si,Fn.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(o,u)),n=u}if(i||s||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let u=this.cache.get(o);u||(u=n.clone(),s&&(u.vertexColors=!0),a&&(u.flatShading=!0),i&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(o,u),this.associations.set(u,this.associations.get(n))),n=u}e.material=n}getMaterialType(){return mc}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let a;const o={},u=s.extensions||{},h=[];if(u[tn.KHR_MATERIALS_UNLIT]){const d=i[tn.KHR_MATERIALS_UNLIT];a=d.getMaterialType(),h.push(d.extendParams(o,s,t))}else{const d=s.pbrMetallicRoughness||{};if(o.color=new je(1,1,1),o.opacity=1,Array.isArray(d.baseColorFactor)){const p=d.baseColorFactor;o.color.setRGB(p[0],p[1],p[2],rs),o.opacity=p[3]}d.baseColorTexture!==void 0&&h.push(t.assignTexture(o,"map",d.baseColorTexture,Sa)),o.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,o.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(o,"metalnessMap",d.metallicRoughnessTexture)),h.push(t.assignTexture(o,"roughnessMap",d.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=$n);const f=s.alphaMode||Hp.OPAQUE;if(f===Hp.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,f===Hp.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==bi&&(h.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new _e(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;o.normalScale.set(d,d)}if(s.occlusionTexture!==void 0&&a!==bi&&(h.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==bi){const d=s.emissiveFactor;o.emissive=new je().setRGB(d[0],d[1],d[2],rs)}return s.emissiveTexture!==void 0&&a!==bi&&h.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,Sa)),Promise.all(h).then(function(){const d=new a(o);return s.name&&(d.name=s.name),jr(d,s),t.associations.set(d,{materials:e}),s.extensions&&ua(i,d,s),d})}createUniqueName(e){const t=an.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(o){return n[tn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(u){return Q_(u,o,t)})}const a=[];for(let o=0,u=e.length;o<u;o++){const h=e[o],f=OB(h),d=i[f];if(d)a.push(d.promise);else{let p;h.extensions&&h.extensions[tn.KHR_DRACO_MESH_COMPRESSION]?p=s(h):p=Q_(new Lt,h,t),i[f]={primitive:h,promise:p},a.push(p)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],a=s.primitives,o=[];for(let u=0,h=a.length;u<h;u++){const f=a[u].material===void 0?FB(this.cache):this.getDependency("material",a[u].material);o.push(f)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(u){const h=u.slice(0,u.length-1),f=u[u.length-1],d=[];for(let g=0,v=f.length;g<v;g++){const A=f[g],y=a[g];let _;const M=h[g];if(y.mode===rr.TRIANGLES||y.mode===rr.TRIANGLE_STRIP||y.mode===rr.TRIANGLE_FAN||y.mode===void 0)_=s.isSkinnedMesh===!0?new Nm(A,M):new ot(A,M),_.isSkinnedMesh===!0&&_.normalizeSkinWeights(),y.mode===rr.TRIANGLE_STRIP?_.geometry=k_(_.geometry,Rm):y.mode===rr.TRIANGLE_FAN&&(_.geometry=k_(_.geometry,Jh));else if(y.mode===rr.LINES)_=new Er(A,M);else if(y.mode===rr.LINE_STRIP)_=new Yt(A,M);else if(y.mode===rr.LINE_LOOP)_=new Gm(A,M);else if(y.mode===rr.POINTS)_=new Hm(A,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+y.mode);Object.keys(_.geometry.morphAttributes).length>0&&NB(_,s),_.name=t.createUniqueName(s.name||"mesh_"+e),jr(_,s),y.extensions&&ua(i,_,y),t.assignFinalMaterial(_),d.push(_)}for(let g=0,v=d.length;g<v;g++)t.associations.set(d[g],{meshes:e,primitives:g});if(d.length===1)return s.extensions&&ua(i,d[0],s),d[0];const p=new ns;s.extensions&&ua(i,p,s),t.associations.set(p,{meshes:e});for(let g=0,v=d.length;g<v;g++)p.add(d[g]);return p})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new En(Hx.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Sr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),jr(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const s=i.pop(),a=i,o=[],u=[];for(let h=0,f=a.length;h<f;h++){const d=a[h];if(d){o.push(d);const p=new It;s!==null&&p.fromArray(s.array,h*16),u.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new fc(o,u)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,a=[],o=[],u=[],h=[],f=[];for(let d=0,p=i.channels.length;d<p;d++){const g=i.channels[d],v=i.samplers[g.sampler],A=g.target,y=A.node,_=i.parameters!==void 0?i.parameters[v.input]:v.input,M=i.parameters!==void 0?i.parameters[v.output]:v.output;A.node!==void 0&&(a.push(this.getDependency("node",y)),o.push(this.getDependency("accessor",_)),u.push(this.getDependency("accessor",M)),h.push(v),f.push(A))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(u),Promise.all(h),Promise.all(f)]).then(function(d){const p=d[0],g=d[1],v=d[2],A=d[3],y=d[4],_=[];for(let M=0,E=p.length;M<E;M++){const w=p[M],B=g[M],P=v[M],D=A[M],F=y[M];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const b=n._createAnimationTracks(w,B,P,D,F);if(b)for(let C=0;C<b.length;C++)_.push(b[C])}return new ko(s,void 0,_)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){const a=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let u=0,h=i.weights.length;u<h;u++)o.morphTargetInfluences[u]=i.weights[u]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),a=[],o=i.children||[];for(let h=0,f=o.length;h<f;h++)a.push(n.getDependency("node",o[h]));const u=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(a),u]).then(function(h){const f=h[0],d=h[1],p=h[2];p!==null&&f.traverse(function(g){g.isSkinnedMesh&&g.bind(p,HB)});for(let g=0,v=d.length;g<v;g++)f.add(d[g]);return f})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?i.createUniqueName(s.name):"",o=[],u=i._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return u&&o.push(u),s.camera!==void 0&&o.push(i.getDependency("camera",s.camera).then(function(h){return i._getNodeRef(i.cameraCache,s.camera,h)})),i._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){o.push(h)}),this.nodeCache[e]=Promise.all(o).then(function(h){let f;if(s.isBone===!0?f=new mf:h.length>1?f=new ns:h.length===1?f=h[0]:f=new qt,f!==h[0])for(let d=0,p=h.length;d<p;d++)f.add(h[d]);if(s.name&&(f.userData.name=s.name,f.name=a),jr(f,s),s.extensions&&ua(n,f,s),s.matrix!==void 0){const d=new It;d.fromArray(s.matrix),f.applyMatrix4(d)}else s.translation!==void 0&&f.position.fromArray(s.translation),s.rotation!==void 0&&f.quaternion.fromArray(s.rotation),s.scale!==void 0&&f.scale.fromArray(s.scale);return i.associations.has(f)||i.associations.set(f,{}),i.associations.get(f).nodes=e,f}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new ns;n.name&&(s.name=i.createUniqueName(n.name)),jr(s,n),n.extensions&&ua(t,s,n);const a=n.nodes||[],o=[];for(let u=0,h=a.length;u<h;u++)o.push(i.getDependency("node",a[u]));return Promise.all(o).then(function(u){for(let f=0,d=u.length;f<d;f++)s.add(u[f]);const h=f=>{const d=new Map;for(const[p,g]of i.associations)(p instanceof Fn||p instanceof yn)&&d.set(p,g);return f.traverse(p=>{const g=i.associations.get(p);g!=null&&d.set(p,g)}),d};return i.associations=h(s),s})}_createAnimationTracks(e,t,n,i,s){const a=[],o=e.name?e.name:e.uuid,u=[];Es[s.path]===Es.weights?e.traverse(function(p){p.morphTargetInfluences&&u.push(p.name?p.name:p.uuid)}):u.push(o);let h;switch(Es[s.path]){case Es.weights:h=Da;break;case Es.rotation:h=La;break;case Es.position:case Es.scale:h=Fa;break;default:switch(n.itemSize){case 1:h=Da;break;case 2:case 3:default:h=Fa;break}break}const f=i.interpolation!==void 0?LB[i.interpolation]:Uo,d=this._getArrayFromAccessor(n);for(let p=0,g=u.length;p<g;p++){const v=new h(u[p]+"."+Es[s.path],t.array,d,f);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(v),a.push(v)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=pm(t.constructor),i=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof La?DB:_A;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function kB(r,e,t){const n=e.attributes,i=new ri;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],u=o.min,h=o.max;if(u!==void 0&&h!==void 0){if(i.set(new N(u[0],u[1],u[2]),new N(h[0],h[1],h[2])),o.normalized){const f=pm(Po[o.componentType]);i.min.multiplyScalar(f),i.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new N,u=new N;for(let h=0,f=s.length;h<f;h++){const d=s[h];if(d.POSITION!==void 0){const p=t.json.accessors[d.POSITION],g=p.min,v=p.max;if(g!==void 0&&v!==void 0){if(u.setX(Math.max(Math.abs(g[0]),Math.abs(v[0]))),u.setY(Math.max(Math.abs(g[1]),Math.abs(v[1]))),u.setZ(Math.max(Math.abs(g[2]),Math.abs(v[2]))),p.normalized){const A=pm(Po[p.componentType]);u.multiplyScalar(A)}o.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}r.boundingBox=i;const a=new ei;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=a}function Q_(r,e,t){const n=e.attributes,i=[];function s(a,o){return t.getDependency("accessor",a).then(function(u){r.setAttribute(o,u)})}for(const a in n){const o=dm[a]||a.toLowerCase();o in r.attributes||i.push(s(n[a],o))}if(e.indices!==void 0&&!r.index){const a=t.getDependency("accessor",e.indices).then(function(o){r.setIndex(o)});i.push(a)}return jr(r,e),kB(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?UB(r,e.targets,t):r})}const A2={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` 4300 varying vec2 vUv; 4301 4302 void main() { 4303 4304 vUv = uv; 4305 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4306 4307 } 4308 `,fragmentShader:` 4309 uniform sampler2D tDiffuse; 4310 uniform float h; 4311 4312 varying vec2 vUv; 4313 4314 void main() { 4315 4316 vec4 sum = vec4( 0.0 ); 4317 4318 sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051; 4319 sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918; 4320 sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245; 4321 sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531; 4322 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; 4323 sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531; 4324 sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245; 4325 sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918; 4326 sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051; 4327 4328 gl_FragColor = sum; 4329 4330 } 4331 `},S2={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:` 4332 varying vec2 vUv; 4333 4334 void main() { 4335 4336 vUv = uv; 4337 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4338 4339 } 4340 `,fragmentShader:` 4341 4342 uniform sampler2D tDiffuse; 4343 uniform float v; 4344 4345 varying vec2 vUv; 4346 4347 void main() { 4348 4349 vec4 sum = vec4( 0.0 ); 4350 4351 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051; 4352 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918; 4353 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245; 4354 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531; 4355 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; 4356 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531; 4357 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245; 4358 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918; 4359 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051; 4360 4361 gl_FragColor = sum; 4362 4363 } 4364 `};class M2 extends ng{constructor(e){super(e),this.type=Vn}parse(e){const a=function(F,b){switch(F){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(b||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(b||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(b||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(b||""))}},f=`
4365`,d=function(F,b,C){b=b||1024;let V=F.pos,J=-1,Q=0,oe="",q=String.fromCharCode.apply(null,new Uint16Array(F.subarray(V,V+128)));for(;0>(J=q.indexOf(f))&&Q<b&&V<F.byteLength;)oe+=q,Q+=q.length,V+=128,q+=String.fromCharCode.apply(null,new Uint16Array(F.subarray(V,V+128)));return-1<J?(F.pos+=Q+J+1,oe+q.slice(0,J)):!1},p=function(F){const b=/^#\?(\S+)/,C=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,U=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,V=/^\s*FORMAT=(\S+)\s*$/,J=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,Q={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let oe,q;for((F.pos>=F.byteLength||!(oe=d(F)))&&a(1,"no header found"),(q=oe.match(b))||a(3,"bad initial token"),Q.valid|=1,Q.programtype=q[1],Q.string+=oe+` 4366`;oe=d(F),oe!==!1;){if(Q.string+=oe+` 4367`,oe.charAt(0)==="#"){Q.comments+=oe+` 4368`;continue}if((q=oe.match(C))&&(Q.gamma=parseFloat(q[1])),(q=oe.match(U))&&(Q.exposure=parseFloat(q[1])),(q=oe.match(V))&&(Q.valid|=2,Q.format=q[1]),(q=oe.match(J))&&(Q.valid|=4,Q.height=parseInt(q[1],10),Q.width=parseInt(q[2],10)),Q.valid&2&&Q.valid&4)break}return Q.valid&2||a(3,"missing format specifier"),Q.valid&4||a(3,"missing image size specifier"),Q},g=function(F,b,C){const U=b;if(U<8||U>32767||F[0]!==2||F[1]!==2||F[2]&128)return new Uint8Array(F);U!==(F[2]<<8|F[3])&&a(3,"wrong scanline width");const V=new Uint8Array(4*b*C);V.length||a(4,"unable to allocate buffer space");let J=0,Q=0;const oe=4*U,q=new Uint8Array(4),ue=new Uint8Array(oe);let z=C;for(;z>0&&Q<F.byteLength;){Q+4>F.byteLength&&a(1),q[0]=F[Q++],q[1]=F[Q++],q[2]=F[Q++],q[3]=F[Q++],(q[0]!=2||q[1]!=2||(q[2]<<8|q[3])!=U)&&a(3,"bad rgbe scanline format");let ne=0,Y;for(;ne<oe&&Q<F.byteLength;){Y=F[Q++];const pe=Y>128;if(pe&&(Y-=128),(Y===0||ne+Y>oe)&&a(3,"bad scanline data"),pe){const we=F[Q++];for(let $=0;$<Y;$++)ue[ne++]=we}else ue.set(F.subarray(Q,Q+Y),ne),ne+=Y,Q+=Y}const se=U;for(let pe=0;pe<se;pe++){let we=0;V[J]=ue[pe+we],we+=U,V[J+1]=ue[pe+we],we+=U,V[J+2]=ue[pe+we],we+=U,V[J+3]=ue[pe+we],J+=4}z--}return V},v=function(F,b,C,U){const V=F[b+3],J=Math.pow(2,V-128)/255;C[U+0]=F[b+0]*J,C[U+1]=F[b+1]*J,C[U+2]=F[b+2]*J,C[U+3]=1},A=function(F,b,C,U){const V=F[b+3],J=Math.pow(2,V-128)/255;C[U+0]=xa.toHalfFloat(Math.min(F[b+0]*J,65504)),C[U+1]=xa.toHalfFloat(Math.min(F[b+1]*J,65504)),C[U+2]=xa.toHalfFloat(Math.min(F[b+2]*J,65504)),C[U+3]=xa.toHalfFloat(1)},y=new Uint8Array(e);y.pos=0;const _=p(y),M=_.width,E=_.height,w=g(y.subarray(y.pos),M,E);let B,P,D;switch(this.type){case In:D=w.length/4;const F=new Float32Array(D*4);for(let C=0;C<D;C++)v(w,C*4,F,C*4);B=F,P=In;break;case Vn:D=w.length/4;const b=new Uint16Array(D*4);for(let C=0;C<D;C++)A(w,C*4,b,C*4);B=b,P=Vn;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:M,height:E,data:B,header:_.string,gamma:_.gamma,exposure:_.exposure,type:P}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(a,o){switch(a.type){case In:case Vn:"colorSpace"in a?a.colorSpace="srgb-linear":a.encoding=3e3,a.minFilter=rn,a.magFilter=rn,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,o)}return super.load(e,s,n,i)}}const Pl=Lf>=152;class E2 extends ng{constructor(e){super(e),this.type=Vn}parse(e){const b=Math.pow(2.7182818,2.2);function C(I,O){for(var Z=0,fe=0;fe<65536;++fe)(fe==0||I[fe>>3]&1<<(fe&7))&&(O[Z++]=fe);for(var xe=Z-1;Z<65536;)O[Z++]=0;return xe}function U(I){for(var O=0;O<16384;O++)I[O]={},I[O].len=0,I[O].lit=0,I[O].p=null}const V={l:0,c:0,lc:0};function J(I,O,Z,fe,xe){for(;Z<I;)O=O<<8|ut(fe,xe),Z+=8;Z-=I,V.l=O>>Z&(1<<I)-1,V.c=O,V.lc=Z}const Q=new Array(59);function oe(I){for(var O=0;O<=58;++O)Q[O]=0;for(var O=0;O<65537;++O)Q[I[O]]+=1;for(var Z=0,O=58;O>0;--O){var fe=Z+Q[O]>>1;Q[O]=Z,Z=fe}for(var O=0;O<65537;++O){var xe=I[O];xe>0&&(I[O]=xe|Q[xe]++<<6)}}function q(I,O,Z,fe,xe,ye,Ve){for(var Ne=Z,Ze=0,Ke=0;xe<=ye;xe++){if(Ne.value-Z.value>fe)return!1;J(6,Ze,Ke,I,Ne);var qe=V.l;if(Ze=V.c,Ke=V.lc,Ve[xe]=qe,qe==63){if(Ne.value-Z.value>fe)throw"Something wrong with hufUnpackEncTable";J(8,Ze,Ke,I,Ne);var Xe=V.l+6;if(Ze=V.c,Ke=V.lc,xe+Xe>ye+1)throw"Something wrong with hufUnpackEncTable";for(;Xe--;)Ve[xe++]=0;xe--}else if(qe>=59){var Xe=qe-59+2;if(xe+Xe>ye+1)throw"Something wrong with hufUnpackEncTable";for(;Xe--;)Ve[xe++]=0;xe--}}oe(Ve)}function ue(I){return I&63}function z(I){return I>>6}function ne(I,O,Z,fe){for(;O<=Z;O++){var xe=z(I[O]),ye=ue(I[O]);if(xe>>ye)throw"Invalid table entry";if(ye>14){var Ve=fe[xe>>ye-14];if(Ve.len)throw"Invalid table entry";if(Ve.lit++,Ve.p){var Ne=Ve.p;Ve.p=new Array(Ve.lit);for(var Ze=0;Ze<Ve.lit-1;++Ze)Ve.p[Ze]=Ne[Ze]}else Ve.p=new Array(1);Ve.p[Ve.lit-1]=O}else if(ye)for(var Ke=0,Ze=1<<14-ye;Ze>0;Ze--){var Ve=fe[(xe<<14-ye)+Ke];if(Ve.len||Ve.p)throw"Invalid table entry";Ve.len=ye,Ve.lit=O,Ke++}}return!0}const Y={c:0,lc:0};function se(I,O,Z,fe){I=I<<8|ut(Z,fe),O+=8,Y.c=I,Y.lc=O}const pe={c:0,lc:0};function we(I,O,Z,fe,xe,ye,Ve,Ne,Ze,Ke){if(I==O){fe<8&&(se(Z,fe,xe,Ve),Z=Y.c,fe=Y.lc),fe-=8;var qe=Z>>fe,qe=new Uint8Array([qe])[0];if(Ze.value+qe>Ke)return!1;for(var Xe=Ne[Ze.value-1];qe-- >0;)Ne[Ze.value++]=Xe}else if(Ze.value<Ke)Ne[Ze.value++]=I;else return!1;pe.c=Z,pe.lc=fe}function $(I){return I&65535}function xt(I){var O=$(I);return O>32767?O-65536:O}const le={a:0,b:0};function Ae(I,O){var Z=xt(I),fe=xt(O),xe=fe,ye=Z+(xe&1)+(xe>>1),Ve=ye,Ne=ye-xe;le.a=Ve,le.b=Ne}function Qe(I,O){var Z=$(I),fe=$(O),xe=Z-(fe>>1)&65535,ye=fe+xe-32768&65535;le.a=ye,le.b=xe}function yt(I,O,Z,fe,xe,ye,Ve){for(var Ne=Ve<16384,Ze=Z>xe?xe:Z,Ke=1,qe;Ke<=Ze;)Ke<<=1;for(Ke>>=1,qe=Ke,Ke>>=1;Ke>=1;){for(var Xe=0,L=Xe+ye*(xe-qe),W=ye*Ke,te=ye*qe,ie=fe*Ke,j=fe*qe,Re,Fe,Ee,Be;Xe<=L;Xe+=te){for(var ze=Xe,it=Xe+fe*(Z-qe);ze<=it;ze+=j){var ke=ze+ie,mt=ze+W,Nt=mt+ie;Ne?(Ae(I[ze+O],I[mt+O]),Re=le.a,Ee=le.b,Ae(I[ke+O],I[Nt+O]),Fe=le.a,Be=le.b,Ae(Re,Fe),I[ze+O]=le.a,I[ke+O]=le.b,Ae(Ee,Be),I[mt+O]=le.a,I[Nt+O]=le.b):(Qe(I[ze+O],I[mt+O]),Re=le.a,Ee=le.b,Qe(I[ke+O],I[Nt+O]),Fe=le.a,Be=le.b,Qe(Re,Fe),I[ze+O]=le.a,I[ke+O]=le.b,Qe(Ee,Be),I[mt+O]=le.a,I[Nt+O]=le.b)}if(Z&Ke){var mt=ze+W;Ne?Ae(I[ze+O],I[mt+O]):Qe(I[ze+O],I[mt+O]),Re=le.a,I[mt+O]=le.b,I[ze+O]=Re}}if(xe&Ke)for(var ze=Xe,it=Xe+fe*(Z-qe);ze<=it;ze+=j){var ke=ze+ie;Ne?Ae(I[ze+O],I[ke+O]):Qe(I[ze+O],I[ke+O]),Re=le.a,I[ke+O]=le.b,I[ze+O]=Re}qe=Ke,Ke>>=1}return Xe}function st(I,O,Z,fe,xe,ye,Ve,Ne,Ze,Ke){for(var qe=0,Xe=0,L=Ne,W=Math.trunc(xe.value+(ye+7)/8);xe.value<W;)for(se(qe,Xe,Z,xe),qe=Y.c,Xe=Y.lc;Xe>=14;){var te=qe>>Xe-14&16383,ie=O[te];if(ie.len)Xe-=ie.len,we(ie.lit,Ve,qe,Xe,Z,fe,xe,Ze,Ke,L),qe=pe.c,Xe=pe.lc;else{if(!ie.p)throw"hufDecode issues";var j;for(j=0;j<ie.lit;j++){for(var Re=ue(I[ie.p[j]]);Xe<Re&&xe.value<W;)se(qe,Xe,Z,xe),qe=Y.c,Xe=Y.lc;if(Xe>=Re&&z(I[ie.p[j]])==(qe>>Xe-Re&(1<<Re)-1)){Xe-=Re,we(ie.p[j],Ve,qe,Xe,Z,fe,xe,Ze,Ke,L),qe=pe.c,Xe=pe.lc;break}}if(j==ie.lit)throw"hufDecode issues"}}var Fe=8-ye&7;for(qe>>=Fe,Xe-=Fe;Xe>0;){var ie=O[qe<<14-Xe&16383];if(ie.len)Xe-=ie.len,we(ie.lit,Ve,qe,Xe,Z,fe,xe,Ze,Ke,L),qe=pe.c,Xe=pe.lc;else throw"hufDecode issues"}return!0}function Dt(I,O,Z,fe,xe,ye){var Ve={value:0},Ne=Z.value,Ze=Ge(O,Z),Ke=Ge(O,Z);Z.value+=4;var qe=Ge(O,Z);if(Z.value+=4,Ze<0||Ze>=65537||Ke<0||Ke>=65537)throw"Something wrong with HUF_ENCSIZE";var Xe=new Array(65537),L=new Array(16384);U(L);var W=fe-(Z.value-Ne);if(q(I,O,Z,W,Ze,Ke,Xe),qe>8*(fe-(Z.value-Ne)))throw"Something wrong with hufUncompress";ne(Xe,Ze,Ke,L),st(Xe,L,I,O,Z,qe,Ke,ye,xe,Ve)}function Zt(I,O,Z){for(var fe=0;fe<Z;++fe)O[fe]=I[O[fe]]}function _t(I){for(var O=1;O<I.length;O++){var Z=I[O-1]+I[O]-128;I[O]=Z}}function Te(I,O){for(var Z=0,fe=Math.floor((I.length+1)/2),xe=0,ye=I.length-1;!(xe>ye||(O[xe++]=I[Z++],xe>ye));)O[xe++]=I[fe++]}function Ue(I){for(var O=I.byteLength,Z=new Array,fe=0,xe=new DataView(I);O>0;){var ye=xe.getInt8(fe++);if(ye<0){var Ve=-ye;O-=Ve+1;for(var Ne=0;Ne<Ve;Ne++)Z.push(xe.getUint8(fe++))}else{var Ve=ye;O-=2;for(var Ze=xe.getUint8(fe++),Ne=0;Ne<Ve+1;Ne++)Z.push(Ze)}}return Z}function Ie(I,O,Z,fe,xe,ye){var ke=new DataView(ye.buffer),Ve=Z[I.idx[0]].width,Ne=Z[I.idx[0]].height,Ze=3,Ke=Math.floor(Ve/8),qe=Math.ceil(Ve/8),Xe=Math.ceil(Ne/8),L=Ve-(qe-1)*8,W=Ne-(Xe-1)*8,te={value:0},ie=new Array(Ze),j=new Array(Ze),Re=new Array(Ze),Fe=new Array(Ze),Ee=new Array(Ze);for(let Et=0;Et<Ze;
vendor: 20,861 bytes, lines 4368-4369
4368++Et)Ee[Et]=O[I.idx[Et]],ie[Et]=Et<1?0:ie[Et-1]+qe*Xe,j[Et]=new Float32Array(64),Re[Et]=new Uint16Array(64),Fe[Et]=new Uint16Array(qe*64);for(let Et=0;Et<Xe;++Et){var Be=8;Et==Xe-1&&(Be=W);var ze=8;for(let St=0;St<qe;++St){St==qe-1&&(ze=L);for(let gt=0;gt<Ze;++gt)Re[gt].fill(0),Re[gt][0]=xe[ie[gt]++],$e(te,fe,Re[gt]),H(Re[gt],j[gt]),At(j[gt]);tt(j);for(let gt=0;gt<Ze;++gt)Tt(j[gt],Fe[gt],St*64)}let lt=0;for(let St=0;St<Ze;++St){const gt=Z[I.idx[St]].type;for(let Qt=8*Et;Qt<8*Et+Be;++Qt){lt=Ee[St][Qt];for(let ai=0;ai<Ke;++ai){const mn=ai*64+(Qt&7)*8;ke.setUint16(lt+0*2*gt,Fe[St][mn+0],!0),ke.setUint16(lt+1*2*gt,Fe[St][mn+1],!0),ke.setUint16(lt+2*2*gt,Fe[St][mn+2],!0),ke.setUint16(lt+3*2*gt,Fe[St][mn+3],!0),ke.setUint16(lt+4*2*gt,Fe[St][mn+4],!0),ke.setUint16(lt+5*2*gt,Fe[St][mn+5],!0),ke.setUint16(lt+6*2*gt,Fe[St][mn+6],!0),ke.setUint16(lt+7*2*gt,Fe[St][mn+7],!0),lt+=8*2*gt}}if(Ke!=qe)for(let Qt=8*Et;Qt<8*Et+Be;++Qt){const ai=Ee[St][Qt]+8*Ke*2*gt,mn=Ke*64+(Qt&7)*8;for(let oi=0;oi<ze;++oi)ke.setUint16(ai+oi*2*gt,Fe[St][mn+oi],!0)}}}for(var it=new Uint16Array(Ve),ke=new DataView(ye.buffer),mt=0;mt<Ze;++mt){Z[I.idx[mt]].decoded=!0;var Nt=Z[I.idx[mt]].type;if(Z[mt].type==2)for(var Ot=0;Ot<Ne;++Ot){const Et=Ee[mt][Ot];for(var Xt=0;Xt<Ve;++Xt)it[Xt]=ke.getUint16(Et+Xt*2*Nt,!0);for(var Xt=0;Xt<Ve;++Xt)ke.setFloat32(Et+Xt*2*Nt,he(it[Xt]),!0)}}}function $e(I,O,Z){for(var fe,xe=1;xe<64;)fe=O[I.value],fe==65280?xe=64:fe>>8==255?xe+=fe&255:(Z[xe]=fe,xe++),I.value++}function H(I,O){O[0]=he(I[0]),O[1]=he(I[1]),O[2]=he(I[5]),O[3]=he(I[6]),O[4]=he(I[14]),O[5]=he(I[15]),O[6]=he(I[27]),O[7]=he(I[28]),O[8]=he(I[2]),O[9]=he(I[4]),O[10]=he(I[7]),O[11]=he(I[13]),O[12]=he(I[16]),O[13]=he(I[26]),O[14]=he(I[29]),O[15]=he(I[42]),O[16]=he(I[3]),O[17]=he(I[8]),O[18]=he(I[12]),O[19]=he(I[17]),O[20]=he(I[25]),O[21]=he(I[30]),O[22]=he(I[41]),O[23]=he(I[43]),O[24]=he(I[9]),O[25]=he(I[11]),O[26]=he(I[18]),O[27]=he(I[24]),O[28]=he(I[31]),O[29]=he(I[40]),O[30]=he(I[44]),O[31]=he(I[53]),O[32]=he(I[10]),O[33]=he(I[19]),O[34]=he(I[23]),O[35]=he(I[32]),O[36]=he(I[39]),O[37]=he(I[45]),O[38]=he(I[52]),O[39]=he(I[54]),O[40]=he(I[20]),O[41]=he(I[22]),O[42]=he(I[33]),O[43]=he(I[38]),O[44]=he(I[46]),O[45]=he(I[51]),O[46]=he(I[55]),O[47]=he(I[60]),O[48]=he(I[21]),O[49]=he(I[34]),O[50]=he(I[37]),O[51]=he(I[47]),O[52]=he(I[50]),O[53]=he(I[56]),O[54]=he(I[59]),O[55]=he(I[61]),O[56]=he(I[35]),O[57]=he(I[36]),O[58]=he(I[48]),O[59]=he(I[49]),O[60]=he(I[57]),O[61]=he(I[58]),O[62]=he(I[62]),O[63]=he(I[63])}function At(I){const O=.5*Math.cos(.7853975),Z=.5*Math.cos(3.14159/16),fe=.5*Math.cos(3.14159/8),xe=.5*Math.cos(3*3.14159/16),ye=.5*Math.cos(5*3.14159/16),Ve=.5*Math.cos(3*3.14159/8),Ne=.5*Math.cos(7*3.14159/16);for(var Ze=new Array(4),Ke=new Array(4),qe=new Array(4),Xe=new Array(4),L=0;L<8;++L){var W=L*8;Ze[0]=fe*I[W+2],Ze[1]=Ve*I[W+2],Ze[2]=fe*I[W+6],Ze[3]=Ve*I[W+6],Ke[0]=Z*I[W+1]+xe*I[W+3]+ye*I[W+5]+Ne*I[W+7],Ke[1]=xe*I[W+1]-Ne*I[W+3]-Z*I[W+5]-ye*I[W+7],Ke[2]=ye*I[W+1]-Z*I[W+3]+Ne*I[W+5]+xe*I[W+7],Ke[3]=Ne*I[W+1]-ye*I[W+3]+xe*I[W+5]-Z*I[W+7],qe[0]=O*(I[W+0]+I[W+4]),qe[3]=O*(I[W+0]-I[W+4]),qe[1]=Ze[0]+Ze[3],qe[2]=Ze[1]-Ze[2],Xe[0]=qe[0]+qe[1],Xe[1]=qe[3]+qe[2],Xe[2]=qe[3]-qe[2],Xe[3]=qe[0]-qe[1],I[W+0]=Xe[0]+Ke[0],I[W+1]=Xe[1]+Ke[1],I[W+2]=Xe[2]+Ke[2],I[W+3]=Xe[3]+Ke[3],I[W+4]=Xe[3]-Ke[3],I[W+5]=Xe[2]-Ke[2],I[W+6]=Xe[1]-Ke[1],I[W+7]=Xe[0]-Ke[0]}for(var te=0;te<8;++te)Ze[0]=fe*I[16+te],Ze[1]=Ve*I[16+te],Ze[2]=fe*I[48+te],Ze[3]=Ve*I[48+te],Ke[0]=Z*I[8+te]+xe*I[24+te]+ye*I[40+te]+Ne*I[56+te],Ke[1]=xe*I[8+te]-Ne*I[24+te]-Z*I[40+te]-ye*I[56+te],Ke[2]=ye*I[8+te]-Z*I[24+te]+Ne*I[40+te]+xe*I[56+te],Ke[3]=Ne*I[8+te]-ye*I[24+te]+xe*I[40+te]-Z*I[56+te],qe[0]=O*(I[te]+I[32+te]),qe[3]=O*(I[te]-I[32+te]),qe[1]=Ze[0]+Ze[3],qe[2]=Ze[1]-Ze[2],Xe[0]=qe[0]+qe[1],Xe[1]=qe[3]+qe[2],Xe[2]=qe[3]-qe[2],Xe[3]=qe[0]-qe[1],I[0+te]=Xe[0]+Ke[0],I[8+te]=Xe[1]+Ke[1],I[16+te]=Xe[2]+Ke[2],I[24+te]=Xe[3]+Ke[3],I[32+te]=Xe[3]-Ke[3],I[40+te]=Xe[2]-Ke[2],I[48+te]=Xe[1]-Ke[1],I[56+te]=Xe[0]-Ke[0]}function tt(I){for(var O=0;O<64;++O){var Z=I[0][O],fe=I[1][O],xe=I[2][O];I[0][O]=Z+1.5747*xe,I[1][O]=Z-.1873*fe-.4682*xe,I[2][O]=Z+1.8556*fe}}function Tt(I,O,Z){for(var fe=0;fe<64;++fe)O[Z+fe]=xa.toHalfFloat(We(I[fe]))}function We(I){return I<=1?Math.sign(I)*Math.pow(Math.abs(I),2.2):Math.sign(I)*Math.pow(b,Math.abs(I)-1)}function G(I){return new DataView(I.array.buffer,I.offset.value,I.size)}function R(I){var O=I.viewer.buffer.slice(I.offset.value,I.offset.value+I.size),Z=new Uint8Array(Ue(O)),fe=new Uint8Array(Z.length);return _t(Z),Te(Z,fe),new DataView(fe.buffer)}function ee(I){var O=I.array.slice(I.offset.value,I.offset.value+I.size),Z=$u(O),fe=new Uint8Array(Z.length);return _t(Z),Te(Z,fe),new DataView(fe.buffer)}function me(I){for(var O=I.viewer,Z={value:I.offset.value},fe=new Uint16Array(I.width*I.scanlineBlockSize*(I.channels*I.type)),xe=new Uint8Array(8192),ye=0,Ve=new Array(I.channels),Ne=0;Ne<I.channels;Ne++)Ve[Ne]={},Ve[Ne].start=ye,Ve[Ne].end=Ve[Ne].start,Ve[Ne].nx=I.width,Ve[Ne].ny=I.lines,Ve[Ne].size=I.type,ye+=Ve[Ne].nx*Ve[Ne].ny*Ve[Ne].size;var Ze=Le(O,Z),Ke=Le(O,Z);if(Ke>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Ze<=Ke)for(var Ne=0;Ne<Ke-Ze+1;Ne++)xe[Ne+Ze]=X(O,Z);var qe=new Uint16Array(65536),Xe=C(xe,qe),L=Ge(O,Z);Dt(I.array,O,Z,L,fe,ye);for(var Ne=0;Ne<I.channels;++Ne)for(var W=Ve[Ne],te=0;te<Ve[Ne].size;++te)yt(fe,W.start+te,W.nx,W.size,W.ny,W.nx*W.size,Xe);Zt(qe,fe,ye);for(var ie=0,j=new Uint8Array(fe.buffer.byteLength),Re=0;Re<I.lines;Re++)for(var Fe=0;Fe<I.channels;Fe++){var W=Ve[Fe],Ee=W.nx*W.size,Be=new Uint8Array(fe.buffer,W.end*2,Ee*2);j.set(Be,ie),ie+=Ee*2,W.end+=Ee}return new DataView(j.buffer)}function Ce(I){var O=I.array.slice(I.offset.value,I.offset.value+I.size),Z=$u(O);const fe=I.lines*I.channels*I.width,xe=I.type==1?new Uint16Array(fe):new Uint32Array(fe);let ye=0,Ve=0;const Ne=new Array(4);for(let Ze=0;Ze<I.lines;Ze++)for(let Ke=0;Ke<I.channels;Ke++){let qe=0;switch(I.type){case 1:Ne[0]=ye,Ne[1]=Ne[0]+I.width,ye=Ne[1]+I.width;for(let Xe=0;Xe<I.width;++Xe){const L=Z[Ne[0]++]<<8|Z[Ne[1]++];qe+=L,xe[Ve]=qe,Ve++}break;case 2:Ne[0]=ye,Ne[1]=Ne[0]+I.width,Ne[2]=Ne[1]+I.width,ye=Ne[2]+I.width;for(let Xe=0;Xe<I.width;++Xe){const L=Z[Ne[0]++]<<24|Z[Ne[1]++]<<16|Z[Ne[2]++]<<8;qe+=L,xe[Ve]=qe,Ve++}break}}return new DataView(xe.buffer)}function ge(I){var O=I.viewer,Z={value:I.offset.value},fe=new Uint8Array(I.width*I.lines*(I.channels*I.type*2)),xe={version:ce(O,Z),unknownUncompressedSize:ce(O,Z),unknownCompressedSize:ce(O,Z),acCompressedSize:ce(O,Z),dcCompressedSize:ce(O,Z),rleCompressedSize:ce(O,Z),rleUncompressedSize:ce(O,Z),rleRawSize:ce(O,Z),totalAcUncompressedCount:ce(O,Z),totalDcUncompressedCount:ce(O,Z),acCompression:ce(O,Z)};if(xe.version<2)throw"EXRLoader.parse: "+Ti.compression+" version "+xe.version+" is unsupported";for(var ye=new Array,Ve=Le(O,Z)-2;Ve>0;){var Ne=ht(O.buffer,Z),Ze=X(O,Z),Ke=Ze>>2&3,qe=(Ze>>4)-1,Xe=new Int8Array([qe])[0],L=X(O,Z);ye.push({name:Ne,index:Xe,type:L,compression:Ke}),Ve-=Ne.length+3}for(var W=Ti.channels,te=new Array(I.channels),ie=0;ie<I.channels;++ie){var j=te[ie]={},Re=W[ie];j.name=Re.name,j.compression=0,j.decoded=!1,j.type=Re.pixelType,j.pLinear=Re.pLinear,j.width=I.width,j.height=I.lines}for(var Fe={idx:new Array(3)},Ee=0;Ee<I.channels;++Ee)for(var j=te[Ee],ie=0;ie<ye.length;++ie){var Be=ye[ie];j.name==Be.name&&(j.compression=Be.compression,Be.index>=0&&(Fe.idx[Be.index]=Ee),j.offset=Ee)}if(xe.acCompressedSize>0)switch(xe.acCompression){case 0:var ke=new Uint16Array(xe.totalAcUncompressedCount);Dt(I.array,O,Z,xe.acCompressedSize,ke,xe.totalAcUncompressedCount);break;case 1:var ze=I.array.slice(Z.value,Z.value+xe.totalAcUncompressedCount),it=$u(ze),ke=new Uint16Array(it.buffer);Z.value+=xe.totalAcUncompressedCount;break}if(xe.dcCompressedSize>0){var mt={array:I.array,offset:Z,size:xe.dcCompressedSize},Nt=new Uint16Array(ee(mt).buffer);Z.value+=xe.dcCompressedSize}if(xe.rleRawSize>0){var ze=I.array.slice(Z.value,Z.value+xe.rleCompressedSize),it=$u(ze),Ot=Ue(it.buffer);Z.value+=xe.rleCompressedSize}for(var Xt=0,Et=new Array(te.length),ie=0;ie<Et.length;++ie)Et[ie]=new Array;for(var lt=0;lt<I.lines;++lt)for(var St=0;St<te.length;++St)Et[St].push(Xt),Xt+=te[St].width*I.type*2;Ie(Fe,Et,te,ke,Nt,fe);for(var ie=0;ie<te.length;++ie){var j=te[ie];if(!j.decoded)switch(j.compression){case 2:for(var gt=0,Qt=0,lt=0;lt<I.lines;++lt){for(var ai=Et[ie][gt],mn=0;mn<j.width;++mn){for(var oi=0;oi<2*j.type;++oi)fe[ai++]=Ot[Qt+oi*j.width*j.height];Qt++}gt++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(fe.buffer)}function ht(I,O){for(var Z=new Uint8Array(I),fe=0;Z[O.value+fe]!=0;)fe+=1;var xe=new TextDecoder().decode(Z.slice(O.value,O.value+fe));return O.value=O.value+fe+1,xe}function Ye(I,O,Z){var fe=new TextDecoder().decode(new Uint8Array(I).slice(O.value,O.value+Z));return O.value=O.value+Z,fe}function ft(I,O){var Z=Pe(I,O),fe=Ge(I,O);return[Z,fe]}function Rt(I,O){var Z=Ge(I,O),fe=Ge(I,O);return[Z,fe]}function Pe(I,O){var Z=I.getInt32(O.value,!0);return O.value=O.value+4,Z}function Ge(I,O){var Z=I.getUint32(O.value,!0);return O.value=O.value+4,Z}function ut(I,O){var Z=I[O.value];return O.value=O.value+1,Z}function X(I,O){var Z=I.getUint8(O.value);return O.value=O.value+1,Z}const ce=function(I,O){let Z;return"getBigInt64"in DataView.prototype?Z=Number(I.getBigInt64(O.value,!0)):Z=I.getUint32(O.value+4,!0)+Number(I.getUint32(O.value,!0)<<32),O.value+=8,Z};function De(I,O){var Z=I.getFloat32(O.value,!0);return O.value+=4,Z}function K(I,O){return xa.toHalfFloat(De(I,O))}function he(I){var O=(I&31744)>>10,Z=I&1023;return(I>>15?-1:1)*(O?O===31?Z?NaN:1/0:Math.pow(2,O-15)*(1+Z/1024):6103515625e-14*(Z/1024))}function Le(I,O){var Z=I.getUint16(O.value,!0);return O.value+=2,Z}function et(I,O){return he(Le(I,O))}function Oe(I,O,Z,fe){for(var xe=Z.value,ye=[];Z.value<xe+fe-1;){var Ve=ht(O,Z),Ne=Pe(I,Z),Ze=X(I,Z);Z.value+=3;var Ke=Pe(I,Z),qe=Pe(I,Z);ye.push({name:Ve,pixelType:Ne,pLinear:Ze,xSampling:Ke,ySampling:qe})}return Z.value+=1,ye}function be(I,O){var Z=De(I,O),fe=De(I,O),xe=De(I,O),ye=De(I,O),Ve=De(I,O),Ne=De(I,O),Ze=De(I,O),Ke=De(I,O);return{redX:Z,redY:fe,greenX:xe,greenY:ye,blueX:Ve,blueY:Ne,whiteX:Ze,whiteY:Ke}}function He(I,O){var Z=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],fe=X(I,O);return Z[fe]}function Mt(I,O){var Z=Ge(I,O),fe=Ge(I,O),xe=Ge(I,O),ye=Ge(I,O);return{xMin:Z,yMin:fe,xMax:xe,yMax:ye}}function jt(I,O){var Z=["INCREASING_Y"],fe=X(I,O);return Z[fe]}function Wt(I,O){var Z=De(I,O),fe=De(I,O);return[Z,fe]}function Pn(I,O){var Z=De(I,O),fe=De(I,O),xe=De(I,O);return[Z,fe,xe]}function Jn(I,O,Z,fe,xe){if(fe==="string"||fe==="stringvector"||fe==="iccProfile")return Ye(O,Z,xe);if(fe==="chlist")return Oe(I,O,Z,xe);if(fe==="chromaticities")return be(I,Z);if(fe==="compression")return He(I,Z);if(fe==="box2i")return Mt(I,Z);if(fe==="lineOrder")return jt(I,Z);if(fe==="float")return De(I,Z);if(fe==="v2f")return Wt(I,Z);if(fe==="v3f")return Pn(I,Z);if(fe==="int")return Pe(I,Z);if(fe==="rational")return ft(I,Z);if(fe==="timecode")return Rt(I,Z);if(fe==="preview")return Z.value+=xe,"skipped";Z.value+=xe}function Zo(I,O,Z){const fe={};if(I.getUint32(0,!0)!=20000630)throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";fe.version=I.getUint8(4);const xe=I.getUint8(5);fe.spec={singleTile:!!(xe&2),longName:!!(xe&4),deepFormat:!!(xe&8),multiPart:!!(xe&16)},Z.value=8;for(var ye=!0;ye;){var Ve=ht(O,Z);if(Ve==0)ye=!1;else{var Ne=ht(O,Z),Ze=Ge(I,Z),Ke=Jn(I,O,Z,Ne,Ze);Ke===void 0?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${Ne}'.`):fe[Ve]=Ke}}if(xe&-5)throw console.error("EXRHeader:",fe),"THREE.EXRLoader: provided file is currently unsupported.";return fe}function za(I,O,Z,fe,xe){const ye={size:0,viewer:O,array:Z,offset:fe,width:I.dataWindow.xMax-I.dataWindow.xMin+1,height:I.dataWindow.yMax-I.dataWindow.yMin+1,channels:I.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:I.channels[0].pixelType,uncompress:null,getter:null,format:null,[Pl?"colorSpace":"encoding"]:null};switch(I.compression){case"NO_COMPRESSION":ye.lines=1,ye.uncompress=G;break;case"RLE_COMPRESSION":ye.lines=1,ye.uncompress=R;break;case"ZIPS_COMPRESSION":ye.lines=1,ye.uncompress=ee;break;case"ZIP_COMPRESSION":ye.lines=16,ye.uncompress=ee;break;case"PIZ_COMPRESSION":ye.lines=32,ye.uncompress=me;break;case"PXR24_COMPRESSION":ye.lines=16,ye.uncompress=Ce;break;case"DWAA_COMPRESSION":ye.lines=32,ye.uncompress=ge;break;case"DWAB_COMPRESSION":ye.lines=256,ye.uncompress=ge;break;default:throw"EXRLoader.parse: "+I.compression+" is unsupported"}if(ye.scanlineBlockSize=ye.lines,ye.type==1)switch(xe){case In:ye.getter=et,ye.inputSize=2;break;case Vn:ye.getter=Le,ye.inputSize=2;break}else if(ye.type==2)switch(xe){case In:ye.getter=De,ye.inputSize=4;break;case Vn:ye.getter=K,ye.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+ye.type+" for "+I.compression+".";ye.blockCount=(I.dataWindow.yMax+1)/ye.scanlineBlockSize;for(var Ve=0;Ve<ye.blockCount;Ve++)ce(O,fe);ye.outputChannels=ye.channels==3?4:ye.channels;const Ne=ye.width*ye.height*ye.outputChannels;switch(xe){case In:ye.byteArray=new Float32Array(Ne),ye.channels<ye.outputChannels&&ye.byteArray.fill(1,0,Ne);break;case Vn:ye.byteArray=new Uint16Array(Ne),ye.channels<ye.outputChannels&&ye.byteArray.fill(15360,0,Ne);break;default:console.error("THREE.EXRLoader: unsupported type: ",xe);break}return ye.bytesPerLine=ye.width*ye.inputSize*ye.channels,ye.outputChannels==4?ye.format=ni:ye.format=oc,Pl?ye.colorSpace="srgb-linear":ye.encoding=3e3,ye}const ur=new DataView(e),Hs=new Uint8Array(e),br={value:0},Ti=Zo(ur,e,br),Ut=za(Ti,ur,Hs,br,this.type),os={value:0},ka={R:0,G:1,B:2,A:3,Y:0};for(let I=0;I<Ut.height/Ut.scanlineBlockSize;I++){const O=Ge(ur,br);Ut.size=Ge(ur,br),Ut.lines=O+Ut.scanlineBlockSize>Ut.height?Ut.height-O:Ut.scanlineBlockSize;const fe=Ut.size<Ut.lines*Ut.bytesPerLine?Ut.uncompress(Ut):G(Ut);br.value+=Ut.size;for(let xe=0;xe<Ut.scanlineBlockSize;xe++){const ye=xe+I*Ut.scanlineBlockSize;if(ye>=Ut.height)break;for(let Ve=0;Ve<Ut.channels;Ve++){const Ne=ka[Ti.channels[Ve].name];for(let Ze=0;Ze<Ut.width;Ze++){os.value=(xe*(Ut.channels*Ut.width)+Ve*Ut.width+Ze)*Ut.inputSize;const Ke=(Ut.height-1-ye)*(Ut.width*Ut.outputChannels)+Ze*Ut.outputChannels+Ne;Ut.byteArray[Ke]=Ut.getter(fe,os)}}}}return{header:Ti,width:Ut.width,height:Ut.height,data:Ut.byteArray,format:Ut.format,[Pl?"colorSpace":"encoding"]:Ut[Pl?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(a,o){Pl?a.colorSpace=o.colorSpace:a.encoding=o.encoding,a.minFilter=rn,a.magFilter=rn,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,o)}return super.load(e,s,n,i)}}const kp=new WeakMap;class w2 extends _i{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const s=new Yi(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{const o={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(a,o).then(t).catch(i)},n,i)}decodeDracoFile(e,t,n,i){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const u in t.attributeTypes){const h=t.attributeTypes[u];h.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[u]=h.name)}const n=JSON.stringify(t);if(kp.has(e)){const u=kp.get(e);if(u.key===n)return u.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(s,a).then(u=>(i=u,new Promise((h,f)=>{i._callbacks[s]={resolve:h,reject:f},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(u=>this._createGeometry(u.geometry));return o.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),kp.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Lt;e.index&&t.setIndex(new sn(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],s=i.name,a=i.array,o=i.itemSize;t.setAttribute(s,new sn(a,o))}return t}_loadLibrary(e,t){const n=new Yi(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=VB.toString(),a=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` 4369`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const a=s.data;switch(a.type){case"decode":i._callbacks[a.id].resolve(a);break;case"error":i._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function VB(){let r,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":r=o.decoderConfig,e=new Promise(function(f){r.onModuleLoaded=function(d){f({draco:d})},DracoDecoderModule(r)});break;case"decode":const u=o.buffer,h=o.taskConfig;e.then(f=>{const d=f.draco,p=new d.Decoder,g=new d.DecoderBuffer;g.Init(new Int8Array(u),u.byteLength);try{const v=t(d,p,g,h),A=v.attributes.map(y=>y.array.buffer);v.index&&A.push(v.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:v},A)}catch(v){console.error(v),self.postMessage({type:"error",id:o.id,error:v.message})}finally{d.destroy(g),d.destroy(p)}});break}};function t(a,o,u,h){const f=h.attributeIDs,d=h.attributeTypes;let p,g;const v=o.GetEncodedGeometryType(u);if(v===a.TRIANGULAR_MESH)p=new a.Mesh,g=o.DecodeBufferToMesh(u,p);else if(v===a.POINT_CLOUD)p=new a.PointCloud,g=o.DecodeBufferToPointCloud(u,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const A={index:null,attributes:[]};for(const y in f){const _=self[d[y]];let M,E;if(h.useUniqueIDs)E=f[y],M=o.GetAttributeByUniqueId(p,E);else{if(E=o.GetAttributeId(p,a[f[y]]),E===-1)continue;M=o.GetAttribute(p,E)}A.attributes.push(i(a,o,p,y,_,M))}return v===a.TRIANGULAR_MESH&&(A.index=n(a,o,p)),a.destroy(p),A}function n(a,o,u){const f=u.num_faces()*3,d=f*4,p=a._malloc(d);o.GetTrianglesUInt32Array(u,d,p);const g=new Uint32Array(a.HEAPF32.buffer,p,f).slice();return a._free(p),{array:g,itemSize:1}}function i(a,o,u,h,f,d){const p=d.num_components(),v=u.num_points()*p,A=v*f.BYTES_PER_ELEMENT,y=s(a,f),_=a._malloc(A);o.GetAttributeDataArrayForAllPoints(u,d,y,A,_);const M=new f(a.HEAPF32.buffer,_,v).slice();return a._free(_),{name:h,array:M,itemSize:p}}function s(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}let th;const b2=()=>{if(th)return th;
4369const r="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
4369LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMG
4369XAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let i=r;WebAssembly.validate(t)&&(i=e);let s;const a=WebAssembly.instantiate(o(i),{}).then(d=>{s=d.instance,s.exports.__wasm_call_ctors()});function o(d){const p=new Uint8Array(d.length);for(let v=0;v<d.length;
vendor: 38,921 bytes, lines 4369-4456
4369++v){const A=d.charCodeAt(v);p[v]=A>96?A-71:A>64?A-65:A>47?A+4:A>46?63:62}let g=0;for(let v=0;v<d.length;++v)p[g++]=p[v]<60?n[p[v]]:(p[v]-60)*64+p[++v];return p.buffer.slice(0,g)}function u(d,p,g,v,A,y){const _=s.exports.sbrk,M=g+3&-4,E=_(M*v),w=_(A.length),B=new Uint8Array(s.exports.memory.buffer);B.set(A,w);const P=d(E,g,v,w,A.length);if(P===0&&y&&y(E,M,v),p.set(B.subarray(E,E+g*v)),_(E-_(0)),P!==0)throw new Error(`Malformed buffer data: ${P}`)}const h={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return th={ready:a,supported:!0,decodeVertexBuffer(d,p,g,v,A){u(s.exports.meshopt_decodeVertexBuffer,d,p,g,v,s.exports[h[A]])},decodeIndexBuffer(d,p,g,v){u(s.exports.meshopt_decodeIndexBuffer,d,p,g,v)},decodeIndexSequence(d,p,g,v){u(s.exports.meshopt_decodeIndexSequence,d,p,g,v)},decodeGltfBuffer(d,p,g,v,A,y){u(s.exports[f[A]],d,p,g,v,s.exports[h[y]])}},th};/** 4370 * postprocessing v6.38.2 build Mon Dec 22 2025 4371 * https://github.com/pmndrs/postprocessing 4372 * Copyright 2015-2025 Raoul van Rüschen 4373 * @license Zlib 4374 */var Vp=1/1e3,WB=1e3,XB=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(r){typeof document<"u"&&document.hidden!==void 0&&(r?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=r)}get delta(){return this._delta*Vp}get fixedDelta(){return this._fixedDelta*Vp}set fixedDelta(r){this._fixedDelta=r*WB}get elapsed(){return this._elapsed*Vp}update(r){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(r!==void 0?r:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(r){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},JB=(()=>{const r=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]),t=new Lt;return t.setAttribute("position",new sn(r,3)),t.setAttribute("uv",new sn(e,2)),t})(),Fi=class mm{static get fullscreenGeometry(){return JB}constructor(e="Pass",t=new ec,n=new Sr){this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;t!==null&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;t!==null?t.material=e:(t=new ot(mm.fullscreenGeometry,e),t.frustumCulled=!1,this.scene===null&&(this.scene=new ec),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=Us){}render(e,t,n,i,s){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof bn||t instanceof Fn||t instanceof yn||t instanceof mm)&&this[e].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},YB=class extends Fi{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(r,e,t,n,i){const s=r.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},KB=`#ifdef COLOR_WRITE 4375#include <common> 4376#include <dithering_pars_fragment> 4377#ifdef FRAMEBUFFER_PRECISION_HIGH 4378uniform mediump sampler2D inputBuffer; 4379#else 4380uniform lowp sampler2D inputBuffer; 4381#endif 4382#endif 4383#ifdef DEPTH_WRITE 4384#include <packing> 4385#ifdef GL_FRAGMENT_PRECISION_HIGH 4386uniform highp sampler2D depthBuffer; 4387#else 4388uniform mediump sampler2D depthBuffer; 4389#endif 4390float readDepth(const in vec2 uv){ 4391#if DEPTH_PACKING == 3201 4392return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 4393#else 4394return texture2D(depthBuffer,uv).r; 4395#endif 4396} 4397#endif 4398#ifdef USE_WEIGHTS 4399uniform vec4 channelWeights; 4400#endif 4401uniform float opacity;varying vec2 vUv;void main(){ 4402#ifdef COLOR_WRITE 4403vec4 texel=texture2D(inputBuffer,vUv); 4404#ifdef USE_WEIGHTS 4405texel*=channelWeights; 4406#endif 4407gl_FragColor=opacity*texel; 4408#ifdef COLOR_SPACE_CONVERSION 4409#include <colorspace_fragment> 4410#endif 4411#include <dithering_fragment> 4412#else 4413gl_FragColor=vec4(0.0); 4414#endif 4415#ifdef DEPTH_WRITE 4416gl_FragDepth=readDepth(vUv); 4417#endif 4418}`,xA="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",yA=class extends Bn{constructor(){super({name:"CopyMaterial",defines:{COLOR_SPACE_CONVERSION:"1",DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new en(null),depthBuffer:new en(null),channelWeights:new en(null),opacity:new en(1)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:KB,vertexShader:xA}),this.depthFunc=Jl}get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(r){const e=r!==null;this.colorWrite!==e&&(e?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=e,this.needsUpdate=!0),this.uniforms.inputBuffer.value=r}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(r){const e=r!==null;this.depthWrite!==e&&(e?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=e,this.depthWrite=e,this.needsUpdate=!0),this.uniforms.depthBuffer.value=r}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}get colorSpaceConversion(){return this.defines.COLOR_SPACE_CONVERSION!==void 0}set colorSpaceConversion(r){this.colorSpaceConversion!==r&&(r?this.defines.COLOR_SPACE_CONVERSION=!0:delete this.defines.COLOR_SPACE_CONVERSION,this.needsUpdate=!0)}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(r){r!==null?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=r):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(r){this.uniforms.inputBuffer.value=r}getOpacity(r){return this.uniforms.opacity.value}setOpacity(r){this.uniforms.opacity.value=r}},ZB=class extends Fi{constructor(r,e=!0){super("CopyPass"),this.fullscreenMaterial=new yA,this.needsSwap=!1,this.renderTarget=r,r===void 0&&(this.renderTarget=new bn(1,1,{minFilter:rn,magFilter:rn,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(r){this.autoResize=r}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(r){this.autoResize=r}render(r,e,t,n,i){this.fullscreenMaterial.inputBuffer=e.texture,r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,e){this.autoResize&&this.renderTarget.setSize(r,e)}initialize(r,e,t){t!==void 0&&(this.renderTarget.texture.type=t,t!==Rn?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":r!==null&&r.outputColorSpace===pn&&(this.renderTarget.texture.colorSpace=pn))}},q_=new je,AA=class extends Fi{constructor(r=!0,e=!0,t=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=r,this.depth=e,this.stencil=t,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(r,e,t){this.color=r,this.depth=e,this.stencil=t}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(r){this.overrideClearColor=r}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(r){this.overrideClearAlpha=r}render(r,e,t,n,i){const s=this.overrideClearColor,a=this.overrideClearAlpha,o=r.getClearAlpha(),u=s!==null,h=a>=0;u?(r.getClearColor(q_),r.setClearColor(s,h?a:o)):h&&r.setClearAlpha(a),r.setRenderTarget(this.renderToScreen?null:e),r.clear(this.color,this.depth,this.stencil),u?r.setClearColor(q_,o):h&&r.setClearAlpha(o)}},QB=class extends Fi{constructor(r,e){super("MaskPass",r,e),this.needsSwap=!1,this.clearPass=new AA(!1,!1,!0),this.inverse=!1}set mainScene(r){this.scene=r}set mainCamera(r){this.camera=r}get inverted(){return this.inverse}set inverted(r){this.inverse=r}get clear(){return this.clearPass.enabled}set clear(r){this.clearPass.enabled=r}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(r){this.inverted=r}render(r,e,t,n,i){const s=r.getContext(),a=r.state.buffers,o=this.scene,u=this.camera,h=this.clearPass,f=this.inverted?0:1,d=1-f;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),a.stencil.setFunc(s.ALWAYS,f,4294967295),a.stencil.setClear(d),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?h.render(r,null):(h.render(r,e),h.render(r,t))),this.renderToScreen?(r.setRenderTarget(null),r.render(o,u)):(r.setRenderTarget(e),r.render(o,u),r.setRenderTarget(t),r.render(o,u)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(s.EQUAL,1,4294967295),a.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),a.stencil.setLocked(!0)}},qB=class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:i=0,frameBufferType:s}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,n,s,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new ZB,this.depthTexture=null,this.passes=[],this.timer=new XB,this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){const t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,e!==null){const t=e.getSize(new _e),n=e.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===Rn&&e.outputColorSpace===pn&&(this.inputBuffer.texture.colorSpace=pn,this.outputBuffer.texture.colorSpace=pn,this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height);for(const s of this.passes)s.initialize(e,n,i)}}replaceRenderer(e,t=!0){const n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&i!==null&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}createDepthTexture(){const e=this.depthTexture=new Ba;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=ts,e.type=Ca):e.type=Ji,e}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,n,i){const s=this.renderer,a=s===null?new _e:s.getDrawingBufferSize(new _e),o={minFilter:rn,magFilter:rn,stencilBuffer:t,depthBuffer:e,type:n},u=new bn(a.width,a.height,o);return i>0&&(u.samples=i),n===Rn&&s!==null&&s.outputColorSpace===pn&&(u.texture.colorSpace=pn),u.texture.name="EffectComposer.Buffer",u.texture.generateMipmaps=!1,u}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const n=this.passes,i=this.renderer,s=i.getDrawingBufferSize(new _e),a=i.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(e.setRenderer(i),e.setSize(s.width,s.height),e.initialize(i,a,o),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),t!==void 0?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){const u=this.createDepthTexture();for(e of n)e.setDepthTexture(u)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,n=t.indexOf(e);if(n!==-1&&t.splice(n,1).length>0){if(this.depthTexture!==null){const a=(u,h)=>u||h.needsDepthTexture;t.reduce(a,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,n=this.copyPass;let i=this.inputBuffer,s=this.outputBuffer,a=!1,o,u,h;e===void 0&&(this.timer.update(),e=this.timer.getDelta());for(const f of this.passes)f.enabled&&(f.render(t,i,s,e,a),f.needsSwap&&(a&&(n.renderToScreen=f.renderToScreen,o=t.getContext(),u=t.state.buffers.stencil,u.setFunc(o.NOTEQUAL,1,4294967295),n.render(t,i,s,e,a),u.setFunc(o.EQUAL,1,4294967295)),h=i,i=s,s=h),f instanceof QB?a=!0:f instanceof YB&&(a=!1))}setSize(e,t,n){const i=this.renderer,s=i.getSize(new _e);(e===void 0||t===void 0)&&(e=s.width,t=s.height),(s.width!==e||s.height!==t)&&i.setSize(e,t,n);const a=i.getDrawingBufferSize(new _e);this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height);for(const o of this.passes)o.setSize(a.width,a.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const e of this.passes)e.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),Fi.fullscreenGeometry.dispose()}},ss={NONE:0,DEPTH:1,CONVOLUTION:2},hn={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},jB=class{constructor(){this.shaderParts=new Map([[hn.FRAGMENT_HEAD,null],[hn.FRAGMENT_MAIN_UV,null],[hn.FRAGMENT_MAIN_IMAGE,null],[hn.VERTEX_HEAD,null],[hn.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=ss.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=as}},Wp=!1,j_=class{constructor(r=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(r),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case $n:t=this.materialsFlatShadedDoubleSide;break;case Hn:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case $n:t=this.materialsDoubleSide;break;case Hn:t=this.materialsBackSide;break;default:t=this.materials;break}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(r){if(!(r instanceof Bn))return r.clone();const e=r.uniforms,t=new Map;for(const i in e){const s=e[i].value;s.isRenderTargetTexture&&(e[i].value=null,t.set(i,s))}const n=r.clone();for(const i of t)e[i[0]].value=i[1],n.uniforms[i[0]].value=i[1];return n}setMaterial(r){if(this.disposeMaterials(),this.material=r,r!==null){const e=this.materials=[this.cloneMaterial(r),this.cloneMaterial(r),this.cloneMaterial(r)];for(const t of e)t.uniforms=Object.assign({},r.uniforms),t.side=Mr;e[2].skinning=!0,this.materialsBackSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},r.uniforms),n.side=Hn,n}),this.materialsDoubleSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},r.uniforms),n.side=$n,n}),this.materialsFlatShaded=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},r.uniforms),n.flatShading=!0,n}),this.materialsFlatShadedBackSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},r.uniforms),n.flatShading=!0,n.side=Hn,n}),this.materialsFlatShadedDoubleSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},r.uniforms),n.flatShading=!0,n.side=$n,n})}}render(r,e,t){const n=r.shadowMap.enabled;if(r.shadowMap.enabled=!1,Wp){const i=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),r.render(e,t);for(const s of i)s[0].material=s[1];this.meshCount!==i.size&&i.clear()}else{const i=e.overrideMaterial;e.overrideMaterial=this.material,r.render(e,t),e.overrideMaterial=i}r.shadowMap.enabled=n}disposeMaterials(){if(this.material!==null){const r=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const e of r)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return Wp}static set workaroundEnabled(r){Wp=r}},ws=-1,vi=class extends Ki{constructor(r,e=ws,t=ws,n=1){super(),this.resizable=r,this.baseSize=new _e(1,1),this.preferredSize=new _e(e,t),this.target=this.preferredSize,this.s=n,this.effectiveSize=new _e,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){const r=this.baseSize,e=this.preferredSize,t=this.effectiveSize,n=this.scale;e.width!==ws?t.width=e.width:e.height!==ws?t.width=Math.round(e.height*(r.width/Math.max(r.height,1))):t.width=Math.round(r.width*n),e.height!==ws?t.height=e.height:e.width!==ws?t.height=Math.round(e.width/Math.max(r.width/Math.max(r.height,1),1)):t.height=Math.round(r.height*n)}get width(){return this.effectiveSize.width}set width(r){this.preferredWidth=r}get height(){return this.effectiveSize.height}set height(r){this.preferredHeight=r}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(r){this.s!==r&&(this.s=r,this.preferredSize.setScalar(ws),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(r){this.scale=r}get baseWidth(){return this.baseSize.width}set baseWidth(r){this.baseSize.width!==r&&(this.baseSize.width=r,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(r){this.baseWidth=r}get baseHeight(){return this.baseSize.height}set baseHeight(r){this.baseSize.height!==r&&(this.baseSize.height=r,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(r){this.baseHeight=r}setBaseSize(r,e){(this.baseSize.width!==r||this.baseSize.height!==e)&&(this.baseSize.set(r,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(r){this.preferredSize.width!==r&&(this.preferredSize.width=r,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(r){this.preferredWidth=r}get preferredHeight(){return this.preferredSize.height}set preferredHeight(r){this.preferredSize.height!==r&&(this.preferredSize.height=r,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(r){this.preferredHeight=r}setPreferredSize(r,e){(this.preferredSize.width!==r||this.preferredSize.height!==e)&&(this.preferredSize.set(r,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(r){this.s=r.scale,this.baseSize.set(r.baseWidth,r.baseHeight),this.preferredSize.set(r.preferredWidth,r.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return ws}},$t={ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},$B="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",eP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}",tP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=(dst.rgb+src.rgb)*0.5;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",nP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.xy,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",iP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/max(b,1e-9))),vec3(1.0),step(1.0,a));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",rP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",sP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",aP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=abs(dst.rgb-src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",oP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb/max(src.rgb,1e-9);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",lP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-2.0*dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",cP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb,1.0);vec3 b=min(src.rgb,1.0);vec3 c=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",uP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=step(1.0,dst.rgb+src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",hP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.x,a.yz));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",fP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",dP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=src.rgb*max(1.0-dst.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",pP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",mP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",gP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb+src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",vP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(2.0*src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",_P="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.xy,b.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",xP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",yP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-abs(1.0-dst.rgb-src.rgb),0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",AP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}",SP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=2.0*src.rgb*dst.rgb;vec3 b=1.0-2.0*(1.0-src.rgb)*(1.0-dst.rgb);vec3 c=mix(a,b,step(0.5,dst.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",MP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 c=mix(mix(src2,dst.rgb,step(0.5*dst.rgb,src.rgb)),max(src2-1.0,vec3(0.0)),step(dst.rgb,src2-1.0));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",EP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb*dst.rgb/max(1.0-src.rgb,1e-9),1.0);vec3 c=mix(a,src.rgb,step(1.0,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",wP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.x,b.y,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",bP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-min(dst.rgb*src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",TP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 d=dst.rgb+(src2-1.0);vec3 w=step(0.5,src.rgb);vec3 a=dst.rgb-(1.0-src2)*dst.rgb*(1.0-dst.rgb);vec3 b=mix(d*(sqrt(dst.rgb)-dst.rgb),d*dst.rgb*((16.0*dst.rgb-12.0)*dst.rgb+3.0),w*(1.0-step(0.25,dst.rgb)));vec3 c=mix(a,b,w);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",CP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}",RP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",IP="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=mix(max(1.0-min((1.0-dst.rgb)/(2.0*src.rgb),1.0),0.0),min(dst.rgb/(2.0*(1.0-src.rgb)),1.0),step(0.5,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",BP=new Map([[$t.ADD,$B],[$t.ALPHA,eP],[$t.AVERAGE,tP],[$t.COLOR,nP],[$t.COLOR_BURN,iP],[$t.COLOR_DODGE,rP],[$t.DARKEN,sP],[$t.DIFFERENCE,aP],[$t.DIVIDE,oP],[$t.DST,null],[$t.EXCLUSION,lP],[$t.HARD_LIGHT,cP],[$t.HARD_MIX,uP],[$t.HUE,hP],[$t.INVERT,fP],[$t.INVERT_RGB,dP],[$t.LIGHTEN,pP],[$t.LINEAR_BURN,mP],[$t.LINEAR_DODGE,gP],[$t.LINEAR_LIGHT,vP],[$t.LUMINOSITY,_P],[$t.MULTIPLY,xP],[$t.NEGATION,yP],[$t.NORMAL,AP],[$t.OVERLAY,SP],[$t.PIN_LIGHT,MP],[$t.REFLECT,EP],[$t.SATURATION,wP],[$t.SCREEN,bP],[$t.SOFT_LIGHT,TP],[$t.SRC,CP],[$t.SUBTRACT,RP],[$t.VIVID_LIGHT,IP]]),PP=class extends Ki{constructor(r,e=1){super(),this._blendFunction=r,this.opacity=new en(e)}getOpacity(){return this.opacity.value}setOpacity(r){this.opacity.value=r}get blendFunction(){return this._blendFunction}set blendFunction(r){this._blendFunction=r,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(r){this.blendFunction=r}getShaderCode(){return BP.get(this.blendFunction)}},jh=class extends Ki{constructor(r,e,{attributes:t=ss.NONE,blendFunction:n=$t.NORMAL,defines:i=new Map,uniforms:s=new Map,extensions:a=null,vertexShader:o=null}={}){super(),this.name=r,this.renderer=null,this.attributes=t,this.fragmentShader=e,this.vertexShader=o,this.defines=i,this.uniforms=s,this.extensions=a,this.blendMode=new PP(n),this.blendMode.addEventListener("change",u=>this.setChanged()),this._inputColorSpace=as,this._outputColorSpace=xr}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(r){this._inputColorSpace=r,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(r){this._outputColorSpace=r,this.setChanged()}set mainScene(r){}set mainCamera(r){}getName(){return this.name}setRenderer(r){this.renderer=r}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(r){this.attributes=r,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(r){this.fragmentShader=r,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(r){this.vertexShader=r,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(r,e=Us){}update(r,e,t){}setSize(r,e){}initialize(r,e,t){}dispose(){for(const r of Object.keys(this)){const e=this[r];(e instanceof bn||e instanceof Fn||e instanceof yn||e instanceof Fi)&&this[r].dispose()}}},vg={MEDIUM:2,LARGE:3},DP=`#ifdef FRAMEBUFFER_PRECISION_HIGH 4419uniform mediump sampler2D inputBuffer; 4420#else 4421uniform lowp sampler2D inputBuffer; 4422#endif 4423varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; 4424#include <colorspace_fragment> 4425}`,LP="uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",FP=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],UP=class extends Bn{constructor(r=new gn){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new en(null),texelSize:new en(new gn),scale:new en(1),kernel:new en(0)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:DP,vertexShader:LP}),this.setTexelSize(r.x,r.y),this.kernelSize=vg.MEDIUM}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setInputBuffer(r){this.inputBuffer=r}get kernelSequence(){return FP[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(r){this.uniforms.scale.value=r}getScale(){return this.uniforms.scale.value}setScale(r){this.uniforms.scale.value=r}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(r){this.uniforms.kernel.value=r}setKernel(r){this.kernel=r}setTexelSize(r,e){this.uniforms.texelSize.value.set(r,e,r*.5,e*.5)}setSize(r,e){const t=1/r,n=1/e;this.uniforms.texelSize.value.set(t,n,t*.5,n*.5)}},NP=class extends Fi{constructor({kernelSize:r=vg.MEDIUM,resolutionScale:e=.5,width:t=vi.AUTO_SIZE,height:n=vi.AUTO_SIZE,resolutionX:i=t,resolutionY:s=n}={}){super("KawaseBlurPass"),this.renderTargetA=new bn(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const a=this.resolution=new vi(this,i,s,e);a.addEventListener("change",o=>this.setSize(a.baseWidth,a.baseHeight)),this._blurMaterial=new UP,this._blurMaterial.kernelSize=r,this.copyMaterial=new yA}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(r){this._blurMaterial=r}get dithering(){return this.copyMaterial.dithering}set dithering(r){this.copyMaterial.dithering=r}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(r){this.blurMaterial.kernelSize=r}get width(){return this.resolution.width}set width(r){this.resolution.preferredWidth=r}get height(){return this.resolution.height}set height(r){this.resolution.preferredHeight=r}get scale(){return this.blurMaterial.scale}set scale(r){this.blurMaterial.scale=r}getScale(){return this.blurMaterial.scale}setScale(r){this.blurMaterial.scale=r}getKernelSize(){return this.kernelSize}setKernelSize(r){this.kernelSize=r}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}render(r,e,t,n,i){const s=this.scene,a=this.camera,o=this.renderTargetA,u=this.renderTargetB,h=this.blurMaterial,f=h.kernelSequence;let d=e;this.fullscreenMaterial=h;for(let p=0,g=f.length;p<g;++p){const v=p&1?u:o;h.kernel=f[p],h.inputBuffer=d.texture,r.setRenderTarget(v),r.render(s,a),d=v}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=d.texture,r.setRenderTarget(this.renderToScreen?null:t),r.render(s,a)}setSize(r,e){const t=this.resolution;t.setBaseSize(r,e);const n=t.width,i=t.height;this.renderTargetA.setSize(n,i),this.renderTargetB.setSize(n,i),this.blurMaterial.setSize(r,e)}initialize(r,e,t){t!==void 0&&(this.renderTargetA.texture.type=t,this.renderTargetB.texture.type=t,t!==Rn?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):r!==null&&r.outputColorSpace===pn&&(this.renderTargetA.texture.colorSpace=pn,this.renderTargetB.texture.colorSpace=pn))}static get AUTO_SIZE(){return vi.AUTO_SIZE}},OP=`#include <common> 4426#ifdef FRAMEBUFFER_PRECISION_HIGH 4427uniform mediump sampler2D inputBuffer; 4428#else 4429uniform lowp sampler2D inputBuffer; 4430#endif 4431#ifdef RANGE 4432uniform vec2 range; 4433#elif defined(THRESHOLD) 4434uniform float threshold;uniform float smoothing; 4435#endif 4436varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0; 4437#ifdef RANGE 4438float low=step(range.x,l);float high=step(l,range.y);mask=low*high; 4439#elif defined(THRESHOLD) 4440mask=smoothstep(threshold,threshold+smoothing,l); 4441#endif 4442#ifdef COLOR 4443gl_FragColor=texel*mask; 4444#else 4445gl_FragColor=vec4(l*mask); 4446#endif 4447}`,GP=class extends Bn{constructor(r=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:Ua.replace(/\D+/g,"")},uniforms:{inputBuffer:new en(null),threshold:new en(0),smoothing:new en(1),range:new en(null)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:OP,vertexShader:xA}),this.colorOutput=r,this.luminanceRange=e}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setInputBuffer(r){this.uniforms.inputBuffer.value=r}get threshold(){return this.uniforms.threshold.value}set threshold(r){this.smoothing>0||r>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=r}getThreshold(){return this.threshold}setThreshold(r){this.threshold=r}get smoothing(){return this.uniforms.smoothing.value}set smoothing(r){this.threshold>0||r>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=r}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(r){this.smoothing=r}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(r){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(r){r?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(r){return this.colorOutput}setColorOutputEnabled(r){this.colorOutput=r}get useRange(){return this.luminanceRange!==null}set useRange(r){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(r){r!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=r,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(r){this.luminanceRange=r}},HP=class extends Fi{constructor({renderTarget:r,luminanceRange:e,colorOutput:t,resolutionScale:n=1,width:i=vi.AUTO_SIZE,height:s=vi.AUTO_SIZE,resolutionX:a=i,resolutionY:o=s}={}){super("LuminancePass"),this.fullscreenMaterial=new GP(t,e),this.needsSwap=!1,this.renderTarget=r,this.renderTarget===void 0&&(this.renderTarget=new bn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const u=this.resolution=new vi(this,a,o,n);u.addEventListener("change",h=>this.setSize(u.baseWidth,u.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(r,e,t,n,i){const s=this.fullscreenMaterial;s.inputBuffer=e.texture,r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,e){const t=this.resolution;t.setBaseSize(r,e),this.renderTarget.setSize(t.width,t.height)}initialize(r,e,t){t!==void 0&&t!==Rn&&(this.renderTarget.texture.type=t,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},zP=`#ifdef FRAMEBUFFER_PRECISION_HIGH 4448uniform mediump sampler2D inputBuffer; 4449#else 4450uniform lowp sampler2D inputBuffer; 4451#endif 4452#define WEIGHT_INNER 0.125 4453#define WEIGHT_OUTER 0.0555555 4454varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c; 4455#include <colorspace_fragment> 4456}`,kP="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;
4456vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}",VP=class extends Bn{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new en(null),texelSize:new en(new _e)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:zP,vertexShader:kP})}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setSize(r,e){this.uniforms.texelSize.value.set(1/r,1/e)}},WP=`#ifdef FRAMEBUFFER_PRECISION_HIGH 4457uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer; 4458#else 4459uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer; 4460#endif 4461uniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius); 4462#include <colorspace_fragment> 4463}`,XP="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}",JP=class extends Bn{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new en(null),supportBuffer:new en(null),texelSize:new en(new _e),radius:new en(.85)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:WP,vertexShader:XP})}set inputBuffer(r){this.uniforms.inputBuffer.value=r}set supportBuffer(r){this.uniforms.supportBuffer.value=r}get radius(){return this.uniforms.radius.value}set radius(r){this.uniforms.radius.value=r}setSize(r,e){this.uniforms.texelSize.value.set(1/r,1/e)}},YP=class extends Fi{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new bn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new VP,this.upsamplingMaterial=new JP,this.resolution=new _e}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(r){if(this.levels!==r){const e=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let t=0;t<r;++t){const n=e.clone();n.texture.name="Downsampling.Mipmap"+t,this.downsamplingMipmaps.push(n)}this.upsamplingMipmaps.push(e);for(let t=1,n=r-1;t<n;++t){const i=e.clone();i.texture.name="Upsampling.Mipmap"+t,this.upsamplingMipmaps.push(i)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(r){this.upsamplingMaterial.radius=r}render(r,e,t,n,i){const{scene:s,camera:a}=this,{downsamplingMaterial:o,upsamplingMaterial:u}=this,{downsamplingMipmaps:h,upsamplingMipmaps:f}=this;let d=e;this.fullscreenMaterial=o;for(let p=0,g=h.length;p<g;++p){const v=h[p];o.setSize(d.width,d.height),o.inputBuffer=d.texture,r.setRenderTarget(v),r.render(s,a),d=v}this.fullscreenMaterial=u;for(let p=f.length-1;p>=0;--p){const g=f[p];
4463u.setSize(d.width,d.height),u.inputBuffer=d.texture,u.supportBuffer=h[p].texture,r.setRenderTarget(g),r.render(s,a),d=g}}setSize(r,e){const t=this.resolution;t.set(r,e);let n=t.width,i=t.height;for(let s=0,a=this.downsamplingMipmaps.length;s<a;++s)n=Math.round(n*.5),i=Math.round(i*.5),this.downsamplingMipmaps[s].setSize(n,i),s<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[s].setSize(n,i)}initialize(r,e,t){if(t!==void 0){const n=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const i of n)i.texture.type=t;if(t!==Rn)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(r!==null&&r.outputColorSpace===pn)for(const i of n)i.texture.colorSpace=pn}}dispose(){super.dispose();for(const r of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))r.dispose()}},KP=`#ifdef FRAMEBUFFER_PRECISION_HIGH 4464uniform mediump sampler2D map; 4465#else 4466uniform lowp sampler2D map; 4467#endif 4468uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}`,ZP=class extends jh{constructor({blendFunction:r=$t.SCREEN,luminanceThreshold:e=1,luminanceSmoothing:t=.03,mipmapBlur:n=!0,intensity:i=1,radius:s=.85,levels:a=8,kernelSize:o=vg.LARGE,resolutionScale:u=.5,width:h=vi.AUTO_SIZE,height:f=vi.AUTO_SIZE,resolutionX:d=h,resolutionY:p=f}={}){super("BloomEffect",KP,{blendFunction:r,uniforms:new Map([["map",new en(null)],["intensity",new en(i)]])}),this.renderTarget=new bn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new NP({kernelSize:o}),this.luminancePass=new HP({colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=t,this.mipmapBlurPass=new YP,this.mipmapBlurPass.enabled=n,this.mipmapBlurPass.radius=s,this.mipmapBlurPass.levels=a,this.uniforms.get("map").value=n?this.mipmapBlurPass.texture:this.renderTarget.texture;const g=this.resolution=new vi(this,d,p,u);g.addEventListener("change",v=>this.setSize(g.baseWidth,g.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(r){this.resolution.preferredWidth=r}get height(){return this.resolution.height}set height(r){this.resolution.preferredHeight=r}get dithering(){return this.blurPass.dithering}set dithering(r){this.blurPass.dithering=r}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(r){this.blurPass.kernelSize=r}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(r){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(r){this.uniforms.get("intensity").value=r}getIntensity(){return this.intensity}setIntensity(r){this.intensity=r}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}update(r,e,t){const n=this.renderTarget,i=this.luminancePass;i.enabled?(i.render(r,e),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(r,i.renderTarget):this.blurPass.render(r,i.renderTarget,n)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(r,e):this.blurPass.render(r,e,n)}setSize(r,e){const t=this.resolution;t.setBaseSize(r,e),this.renderTarget.setSize(t.width,t.height),this.blurPass.resolution.copy(t),this.luminancePass.setSize(r,e),this.mipmapBlurPass.setSize(r,e)}initialize(r,e,t){this.blurPass.initialize(r,e,t),this.luminancePass.initialize(r,e,t),this.mipmapBlurPass.initialize(r,e,t),t!==void 0&&(this.renderTarget.texture.type=t,r!==null&&r.outputColorSpace===pn&&(this.renderTarget.texture.colorSpace=pn))}},SA=class extends Fi{constructor(r,e,t=null){super("RenderPass",r,e),this.needsSwap=!1,this.clearPass=new AA,this.overrideMaterialManager=t===null?null:new j_(t),this.ignoreBackgroun
vendor: 6,356 bytes, lines 4468-4495
4468d=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(r){this.scene=r}set mainCamera(r){this.camera=r}get renderToScreen(){return super.renderToScreen}set renderToScreen(r){super.renderToScreen=r,this.clearPass.renderToScreen=r}get overrideMaterial(){const r=this.overrideMaterialManager;return r!==null?r.material:null}set overrideMaterial(r){const e=this.overrideMaterialManager;r!==null?e!==null?e.setMaterial(r):this.overrideMaterialManager=new j_(r):e!==null&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(r){this.overrideMaterial=r}get clear(){return this.clearPass.enabled}set clear(r){this.clearPass.enabled=r}getSelection(){return this.selection}setSelection(r){this.selection=r}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(r){this.ignoreBackground=r}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(r){this.skipShadowMapUpdate=r}getClearPass(){return this.clearPass}render(r,e,t,n,i){const s=this.scene,a=this.camera,o=this.selection,u=a.layers.mask,h=s.background,f=r.shadowMap.autoUpdate,d=this.renderToScreen?null:e;o!==null&&a.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(r.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(r,e),r.setRenderTarget(d),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(r,s,a):r.render(s,a),a.layers.mask=u,s.background=h,r.shadowMap.autoUpdate=f}},Dl={DEFAULT:0,ESKIL:1},QP=`#include <packing> 4469#ifdef GL_FRAGMENT_PRECISION_HIGH 4470uniform highp sampler2D depthBuffer; 4471#else 4472uniform mediump sampler2D depthBuffer; 4473#endif 4474#ifdef DOWNSAMPLE_NORMALS 4475uniform lowp sampler2D normalBuffer; 4476#endif 4477varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){ 4478#if DEPTH_PACKING == 3201 4479return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 4480#else 4481return texture2D(depthBuffer,uv).r; 4482#endif 4483}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[4];d[0]=readDepth(vUv0);d[1]=readDepth(vUv1);d[2]=readDepth(vUv2);d[3]=readDepth(vUv3);int index=findBestDepth(d); 4484#ifdef DOWNSAMPLE_NORMALS 4485vec3 n[4];n[0]=texture2D(normalBuffer,vUv0).rgb;n[1]=texture2D(normalBuffer,vUv1).rgb;n[2]=texture2D(normalBuffer,vUv2).rgb;n[3]=texture2D(normalBuffer,vUv3).rgb; 4486#else 4487vec3 n[4];n[0]=vec3(0.0);n[1]=vec3(0.0);n[2]=vec3(0.0);n[3]=vec3(0.0); 4488#endif 4489gl_FragColor=vec4(n[index],d[index]);}`,qP="uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}",jP=class extends Bn{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new en(null),normalBuffer:new en(null),texelSize:new en(new _e)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:QP,vertexShader:qP})}set depthBuffer(r){this.uniforms.depthBuffer.value=r}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}setDepthBuffer(r,e=Us){this.depthBuffer=r,this.depthPacking=e}set normalBuffer(r){this.uniforms.normalBuffer.value=r,r!==null?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(r){this.normalBuffer=r}setTexelSize(r,e){this.uniforms.texelSize.value.set(r,e)}setSize(r,e){this.uniforms.texelSize.value.set(1/r,1/e)}},$P=class extends Fi{constructor({normalBuffer:r=null,resolutionScale:e=.5,width:t=vi.AUTO_SIZE,height:n=vi.AUTO_SIZE,resolutionX:i=t,resolutionY:s=n}={}){super("DepthDownsamplingPass");const a=new jP;a.normalBuffer=r,this.fullscreenMaterial=a,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new bn(1,1,{minFilter:xn,magFilter:xn,depthBuffer:!1,type:In}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const o=this.resolution=new vi(this,i,s,e);o.addEventListener("change",u=>this.setSize(o.baseWidth,o.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(r,e=Us){this.fullscreenMaterial.depthBuffer=r,this.fullscreenMaterial.depthPacking=e}render(r,e,t,n,i){r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,e){const t=this.resolution;t.setBaseSize(r,e),this.renderTarget.setSize(t.width,t.height),this.fullscreenMaterial.setSize(r,e)}initialize(r,e,t){const n=r.getContext();if(!(n.getExtension("EXT_color_buffer_float")||n.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}},e2=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb; 4490#if VIGNETTE_TECHNIQUE == 0 4491float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset)); 4492#else 4493vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord)); 4494#endif 4495outputColor=vec4(color,inputColor.a);}`,t2=class extends jh{constructor({blendFunction:r,eskil:e=!1,technique:t=e?Dl.ESKIL:Dl.DEFAULT,offset:n=.5,darkness:i=.5}={}){super("VignetteEffect",e2,{blendFunction:r,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new en(n)],["dar
4495kness",new en(i)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(r){this.technique!==r&&(this.defines.set("VIGNETTE_TECHNIQUE",r.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Dl.ESKIL}set eskil(r){this.technique=r?Dl.ESKIL:Dl.DEFAULT}getTechnique(){return this.technique}setTechnique(r){this.technique=r}get offset(){return this.uniforms.get("offset").value}set offset(r){this.uniforms.get("offset").value=r}getOffset(){return this.offset}setOffset(r){this.offset=r}get darkness(){return this.uniforms.get("darkness").value}set darkness(r){this.uniforms.get("darkness").value=r}getDarkness(){return this.darkness}setDarkness(r){this.darkness=r}},n2=`#include <common> 4496#include <packing> 4497#include <dithering_pars_fragment> 4498#define packFloatToRGBA(v) packDepthToRGBA(v) 4499#define unpackRGBAToFloat(v) unpackRGBAToDepth(v) 4500#ifdef FRAMEBUFFER_PRECISION_HIGH 4501uniform mediump sampler2D inputBuffer; 4502#else 4503uniform lowp sampler2D inputBuffer; 4504#endif 4505#if DEPTH_PACKING == 3201 4506uniform lowp sampler2D depthBuffer; 4507#elif defined(GL_FRAGMENT_PRECISION_HIGH) 4508uniform highp sampler2D depthBuffer; 4509#else 4510uniform mediump sampler2D depthBuffer; 4511#endif 4512uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}float readDepth(const in vec2 uv){ 4513#if DEPTH_PACKING == 3201 4514float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv)); 4515#else 4516float depth=texture2D(depthBuffer,uv).r; 4517#endif 4518#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH) 4519float d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d; 4520#elif defined(USE_REVERSED_DEPTH_BUFFER) 4521depth=1.0-depth; 4522#endif 4523return depth;}float getViewZ(const in float depth){ 4524#ifdef PERSPECTIVE_CAMERA 4525return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); 4526#else 4527return orthographicDepthToViewZ(depth,cameraNear,cameraFar); 4528#endif 4529}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0; 4530#ifdef ENCODE_OUTPUT 4531#include <colorspace_fragment> 4532#endif 4533#include <dithering_fragment> 4534}`,i2="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}",r2=class extends Bn{constructor(r,e,t,n,i=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:Ua.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new en(null),depthBuffer:new en(null),resolution:new en(new _e),texelSize:new en(new _e),cameraNear:new en(.3),cameraFar:new en(1e3),aspect:new en(1),time:new en(0)},blending:ii,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:i}),r&&this.setShaderParts(r),e&&this.setDefines(e),t&&this.setUniforms(t),this.copyCameraSettings(n)}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setInputBuffer(r){this.uniforms.inputBuffer.value=r}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(r){this.uniforms.depthBuffer.value=r}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}setDepthBuffer(r,e=Us){this.depthBuffer=r,this.depthPacking=e}setShaderData(r){this.setShaderParts(r.shaderParts),this.setDefines(r.defines),this.setUniforms(r.uniforms),this.setExtensions(r.extensions)}setShaderParts(r){return this.fragmentShader=n2.replace(hn.FRAGMENT_HEAD,r.get(hn.FRAGMENT_HEAD)||"").replace(hn.FRAGMENT_MAIN_UV,r.get(hn.FRAGMENT_MAIN_UV)||"").replace(hn.FRAGMENT_MAIN_IMAGE,r.get(hn.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=i2.replace(hn.VERTEX_HEAD,r.get(hn.VERTEX_HEAD)||"").replace(hn.VERTEX_MAIN_SUPPORT,r.get(hn.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(r){for(const e of r.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(r){for(const e of r.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(r){this.extensions={};for(const e of r)this.extensions[e]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(r){this.encodeOutput!==r&&(r?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(r){return this.encodeOutput}setOutputEncodingEnabled(r){this.encodeOutput=r}get time(){return this.uniforms.time.value}set time(r){this.uniforms.time.value=r}setDeltaTime(r){this.uniforms.time.value+=r}adoptCameraSettings(r){this.copyCameraSettings(r)}copyCameraSettings(r){r&&(this.uniforms.cameraNear.value=r.near,this.uniforms.cameraFar.value=r.far,r instanceof En?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(r,e){const t=this.uniforms;t.resolution.value.set(r,e),t.texelSize.value.set(1/r,1/e),t.aspect.value=r/e}static get Section(){return hn}};function $_(r,e,t){for(const n of e){const i="$1"+r+n.charAt(0).toUpperCase()+n.slice(1),s=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(const a of t.entries())a[1]!==null&&t.set(a[0],a[1].replace(s,i))}}function s2(r,e,t){let n=e.getFragmentShader(),i=e.getVertexShader();const s=n!==void 0&&/mainImage/.test(n),a=n!==void 0&&/mainUv/.test(n);if(t.attributes|=e.getAttributes(),n===void 0)throw new Error(`Missing fragment shader (${e.name})`);if(a&&t.attributes&ss.CONVOLUTION)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!s&&!a)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{const o=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,u=t.shaderParts;let h=u.get(hn.FRAGMENT_HEAD)||"",f=u.get(hn.FRAGMENT_MAIN_UV)||"",d=u.get(hn.FRAGMENT_MAIN_IMAGE)||"",p=u.get(hn.VERTEX_HEAD)||"",g=u.get(hn.VERTEX_MAIN_SUPPORT)||"";const v=new Set,A=new Set;if(a&&(f+=` ${r}MainUv(UV); 4535`,t.uvTransformation=!0),i!==null&&/mainSupport/.test(i)){const M=/mainSupport *\([\w\s]*?uv\s*?\)/.test(i);g+=` ${r}MainSupport(`,g+=M?`vUv); 4536`:`); 4537`;for(const E of i.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const w of E[1].split(/\s*,\s*/))t.varyings.add(w),v.add(w),A.add(w);for(const E of i.matchAll(o))A.add(E[1])}for(const M of n.matchAll(o))A.add(M[1]);for(const M of e.defines.keys())A.add(M.replace(/\([\w\s,]*\)/g,""));for(const M of e.uniforms.keys())A.add(M);A.delete("while"),A.delete("for"),A.delete("if"),e.uniforms.forEac
vendor: 4,470 bytes, lines 4537-4552
4537h((M,E)=>t.uniforms.set(r+E.charAt(0).toUpperCase()+E.slice(1),M)),e.defines.forEach((M,E)=>t.defines.set(r+E.charAt(0).toUpperCase()+E.slice(1),M));const y=new Map([["fragment",n],["vertex",i]]);$_(r,A,t.defines),$_(r,A,y),n=y.get("fragment"),i=y.get("vertex");const _=e.blendMode;if(t.blendModes.set(_.blendFunction,_),s){e.inputColorSpace!==null&&e.inputColorSpace!==t.colorSpace&&(d+=e.inputColorSpace===pn?`color0 = sRGBTransferOETF(color0); 4538 `:`color0 = sRGBToLinear(color0); 4539 `),e.outputColorSpace!==xr?t.colorSpace=e.outputColorSpace:e.inputColorSpace!==null&&(t.colorSpace=e.inputColorSpace);const M=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;d+=`${r}MainImage(color0, UV, `,t.attributes&ss.DEPTH&&M.test(n)&&(d+="depth, ",t.readDepth=!0),d+=`color1); 4540 `;const E=r+"BlendOpacity";t.uniforms.set(E,_.opacity),d+=`color0 = blend${_.blendFunction}(color0, color1, ${E}); 4541 4542 `,h+=`uniform float ${E}; 4543 4544`}if(h+=n+` 4545`,i!==null&&(p+=i+` 4546`),u.set(hn.FRAGMENT_HEAD,h),u.set(hn.FRAGMENT_MAIN_UV,f),u.set(hn.FRAGMENT_MAIN_IMAGE,d),u.set(hn.VERTEX_HEAD,p),u.set(hn.VERTEX_MAIN_SUPPORT,g),e.extensions!==null)for(const M of e.extensions)t.extensions.add(M)}}var a2=class extends Fi{constructor(r,...e){super("EffectPass"),this.fullscreenMaterial=new r2(null,null,null,r),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(r){for(const e of this.effects)e.mainScene=r}set mainCamera(r){this.fullscreenMaterial.copyCameraSettings(r);for(const e of this.effects)e.mainCamera=r}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(r){this.fullscreenMaterial.encodeOutput=r}get dithering(){return this.fullscreenMaterial.dithering}set dithering(r){const e=this.fullscreenMaterial;e.dithering=r,e.needsUpdate=!0}setEffects(r){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=r.sort((e,t)=>t.attributes-e.attributes);for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const r=new jB;let e=0;for(const a of this.effects)if(a.blendMode.blendFunction===$t.DST)r.attributes|=a.getAttributes()&ss.DEPTH;else{if(r.attributes&a.getAttributes()&ss.CONVOLUTION)throw new Error(`Convolution effects cannot be merged (${a.name})`);s2("e"+e++,a,r)}let t=r.shaderParts.get(hn.FRAGMENT_HEAD),n=r.shaderParts.get(hn.FRAGMENT_MAIN_IMAGE),i=r.shaderParts.get(hn.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const a of r.blendModes.values())t+=a.getShaderCode().replace(s,`blend${a.blendFunction}`)+` 4547`;r.attributes&ss.DEPTH?(r.readDepth&&(n=`float depth = readDepth(UV); 4548 4549 `+n),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,r.colorSpace===pn&&(n+=`color0 = sRGBToLinear(color0); 4550 `),r.uvTransformation?(i=`vec2 transformedUv = vUv; 4551`+i,r.defines.set("UV","transformedUv")):r.defines.set("UV","vUv"),r.shaderParts.set(hn.FRAGMENT_HEAD,t),r.shaderParts.set(hn.FRAGMENT_MAIN_IMAGE,n),r.shaderParts.set(hn.FRAGMENT_MAIN_UV,i);for(const[a,o]of r.shaderParts)o!==null&&r.shaderParts.set(a,o.trim().replace(/^#/,` 4552#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(r)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(r,e=Us){this.fullscreenMaterial.depthBuffer=r,this.fullscreenMaterial.depthPacking=e;for(const t of this.effects)t.setDepthTexture(r,e)}render(r,e,t,n,i){for(const s of this.effects)s.update(r,e,n);if(!this.skipRendering||this.renderToScreen){const s=this.fullscreenMaterial;s.inputBuffer=e.texture,s.time+=n*this.timeScale,r.setRenderTarget(this.renderToScreen?null:t),r.render(this.scene,this.camera)}}setSize(r,e){this.fullscreenMaterial.setSize(r,e);for(const t of this.effects)t.setSize(r,e)}initialize(r,e,t){this.renderer=r;for(const n of this.effects)n.initialize(r,e,t);this.updateMaterial(),t!==void 0&&t!==Rn&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const r of this.effects)r.removeEventListener("change",this.listener),r.dispose()}handleEvent(r){switch(r.type){case"change":this.recompile();break}}},o2=class extends Fi{constructor(r,e,{renderTarget:t,resolutionScale:n=1,width:i=vi.AUTO_SIZE,height:s=vi.AUTO_SIZE,resolutionX:a=i,resolutionY:o=s}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new SA(r,e,new Zm);const u=this.renderPass;
4552u.ignoreBackground=!0,u.skipShadowMapUpdate=!0;const h=u.getClearPass();h.overrideClearColor=new je(7829503),h.overrideClearAlpha=1,this.renderTarget=t,this.renderTarget===void 0&&(this.renderTarget=new bn(1,1,{minFilter:xn,magFilter:xn}),this.renderTarget.texture.name="NormalPass.Target");const f=this.resolution=new vi(this,a,o,n);f.addEventListener("change",d=>this.setSize(f.baseWidth,f.baseHeight))}set mainScene(r){this.renderPass.mainScene=r}set mainCamera(r){this.renderPass.mainCamera=r}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}render(r,e,t,n,i){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(r,s,s)}setSize(r,e){const t=this.resolution;t.setBaseSize(r,e),this.renderTarget.setSize(t.width,t.height)}};const l2=dt.createContext(null),ex=r=>(r.getAttributes()&ss.CONVOLUTION)===ss.CONVOLUTION,C2=Xp.memo(dt.forwardRef(({children:r,camera:e,scene:t,resolutionScale:n,enabled:i=!0,renderPriority:s=1,autoClear:a=!0,depthBuffer:o,enableNormalPass:u,stencilBuffer:h,multisampling:f=8,frameBufferType:d=Vn},p)=>{const{gl:g,scene:v,camera:A,size:y}=iA(),_=t||v,M=e||A,[E,w,B]=dt.useMemo(()=>{const F=LI(),b=new qB(g,{depthBuffer:o,stencilBuffer:h,multisampling:f>0&&F?f:0,frameBufferType:d});b.addPass(new SA(_,M));let C=null,U=null;return u&&(U=new o2(_,M),U.enabled=!1,b.addPass(U),n!==void 0&&F&&(C=new $P({normalBuffer:U.texture,resolutionScale:n}),C.enabled=!1,b.addPass(C))),[b,U,C]},[M,g,o,h,f,d,_,u,n]);dt.useEffect(()=>E?.setSize(y.width,y.height),[E,y]),fI((F,b)=>{if(i){const C=g.autoClear;g.autoClear=a,h&&!a&&g.clearStencil(),E.render(b),g.autoClear=C}},i?s:0);const P=dt.useRef(null);dt.useLayoutEffect(()=>{var F;const b=[],C=(F=P.current)==null?void 0:F.__r3f;if(C&&E){const U=C.objects;for(let V=0;V<U.length;V++){const J=U[V];if(J instanceof jh){const Q=[J];if(!ex(J)){let q=null;for(;(q=U[V+1])instanceof jh&&!ex(q);)Q.push(q),V++}const oe=new a2(M,...Q);b.push(oe)}else J instanceof Fi&&b.push(J)}for(const V of b)E?.addPass(V);w&&(w.enabled=!0),B&&(B.enabled=!0)}return()=>{for(const U of b)E?.removePass(U);w&&(w.enabled=!1),B&&(B.enabled=!1)}},[E,r,M,w,B]),dt.useEffect(()=>{const F=g.toneMapping;return g.toneMapping=Wi,()=>{g.toneMapping=F}},[g]);const D=dt.useMemo(()=>({composer:E,normalPass:w,downSamplingPass:B,resolutionScale:n,camera:M,scene:_}),[E,w,B,n,M,_]);return dt.useImperativeHandle(p,()=>E,[E]),jn.jsx(l2.Provider,{value:D,children:jn.jsx("group",{ref:P,children:r})})}));let c2=0;const tx=new WeakMap,MA=(r,e)=>Xp.forwardRef(function({blendFunction:n=e?.blendFunction,opacity:i=e?.opacity,...s},a){let o=tx.get(r);if(!o){const f=`@react-three/postprocessing/${r.name}-${c2++}`;Jy({[f]:r}),tx.set(r,o=f)}const u=iA(f=>f.camera),h=Xp.useMemo(()=>{var f,d;return[...(f=e?.args)!=null?f:[],...(d=s.args)!=null?d:[{...e,...s}]]},[JSON.stringify(s)]);return jn.jsx(o,{camera:u,"blendMode-blendFunction":n,"blendMode-opacity-value":i,...s,ref:a,args:h})}),R2=MA(ZP,{blendFunction:$t.ADD}),I2=MA(t2);export{pn as $,ko as A,ri as B,m2 as C,w2 as D,C2 as E,In as F,y2 as G,A2 as H,bi as I,nf as J,Mm as K,Tx as L,b2 as M,Sm as N,qt as O,ki as P,Ji as Q,Ua as R,Bn as S,yn as T,Lm as U,N as V,bn as W,Rn as X,_i as Y,tg as Z,mS as _,f1 as a,Yi as a0,ii as a1,Or as a2,Yl as a3,kE as a4,M2 as a5,E2 as a6,v2 as a7,Fm as a8,p2 as a9,Lt as aA,sn as aB,Li as aC,Mo as aa,g2 as ab,xy as ac,am as ad,mc as ae,sE as af,Ds as ag,or as ah,bx as ai,on as aj,qm as ak,vS as al,Vt as am,It as an,_e as ao,Ey as ap,ei as aq,Ia as ar,zt as as,gn as at,$n as au,VR as av,Ba as aw,_2 as ax,df as ay,xn as az,fI as b,iA as c,x2 as d,_y as e,ot as f,Qm as g,je as h,S2 as i,R2 as j,I2 as k,Hx as l,Jy as m,$r as n,Hn as o,wi as p,rn as q,ec as r,Sr as s,Vn as t,sA as u,ni as v,ef as w,Oy as x,Ar as y,as as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.