1var tM=Object.defineProperty;var nM=(r,e,t)=>e in r?tM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var gn=(r,e,t)=>nM(r,typeof e!="symbol"?e+"":e,t);import{b as iM,a as He,r as rM,g as sM}from"./react-vendor-jXSaP3hU.js";import{j as ri}from"./motion-vendor-DL5VjzrS.js";var Oc={},wv;function oM(){if(wv)return Oc;wv=1;var r=iM();return Oc.createRoot=r.createRoot,Oc.hydrateRoot=r.hydrateRoot,Oc}var UB=oM();const aM="modulepreload",lM=function(r){return"/"+r},Cv={},NB=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let o=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(t.map(h=>{if(h=lM(h),h in Cv)return;Cv[h]=!0;const f=h.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${d}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":aM,f||(p.as="script"),p.crossOrigin="",p.href=h,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((g,v)=>{p.addEventListener("load",g),p.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};/** 2 * @license 3 * Copyright 2010-2025 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Rl="175",cM={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},uM={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},U_=0,yp=1,N_=2,hM=3,O_=0,Th=1,sl=2,qi=3,dr=0,ai=1,Oi=2,ur=0,eo=1,xp=2,Ap=3,Mp=4,H_=5,ls=100,G_=101,k_=102,z_=103,V_=104,W_=200,X_=201,J_=202,Y_=203,ku=204,zu=205,K_=206,Z_=207,q_=208,Q_=209,j_=210,$_=211,ey=212,ty=213,ny=214,Vu=0,Wu=1,Xu=2,ro=3,Ju=4,Yu=5,Ku=6,Zu=7,Il=0,iy=1,ry=2,hr=0,sy=1,oy=2,ay=3,zp=4,ly=5,cy=6,uy=7,Sp="attached",hy="detached",fs=300,pr=301,ds=302,ia=303,ml=304,ga=306,ps=1e3,An=1001,ra=1002,Nn=1003,bh=1004,fM=1004,Ys=1005,dM=1005,Qt=1006,$o=1007,pM=1007,Gi=1008,Ep=1008,gi=1009,Rh=1010,Ih=1011,sa=1012,Bl=1013,mr=1014,dn=1015,Un=1016,Bh=1017,Ph=1018,oa=1020,Vp=35902,Wp=1021,Xp=1022,Mn=1023,Jp=1024,Yp=1025,aa=1026,la=1027,Pl=1028,Dl=1029,Kp=1030,Dh=1031,mM=1032,Lh=1033,ol=33776,al=33777,ll=33778,cl=33779,qu=35840,Qu=35841,ju=35842,$u=35843,eh=36196,th=37492,nh=37496,ih=37808,rh=37809,sh=37810,oh=37811,ah=37812,lh=37813,ch=37814,uh=37815,hh=37816,fh=37817,dh=37818,ph=37819,mh=37820,gh=37821,ul=36492,vh=36494,_h=36495,Zp=36283,yh=36284,xh=36285,Ah=36286,fy=2200,dy=2201,py=2202,ca=2300,ua=2301,Uu=2302,Ks=2400,Zs=2401,gl=2402,Fh=2500,qp=2501,my=0,Qp=1,Mh=2,gy=3200,vy=3201,gM=3202,vM=3203,gs=0,_y=1,Pr="",si="srgb",gr="srgb-linear",vl="linear",$t="srgb",_M=0,Ws=7680,yM=7681,xM=7682,AM=7683,MM=34055,SM=34056,EM=5386,wM=512,CM=513,TM=514,bM=515,RM=516,IM=517,BM=518,wp=519,yy=512,xy=513,Ay=514,jp=515,My=516,Sy=517,Ey=518,wy=519,_l=35044,PM=35048,DM=35040,LM=35045,FM=35049,UM=35041,NM=35046,OM=35050,HM=35042,GM="100",Cp="300 es",ji=2e3,yl=2001,kM={COMPUTE:"compute",RENDER:"render"};class vr{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,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const Yn=["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 Tv=1234567;const to=Math.PI/180,ha=180/Math.PI;function Ci(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Yn[r&255]+Yn[r>>8&255]+Yn[r>>16&255]+Yn[r>>24&255]+"-"+Yn[e&255]+Yn[e>>8&255]+"-"+Yn[e>>16&15|64]+Yn[e>>24&255]+"-"+Yn[t&63|128]+Yn[t>>8&255]+"-"+Yn[t>>16&255]+Yn[t>>24&255]+Yn[n&255]+Yn[n>>8&255]+Yn[n>>16&255]+Yn[n>>24&255]).toLowerCase()}function St(r,e,t){return Math.max(e,Math.min(t,r))}function $p(r,e){return(r%e+e)%e}function zM(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function VM(r,e,t){return r!==e?(t-r)/(e-r):0}function hl(r,e,t){return(1-t)*r+t*e}function WM(r,e,t,n){return hl(r,e,1-Math.exp(-t*n))}function XM(r,e=1){return e-Math.abs($p(r,e*2)-e)}function JM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function YM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function KM(r,e){return r+Math.floor(Math.random()*(e-r+1))}function ZM(r,e){return r+Math.random()*(e-r)}function qM(r){return r*(.5-Math.random())}function QM(r){r!==void 0&&(Tv=r);let e=Tv+=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 jM(r){return r*to}function $M(r){return r*ha}function eS(r){return(r&r-1)===0&&r!==0}function tS(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function nS(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function iS(r,e,t,n,i){const s=Math.cos,o=Math.sin,l=s(t/2),u=o(t/2),h=s((e+n)/2),f=o((e+n)/2),d=s((e-n)/2),p=o((e-n)/2),g=s((n-e)/2),v=o((n-e)/2);switch(i){case"XYX":r.set(l*f,u*d,u*p,l*h);break;case"YZY":r.set(u*p,l*f,u*d,l*h);break;case"ZXZ":r.set(u*d,u*p,l*f,l*h);break;case"XZX":r.set(l*f,u*v,u*g,l*h);break;case"YXY":r.set(u*g,l*f,u*v,l*h);break;case"ZYZ":r.set(u*v,u*g,l*f,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function oi(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 Pt(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 Cy={DEG2RAD:to,RAD2DEG:ha,generateUUID:Ci,clamp:St,euclideanModulo:$p,mapLinear:zM,inverseLerp:VM,lerp:hl,damp:WM,pingpong:XM,smoothstep:JM,smootherstep:YM,randInt:KM,randFloat:ZM,randFloatSpread:qM,seededRandom:QM,degToRad:jM,radToDeg:$M,isPowerOfTwo:eS,ceilPowerOfTwo:tS,floorPowerOfTwo:nS,setQuaternionFromProperEuler:iS,normalize:Pt,denormalize:oi};class be{constructor(e=0,t=0){be.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: 7,734 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=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(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(St(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,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class bt{constructor(e,t,n,i,s,o,l,u,h){bt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,l,u,h)}set(e,t,n,i,s,o,l,u,h){const f=this.elements;return f[0]=e,f[1]=i,f[2]=l,f[3]=t,f[4]=s,f[5]=u,f[6]=n,f[7]=o,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,o=n[0],l=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],x=i[3],_=i[6],S=i[1],E=i[4],w=i[7],L=i[2],B=i[5],F=i[8];return s[0]=o*A+l*S+u*L,s[3]=o*x+l*E+u*B,s[6]=o*_+l*w+u*F,s[1]=h*A+f*S+d*L,s[4]=h*x+f*E+d*B,s[7]=h*_+f*w+d*F,s[2]=p*A+g*S+v*L,s[5]=p*x+g*E+v*B,s[8]=p*_+g*w+v*F,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],o=e[4],l=e[5],u=e[6],h=e[7],f=e[8];return t*o*f-t*l*h-n*s*f+n*l*u+i*s*h-i*o*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],h=e[7],f=e[8],d=f*o-l*h,p=l*u-f*s,g=h*s-o*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]=(l*n-i*o)*A,e[3]=p*A,e[4]=(f*t-i*u)*A,e[5]=(i*s-l*t)*A,e[6]=g*A,e[7]=(n*u-h*t)*A,e[8]=(o*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,o,l){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*o+h*l)+o+e,-i*h,i*u,-i*(-h*o+u*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(ud.makeScale(e,t)),this}rotate(e){return this.premultiply(ud.makeRotation(-e)),this}translate(e,t){return this.premultiply(ud.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 ud=new bt;function Ty(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const rS={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function qo(r,e){return new rS[r](e)}function xl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function by(){const r=xl("canvas");return r.style.display="block",r}const bv={};function Nu(r){r in bv||(bv[r]=!0,console.warn(r))}function sS(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)})}function oS(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function aS(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Rv=new bt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Iv=new bt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function lS(){const r={enabled:!0,workingColorSpace:gr,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===$t&&(i.r=Ur(i.r),i.g=Ur(i.g),i.b=Ur(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===$t&&(i.r=ea(i.r),i.g=ea(i.g),i.b=ea(i.b))),i},fromWorkingColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},toWorkingColorSpace:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Pr?vl:this.spaces[i].transfer},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,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.space
vendor: 4,548 bytes, line 5
5s[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[gr]:{primaries:e,whitePoint:n,transfer:vl,toXYZ:Rv,fromXYZ:Iv,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:si},outputColorSpaceConfig:{drawingBufferColorSpace:si}},[si]:{primaries:e,whitePoint:n,transfer:$t,toXYZ:Rv,fromXYZ:Iv,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:si}}}),r}const Xt=lS();function Ur(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function ea(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Ro;class Ry{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{Ro===void 0&&(Ro=xl("canvas")),Ro.width=e.width,Ro.height=e.height;const i=Ro.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ro}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=xl("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 o=0;o<s.length;o++)s[o]=Ur(s[o]/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(Ur(t[n]/255)*255):t[n]=Ur(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let cS=0;class cs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:cS++}),this.uuid=Ci(),this.data=e,this.dataReady=!0,this.version=0}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 o=0,l=i.length;o<l;o++)i[o].isDataTexture?s.push(hd(i[o].image)):s.push(hd(i[o]))}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?Ry.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let uS=0;class jt extends vr{constructor(e=jt.DEFAULT_IMAGE,t=jt.DEFAULT_MAPPING,n=An,i=An,s=Qt,o=Gi,l=Mn,u=gi,h=jt.DEFAULT_ANISOTROPY,f=Pr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:uS++}),this.uuid=Ci(),this.name="",this.source=new cs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=h,this.format=l,this.internalFormat=null,this.type=u,this.offset=new be(0,0),this.repeat=new be(1,1),this.center=new be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new bt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace
vendor: 5,622 bytes, line 5
5=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}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.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==fs)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ps:e.x=e.x-Math.floor(e.x);break;case An:e.x=e.x<0?0:1;break;case ra: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 ps:e.y=e.y-Math.floor(e.y);break;case An:e.y=e.y<0?0:1;break;case ra: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++}}jt.DEFAULT_IMAGE=null;jt.DEFAULT_MAPPING=fs;jt.DEFAULT_ANISOTROPY=1;class Jt{constructor(e=0,t=0,n=0,i=1){Jt.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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[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],x=u[6],_=u[10];if(Math.abs(f-p)<.01&&Math.abs(d-A)<.01&&Math.abs(v-x)<.01){if(Math.abs(f+p)<.1&&Math.abs(d+A)<.1&&Math.abs(v+x)<.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,L=(_+1)/2,B=(f+p)/4,F=(d+A)/4,D=(v+x)/4;return E>w&&E>L?E<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(E),i=B/n,s=F/n):w>L?w<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(w),n=B/i,s=D/i):L<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(L),n=F/s,i=D/s),this.set(n,i,s,t),this}let S=Math.sqrt((x-v)*(x-v)+(d-A)*(d-A)+(p-f)*(p-f));return Math.abs(S)<.001&&(S=1),this.x=(x-v)/S,this.y=(d-A)/S,this.z=(p-f)/S,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=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this.w=St(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this.w=St(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(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}
vendor: 4,338 bytes, line 5
5round(){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 Uh extends vr{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Jt(0,0,e,t),this.scissorTest=!1,this.viewport=new Jt(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new jt(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let l=0;l<o;l++)this.textures[l]=s.clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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.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 cs(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 ki extends Uh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Ll extends jt{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=Nn,this.minFilter=Nn,this.wrapR=An,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class hS extends ki{constructor(e=1,t=1,n=1,i={}
vendor: 6,235 bytes, line 5
5){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Ll(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Nh extends jt{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=Nn,this.minFilter=Nn,this.wrapR=An,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class fS extends ki{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Nh(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class qn{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,o,l){let u=n[i+0],h=n[i+1],f=n[i+2],d=n[i+3];const p=s[o+0],g=s[o+1],v=s[o+2],A=s[o+3];if(l===0){e[t+0]=u,e[t+1]=h,e[t+2]=f,e[t+3]=d;return}if(l===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 x=1-l;const _=u*p+h*g+f*v+d*A,S=_>=0?1:-1,E=1-_*_;if(E>Number.EPSILON){const L=Math.sqrt(E),B=Math.atan2(L,_*S);x=Math.sin(x*B)/L,l=Math.sin(l*B)/L}const w=l*S;if(u=u*x+p*w,h=h*x+g*w,f=f*x+v*w,d=d*x+A*w,x===1-l){const L=1/Math.sqrt(u*u+h*h+f*f+d*d);u*=L,h*=L,f*=L,d*=L}}e[t]=u,e[t+1]=h,e[t+2]=f,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,i,s,o){const l=n[i],u=n[i+1],h=n[i+2],f=n[i+3],d=s[o],p=s[o+1],g=s[o+2],v=s[o+3];return e[t]=l*v+f*d+u*g-h*p,e[t+1]=u*v+f*p+h*d-l*g,e[t+2]=h*v+f*g+l*p-u*d,e[t+3]=f*v-l*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,o=e._order,l=Math.cos,u=Math.sin,h=l(n/2),f=l(i/2),d=l(s/2),p=u(n/2),g=u(i/2),v=u(s/2);switch(o){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:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=t[1],l=t[5],u=t[9],h=t[2],f=t[6],d=t[10],p=n+l+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=(o-i)*g}else if(n>l&&n>d){const g=2*Math.sqrt(1+n-l-d);this._w=(f-u)/g,this._x=.25*g,this._y=(i+o)/g,this._z=(s+h)/g}else if(l>d){const g=2*Math.sqrt(1+l-n-d);this._w=(s-h)/g,this._x=(i+o)/g,this._y=.25*g,this._z=(u+f)/g}else{const g=2*Math.sqrt(1+d-n-l);this._w=(o-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<Number.EPSILON?(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(St(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,o=e._w,l=t._x,u=t._y,h=t._z,f=t._w;return this._x=n*f+o*l+i*h-s*u,this._y=i*f+o*u+s*l-n*h,this._z=s*f+o*h+n*u-i*l,this._w=o*f-n*l-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let l=o*e._w+n*e._x+i*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const u=1-l*l;if(u<=Number.EPSILON){const g=1-t;return this._w=g*o+t*this._w,this._x=g*n+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),f=Math.atan2(h,l),d=Math.sin((1-t)*f)/h,p=Math.sin(t*f)/h;return this._w=o*d+this._w*p,this._x=n*d+this._x*p,this._y=i*d+this._y*p,this._z=s*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),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()}
vendor: 4,147 bytes, line 5
5_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class H{constructor(e=0,t=0,n=0){H.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(Bv.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Bv.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,o=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])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,l=e.z,u=e.w,h=2*(o*i-l*n),f=2*(l*t-s*i),d=2*(s*n-o*t);return this.x=t+u*h+o*d-l*f,this.y=n+u*f+l*h-s*d,this.z=i+u*d+s*f-o*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=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(St(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}
vendor: 4,115 bytes, line 5
5lerpVectors(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,o=t.x,l=t.y,u=t.z;return this.x=i*u-s*l,this.y=s*o-n*u,this.z=n*l-i*o,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 fd.copy(this).projectOnVector(e),this.sub(fd)}reflect(e){return this.sub(fd.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(St(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 fd=new H,Bv=new qn;class Qn{constructor(e=new H(1/0,1/0,1/0),t=new H(-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(Ji.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ji.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=Ji.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 o=0,l=s.count;o<l;o++)e.isMesh===!0?e.getVertexPosition(o,Ji):Ji.fromBufferAttribute(s,o),Ji.applyMatrix4(e.matrixWorld),this.expandByPoint(Ji
vendor: 4,594 bytes, line 5
5);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Hc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Hc.copy(n.boundingBox)),Hc.applyMatrix4(e.matrixWorld),this.union(Hc)}const i=e.children;for(let s=0,o=i.length;s<o;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,Ji),Ji.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(Ha),Gc.subVectors(this.max,Ha),Io.subVectors(e.a,Ha),Bo.subVectors(e.b,Ha),Po.subVectors(e.c,Ha),qr.subVectors(Bo,Io),Qr.subVectors(Po,Bo),Is.subVectors(Io,Po);let t=[0,-qr.z,qr.y,0,-Qr.z,Qr.y,0,-Is.z,Is.y,qr.z,0,-qr.x,Qr.z,0,-Qr.x,Is.z,0,-Is.x,-qr.y,qr.x,0,-Qr.y,Qr.x,0,-Is.y,Is.x,0];return!dd(t,Io,Bo,Po,Gc)||(t=[1,0,0,0,1,0,0,0,1],!dd(t,Io,Bo,Po,Gc))?!1:(kc.crossVectors(qr,Qr),t=[kc.x,kc.y,kc.z],dd(t,Io,Bo,Po,Gc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ji).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ji).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:(wr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wr),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 wr=[new H,new H,new H,new H,new H,new H,new H,new H],Ji=new H,Hc=new Qn,Io=new H,Bo=new H,Po=new H,qr=new H,Qr=new H,Is=new H,Ha=new H,Gc=new H,kc=new H,Bs=new H;function dd(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Bs.fromArray(r,s);const l=i.x*Math.abs(Bs.x)+i.y*Math.abs(Bs.y)+i.z*Math.abs(Bs.z),u=e.dot(Bs),h=t.dot(Bs),f=n.dot(Bs);if(Math.max(-Math.max(u,h,f),Math.min(u,h,f))>l)return!1}return!0}const dS=new Qn,Ga=new H,pd=new H;class Hn{constructor(e=new H,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):dS.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;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)}
vendor: 17,999 bytes, line 5
5applyMatrix4(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;Ga.subVectors(e,this.center);const t=Ga.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ga,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):(pd.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ga.copy(e.center).add(pd)),this.expandByPoint(Ga.copy(e.center).sub(pd))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Cr=new H,md=new H,zc=new H,jr=new H,gd=new H,Vc=new H,vd=new H;class va{constructor(e=new H,t=new H(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,Cr)),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=Cr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Cr.copy(this.origin).addScaledVector(this.direction,t),Cr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){md.copy(e).add(t).multiplyScalar(.5),zc.copy(t).sub(e).normalize(),jr.copy(this.origin).sub(md);const s=e.distanceTo(t)*.5,o=-this.direction.dot(zc),l=jr.dot(this.direction),u=-jr.dot(zc),h=jr.lengthSq(),f=Math.abs(1-o*o);let d,p,g,v;if(f>0)if(d=o*u-l,p=o*l-u,v=s*f,d>=0)if(p>=-v)if(p<=v){const A=1/f;d*=A,p*=A,g=d*(d+o*p+2*l)+p*(o*d+p+2*u)+h}else p=s,d=Math.max(0,-(o*p+l)),g=-d*d+p*(p+2*u)+h;else p=-s,d=Math.max(0,-(o*p+l)),g=-d*d+p*(p+2*u)+h;else p<=-v?(d=Math.max(0,-(-o*s+l)),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,-(o*s+l)),p=d>0?s:Math.min(Math.max(-s,-u),s),g=-d*d+p*(p+2*u)+h);else p=o>0?-s:s,d=Math.max(0,-(o*p+l)),g=-d*d+p*(p+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(md).addScaledVector(zc,p),g}intersectSphere(e,t){Cr.subVectors(e.center,this.origin);const n=Cr.dot(this.direction),i=Cr.dot(Cr)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),l=n-o,u=n+o;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return 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,o,l,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,o=(e.max.y-p.y)*f):(s=(e.max.y-p.y)*f,o=(e.min.y-p.y)*f),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),d>=0?(l=(e.min.z-p.z)*d,u=(e.max.z-p.z)*d):(l=(e.max.z-p.z)*d,u=(e.min.z-p.z)*d),n>u||l>i)||((l>n||n!==n)&&(n=l),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Cr)!==null}intersectTriangle(e,t,n,i,s){gd.subVectors(t,e),Vc.subVectors(n,e),vd.crossVectors(gd,Vc);let o=this.direction.dot(vd),l;if(o>0){if(i)return null;l=1}else if(o<0)l=-1,o=-o;else return null;jr.subVectors(this.origin,e);const u=l*this.direction.dot(Vc.crossVectors(jr,Vc));if(u<0)return null;const h=l*this.direction.dot(gd.cross(jr));if(h<0||u+h>o)return null;const f=-l*jr.dot(vd);return f<0?null:this.at(f/o,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 gt{constructor(e,t,n,i,s,o,l,u,h,f,d,p,g,v,A,x){gt.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,o,l,u,h,f,d,p,g,v,A,x)}set(e,t,n,i,s,o,l,u,h,f,d,p,g,v,A,x){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=s,_[5]=o,_[9]=l,_[13]=u,_[2]=h,_[6]=f,_[10]=d,_[14]=p,_[3]=g,_[7]=v,_[11]=A,_[15]=x,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 gt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Do.setFromMatrixColumn(e,0).length(),s=1/Do.setFromMatrixColumn(e,1).length(),o=1/Do.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),l=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=o*f,g=o*d,v=l*f,A=l*d;t[0]=u*f,t[4]=-u*d,t[8]=h,t[1]=g+v*h,t[5]=p-A*h,t[9]=-l*u,t[2]=A-p*h,t[6]=v+g*h,t[10]=o*u}else if(e.order==="YXZ"){const p=u*f,g=u*d,v=h*f,A=h*d;t[0]=p+A*l,t[4]=v*l-g,t[8]=o*h,t[1]=o*d,t[5]=o*f,t[9]=-l,t[2]=g*l-v,t[6]=A+p*l,t[10]=o*u}else if(e.order==="ZXY"){const p=u*f,g=u*d,v=h*f,A=h*d;t[0]=p-A*l,t[4]=-o*d,t[8]=v+g*l,t[1]=g+v*l,t[5]=o*f,t[9]=A-p*l,t[2]=-o*h,t[6]=l,t[10]=o*u}else if(e.order==="ZYX"){const p=o*f,g=o*d,v=l*f,A=l*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]=l*u,t[10]=o*u}else if(e.order==="YZX"){const p=o*u,g=o*h,v=l*u,A=l*h;t[0]=u*f,t[4]=A-p*d,t[8]=v*d+g,t[1]=d,t[5]=o*f,t[9]=-l*f,t[2]=-h*f,t[6]=g*d+v,t[10]=p-A*d}else if(e.order==="XZY"){const p=o*u,g=o*h,v=l*u,A=l*h;t[0]=u*f,t[4]=-d,t[8]=h*f,t[1]=p*d+A,t[5]=o*f,t[9]=g*d-v,t[2]=v*d-g,t[6]=l*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(pS,e,mS)}lookAt(e,t,n){const i=this.elements;return Ei.subVectors(e,t),Ei.lengthSq()===0&&(Ei.z=1),Ei.normalize(),$r.crossVectors(n,Ei),$r.lengthSq()===0&&(Math.abs(n.z)===1?Ei.x+=1e-4:Ei.z+=1e-4,Ei.normalize(),$r.crossVectors(n,Ei)),$r.normalize(),Wc.crossVectors(Ei,$r),i[0]=$r.x,i[4]=Wc.x,i[8]=Ei.x,i[1]=$r.y,i[5]=Wc.y,i[9]=Ei.y,i[2]=$r.z,i[6]=Wc.z,i[10]=Ei.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,o=n[0],l=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],x=n[10],_=n[14],S=n[3],E=n[7],w=n[11],L=n[15],B=i[0],F=i[4],D=i[8],T=i[12],b=i[1],N=i[5],Y=i[9],K=i[13],Q=i[2],oe=i[6],ee=i[10],Me=i[14],G=i[3],te=i[7],q=i[11],ce=i[15];return s[0]=o*B+l*b+u*Q+h*G,s[4]=o*F+l*N+u*oe+h*te,s[8]=o*D+l*Y+u*ee+h*q,s[12]=o*T+l*K+u*Me+h*ce,s[1]=f*B+d*b+p*Q+g*G,s[5]=f*F+d*N+p*oe+g*te,s[9]=f*D+d*Y+p*ee+g*q,s[13]=f*T+d*K+p*Me+g*ce,s[2]=v*B+A*b+x*Q+_*G,s[6]=v*F+A*N+x*oe+_*te,s[10]=v*D+A*Y+x*ee+_*q,s[14]=v*T+A*K+x*Me+_*ce,s[3]=S*B+E*b+w*Q+L*G,s[7]=S*F+E*N+w*oe+L*te,s[11]=S*D+E*Y+w*ee+L*q,s[15]=S*T+E*K+w*Me+L*ce,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],o=e[1],l=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],x=e[11],_=e[15];return v*(+s*u*d-i*h*d-s*l*p+n*h*p+i*l*g-n*u*g)+A*(+t*u*g-t*h*p+s*o*p-i*o*g+i*h*f-s*u*f)+x*(+t*h*d-t*l*g-s*o*d+n*o*g+s*l*f-n*h*f)+_*(-i*l*f-t*u*d+t*l*p+i*o*d-n*o*p+n*u*f)}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],o=e[4],l=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],x=e[14],_=e[15],S=d*x*h-A*p*h+A*u*g-l*x*g-d*u*_+l*p*_,E=v*p*h-f*x*h-v*u*g+o*x*g+f*u*_-o*p*_,w=f*A*h-v*d*h+v*l*g-o*A*g-f*l*_+o*d*_,L=v*d*u-f*A*u-v*l*p+o*A*p+f*l*x-o*d*x,B=t*S+n*E+i*w+s*L;if(B===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/B;return e[0]=S*F,e[1]=(A*p*s-d*x*s-A*i*g+n*x*g+d*i*_-n*p*_)*F,e[2]=(l*x*s-A*u*s+A*i*h-n*x*h-l*i*_+n*u*_)*F,e[3]=(d*u*s-l*p*s-d*i*h+n*p*h+l*i*g-n*u*g)*F,e[4]=E*F,e[5]=(f*x*s-v*p*s+v*i*g-t*x*g-f*i*_+t*p*_)*F,e[6]=(v*u*s-o*x*s-v*i*h+t*x*h+o*i*_-t*u*_)*F,e[7]=(o*p*s-f*u*s+f*i*h-t*p*h-o*i*g+t*u*g)*F,e[8]=w*F,e[9]=(v*d*s-f*A*s-v*n*g+t*A*g+f*n*_-t*d*_)*F,e[10]=(o*A*s-v*l*s+v*n*h-t*A*h-o*n*_+t*l*_)*F,e[11]=(f*l*s-o*d*s-f*n*h+t*d*h+o*n*g-t*l*g)*F,e[12]=L*F,e[13]=(f*A*i-v*d*i+v*n*p-t*A*p-f*n*x+t*d*x)*F,e[14]=(v*l*i-o*A*i-v*n*u+t*A*u+o*n*x-t*l*x)*F,e[15]=(o*d*i-f*l*i+f*n*u-t*d*u-o*n*p+t*l*p)*F,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,o=e.x,l=e.y,u=e.z,h=s*o,f=s*l;return this.set(h*o+n,h*l-i*u,h*u+i*l,0,h*l+i*u,f*l+n,f*u-i*o,0,h*u-i*l,f*u+i*o,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,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,l=t._z,u=t._w,h=s+s,f=o+o,d=l+l,p=s*h,g=s*f,v=s*d,A=o*f,x=o*d,_=l*d,S=u*h,E=u*f,w=u*d,L=n.x,B=n.y,F=n.z;return i[0]=(1-(A+_))*L,i[1]=(g+w)*L,i[2]=(v-E)*L,i[3]=0,i[4]=(g-w)*B,i[5]=(1-(p+_))*B,i[6]=(x+S)*B,i[7]=0,i[8]=(v+E)*F,i[9]=(x-S)*F,i[10]=(1-(p+A))*F,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;let s=Do.set(i[0],i[1],i[2]).length();const o=Do.set(i[4],i[5],i[6]).length(),l=Do.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Yi.copy(this);const h=1/s,f=1/o,d=1/l;return Yi.elements[0]*=h,Yi.elements[1]*=h,Yi.elements[2]*=h,Yi.elements[4]*=f,Yi.elements[5]*=f,Yi.elements[6]*=f,Yi.elements[8]*=d,Yi.elements[9]*=d,Yi.elements[10]*=d,t.setFromRotationMatrix(Yi),n.x=s,n.y=o,n.z=l,this}makePerspective(e,t,n,i,s,o,l=ji){const u=this.elements,h=2*s/(t-e),f=2*s/(n-i),d=(t+e)/(t-e),p=(n+i)/(n-i);let g,v;if(l===ji)g=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(l===yl)g=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return u[0]=h,u[4]=0,u[8]=d,u[12]=0,u[1]=0,u[5]=f,u[9]=p,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=v,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,s,o,l=ji){const u=this.elements,h=1/(t-e),f=1/(n-i),d=1/(o-s),p=(t+e)*h,g=(n+i)*f;let v,A;if(l===ji)v=(o+s)*d,A=-2*d;else if(l===yl)v=s*d,A=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-p,u[1]=0,u[5]=2*f,u[9]=0,u[13]=-g,u[2]=0,u[6]=0,u[10]=A,u[14]=-v,u[3]=0,u[7]=0,u[11]=0,u[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 Do=new H,Yi=new gt,pS=new H(0,0,0),mS=new H(1,1,1),$r=new H,Wc=new H,Ei=new H,Pv=new gt,Dv=new qn;class Ti{constructor(e=0,t=0,n=0,i=Ti.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],o=i[4],l=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(St(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-St(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(St(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,g),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-St(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(-o,h));break;case"YZX":this._z=Math.asin(St(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(l,g));break;case"XZY":this._z=Math.asin(-St(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-f,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Pv.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pv,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Dv.setFromEuler(this),this.setFromQuaternion(Dv,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}}Ti.DEFAULT_ORDER="XYZ";class no{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 gS=0;const Lv=new H,Lo=new qn,Tr=new gt,Xc=new H,ka=new H,vS=new H,_S=new qn,Fv=new H(1,0,0),Uv=new H(0,1,0),Nv=new H(0,0,1),Ov={type:"added"},yS={type:"removed"},Fo={type:"childadded",child:null},_d={type:"childremoved",child:null};class zt extends vr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gS++}),this.uuid=Ci(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=zt.DEFAULT_UP.clone();const e=new H,t=new Ti,n=new qn,i=new H(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),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 gt},normalMatrix:{value:new bt}}),this.matrix=new gt,this.matrixWorld=new gt,this.matrixAutoUpdate=zt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new no,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)}
vendor: 4,289 bytes, line 5
5setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Lo.setFromAxisAngle(e,t),this.quaternion.multiply(Lo),this}rotateOnWorldAxis(e,t){return Lo.setFromAxisAngle(e,t),this.quaternion.premultiply(Lo),this}rotateX(e){return this.rotateOnAxis(Fv,e)}rotateY(e){return this.rotateOnAxis(Uv,e)}rotateZ(e){return this.rotateOnAxis(Nv,e)}translateOnAxis(e,t){return Lv.copy(e).applyQuaternion(this.quaternion),this.position.add(Lv.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Fv,e)}translateY(e){return this.translateOnAxis(Uv,e)}translateZ(e){return this.translateOnAxis(Nv,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Tr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Xc.copy(e):Xc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ka.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Tr.lookAt(ka,Xc,this.up):Tr.lookAt(Xc,ka,this.up),this.quaternion.setFromRotationMatrix(Tr),i&&(Tr.extractRotation(i.matrixWorld),Lo.setFromRotationMatrix(Tr),this.quaternion.premultiply(Lo.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ov),Fo.child=e,this.dispatchEvent(Fo),Fo.child=null):console.error("THREE.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(yS),_d.child=e,this.dispatchEvent(_d),_d.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),Tr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Tr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Tr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ov),Fo.child=e,this.dispatchEvent(Fo),Fo.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 o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;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(ka,e,vS),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ka,_S,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
vendor: 5,733 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;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.6,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.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(l,u){return l[u.uuid]===void 0&&(l[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 l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.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 l=[];for(let u=0,h=this.material.length;u<h;u++)l.push(s(e.materials,this.material[u]));i.material=l}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let l=0;l<this.children.length;l++)i.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let l=0;l<this.animations.length;l++){const u=this.animations[l];i.animations.push(s(e.animations,u))}}if(t){const l=o(e.geometries),u=o(e.materials),h=o(e.textures),f=o(e.images),d=o(e.shapes),p=o(e.skeletons),g=o(e.animations),v=o(e.nodes);l.length>0&&(n.geometries=l),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 o(l){const u=[];for(const h in l){const f=l[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}}zt.DEFAULT_UP=new H(0,1,0);zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ki=new H,br=new H,yd=new H,Rr=new H,Uo=new H,No=new H,Hv=new H,xd=new H,Ad=new H,Md=new H,Sd=new Jt,Ed=new Jt,wd=new Jt;class pi{constructor(e=new H,t=new H,n=new H){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ki.subVectors(e,t),i.cross(Ki);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){Ki.subVectors(i,t),br.subVectors(n,t),yd.subVectors(e,t);const o=Ki.dot(Ki),l=Ki.dot(br),u=Ki.dot(yd),h=br.dot(br),f=br.dot(yd),d=o*h-l*l;if(d===0)return s.set(0,0,0),null;const p=1/d,g=(h*u-l*f)*p,v=(o*f-l*u)*p;return s.set(1-g-v,v,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Rr)===null?!1:Rr.x>=0&&Rr.y>=0&&Rr.x+Rr.y<=1}static getInterpolation(e,t,n,i,s,o,l,u){return this.getBarycoord(e,t,n,i,Rr)===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,Rr.x),u.addScaledVector(o,Rr.y
vendor: 8,259 bytes, line 5
5),u.addScaledVector(l,Rr.z),u)}static getInterpolatedAttribute(e,t,n,i,s,o){return Sd.setScalar(0),Ed.setScalar(0),wd.setScalar(0),Sd.fromBufferAttribute(e,t),Ed.fromBufferAttribute(e,n),wd.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(Sd,s.x),o.addScaledVector(Ed,s.y),o.addScaledVector(wd,s.z),o}static isFrontFacing(e,t,n,i){return Ki.subVectors(n,t),br.subVectors(e,t),Ki.cross(br).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 Ki.subVectors(this.c,this.b),br.subVectors(this.a,this.b),Ki.cross(br).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return pi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return pi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return pi.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return pi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return pi.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 o,l;Uo.subVectors(i,n),No.subVectors(s,n),xd.subVectors(e,n);const u=Uo.dot(xd),h=No.dot(xd);if(u<=0&&h<=0)return t.copy(n);Ad.subVectors(e,i);const f=Uo.dot(Ad),d=No.dot(Ad);if(f>=0&&d<=f)return t.copy(i);const p=u*d-f*h;if(p<=0&&u>=0&&f<=0)return o=u/(u-f),t.copy(n).addScaledVector(Uo,o);Md.subVectors(e,s);const g=Uo.dot(Md),v=No.dot(Md);if(v>=0&&g<=v)return t.copy(s);const A=g*h-u*v;if(A<=0&&h>=0&&v<=0)return l=h/(h-v),t.copy(n).addScaledVector(No,l);const x=f*v-g*d;if(x<=0&&d-f>=0&&g-v>=0)return Hv.subVectors(s,i),l=(d-f)/(d-f+(g-v)),t.copy(i).addScaledVector(Hv,l);const _=1/(x+A+p);return o=A*_,l=p*_,t.copy(n).addScaledVector(Uo,o).addScaledVector(No,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Iy={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},es={h:0,s:0,l:0},Jc={h:0,s:0,l:0};function Cd(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 Ye{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=si){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Xt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Xt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Xt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Xt.workingColorSpace){if(e=$p(e,1),t=St(t,0,1),n=St(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Cd(o,s,e+1/3),this.g=Cd(o,s,e),this.b=Cd(o,s,e-1/3)}return Xt.toWorkingColorSpace(this,i),this}setStyle(e,t=si){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],l=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))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(l))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(l))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=si){const n=Iy[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ur(e.r),this.g=Ur(e.g),this.b=Ur(e.b),this}copyLinearToSRGB(e){return this.r=ea(e.r),this.g=ea(e.g),this.b=ea(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=si){return Xt.fromWorkingColorSpace(Kn.copy(this),e),Math.round(St(Kn.r*255,0,255))*65536+Math.round(St(Kn.g*255,0,255))*256+Math.round(St(Kn.b*255,0,255))}getHexString(e=si){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Xt.workingColorSpace){Xt.fromWorkingColorSpace(Kn.copy(this),t);const n=Kn.r,i=Kn.g,s=Kn.b,o=Math.max(n,i,s),l=Math.min(n,i,s);let u,h;const f=(l+o)/2;if(l===o)u=0,h=0;else{const d=o-l;switch(h=f<=.5?d/(o+l):d/(2-o-l),o){case n:u=(i-s)/d+(i<s?6:0);break;
vendor: 3,654 bytes, line 5
5case 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=Xt.workingColorSpace){return Xt.fromWorkingColorSpace(Kn.copy(this),t),e.r=Kn.r,e.g=Kn.g,e.b=Kn.b,e}getStyle(e=si){Xt.fromWorkingColorSpace(Kn.copy(this),e);const t=Kn.r,n=Kn.g,i=Kn.b;return e!==si?`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(es),this.setHSL(es.h+e,es.s+t,es.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(es),e.getHSL(Jc);const n=hl(es.h,Jc.h,t),i=hl(es.s,Jc.s,t),s=hl(es.l,Jc.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 Kn=new Ye;Ye.NAMES=Iy;let xS=0;class Rn extends vr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:xS++}),this.uuid=Ci(),this.name="",this.type="Material",this.blending=eo,this.side=dr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ku,this.blendDst=zu,this.blendEquation=ls,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=ro,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ws,this.stencilZFail=Ws,this.stencilZPass=Ws,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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.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.6,type:"Material",generator:"Material.toJSON"}};
vendor: 8,832 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.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!==eo&&(n.blending=this.blending),this.side!==dr&&(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!==ku&&(n.blendSrc=this.blendSrc),this.blendDst!==zu&&(n.blendDst=this.blendDst),this.blendEquation!==ls&&(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!==ro&&(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!==wp&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ws&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ws&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ws&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const l in s){const u=s[l];delete u.metadata,o.push(u)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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,421 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.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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class mi extends Rn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(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 Ti,this.combine=Il,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 Dr=AS();function AS(){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),o=new Uint32Array(64),l=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,f=0;for(;(h&8388608)===0;)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)o[u]=u<<23;o[31]=1199570944,o[32]=2147483648;for(let u=33;u<63;++u)o[u]=2147483648+(u-32<<23);o[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(l[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:l}}function di(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=St(r,-65504,65504),Dr.floatView[0]=r;const e=Dr.uint32View[0],t=e>>23&511;return Dr.baseTable[t]+((e&8388607)>>Dr.shiftTable[t])}function nl(r){const e=r>>10;return Dr.uint32View[0]=Dr.mantissaTable[Dr.offsetTable[e]+(r&1023)]+Dr.exponentTable[e],Dr.floatView[0]}class qs{static toHalfFloat(e){return di(e)}static fromHalfFloat(e){return nl(e)}}const wn=new H,Yc=new be;let MS=0;class Yt{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:MS++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=_l,this.updateRanges=[],this.gpuType=dn,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++)Yc.fromBufferAttribute(this,t),Yc.applyMatrix3(e),this.setXY(t,Yc.x,Yc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)wn.fromBufferAttribute(this,t),wn.applyMatrix3(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)wn.fromBufferAttribute(this,t),wn.applyMatrix4(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)wn.fromBufferAttribute(this,t),wn.applyNormalMatrix(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)wn.fromBufferAttribute(this,t),wn.transformDirection(e),this.setXYZ(t,wn.x,wn.y,wn.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=oi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Pt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=oi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Pt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=oi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Pt(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=oi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Pt(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=oi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Pt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Pt(t,this.array),n=Pt(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=Pt(t,this.array),n=Pt(n,this.array),i=Pt(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=Pt(t,this.array),n=Pt(n,this.array),i=Pt(i,this.array),s=Pt(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: 4,268 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!==_l&&(e.usage=this.usage),e}}class SS extends Yt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class ES extends Yt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class wS extends Yt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class CS extends Yt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class em extends Yt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class TS extends Yt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class tm extends Yt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class bS extends Yt{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=nl(this.array[e*this.itemSize]);return this.normalized&&(t=oi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Pt(t,this.array)),this.array[e*this.itemSize]=di(t),this}getY(e){let t=nl(this.array[e*this.itemSize+1]);return this.normalized&&(t=oi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Pt(t,this.array)),this.array[e*this.itemSize+1]=di(t),this}getZ(e){let t=nl(this.array[e*this.itemSize+2]);return this.normalized&&(t=oi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Pt(t,this.array)),this.array[e*this.itemSize+2]=di(t),this}getW(e){let t=nl(this.array[e*this.itemSize+3]);return this.normalized&&(t=oi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Pt(t,this.array)),this.array[e*this.itemSize+3]=di(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Pt(t,this.array),n=Pt(n,this.array)),this.array[e+0]=di(t),this.array[e+1]=di(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Pt(t,this.array),n=Pt(n,this.array),i=Pt(i,this.array)),this.array[e+0]=di(t),this.array[e+1]=di(n),this.array[e+2]=di(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Pt(t,this.array),n=Pt(n,this.array),i=Pt(i,this.array),s=Pt(s,this.array)),this.array[e+0]=di(t),this.array[e+1]=di(n),this.array[e+2]=di(i),this.array[e+3]=di(s),this}}class at extends Yt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let RS=0;const Ui=new gt,Td=new zt,Oo=new H,wi=new Qn,za=new Qn,Fn=new H;class Rt extends vr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:RS++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ty(e)?tm:em)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new bt().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 Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Td.lookAt(e),Td.updateMatrix(),this.applyMatrix4(Td.matrix
vendor: 4,397 bytes, line 5
5),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Oo).negate(),this.translate(Oo.x,Oo.y,Oo.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 o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new at(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&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new H(-1/0,-1/0,-1/0),new H(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];wi.setFromBufferAttribute(s),this.morphTargetsRelative?(Fn.addVectors(this.boundingBox.min,wi.min),this.boundingBox.expandByPoint(Fn),Fn.addVectors(this.boundingBox.max,wi.max),this.boundingBox.expandByPoint(Fn)):(this.boundingBox.expandByPoint(wi.min),this.boundingBox.expandByPoint(wi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new H,1/0);return}if(e){const n=this.boundingSphere.center;if(wi.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const l=t[s];za.setFromBufferAttribute(l),this.morphTargetsRelative?(Fn.addVectors(wi.min,za.min),wi.expandByPoint(Fn),Fn.addVectors(wi.max,za.max),wi.expandByPoint(Fn)):(wi.expandByPoint(za.min),wi.expandByPoint(za.max))}wi.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Fn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Fn));if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s],u=this.morphTargetsRelative;for(let h=0,f=l.count;h<f;h++)Fn.fromBufferAttribute(l,h),u&&(Oo.fromBufferAttribute(e,h),Fn.add(Oo)),i=Math.max(i,n.distanceToSquared(Fn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Yt(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),l=[],u=[];for(let D=0;D<n.count;D++)l[D]=new H,u[D]=new H;const h=new H,f=new H,d=new H,p=new be,g=new be,v=new be,A=new H,x=new H;function _(D,T,b){h.fromBufferAttribute(n,D),f.fromBufferAttribute(n,T),d.fromBufferAttribute(n,b),p.fromBufferAttribute(s,D),g.fromBufferAttribute(s,T),v.fromBufferAttribute(s,b),f.sub(h),d.sub(h),g.sub(p),v.sub(p);const N=1/(g.x*v.y-v.x*g.y);isFinite(N)&&(A.copy(f).multiplyScalar(v.y).addScaledVector(d,-g.y).multiplyScalar(N),x.copy(d).multiplyScalar(g.x).addScaledVector(f,-v.x).multiplyScalar(N),l[D].add(A),l[T].add(A),l[b].add(A),u[D].add(x),u[T].add(x),u[b].add(x))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let D=0,T=S.length;D<T;++D){const b=S[D],N=b.start,Y=b.count;for(let K=N,Q=N+Y;K<Q;K+=3)_(e.getX(K+0),e.getX(K+1),e.getX(K+2))}const E=new H,w=new H,L=new H,B=new H;function F(D){L.fromBufferAttribute(i,D),B.copy(L);const T=l[D];E.copy(T),E.sub(L.multiplyScalar(L.dot(T))).normalize(),w.crossVectors(B,T);const N=w.dot(u[D])<0?-1:1;o.setXYZW(D,E.x,E.y,E.z,N)}for(let D=0,T=S.length;D<T;++D){const b=S[D],N=b.start,Y=b.count;for(let K=N,Q=N+Y;K<Q;
vendor: 12,928 bytes, lines 5-9
5K+=3)F(e.getX(K+0)),F(e.getX(K+1)),F(e.getX(K+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 Yt(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 H,s=new H,o=new H,l=new H,u=new H,h=new H,f=new H,d=new H;if(e)for(let p=0,g=e.count;p<g;p+=3){const v=e.getX(p+0),A=e.getX(p+1),x=e.getX(p+2);i.fromBufferAttribute(t,v),s.fromBufferAttribute(t,A),o.fromBufferAttribute(t,x),f.subVectors(o,s),d.subVectors(i,s),f.cross(d),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,A),h.fromBufferAttribute(n,x),l.add(f),u.add(f),h.add(f),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(A,u.x,u.y,u.z),n.setXYZ(x,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),o.fromBufferAttribute(t,p+2),f.subVectors(o,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++)Fn.fromBufferAttribute(e,t),Fn.normalize(),e.setXYZ(t,Fn.x,Fn.y,Fn.z)}toNonIndexed(){function e(l,u){const h=l.array,f=l.itemSize,d=l.normalized,p=new h.constructor(u.length*f);let g=0,v=0;for(let A=0,x=u.length;A<x;A++){l.isInterleavedBufferAttribute?g=u[A]*l.data.stride+l.offset:g=u[A]*f;for(let _=0;_<f;_++)p[v++]=h[g++]}return new Yt(p,f,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Rt,n=this.index.array,i=this.attributes;for(const l in i){const u=i[l],h=e(u,n);t.setAttribute(l,h)}const s=this.morphAttributes;for(const l in s){const u=[],h=s[l];for(let f=0,d=h.length;f<d;f++){const p=h[f],g=e(p,n);u.push(g)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let l=0,u=o.length;l<u;l++){const h=o[l];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(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 o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&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 o=e.groups;for(let h=0,f=o.length;h<f;h++){const d=o[h];this.addGroup(d.start,d.count,d.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.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 Gv=new gt,Ps=new va,Kc=new Hn,kv=new H,Zc=new H,qc=new H,Qc=new H,bd=new H,jc=new H,zv=new H,$c=new H;class un extends zt{constructor(e=new Rt,t=new mi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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,o=i.length;s<o;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const l=this.morphTargetInfluences;if(s&&l){jc.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const f=l[u],d=s[u];f!==0&&(bd.fromBufferAttribute(d,e),o?jc.addScaledVector(bd,f):jc.addScaledVector(bd.sub(t),f))}t.add(jc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Kc.copy(n.boundingSphere),Kc.applyMatrix4(s),Ps.copy(e.ray).recast(e.near),!(Kc.containsPoint(Ps.origin)===!1&&(Ps.intersectSphere(Kc,kv)===null||Ps.origin.distanceToSquared(kv)>(e.far-e.near)**2))&&(Gv.copy(s).invert(),Ps.copy(e.ray).applyMatrix4(Gv),!(n.boundingBox!==null&&Ps.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ps)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,l=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(l!==null)if(Array.isArray(o))for(let v=0,A=p.length;v<A;v++){const x=p[v],_=o[x.materialIndex],S=Math.max(x.start,g.start),E=Math.min(l.count,Math.min(x.start+x.count,g.start+g.count));for(let w=S,L=E;w<L;w+=3){const B=l.getX(w),F=l.getX(w+1),D=l.getX(w+2);i=eu(this,_,e,n,h,f,d,B,F,D),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const v=Math.max(0,g.start),A=Math.min(l.count,g.start+g.count);for(let x=v,_=A;x<_;x+=3){const S=l.getX(x),E=l.getX(x+1),w=l.getX(x+2);i=eu(this,o,e,n,h,f,d,S,E,w),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(o))for(let v=0,A=p.length;v<A;v++){const x=p[v],_=o[x.materialIndex],S=Math.max(x.start,g.start),E=Math.min(u.count,Math.min(x.start+x.count,g.start+g.count));for(let w=S,L=E;w<L;w+=3){const B=w,F=w+1,D=w+2;i=eu(this,_,e,n,h,f,d,B,F,D),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const v=Math.max(0,g.start),A=Math.min(u.count,g.start+g.count);for(let x=v,_=A;x<_;x+=3){const S=x,E=x+1,w=x+2;i=eu(this,o,e,n,h,f,d,S,E,w),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}}}function IS(r,e,t,n,i,s,o,l){let u;if(e.side===ai?u=n.intersectTriangle(o,s,i,!0,l):u=n.intersectTriangle(i,s,o,e.side===dr,l),u===null)return null;$c.copy(l),$c.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo($c);return h<t.near||h>t.far?null:{distance:h,point:$c.clone(),object:r}}function eu(r,e,t,n,i,s,o,l,u,h){r.getVertexPosition(l,Zc),r.getVertexPosition(u,qc),r.getVertexPosition(h,Qc);const f=IS(r,e,t,n,Zc,qc,Qc,zv);if(f){const d=new H;pi.getBarycoord(zv,Zc,qc,Qc,d),i&&(f.uv=pi.getInterpolatedAttribute(i,l,u,h,d,new be)),s&&(f.uv1=pi.getInterpolatedAttribute(s,l,u,h,d,new be)),o&&(f.normal=pi.getInterpolatedAttribute(o,l,u,h,d,new H),f.normal.dot(n.direction)>0&&f.normal.multiplyScalar(-1));const p={a:l,b:u,c:h,normal:new H,materialIndex:0};pi.getNormal(Zc,qc,Qc,p.normal),f.face=p,f.barycoord=d}return f}class uo extends Rt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const l=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const u=[],h=[],f=[],d=[];let p=0,g=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,i,o,2),v("x","z","y",1,-1,e,n,-t,i,o,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 at(h,3)),this.setAttribute("normal",new at(f,3)),this.setAttribute("uv",new at(d,2));function v(A,x,_,S,E,w,L,B,F,D,T){const b=w/F,N=L/D,Y=w/2,K=L/2,Q=B/2,oe=F+1,ee=D+1;let Me=0,G=0;const te=new H;for(let q=0;q<ee;q++){const ce=q*N-K;for(let Se=0;Se<oe;Se++){const Ge=Se*b-Y;te[A]=Ge*S,te[x]=ce*E,te[_]=Q,h.push(te.x,te.y,te.z),te[A]=0,te[x]=0,te[_]=B>0?1:-1,f.push(te.x,te.y,te.z),d.push(Se/F),d.push(1-q/D),Me+=1}}for(let q=0;q<D;q++)for(let ce=0;ce<F;ce++){const Se=p+ce+oe*q,Ge=p+ce+oe*(q+1),le=p+(ce+1)+oe*(q+1),Re=p+(ce+1)+oe*q;u.push(Se,Ge,Re),u.push(Ge,le,Re),G+=6}l.addGroup(g,G,T),g+=G,p+=Me}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uo(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function fa(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?(console.warn("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 ii(r){const e={};for(let t=0;t<r.length;t++){const n=fa(r[t]);for(const i in n)e[i]=n[i]}return e}function BS(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function By(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Xt.workingColorSpace}const Py={clone:fa,merge:ii};var PS=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,DS=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class vi extends Rn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=PS,this.fragmentShader=DS,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=fa(e.uniforms),this.uniformsGroups=BS(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}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 Fl extends zt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new gt,this.projectionMatrix=new gt,this.projectionMatrixInverse=new gt,this.coordinateSystem=ji}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 ts=new H,Vv=new be,Wv=new be;
vendor: 4,608 bytes, line 9
9class bn extends Fl{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=ha*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(to*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ha*2*Math.atan(Math.tan(to*.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){ts.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ts.x,ts.y).multiplyScalar(-e/ts.z),ts.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ts.x,ts.y).multiplyScalar(-e/ts.z)}getViewSize(e,t){return this.getViewBounds(e,Vv,Wv),t.subVectors(Wv,Vv)}setViewOffset(e,t,n,i,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(to*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const u=o.fullWidth,h=o.fullHeight;s+=o.offsetX*i/u,t-=o.offsetY*n/h,i*=o.width/u,n*=o.height/h}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Ho=-90,Go=1;class Dy extends zt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new bn(Ho,Go,e,t);i.layers=this.layers,this.add(i);const s=new bn(Ho,Go,e,t);s.layers=this.layers,this.add(s);const o=new bn(Ho,Go,e,t);o.layers=this.layers,this.add(o);const l=new bn(Ho,Go,e,t);l.layers=this.layers,this.add(l);const u=new bn(Ho,Go,e,t);u.layers=this.layers,this.add(u);const h=new bn(Ho,Go,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,l,u]=t;for(const h of t)this.remove(h);if(e===ji)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),o.up.set(0,0,1),o.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===yl)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),o.up.set(0,0,-1),o.lookAt(0,-1,0),l.up.set(0,-1,0),l.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,o,l,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,o),e.setRenderTarget(n,2,i),e.render(t,l),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 Ul extends jt{constructor(e=[],t=pr,n,i,s,o,l,u,h,f){super(e,t,n,i,s,o,l,u,h,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class nm extends ki{constructor(e=1,t={}
vendor: 18,661 bytes, lines 9-44
9){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 Ul(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Qt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 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 uo(5,5,5),s=new vi({name:"CubemapFromEquirect",uniforms:fa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ai,blending:ur});s.uniforms.tEquirect.value=t;const o=new un(i,s),l=t.minFilter;return t.minFilter===Gi&&(t.minFilter=Qt),new Dy(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}class Lr extends zt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const LS={type:"move"};class Ou{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Lr,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 Lr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Lr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H),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,o=null;const l=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){o=!0;for(const A of e.hand.values()){const x=t.getJointPose(A,n),_=this._getHandJoint(h,A);x!==null&&(_.matrix.fromArray(x.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=x.radius),_.visible=x!==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));l!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(LS)))}return l!==null&&(l.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Lr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Oh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ye(e),this.density=t}clone(){return new Oh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Hh{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ye(e),this.near=t,this.far=n}clone(){return new Hh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Nl extends zt{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 Ti,this.environmentIntensity=1,this.environmentRotation=new Ti,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 Ol{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_l,this.updateRanges=[],this.version=0,this.uuid=Ci()}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=Ci()),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=Ci()),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 ni=new H;class ms{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++)ni.fromBufferAttribute(this,t),ni.applyMatrix4(e),this.setXYZ(t,ni.x,ni.y,ni.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ni.fromBufferAttribute(this,t),ni.applyNormalMatrix(e),this.setXYZ(t,ni.x,ni.y,ni.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ni.fromBufferAttribute(this,t),ni.transformDirection(e),this.setXYZ(t,ni.x,ni.y,ni.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=oi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Pt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Pt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Pt(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=oi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=oi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=oi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=oi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Pt(t,this.array),n=Pt(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=Pt(t,this.array),n=Pt(n,this.array),i=Pt(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=Pt(t,this.array),n=Pt(n,this.array),i=Pt(i,this.array),s=Pt(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){console.log("THREE.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 Yt(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 ms(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.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 im extends Rn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(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 ko;const Va=new H,zo=new H,Vo=new H,Wo=new be,Wa=new be,Ly=new gt,tu=new H,Xa=new H,nu=new H,Xv=new be,Rd=new be,Jv=new be;class Fy extends zt{constructor(e=new im){if(super(),this.isSprite=!0,this.type="Sprite",ko===void 0){ko=new Rt;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 Ol(t,5);ko.setIndex([0,1,2,0,2,3]),ko.setAttribute("position",new ms(n,3,0,!1)),ko.setAttribute("uv",new ms(n,2,3,!1))}this.geometry=ko,this.material=e,this.center=new be(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),zo.setFromMatrixScale(this.matrixWorld),Ly.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&zo.multiplyScalar(-Vo.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;iu(tu.set(-.5,-.5,0),Vo,o,zo,i,s),iu(Xa.set(.5,-.5,0),Vo,o,zo,i,s),iu(nu.set(.5,.5,0),Vo,o,zo,i,s),Xv.set(0,0),Rd.set(1,0),Jv.set(1,1);let l=e.ray.intersectTriangle(tu,Xa,nu,!1,Va);if(l===null&&(iu(Xa.set(-.5,.5,0),Vo,o,zo,i,s),Rd.set(0,1),l=e.ray.intersectTriangle(tu,nu,Xa,!1,Va),l===null))return;const u=e.ray.origin.distanceTo(Va);u<e.near||u>e.far||t.push({distance:u,point:Va.clone(),uv:pi.getInterpolation(Va,tu,Xa,nu,Xv,Rd,Jv,new be),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 iu(r,e,t,n,i,s){Wo.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Wa.x=s*Wo.x-i*Wo.y,Wa.y=i*Wo.x+s*Wo.y):Wa.copy(Wo),r.copy(e),r.x+=Wa.x,r.y+=Wa.y,r.applyMatrix4(Ly)}const ru=new H,Yv=new H;class Uy extends zt{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){ru.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(ru);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ru.setFromMatrixPosition(e.matrixWorld),Yv.setFromMatrixPosition(this.matrixWorld);const n=ru.distanceTo(Yv)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)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 o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Kv=new H,Zv=new Jt,qv=new Jt,FS=new H,Qv=new gt,su=new H,Id=new Hn,jv=new gt,Bd=new va;class rm extends un{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Sp,this.bindMatrix=new gt,this.bindMatrixInverse=new gt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Qn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,su),this.boundingBox.expandByPoint(su)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Hn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,su),this.boundingSphere.expandByPoint(su)}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(),Id.copy(this.boundingSphere),Id.applyMatrix4(i),e.ray.intersectsSphere(Id)!==!1&&(jv.copy(i).invert(),Bd.copy(e.ray).applyMatrix4(jv),!(this.boundingBox!==null&&Bd.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Bd)))}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 Jt,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===Sp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===hy?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
vendor: 6,562 bytes, line 44
44applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Zv.fromBufferAttribute(i.attributes.skinIndex,e),qv.fromBufferAttribute(i.attributes.skinWeight,e),Kv.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=qv.getComponent(s);if(o!==0){const l=Zv.getComponent(s);Qv.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),t.addScaledVector(FS.copy(Kv).applyMatrix4(Qv),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Gh extends zt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class $i extends jt{constructor(e=null,t=1,n=1,i,s,o,l,u,h=Nn,f=Nn,d,p){super(null,o,l,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 $v=new gt,US=new gt;class Hl{constructor(e=[],t=[]){this.uuid=Ci(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new gt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new gt;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,o=e.length;s<o;s++){const l=e[s]?e[s].matrixWorld:US;$v.multiplyMatrices(l,t[s]),$v.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Hl(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 $i(t,e,e,Mn,dn);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 o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Gh),this.bones.push(o),this.boneInverses.push(new gt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const l=n[i];e.boneInverses.push(l.toArray())}return e}}class so extends Yt{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 Xo=new gt,e0=new gt,ou=[],t0=new Qn,NS=new gt,Ja=new un,Ya=new Hn;class sm extends un{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new so(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,NS)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Qn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Xo),t0.copy(e.boundingBox).applyMatrix4(Xo),this.boundingBox.union(t0)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Hn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Xo),Ya.copy(e.boundingSphere).applyMatrix4(Xo),this.boundingSphere.union(Ya)}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,o=e*s+1;for(let l=0;l<n.length;l++)n[l]=i[o+l]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ja.geometry=this.geometry,Ja.material=this.material,Ja.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ya.copy(this.boundingSphere),Ya.applyMatrix4(n),e.ray.intersectsSphere(Ya)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Xo),e0.multiplyMatrices(n,Xo),Ja.matrixWorld=e0,Ja.raycast(e,ou);for(let o=0,l=ou.length;o<l;o++){const u=ou[o];u.instanceId=s,u.object=this,t.push(u)}ou.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new so(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 $i(new Float32Array(i*this.count),i,this.count,Pl,dn));const s=this.morphTexture.source.data.data;let o=0;for(let h=0;h<n.length;h++)o+=n[h];const l=this.geometry.morphTargetsRelative?1:1-o,u=i*e;s[u]=l,s.set(n,u+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Pd=new H,OS=new H,HS=new bt;class os{constructor(e=new H(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}
vendor: 5,890 bytes, line 44
44setFromCoplanarPoints(e,t,n){const i=Pd.subVectors(n,t).cross(OS.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(Pd),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||HS.getNormalMatrix(e),i=this.coplanarPoint(Pd).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 Ds=new Hn,au=new H;class Gl{constructor(e=new os,t=new os,n=new os,i=new os,s=new os,o=new os){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(i),l[4].copy(s),l[5].copy(o),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=ji){const n=this.planes,i=e.elements,s=i[0],o=i[1],l=i[2],u=i[3],h=i[4],f=i[5],d=i[6],p=i[7],g=i[8],v=i[9],A=i[10],x=i[11],_=i[12],S=i[13],E=i[14],w=i[15];if(n[0].setComponents(u-s,p-h,x-g,w-_).normalize(),n[1].setComponents(u+s,p+h,x+g,w+_).normalize(),n[2].setComponents(u+o,p+f,x+v,w+S).normalize(),n[3].setComponents(u-o,p-f,x-v,w-S).normalize(),n[4].setComponents(u-l,p-d,x-A,w-E).normalize(),t===ji)n[5].setComponents(u+l,p+d,x+A,w+E).normalize();else if(t===yl)n[5].setComponents(l,d,A,E).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(),Ds.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ds.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ds)}intersectsSprite(e){return Ds.center.set(0,0,0),Ds.radius=.7071067811865476,Ds.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ds)}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(au.x=i.normal.x>0?e.max.x:e.min.x,au.y=i.normal.y>0?e.max.y:e.min.y,au.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(au)<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)}}function Dd(r,e){return r-e}function GS(r,e){return r.z-e.z}function kS(r,e){return e.z-r.z}class zS{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const l=s[this.index];o.push(l),this.index++,l.start=e,l.count=t,l.z=n,l.index=i}reset(){this.list.length=0,this.index=0}}const fi=new gt,VS=new Ye(1,1,1),Ld=new Gl,lu=new Qn,Ls=new Hn,Ka=new H,n0=new H,WS=new H,Fd=new zS,Zn=new un,cu=[];function XS(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 o=0;o<n;o++)e.setComponent(s+t,o,r.getComponent(s,o))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function Fs(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 Ny extends un{constructor(e,t,n=t*2,i){super(new Rt,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 $i(t,e,e,Mn,dn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new $i(t,e,e,Dl,mr);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 $i(t,e,e,Mn,dn);
44n.colorSpace=Xt.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 o=e.getAttribute(s),{array:l,itemSize:u,normalized:h}=o,f=new l.constructor(n*u),d=new Yt(f,u,h);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Yt(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 Qn);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,fi),this.getBoundingBoxAt(s,lu).applyMatrix4(fi),e.union(lu)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hn);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,fi),this.getBoundingSphereAt(s,Ls).applyMatrix4(fi),e.union(Ls)}}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(Dd),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;fi.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(VS.toArray(o.image.data,i*4),o.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 o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.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(Dd),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(),o=t.getIndex(),l=this._geometryInfo[e];if(i&&o.count>l.reservedIndexCount||t.attributes.position.count>l.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=l.vertexStart,h=l.reservedVertexCount;l.vertexCount=t.getAttribute("position").count;for(const f in n.attributes){const d=t.getAttribute(f),p=n.getAttribute(f);XS(d,p,u);const g=d.itemSize;
vendor: 9,044 bytes, line 44
44for(let v=d.count,A=h;v<A;v++){const x=u+v;for(let _=0;_<g;_++)p.setComponent(x,_,0)}p.needsUpdate=!0,p.addUpdateRange(u*g,h*g)}if(i){const f=l.indexStart,d=l.reservedIndexCount;l.indexCount=t.getIndex().count;for(let p=0;p<o.count;p++)s.setX(f+p,u+o.getX(p));for(let p=o.count,g=d;p<g;p++)s.setX(f+p,u);s.needsUpdate=!0,s.addUpdateRange(f,l.reservedIndexCount)}return l.start=i?l.indexStart:l.vertexStart,l.count=i?l.indexCount:l.vertexCount,l.boundingBox=null,t.boundingBox!==null&&(l.boundingBox=t.boundingBox.clone()),l.boundingSphere=null,t.boundingSphere!==null&&(l.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((o,l)=>l).sort((o,l)=>n[o].vertexStart-n[l].vertexStart),s=this.geometry;for(let o=0,l=n.length;o<l;o++){const u=i[o],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 x=f;x<f+p;x++)v[x]=v[x]+A;g.array.copyWithin(t,f,f+p),g.addUpdateRange(t,p),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:x}=v;A.copyWithin(e*x,f*x,(f+d)*x),v.addUpdateRange(e*x,d*x)}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}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Qn,o=n.index,l=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let f=u;o&&(f=o.getX(f)),s.expandByPoint(Ka.fromBufferAttribute(l,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 Hn;this.getBoundingBoxAt(e,lu),lu.getCenter(s.center);const o=n.index,l=n.attributes.position;let u=0;for(let h=i.start,f=i.start+i.count;h<f;h++){let d=h;o&&(d=o.getX(d)),Ka.fromBufferAttribute(l,d),u=Math.max(u,s.center.distanceToSquared(Ka))}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(Dd);t[t.length-1]===n.length;)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);Fs(this._multiDrawCounts,i),Fs(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,l=this._matricesTexture,u=this._colorsTexture;o.dispose(),this._initIndirectTexture(),Fs(o.image.data,this._indirectTexture.image.data),l.dispose(),this._initMatricesTexture(),Fs(l.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),Fs(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(l=>l.active);if(Math.max(...n.map(l=>l.vertexStart+l.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 Rt,this._initializeGeometry(s));const o=this.geometry;s.index&&Fs(s.index.array,o.index.array);for(const l in s.attributes)Fs(s.attributes[l].array,o.attributes[l].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Zn.material=this.material,Zn.geometry.index=o.index,Zn.geometry.attributes=o.attributes,Zn.geometry.boundingBox===null&&(Zn.geometry.boundingBox=new Qn),Zn.geometry.boundingSphere===null&&(Zn.geometry.boundingSphere=new Hn);for(let l=0,u=n.length;l<u;l++){if(!n[l].visible||!n[l].active)continue;const h=n[l].geometryIndex,f=i[h];Zn.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(l,Zn.matrixWorld).premultiply(s),this.getBoundingBoxAt(h,Zn.geometry.boundingBox),this.getBoundingSphereAt(h,Zn.geometry.boundingSphere),Zn.raycast(e,cu);for(let d=0,p=cu.length;d<p;d++){const g=cu[d];g.object=this,g.batchId=l,t.push(g)}cu.length=0}Zn.material=null,Zn.geometry.index=null,Zn.geometry.attributes={},Zn.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._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.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 o=i.getIndex(),l=o===null?1:o.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;p&&(fi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Ld.setFromProjectionMatrix(fi,e.coordinateSystem));let A=0;if(this.sortObjects){fi.copy(this.matrixWorld).invert(),Ka.setFromMatrixPosition(n.matrixWorld).applyMatrix4(fi),n0.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(fi);for(let S=0,E=u.length;S<E;S++)if(u[S].visible&&u[S].active){const w=u[S].geometryIndex;this.getMatrixAt(S,fi),this.getBoundingSphereAt(w,Ls).applyMatrix4(fi);let L=!1;if(p&&(L=!Ld.intersectsSphere(Ls)),!L){const B=d[w],F=WS.subVectors(Ls.center,Ka).dot(n0);Fd.push(B.start,B.count,F,S)}}const x=Fd.list,_=this.customSort;_===null?x.sort(s.transparent?kS:GS):_.call(this,x,n);for(let S=0,E=x.length;S<E;S++){const w=x[S];h[A]=w.start*l,f[A]=w.count,v[A]=w.index,A++}Fd.reset()}else for(let x=0,_=u.length;x<_;x++)if(u[x].visible&&u[x].active){const S=u[x].geometryIndex;let E=!1;
vendor: 10,515 bytes, line 44
44if(p&&(this.getMatrixAt(x,fi),this.getBoundingSphereAt(S,Ls).applyMatrix4(fi),E=!Ld.intersectsSphere(Ls)),!E){const w=d[S];h[A]=w.start*l,f[A]=w.count,v[A]=x,A++}}g.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class jn extends Rn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Sh=new H,Eh=new H,i0=new gt,Za=new va,uu=new Hn,Ud=new H,r0=new H;class Or extends zt{constructor(e=new Rt,t=new jn){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++)Sh.fromBufferAttribute(t,i-1),Eh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Sh.distanceTo(Eh);e.setAttribute("lineDistance",new at(n,1))}else console.warn("THREE.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,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),uu.copy(n.boundingSphere),uu.applyMatrix4(i),uu.radius+=s,e.ray.intersectsSphere(uu)===!1)return;i0.copy(i).invert(),Za.copy(e.ray).applyMatrix4(i0);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(f!==null){const g=Math.max(0,o.start),v=Math.min(f.count,o.start+o.count);for(let A=g,x=v-1;A<x;A+=h){const _=f.getX(A),S=f.getX(A+1),E=hu(this,e,Za,u,_,S,A);E&&t.push(E)}if(this.isLineLoop){const A=f.getX(v-1),x=f.getX(g),_=hu(this,e,Za,u,A,x,v-1);_&&t.push(_)}}else{const g=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let A=g,x=v-1;A<x;A+=h){const _=hu(this,e,Za,u,A,A+1,A);_&&t.push(_)}if(this.isLineLoop){const A=hu(this,e,Za,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,o=i.length;s<o;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function hu(r,e,t,n,i,s,o){const l=r.geometry.attributes.position;if(Sh.fromBufferAttribute(l,i),Eh.fromBufferAttribute(l,s),t.distanceSqToSegment(Sh,Eh,Ud,r0)>n)return;Ud.applyMatrix4(r.matrixWorld);const h=e.ray.origin.distanceTo(Ud);if(!(h<e.near||h>e.far))return{distance:h,point:r0.clone().applyMatrix4(r.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:r}}const s0=new H,o0=new H;class er extends Or{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)s0.fromBufferAttribute(t,i),o0.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+s0.distanceTo(o0);e.setAttribute("lineDistance",new at(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class om extends Or{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class kh extends Rn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(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 a0=new gt,Tp=new va,fu=new Hn,du=new H;class am extends zt{constructor(e=new Rt,t=new kh){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,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fu.copy(n.boundingSphere),fu.applyMatrix4(i),fu.radius+=s,e.ray.intersectsSphere(fu)===!1)return;a0.copy(i).invert(),Tp.copy(e.ray).applyMatrix4(a0);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=n.index,d=n.attributes.position;if(h!==null){const p=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let v=p,A=g;v<A;v++){const x=h.getX(v);du.fromBufferAttribute(d,x),l0(du,x,u,i,e,t,this)}}else{const p=Math.max(0,o.start),g=Math.min(d.count,o.start+o.count);for(let v=p,A=g;v<A;v++)du.fromBufferAttribute(d,v),l0(du,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,o=i.length;s<o;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function l0(r,e,t,n,i,s,o){const l=Tp.distanceSqToPoint(r);if(l<t){const u=new H;Tp.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(l),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Oy extends jt{constructor(e,t,n,i,s=Qt,o=Qt,l,u,h){super(e,t,n,i,s,o,l,u,h),this.isVideoTexture=!0,this.generateMipmaps=!1;const f=this;function d(){f.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&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)}}class JS extends Oy{constructor(e,t,n,i,s,o,l,u){super({},e,t,n,i,s,o,l,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class YS extends jt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Nn,this.minFilter=Nn,this.generateMipmaps=!1,this.needsUpdate=!0}}class zh extends jt{constructor(e,t,n,i,s,o,l,u,h,f,d,p){super(null,o,l,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 KS extends zh{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=An,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ZS extends zh{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,pr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class qS extends jt{constructor(e,t,n,i,s,o,l,u,h){super(e,t,n,i,s,o,l,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class lm extends jt{constructor(e,t,n=mr,i,s,o,l=Nn,u=Nn,h,f=aa){if(f!==aa&&f!==la)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,i,s,o,l,u,f,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new cs(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 tr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.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 o=1;o<=e;o++)n=this.getPoint(o/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 o;t?o=t:o=e*n[s-1];let l=0,u=s-1,h;for(;l<=u;)if(i=Math.floor(l+(u-l)/2),h=n[i]-o,h<0)l=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===o)return i/(s-1);const f=n[i],p=n[i+1]-f,g=(o-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 o=this.getPoint(i),l=this.getPoint(s),u=t||(o.isVector2?new be:new H);return u.copy(l).sub(o).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new H,i=[],s=[],o=[],l=new H,u=new gt;for(let g=0;g<=e;g++){const v=g/e;i[g]=this.getTangentAt(v,new H)}s[0]=new H,o[0]=new H;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),l.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],l),o[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),l.crossVectors(i[g-1],i[g]),l.length()>Number.EPSILON){l.normalize();const v=Math.acos(St(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(l,v))}o[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(St(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(l.crossVectors(s[0],s[e]))>0&&(g=-g);for(let v=1;v<=e;v++)s[v].applyMatrix4(u.makeRotationAxis(i[v],g*v)),o[v].crossVectors(i[v],s[v])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.t
vendor: 6,024 bytes, line 44
44ype,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Vh extends tr{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,l=!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=o,this.aClockwise=l,this.aRotation=u}getPoint(e,t=new be){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const l=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(l),h=this.aY+this.yRadius*Math.sin(l);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 Hy extends Vh{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function cm(){let r=0,e=0,t=0,n=0;function i(s,o,l,u){r=s,e=l,t=-3*s+3*o-2*l-u,n=2*s-2*o+l+u}return{initCatmullRom:function(s,o,l,u,h){i(o,l,h*(l-s),h*(u-o))},initNonuniformCatmullRom:function(s,o,l,u,h,f,d){let p=(o-s)/h-(l-s)/(h+f)+(l-o)/f,g=(l-o)/f-(u-o)/(f+d)+(u-l)/d;p*=f,g*=f,i(o,l,p,g)},calc:function(s){const o=s*s,l=o*s;return r+e*s+t*o+n*l}}}const pu=new H,Nd=new cm,Od=new cm,Hd=new cm;class Gy extends tr{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 H){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let l=Math.floor(o),u=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/s)+1)*s:u===0&&l===s-1&&(l=s-2,u=1);let h,f;this.closed||l>0?h=i[(l-1)%s]:(pu.subVectors(i[0],i[1]).add(i[0]),h=pu);const d=i[l%s],p=i[(l+1)%s];if(this.closed||l+2<s?f=i[(l+2)%s]:(pu.subVectors(i[s-1],i[s-2]).add(i[s-1]),f=pu),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),x=Math.pow(p.distanceToSquared(f),g);A<1e-4&&(A=1),v<1e-4&&(v=A),x<1e-4&&(x=A),Nd.initNonuniformCatmullRom(h.x,d.x,p.x,f.x,v,A,x),Od.initNonuniformCatmullRom(h.y,d.y,p.y,f.y,v,A,x),Hd.initNonuniformCatmullRom(h.z,d.z,p.z,f.z,v,A,x)}else this.curveType==="catmullrom"&&(Nd.initCatmullRom(h.x,d.x,p.x,f.x,this.tension),Od.initCatmullRom(h.y,d.y,p.y,f.y,this.tension),Hd.initCatmullRom(h.z,d.z,p.z,f.z,this.tension));return n.set(Nd.calc(u),Od.calc(u),Hd.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 H().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function c0(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,l=r*r,u=r*l;return(2*t-2*n+s+o)*u+(-3*t+3*n-2*s-o)*l+s*r+t}function QS(r,e){const t=1-r;return t*t*e}function jS(r,e){return 2*(1-r)*r*e}function $S(r,e){return r*r*e}function fl(r,e,t,n){return QS(r,e)+jS(r,t)+$S(r,n)}function eE(r,e){const t=1-r;return t*t*t*e}function tE(r,e){const t=1-r;return 3*t*t*r*e}function nE(r,e){return 3*(1-r)*r*r*e}function iE(r,e){return r*r*r*e}function dl(r,e,t,n,i){return eE(r,e)+tE(r,t)+nE(r,n)+iE(r,i)}class um extends tr{constructor(e=new be,t=new be,n=new be,i=new be){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new be){const n=t,i=this.v0,s=this.v1,o=this.v2,l=this.v3;return n.set(dl(e,i.x,s.x,o.x,l.x),dl(e,i.y,s.y,o.y,l.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 ky extends tr{constructor(e=new H,t=new H,n=new H,i=new H){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new H){const n=t,i=this.v0,s=this.v1,o=this.v2,l=this.v3;return n.set(dl(e,i.x,s.x,o.x,l.x),dl(e,i.y,s.y,o.y,l.y),dl(e,i.z,s.z,o.z,l.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 hm extends tr{constructor(e=new be,t=new be){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new be){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: 4,414 bytes, line 44
44getTangent(e,t=new be){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 zy extends tr{constructor(e=new H,t=new H){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new H){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 H){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 fm extends tr{constructor(e=new be,t=new be,n=new be){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new be){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(fl(e,i.x,s.x,o.x),fl(e,i.y,s.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}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 dm extends tr{constructor(e=new H,t=new H,n=new H){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new H){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(fl(e,i.x,s.x,o.x),fl(e,i.y,s.y,o.y),fl(e,i.z,s.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}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 pm extends tr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new be){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),l=s-o,u=i[o===0?o:o-1],h=i[o],f=i[o>i.length-2?i.length-1:o+1],d=i[o>i.length-3?i.length-1:o+2];return n.set(c0(l,u.x,h.x,f.x,d.x),c0(l,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 be().fromArray(i))}return this}}var wh=Object.freeze({__proto__:null,ArcCurve:Hy,CatmullRomCurve3:Gy,CubicBezierCurve:um,CubicBezierCurve3:ky,EllipseCurve:Vh,LineCurve:hm,LineCurve3:zy,QuadraticBezierCurve:fm,QuadraticBezierCurve3:dm,SplineCurve:pm});class Vy extends tr{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 wh[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 o=i[s]-n,l=this.curves[s],u=l.getLength(),h=u===0?0:1-o/u;return l.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 o=s[i],l=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 6,606 bytes, line 44
44plineCurve?e*o.points.length:e,u=o.getPoints(l);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 wh[i.type]().fromJSON(i))}return this}}class Al extends Vy{constructor(e){super(),this.type="Path",this.currentPoint=new be,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 hm(this.currentPoint.clone(),new be(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new fm(this.currentPoint.clone(),new be(e,t),new be(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const l=new um(this.currentPoint.clone(),new be(e,t),new be(n,i),new be(s,o));return this.curves.push(l),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new pm(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+l,t+u,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,l,u){const h=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+h,t+f,n,i,s,o,l,u),this}absellipse(e,t,n,i,s,o,l,u){const h=new Vh(e,t,n,i,s,o,l,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 kl extends Rt{constructor(e=[new be(0,-.5),new be(.5,0),new be(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=St(i,0,Math.PI*2);const s=[],o=[],l=[],u=[],h=[],f=1/t,d=new H,p=new be,g=new H,v=new H,A=new H;let x=0,_=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:x=e[S+1].x-e[S].x,_=e[S+1].y-e[S].y,g.x=_*1,g.y=-x,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:x=e[S+1].x-e[S].x,_=e[S+1].y-e[S].y,g.x=_*1,g.y=-x,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 S=0;S<=t;S++){const E=n+S*f*i,w=Math.sin(E),L=Math.cos(E);for(let B=0;B<=e.length-1;B++){d.x=e[B].x*w,d.y=e[B].y,d.z=e[B].x*L,o.push(d.x,d.y,d.z),p.x=S/t,p.y=B/(e.length-1),l.push(p.x,p.y);const F=u[3*B+0]*w,D=u[3*B+1],T=u[3*B+0]*L;h.push(F,D,T)}}for(let S=0;S<t;S++)for(let E=0;E<e.length-1;E++){const w=E+S*e.length,L=w,B=w+e.length,F=w+e.length+1,D=w+1;s.push(L,B,D),s.push(F,D,B)}this.setIndex(s),this.setAttribute("position",new at(o,3)),this.setAttribute("uv",new at(l,2)),this.setAttribute("normal",new at(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kl(e.points,e.segments,e.phiStart,e.phiLength)}}class Wh extends kl{constructor(e=1,t=1,n=4,i=8){const s=new Al;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Wh(e.radius,e.length,e.capSegments,e.radialSegments)}}class Xh extends Rt{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=[],o=[],l=[],u=[],h=new H,f=new be;o.push(0,0,0),l.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),o.push(h.x,h.y,h.z),l.push(0,0,1),f.x=(o[p]/e+1)/2,f.y=(o[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 at(o,3)),this.setAttribute("normal",new at(l,3)),this.setAttribute("uv",new at(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class _a extends Rt{constructor(e=1,t=1,n=1,i=32,s=1,o=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const f=[],d=[],p=[],g=[];let v=0;const A=[],x=n/2;let _=0;S(),o===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(f),this.setAttribute("position",new at(d,3)),this.setAttribute("normal",new at(p,3)),this.setAttribute("uv",new at(g,2));function S(){const w=new H,L=new H;let B=0;const F=(t-e)/n;for(let D=0;D<=s;D++){const T=[],b=D/s,N=b*(t-e)+e;for(let Y=0;Y<=i;Y++){const K=Y/i,Q=K*u+l,oe=Math.sin(Q),ee=Math.cos(Q);L.x=N*oe,L.y=-b*n+x,L.z=N*ee,d.push(L.x,L.y,L.z),w.set(oe,F,ee).normalize(),p.push(w.x,w.y,w.z),g.push(K,1-b),T.push(v++)}A.push(T)}for(let D=0;D<i;D++)for(let T=0;T<s;T++){const b=A[T][D],N=A[T+1][D],Y=A[T+1][D+1],K=A[T][D+1];(e>0||T!==0)&&(f.push(b,N,K),B+=3),(t>0||T!==s-1)&&(f.push(N,Y,K),B+=3)}h.addGroup(_,B,0),_+=B}function E(w){const L=v,B=new be,F=new H;let D=0;const T=w===!0?e:t,b=w===!0?1:-1;for(let Y=1;Y<=i;Y++)d.push(0,x*b,0),p.push(0,b,0),g.push(.5,.5),v++;const N=v;for(let Y=0;Y<=i;Y++){const Q=Y/i*u+l,oe=Math.cos(Q),ee=Math.sin(Q);F.x=T*ee,F.y=x*b,F.z=T*oe,d.push(F.x,F.y,F.z),p.push(0,b,0),B.x=oe*.5+.5,B.y=ee*.5*b+.5,g.push(B.x,B.y),v++}for(let Y=0;Y<i;Y++){const K=L+Y,Q=N+Y;w===!0?f.push(Q,Q+1,K):f.push(Q+1,Q,K),D+=3}h.addGroup(_,D,w===!0?1:2),_+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _a(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Jh extends _a{constructor(e=1,t=1,n=32,i=1,s=!1,o=0,l=Math.PI*2){super(0,e,t,n,i,s,o,l),this.type="C
44oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:l}}static fromJSON(e){return new Jh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vs extends Rt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];l(i),h(n),f(),this.setAttribute("position",new at(s,3)),this.setAttribute("normal",new at(s.slice(),3)),this.setAttribute("uv",new at(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function l(S){const E=new H,w=new H,L=new H;for(let B=0;B<t.length;B+=3)g(t[B+0],E),g(t[B+1],w),g(t[B+2],L),u(E,w,L,S)}function u(S,E,w,L){const B=L+1,F=[];for(let D=0;D<=B;D++){F[D]=[];const T=S.clone().lerp(w,D/B),b=E.clone().lerp(w,D/B),N=B-D;for(let Y=0;Y<=N;Y++)Y===0&&D===B?F[D][Y]=T:F[D][Y]=T.clone().lerp(b,Y/N)}for(let D=0;D<B;D++)for(let T=0;T<2*(B-D)-1;T++){const b=Math.floor(T/2);T%2===0?(p(F[D][b+1]),p(F[D+1][b]),p(F[D][b])):(p(F[D][b+1]),p(F[D+1][b+1]),p(F[D+1][b]))}}function h(S){const E=new H;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(S),s[w+0]=E.x,s[w+1]=E.y,s[w+2]=E.z}function f(){const S=new H;for(let E=0;E<s.length;E+=3){S.x=s[E+0],S.y=s[E+1],S.z=s[E+2];const w=x(S)/2/Math.PI+.5,L=_(S)/Math.PI+.5;o.push(w,1-L)}v(),d()}function d(){for(let S=0;S<o.length;S+=6){const E=o[S+0],w=o[S+2],L=o[S+4],B=Math.max(E,w,L),F=Math.min(E,w,L);B>.9&&F<.1&&(E<.2&&(o[S+0]+=1),w<.2&&(o[S+2]+=1),L<.2&&(o[S+4]+=1))}}function p(S){s.push(S.x,S.y,S.z)}function g(S,E){const w=S*3;E.x=e[w+0],E.y=e[w+1],E.z=e[w+2]}function v(){const S=new H,E=new H,w=new H,L=new H,B=new be,F=new be,D=new be;for(let T=0,b=0;T<s.length;T+=9,b+=6){S.set(s[T+0],s[T+1],s[T+2]),E.set(s[T+3],s[T+4],s[T+5]),w.set(s[T+6],s[T+7],s[T+8]),B.set(o[b+0],o[b+1]),F.set(o[b+2],o[b+3]),D.set(o[b+4],o[b+5]),L.copy(S).add(E).add(w).divideScalar(3);const N=x(L);A(B,b+0,S,N),A(F,b+2,E,N),A(D,b+4,w,N)}}function A(S,E,w,L){L<0&&S.x===1&&(o[E]=S.x-1),w.x===0&&w.z===0&&(o[E]=L/2/Math.PI+.5)}function x(S){return Math.atan2(S.z,-S.x)}function _(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vs(e.vertices,e.indices,e.radius,e.details)}}class Yh extends vs{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],o=[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: 3,088 bytes, line 44
4419,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Yh(e.radius,e.detail)}}const mu=new H,gu=new H,Gd=new H,vu=new pi;class Wy extends Rt{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(to*t),o=e.getIndex(),l=e.getAttribute("position"),u=o?o.count:l.count,h=[0,0,0],f=["a","b","c"],d=new Array(3),p={},g=[];for(let v=0;v<u;v+=3){o?(h[0]=o.getX(v),h[1]=o.getX(v+1),h[2]=o.getX(v+2)):(h[0]=v,h[1]=v+1,h[2]=v+2);const{a:A,b:x,c:_}=vu;if(A.fromBufferAttribute(l,h[0]),x.fromBufferAttribute(l,h[1]),_.fromBufferAttribute(l,h[2]),vu.getNormal(Gd),d[0]=`${Math.round(A.x*i)},${Math.round(A.y*i)},${Math.round(A.z*i)}`,d[1]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.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 S=0;S<3;S++){const E=(S+1)%3,w=d[S],L=d[E],B=vu[f[S]],F=vu[f[E]],D=`${w}_${L}`,T=`${L}_${w}`;T in p&&p[T]?(Gd.dot(p[T].normal)<=s&&(g.push(B.x,B.y,B.z),g.push(F.x,F.y,F.z)),p[T]=null):D in p||(p[D]={index0:h[S],index1:h[E],normal:Gd.clone()})}}for(const v in p)if(p[v]){const{index0:A,index1:x}=p[v];mu.fromBufferAttribute(l,A),gu.fromBufferAttribute(l,x),g.push(mu.x,mu.y,mu.z),g.push(gu.x,gu.y,gu.z)}this.setAttribute("position",new at(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class io extends Al{constructor(e){super(e),this.uuid=Ci(),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 Al().fromJSON(i))}return this}}function rE(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=Xy(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let l,u,h;if(n&&(s=cE(r,e,s,t)),r.length>80*t){l=1/0,u=1/0;let f=-1/0,d=-1/0;for(let p=t;p<i;p+=t){const g=r[p],v=r[p+1];g<l&&(l=g),v<u&&(u=v),g>f&&(f=g),v>d&&(d=v)}h=Math.max(f-l,d-u),h=h!==0?32767/h:0}return Ml(s,o,t,l,u,h,0),o}function Xy(r,e,t,n,i){let s;if(i===xE(r,e,t,n)>0)for(let o=e;o<t;o+=n)s=u0(o/n|0,r[o],r[o+1],s);else for(let o=t-n;o>=e;o-=n)s=u0(o/n|0,r[o],r[o+1],s);return s&&da(s,s.next)&&(El(s),s=s.next),s}function oo(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(da(t,t.next)||fn(t.prev,t,t.next)===0)){if(El(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ml(r,e,t,n,i,s,o){if(!r)return;!o&&s&&pE(r,n,i,s);let l=r;
vendor: 1,971 bytes, line 44
44for(;r.prev!==r.next;){const u=r.prev,h=r.next;if(s?oE(r,n,i,s):sE(r)){e.push(u.i,r.i,h.i),El(r),r=h.next,l=h.next;continue}if(r=h,r===l){o?o===1?(r=aE(oo(r),e),Ml(r,e,t,n,i,s,2)):o===2&&lE(r,e,t,n,i,s):Ml(oo(r),e,t,n,i,s,1);break}}}function sE(r){const e=r.prev,t=r,n=r.next;if(fn(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,l=e.y,u=t.y,h=n.y,f=Math.min(i,s,o),d=Math.min(l,u,h),p=Math.max(i,s,o),g=Math.max(l,u,h);let v=n.next;for(;v!==e;){if(v.x>=f&&v.x<=p&&v.y>=d&&v.y<=g&&il(i,l,s,u,o,h,v.x,v.y)&&fn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function oE(r,e,t,n){const i=r.prev,s=r,o=r.next;if(fn(i,s,o)>=0)return!1;const l=i.x,u=s.x,h=o.x,f=i.y,d=s.y,p=o.y,g=Math.min(l,u,h),v=Math.min(f,d,p),A=Math.max(l,u,h),x=Math.max(f,d,p),_=bp(g,v,e,t,n),S=bp(A,x,e,t,n);let E=r.prevZ,w=r.nextZ;for(;E&&E.z>=_&&w&&w.z<=S;){if(E.x>=g&&E.x<=A&&E.y>=v&&E.y<=x&&E!==i&&E!==o&&il(l,f,u,d,h,p,E.x,E.y)&&fn(E.prev,E,E.next)>=0||(E=E.prevZ,w.x>=g&&w.x<=A&&w.y>=v&&w.y<=x&&w!==i&&w!==o&&il(l,f,u,d,h,p,w.x,w.y)&&fn(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<=x&&E!==i&&E!==o&&il(l,f,u,d,h,p,E.x,E.y)&&fn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;w&&w.z<=S;){if(w.x>=g&&w.x<=A&&w.y>=v&&w.y<=x&&w!==i&&w!==o&&il(l,f,u,d,h,p,w.x,w.y)&&fn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function aE(r,e){let t=r;do{const n=t.prev,i=t.next.next;!da(n,i)&&Yy(n,t,t.next,i)&&Sl(n,i)&&Sl(i,n)&&(e.push(n.i,t.i,i.i),El(t),El(t.next),t=r=i),t=t.next}while(t!==r);return oo(t)}function lE(r,e,t,n,i,s){let o=r;do{let l=o.next.next;for(;l!==o.prev;){if(o.i!==l.i&&vE(o,l)){let u=Ky(o,l);o=oo(o,o.next),u=oo(u,u.next),Ml(o,e,t,n,i,s,0),Ml(u,e,t,n,i,s,0);return}l=l.next}o=o.next}while(o!==r)}function cE(r,e,t,n){const i=[];for(let s=0,o=e.length;s<o;s++){const l=e[s]*n,u=s<o-1?e[s+1]*n:r.length,h=Xy(r,l,u,n,!1);h===h.next&&(h.steiner=!0),i.push(gE(h))}i.sort(uE);for(let s=0;s<i.length;s++)t=hE(i[s],t);return t}function uE(r,e){let t=r.x-e.x;
vendor: 5,458 bytes, line 44
44if(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 hE(r,e){const t=fE(r,e);if(!t)return e;const n=Ky(t,r);return oo(n,n.next),oo(t,t.next)}function fE(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;if(da(r,t))return t;do{if(da(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,o=t.x<t.next.x?t:t.next,d===n))return o}t=t.next}while(t!==e);if(!o)return null;const l=o,u=o.x,h=o.y;let f=1/0;t=o;do{if(n>=t.x&&t.x>=u&&n!==t.x&&Jy(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);Sl(t,r)&&(d<f||d===f&&(t.x>o.x||t.x===o.x&&dE(o,t)))&&(o=t,f=d)}t=t.next}while(t!==l);return o}function dE(r,e){return fn(r.prev,r,e.prev)<0&&fn(e.next,r,r.next)<0}function pE(r,e,t,n){let i=r;do i.z===0&&(i.z=bp(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,mE(i)}function mE(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let o=n,l=0;for(let h=0;h<t&&(l++,o=o.nextZ,!!o);h++);let u=t;for(;l>0||u>0&&o;)l!==0&&(u===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,l--):(i=o,o=o.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=o}s.nextZ=null,t*=2}while(e>1);return r}function bp(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 gE(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 Jy(r,e,t,n,i,s,o,l){return(i-o)*(e-l)>=(r-o)*(s-l)&&(r-o)*(n-l)>=(t-o)*(e-l)&&(t-o)*(s-l)>=(i-o)*(n-l)}function il(r,e,t,n,i,s,o,l){return!(r===o&&e===l)&&Jy(r,e,t,n,i,s,o,l)}function vE(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!_E(r,e)&&(Sl(r,e)&&Sl(e,r)&&yE(r,e)&&(fn(r.prev,r,e.prev)||fn(r,e.prev,e))||da(r,e)&&fn(r.prev,r,r.next)>0&&fn(e.prev,e,e.next)>0)}function fn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function da(r,e){return r.x===e.x&&r.y===e.y}function Yy(r,e,t,n){const i=yu(fn(r,e,t)),s=yu(fn(r,e,n)),o=yu(fn(t,n,r)),l=yu(fn(t,n,e));return!!(i!==s&&o!==l||i===0&&_u(r,t,e)||s===0&&_u(r,n,e)||o===0&&_u(t,r,n)||l===0&&_u(t,e,n))}function _u(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 yu(r){return r>0?1:r<0?-1:0}function _E(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&&Yy(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Sl(r,e){return fn(r.prev,r,r.next)<0?fn(r,e,r.next)>=0&&fn(r,r.prev,e)>=0:fn(r,e,r.prev)<0||fn(r,r.next,e)<0}function yE(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 Ky(r,e){const t=Rp(r.i,r.x,r.y),n=Rp(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 u0(r,e,t,n){const i=Rp(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 El(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 Rp(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xE(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class AE{static triangulate(e,t,n=2){return rE(e,t,n)}}class fr{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 fr.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];h0(e),f0(n,e);let o=e.length;t.forEach(h0);for(let u=0;u<t.length;u++)i.push(o),o+=t[u].length,f0(n,t[u]);const l=AE.triangulate(n,i);for(let u=0;u<l.length;u+=3)s.push(l.slice(u,u+3));return s}}function h0(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function f0(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Kh extends Rt{constructor(e=new io([new be(.5,.5),new be(-.5,.5),new be(-.5,-.5),new be(.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 l=0,u=e.length;l<u;l++){const h=e[l];o(h)}this.setAttribute("position",new at(i,3)),this.setAttribute("uv",new at(s,2)),this.computeVertexNormals();function o(l){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,x=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:ME;let E,w=!1,L,B,F,D;_&&(E=_.getSpacedPoints(f),w=!0,p=!1,L=_.computeFrenetFrames(f,!1),B=new H,F=new H,D=new H),p||(x=0,g=0,v=0,A=0);const T=l.extractPoints(h);let b=T.shape;const N=T.holes;if(!fr.isClockWise(b)){b=b.reverse();for(let Ee=0,Ie=N.length;Ee<Ie;Ee++){const Ae=N[Ee];fr.isClockWise(Ae)&&(N[Ee]=Ae.reverse())}}function K(Ee){const Ae=10000000000000001e-36;let ze=Ee[0];for(let ye=1;ye<=Ee.length;ye++){const O=ye%Ee.length,P=Ee[O],ne=P.x-ze.x,he=P.y-ze.y,xe=ne*ne+he*he,ve=Math.max(Math.abs(P.x),Math.abs(P.y),Math.abs(ze.x),Math.abs(ze.y)),tt=Ae*ve*ve;if(xe<=tt){Ee.splice(O,1),ye--;continue}ze=P}}
vendor: 107,718 bytes, line 44
44K(b),N.forEach(K);const Q=N.length,oe=b;for(let Ee=0;Ee<Q;Ee++){const Ie=N[Ee];b=b.concat(Ie)}function ee(Ee,Ie,Ae){return Ie||console.error("THREE.ExtrudeGeometry: vec does not exist"),Ee.clone().addScaledVector(Ie,Ae)}const Me=b.length;function G(Ee,Ie,Ae){let ze,ye,O;const P=Ee.x-Ie.x,ne=Ee.y-Ie.y,he=Ae.x-Ee.x,xe=Ae.y-Ee.y,ve=P*P+ne*ne,tt=P*xe-ne*he;if(Math.abs(tt)>Number.EPSILON){const Oe=Math.sqrt(ve),Ke=Math.sqrt(he*he+xe*xe),Lt=Ie.x-ne/Oe,Fe=Ie.y+P/Oe,$e=Ae.x-xe/Ke,ut=Ae.y+he/Ke,it=(($e-Lt)*xe-(ut-Fe)*he)/(P*xe-ne*he);ze=Lt+P*it-Ee.x,ye=Fe+ne*it-Ee.y;const je=ze*ze+ye*ye;if(je<=2)return new be(ze,ye);O=Math.sqrt(je/2)}else{let Oe=!1;P>Number.EPSILON?he>Number.EPSILON&&(Oe=!0):P<-Number.EPSILON?he<-Number.EPSILON&&(Oe=!0):Math.sign(ne)===Math.sign(xe)&&(Oe=!0),Oe?(ze=-ne,ye=P,O=Math.sqrt(ve)):(ze=P,ye=ne,O=Math.sqrt(ve/2))}return new be(ze/O,ye/O)}const te=[];for(let Ee=0,Ie=oe.length,Ae=Ie-1,ze=Ee+1;Ee<Ie;Ee++,Ae++,ze++)Ae===Ie&&(Ae=0),ze===Ie&&(ze=0),te[Ee]=G(oe[Ee],oe[Ae],oe[ze]);const q=[];let ce,Se=te.concat();for(let Ee=0,Ie=Q;Ee<Ie;Ee++){const Ae=N[Ee];ce=[];for(let ze=0,ye=Ae.length,O=ye-1,P=ze+1;ze<ye;ze++,O++,P++)O===ye&&(O=0),P===ye&&(P=0),ce[ze]=G(Ae[ze],Ae[O],Ae[P]);q.push(ce),Se=Se.concat(ce)}const Ge=[],le=[];for(let Ee=0;Ee<x;Ee++){const Ie=Ee/x,Ae=g*Math.cos(Ie*Math.PI/2),ze=v*Math.sin(Ie*Math.PI/2)+A;for(let ye=0,O=oe.length;ye<O;ye++){const P=ee(oe[ye],te[ye],ze);xt(P.x,P.y,-Ae),Ie==0&&Ge.push(P)}for(let ye=0,O=Q;ye<O;ye++){const P=N[ye];ce=q[ye];const ne=[];for(let he=0,xe=P.length;he<xe;he++){const ve=ee(P[he],ce[he],ze);xt(ve.x,ve.y,-Ae),Ie==0&&ne.push(ve)}Ie==0&&le.push(ne)}}const Re=fr.triangulateShape(Ge,le),we=Re.length,Le=v+A;for(let Ee=0;Ee<Me;Ee++){const Ie=p?ee(b[Ee],Se[Ee],Le):b[Ee];w?(F.copy(L.normals[0]).multiplyScalar(Ie.x),B.copy(L.binormals[0]).multiplyScalar(Ie.y),D.copy(E[0]).add(F).add(B),xt(D.x,D.y,D.z)):xt(Ie.x,Ie.y,0)}for(let Ee=1;Ee<=f;Ee++)for(let Ie=0;Ie<Me;Ie++){const Ae=p?ee(b[Ie],Se[Ie],Le):b[Ie];w?(F.copy(L.normals[Ee]).multiplyScalar(Ae.x),B.copy(L.binormals[Ee]).multiplyScalar(Ae.y),D.copy(E[Ee]).add(F).add(B),xt(D.x,D.y,D.z)):xt(Ae.x,Ae.y,d/f*Ee)}for(let Ee=x-1;Ee>=0;Ee--){const Ie=Ee/x,Ae=g*Math.cos(Ie*Math.PI/2),ze=v*Math.sin(Ie*Math.PI/2)+A;for(let ye=0,O=oe.length;ye<O;ye++){const P=ee(oe[ye],te[ye],ze);xt(P.x,P.y,d+Ae)}for(let ye=0,O=N.length;ye<O;ye++){const P=N[ye];ce=q[ye];for(let ne=0,he=P.length;ne<he;ne++){const xe=ee(P[ne],ce[ne],ze);w?xt(xe.x,xe.y+E[f-1].y,E[f-1].x+Ae):xt(xe.x,xe.y,d+Ae)}}}ot(),Ut();function ot(){const Ee=i.length/3;if(p){let Ie=0,Ae=Me*Ie;for(let ze=0;ze<we;ze++){const ye=Re[ze];kt(ye[2]+Ae,ye[1]+Ae,ye[0]+Ae)}Ie=f+x*2,Ae=Me*Ie;for(let ze=0;ze<we;ze++){const ye=Re[ze];kt(ye[0]+Ae,ye[1]+Ae,ye[2]+Ae)}}else{for(let Ie=0;Ie<we;Ie++){const Ae=Re[Ie];kt(Ae[2],Ae[1],Ae[0])}for(let Ie=0;Ie<we;Ie++){const Ae=Re[Ie];kt(Ae[0]+Me*f,Ae[1]+Me*f,Ae[2]+Me*f)}}n.addGroup(Ee,i.length/3-Ee,0)}function Ut(){const Ee=i.length/3;let Ie=0;ft(oe,Ie),Ie+=oe.length;for(let Ae=0,ze=N.length;Ae<ze;Ae++){const ye=N[Ae];ft(ye,Ie),Ie+=ye.length}n.addGroup(Ee,i.length/3-Ee,1)}function ft(Ee,Ie){let Ae=Ee.length;for(;--Ae>=0;){const ze=Ae;let ye=Ae-1;ye<0&&(ye=Ee.length-1);for(let O=0,P=f+x*2;O<P;O++){const ne=Me*O,he=Me*(O+1),xe=Ie+ze+ne,ve=Ie+ye+ne,tt=Ie+ye+he,Oe=Ie+ze+he;pt(xe,ve,tt,Oe)}}}function xt(Ee,Ie,Ae){u.push(Ee),u.push(Ie),u.push(Ae)}function kt(Ee,Ie,Ae){X(Ee),X(Ie),X(Ae);const ze=i.length/3,ye=S.generateTopUV(n,i,ze-3,ze-2,ze-1);tn(ye[0]),tn(ye[1]),tn(ye[2])}function pt(Ee,Ie,Ae,ze){X(Ee),X(Ie),X(ze),X(Ie),X(Ae),X(ze);const ye=i.length/3,O=S.generateSideWallUV(n,i,ye-6,ye-3,ye-2,ye-1);tn(O[0]),tn(O[1]),tn(O[3]),tn(O[1]),tn(O[2]),tn(O[3])}function X(Ee){i.push(u[Ee*3+0]),i.push(u[Ee*3+1]),i.push(u[Ee*3+2])}function tn(Ee){s.push(Ee.x),s.push(Ee.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 SE(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const l=t[e.shapes[s]];n.push(l)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new wh[i.type]().fromJSON(i)),new Kh(n,e.options)}}const ME={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],l=e[n*3],u=e[n*3+1],h=e[i*3],f=e[i*3+1];return[new be(s,o),new be(l,u),new be(h,f)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],l=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],x=e[s*3+1],_=e[s*3+2];return Math.abs(l-f)<Math.abs(o-h)?[new be(o,1-u),new be(h,1-d),new be(p,1-v),new be(A,1-_)]:[new be(l,1-u),new be(f,1-d),new be(g,1-v),new be(x,1-_)]}};function SE(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 zl extends vs{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 zl(e.radius,e.detail)}}class Vl extends vs{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 Vl(e.radius,e.detail)}}class _s extends Rt{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,o=t/2,l=Math.floor(n),u=Math.floor(i),h=l+1,f=u+1,d=e/l,p=t/u,g=[],v=[],A=[],x=[];for(let _=0;_<f;_++){const S=_*p-o;for(let E=0;E<h;E++){const w=E*d-s;v.push(w,-S,0),A.push(0,0,1),x.push(E/l),x.push(1-_/u)}}for(let _=0;_<u;_++)for(let S=0;S<l;S++){const E=S+h*_,w=S+h*(_+1),L=S+1+h*(_+1),B=S+1+h*_;g.push(E,w,B),g.push(w,L,B)}this.setIndex(g),this.setAttribute("position",new at(v,3)),this.setAttribute("normal",new at(A,3)),this.setAttribute("uv",new at(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _s(e.width,e.height,e.widthSegments,e.heightSegments)}}class Zh extends Rt{constructor(e=.5,t=1,n=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const l=[],u=[],h=[],f=[];let d=e;const p=(t-e)/i,g=new H,v=new be;for(let A=0;A<=i;A++){for(let x=0;x<=n;x++){const _=s+x/n*o;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 x=A*(n+1);for(let _=0;_<n;_++){const S=_+x,E=S,w=S+n+1,L=S+n+2,B=S+1;l.push(E,w,B),l.push(w,L,B)}}this.setIndex(l),this.setAttribute("position",new at(u,3)),this.setAttribute("normal",new at(h,3)),this.setAttribute("uv",new at(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class qh extends Rt{constructor(e=new io([new be(0,.5),new be(-.5,-.5),new be(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let l=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let f=0;f<e.length;f++)h(e[f]),this.addGroup(l,u,f),l+=u,u=0;this.setIndex(n),this.setAttribute("position",new at(i,3)),this.setAttribute("normal",new at(s,3)),this.setAttribute("uv",new at(o,2));function h(f){const d=i.length/3,p=f.extractPoints(t);let g=p.shape;const v=p.holes;fr.isClockWise(g)===!1&&(g=g.reverse());for(let x=0,_=v.length;x<_;x++){const S=v[x];fr.isClockWise(S)===!0&&(v[x]=S.reverse())}const A=fr.triangulateShape(g,v);for(let x=0,_=v.length;x<_;x++){const S=v[x];g=g.concat(S)}for(let x=0,_=g.length;x<_;x++){const S=g[x];i.push(S.x,S.y,0),s.push(0,0,1),o.push(S.x,S.y)}for(let x=0,_=A.length;x<_;x++){const S=A[x],E=S[0]+d,w=S[1]+d,L=S[2]+d;n.push(E,w,L),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 EE(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new qh(n,e.curveSegments)}}function EE(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 Wl extends Rt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:l},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(o+l,Math.PI);let h=0;const f=[],d=new H,p=new H,g=[],v=[],A=[],x=[];for(let _=0;_<=n;_++){const S=[],E=_/n;let w=0;_===0&&o===0?w=.5/t:_===n&&u===Math.PI&&(w=-.5/t);for(let L=0;L<=t;L++){const B=L/t;d.x=-e*Math.cos(i+B*s)*Math.sin(o+E*l),d.y=e*Math.cos(o+E*l),d.z=e*Math.sin(i+B*s)*Math.sin(o+E*l),v.push(d.x,d.y,d.z),p.copy(d).normalize(),A.push(p.x,p.y,p.z),x.push(B+w,1-E),S.push(h++)}f.push(S)}for(let _=0;_<n;_++)for(let S=0;S<t;S++){const E=f[_][S+1],w=f[_][S],L=f[_+1][S],B=f[_+1][S+1];(_!==0||o>0)&&g.push(E,w,B),(_!==n-1||u<Math.PI)&&g.push(w,L,B)}this.setIndex(g),this.setAttribute("position",new at(v,3)),this.setAttribute("normal",new at(A,3)),this.setAttribute("uv",new at(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Qh extends vs{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 Qh(e.radius,e.detail)}}class jh extends Rt{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 o=[],l=[],u=[],h=[],f=new H,d=new H,p=new H;for(let g=0;g<=n;g++)for(let v=0;v<=i;v++){const A=v/i*s,x=g/n*Math.PI*2;d.x=(e+t*Math.cos(x))*Math.cos(A),d.y=(e+t*Math.cos(x))*Math.sin(A),d.z=t*Math.sin(x),l.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,x=(i+1)*(g-1)+v-1,_=(i+1)*(g-1)+v,S=(i+1)*g+v;o.push(A,x,S),o.push(x,_,S)}this.setIndex(o),this.setAttribute("position",new at(l,3)),this.setAttribute("normal",new at(u,3)),this.setAttribute("uv",new at(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class $h extends Rt{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const l=[],u=[],h=[],f=[],d=new H,p=new H,g=new H,v=new H,A=new H,x=new H,_=new H;for(let E=0;E<=n;++E){const w=E/n*s*Math.PI*2;S(w,s,o,e,g),S(w+.01,s,o,e,v),x.subVectors(v,g),_.addVectors(v,g),A.crossVectors(x,_),_.crossVectors(A,x),A.normalize(),_.normalize();for(let L=0;L<=i;++L){const B=L/i*Math.PI*2,F=-t*Math.cos(B),D=t*Math.sin(B);d.x=g.x+(F*_.x+D*A.x),d.y=g.y+(F*_.y+D*A.y),d.z=g.z+(F*_.z+D*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(L/i)}}for(let E=1;E<=n;E++)for(let w=1;w<=i;w++){const L=(i+1)*(E-1)+(w-1),B=(i+1)*E+(w-1),F=(i+1)*E+w,D=(i+1)*(E-1)+w;l.push(L,B,D),l.push(B,F,D)}this.setIndex(l),this.setAttribute("position",new at(u,3)),this.setAttribute("normal",new at(h,3)),this.setAttribute("uv",new at(f,2));function S(E,w,L,B,F){const D=Math.cos(E),T=Math.sin(E),b=L/w*E,N=Math.cos(b);F.x=B*(2+N)*.5*D,F.y=B*(2+N)*T*.5,F.z=B*Math.sin(b)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $h(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ef extends Rt{constructor(e=new dm(new H(-1,-1,0),new H(-1,1,0),new H(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 o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const l=new H,u=new H,h=new be;let f=new H;const d=[],p=[],g=[],v=[];A(),this.setIndex(v),this.setAttribute("position",new at(d,3)),this.setAttribute("normal",new at(p,3)),this.setAttribute("uv",new at(g,2));function A(){for(let E=0;E<t;E++)x(E);x(s===!1?t:0),S(),_()}function x(E){f=e.getPointAt(E/t,f);const w=o.normals[E],L=o.binormals[E];for(let B=0;B<=i;B++){const F=B/i*Math.PI*2,D=Math.sin(F),T=-Math.cos(F);u.x=T*w.x+D*L.x,u.y=T*w.y+D*L.y,u.z=T*w.z+D*L.z,u.normalize(),p.push(u.x,u.y,u.z),l.x=f.x+n*u.x,l.y=f.y+n*u.y,l.z=f.z+n*u.z,d.push(l.x,l.y,l.z)}}function _(){for(let E=1;E<=t;E++)for(let w=1;w<=i;w++){const L=(i+1)*(E-1)+(w-1),B=(i+1)*E+(w-1),F=(i+1)*E+w,D=(i+1)*(E-1)+w;v.push(L,B,D),v.push(B,F,D)}}function S(){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 ef(new wh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Zy extends Rt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new H,s=new H;if(e.index!==null){const o=e.attributes.position,l=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:l.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 x=0;x<3;x++){const _=l.getX(v+x),S=l.getX(v+(x+1)%3);i.fromBufferAttribute(o,_),s.fromBufferAttribute(o,S),d0(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let l=0,u=o.count/3;l<u;l++)for(let h=0;h<3;h++){const f=3*l+h,d=3*l+(h+1)%3;i.fromBufferAttribute(o,f),s.fromBufferAttribute(o,d),d0(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new at(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function d0(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 p0=Object.freeze({__proto__:null,BoxGeometry:uo,CapsuleGeometry:Wh,CircleGeometry:Xh,ConeGeometry:Jh,CylinderGeometry:_a,DodecahedronGeometry:Yh,EdgesGeometry:Wy,ExtrudeGeometry:Kh,IcosahedronGeometry:zl,LatheGeometry:kl,OctahedronGeometry:Vl,PlaneGeometry:_s,PolyhedronGeometry:vs,RingGeometry:Zh,ShapeGeometry:qh,SphereGeometry:Wl,TetrahedronGeometry:Qh,TorusGeometry:jh,TorusKnotGeometry:$h,TubeGeometry:ef,WireframeGeometry:Zy});class qy extends Rn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ye(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 Qy extends vi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Xl extends Rn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ye(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 Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gs,this.normalScale=new be(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 Ti,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 zi extends Xl{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 be(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return St(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 Ye(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 Ye(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ye(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 jy extends Rn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ye(16777215),this.specular=new Ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gs,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ti,this.combine=Il,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 $y extends Rn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ye(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gs,this.normalScale=new be(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 ex extends Rn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gs,this.normalScale=new be(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 tx extends Rn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gs,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ti,this.combine=Il,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 mm extends Rn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=gy,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 gm extends Rn{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 nx extends Rn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ye(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gs,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.flatShading=e.flatShading,this.fog=e.fog,this}}class ix extends jn{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 Qs(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function rx(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function sx(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 Ip(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const l=t[s]*e;for(let u=0;u!==e;++u)i[o++]=r[l+u]}return i}function vm(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 o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function wE(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];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=Qs(d,h.times.constructor),h.values=Qs(p,h.values.constructor),o.push(h))}s.tracks=o;let l=1/0;for(let u=0;u<s.tracks.length;++u)l>s.tracks[u].times[0]&&(l=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*l);return s.resetDuration(),s}function CE(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const l=t.tracks[o],u=l.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(_){return _.name===l.name&&_.ValueTypeName===u});if(h===void 0)continue;let f=0;const d=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);const v=l.times.length-1;let A;if(s<=l.times[0]){const _=f,S=d-f;A=l.values.slice(_,S)}else if(s>=l.times[v]){const _=v*d+f,S=_+d-f;A=l.values.slice(_,S)}else{const _=l.createInterpolant(),S=f,E=d-f;_.evaluate(s),A=_.resultBuffer.slice(S,E)}u==="quaternion"&&new qn().fromArray(A).normalize().conjugate().toArray(A);const x=h.times.length;for(let _=0;_<x;++_){const S=_*g+p;if(u==="quaternion")qn.multiplyQuaternionsFlat(h.values,S,A,0,h.values,S);else{const E=g-p*2;for(let w=0;w<E;++w)h.values[S+w]-=A[w]}}}return r.blendMode=qp,r}class TE{static convertArray(e,t){return Qs(e,t)}static isTypedArray(e){return rx(e)}static getKeyframeOrder(e){return sx(e)}static sortedArray(e,t,n){return Ip(e,t,n)}static flattenJSON(e,t,n,i){vm(e,t,n,i)}static subclip(e,t,n,i,s=30){return wE(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return CE(e,t,n,i)}}class ya{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 o;n:{i:if(!(e<i)){for(let l=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===l)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const l=t[1];e<l&&(n=2,s=l);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}o=n,n=0;break n}break e}for(;n<o;){const l=n+o>>>1;e<t[l]?o=l:n=l+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 o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ox extends ya{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:Ks,endingEnd:Ks}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,l=i[s],u=i[o];if(l===void 0)switch(this.getSettings_().endingStart){case Zs:s=e,l=2*t-n;break;case gl:s=i.length-2,l=t+i[s]-i[s+1];break;default:s=e,l=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Zs:o=e,u=2*n-t;break;case gl:o=1,u=n+i[1]-i[0];break;default:o=e-1,u=t}const h=(n-t)*.5,f=this.valueSize;this._weightPrev=h/(t-l),this._weightNext=h/(u-n),this._offsetPrev=s*f,this._offsetNext=o*f}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=e*l,h=u-l,f=this._offsetPrev,d=this._offsetNext,p=this._weightPrev,g=this._weightNext,v=(n-t)/(i-t),A=v*v,x=A*v,_=-p*x+2*p*A-p*v,S=(1+p)*x+(-1.5-2*p)*A+(-.5+p)*v+1,E=(-1-g)*x+(1.5+g)*A+.5*v,w=g*x-g*A;for(let L=0;L!==l;++L)s[L]=_*o[f+L]+S*o[h+L]+E*o[u+L]+w*o[d+L];return s}}class _m extends ya{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=e*l,h=u-l,f=(n-t)/(i-t),d=1-f;for(let p=0;p!==l;++p)s[p]=o[h+p]*d+o[u+p]*f;return s}}class ax extends ya{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Vi{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=Qs(t,this.TimeBufferType),this.values=Qs(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:Qs(e.times,Array),values:Qs(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ax(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new _m(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ox(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ca:t=this.InterpolantFactoryMethodDiscrete;break;case ua:t=this.InterpolantFactoryMethodLinear;break;case Uu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ca;case this.InterpolantFactoryMethodLinear:return ua;case this.InterpolantFactoryMethodSmooth:return Uu}}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,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const l=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*l,o*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let l=0;l!==s;l++){const u=n[l];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,u),e=!1;break}if(o!==null&&o>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,u,o),e=!1;break}o=u}if(i!==void 0&&rx(i))for(let l=0,u=i.length;l!==u;++l){const h=i[l];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Uu,s=e.length-1;let o=1;for(let l=1;l<s;++l){let u=!1;const h=e[l],f=e[l+1];if(h!==f&&(l!==1||h!==e[0]))if(i)u=!0;else{const d=l*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(l!==o){e[o]=e[l];const d=l*n,p=o*n;for(let g=0;g!==n;++g)t[p+g]=t[d+g]}++o}}if(s>0){e[o]=e[s];for(let l=s*n,u=o*n,h=0;h!==n;++h)t[u+h]=t[l+h];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*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}}Vi.prototype.ValueTypeName="";Vi.prototype.TimeBufferType=Float32Array;Vi.prototype.ValueBufferType=Float32Array;Vi.prototype.DefaultInterpolation=ua;class ho extends Vi{constructor(e,t,n){super(e,t,n)}}ho.prototype.ValueTypeName="bool";ho.prototype.ValueBufferType=Array;ho.prototype.DefaultInterpolation=ca;ho.prototype.InterpolantFactoryMethodLinear=void 0;ho.prototype.InterpolantFactoryMethodSmooth=void 0;class ym extends Vi{constructor(e,t,n,i){super(e,t,n,i)}}ym.prototype.ValueTypeName="color";class ao extends Vi{constructor(e,t,n,i){super(e,t,n,i)}}ao.prototype.ValueTypeName="number";class lx extends ya{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=(n-t)/(i-t);let h=e*l;for(let f=h+l;h!==f;h+=4)qn.slerpFlat(s,0,o,h-l,o,h,u);return s}}class lo extends Vi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new lx(this.times,this.values,this.getValueSize(),e)}}lo.prototype.ValueTypeName="quaternion";lo.prototype.InterpolantFactoryMethodSmooth=void 0;class fo extends Vi{constructor(e,t,n){super(e,t,n)}}fo.prototype.ValueTypeName="string";fo.prototype.ValueBufferType=Array;fo.prototype.DefaultInterpolation=ca;fo.prototype.InterpolantFactoryMethodLinear=void 0;fo.prototype.InterpolantFactoryMethodSmooth=void 0;class co extends Vi{constructor(e,t,n,i){super(e,t,n,i)}}co.prototype.ValueTypeName="vector";class pa{constructor(e="",t=-1,n=[],i=Fh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,l=n.length;o!==l;++o)t.push(RE(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Vi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let l=0;l<s;l++){let u=[],h=[];u.push((l+s-1)%s,l,(l+1)%s),h.push(0,1,0);const f=sx(u);u=Ip(u,1,f),h=Ip(h,1,f),!i&&u[0]===0&&(u.push(s),h.push(h[0])),o.push(new ao(".morphTargetInfluences["+t[l].name+"]",u,h).scale(1/n))}return new this(e,-1,o)}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 l=0,u=e.length;l<u;l++){const h=e[l],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 o=[];for(const l in i)o.push(this.CreateFromMorphTargetSequence(l,i[l],t,n));return o}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,p,g,v,A){if(g.length!==0){const x=[],_=[];vm(g,x,_,v),x.length!==0&&A.push(new d(p,x,_))}},i=[],s=e.name||"default",o=e.fps||30,l=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 x=[],_=[];for(let S=0;S!==p[v].morphTargets.length;++S){const E=p[v];x.push(E.time),_.push(E.morphTarget===A?1:0)}i.push(new ao(".morphTargetInfluence["+A+"]",x,_))}u=g.length*o}else{const g=".bones["+t[d].name+"]";n(co,g+".position",p,"pos",i),n(lo,g+".quaternion",p,"rot",i),n(co,g+".scale",p,"scl",i)}}return i.length===0?null:new this(s,u,i,l)}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 t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function bE(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ao;case"vector":case"vector2":case"vector3":case"vector4":return co;case"color":return ym;case"quaternion":return lo;case"bool":case"boolean":return ho;case"string":return fo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function RE(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=bE(r.type);if(r.times===void 0){const t=[],n=[];vm(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 Fr={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 tf{constructor(e,t,n){const i=this;let s=!1,o=0,l=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(f){l++,s===!1&&i.onStart!==void 0&&i.onStart(f,o,l),s=!0},this.itemEnd=function(f){o++,i.onProgress!==void 0&&i.onProgress(f,o,l),o===l&&(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}}}const cx=new tf;class kn{constructor(e){this.manager=e!==void 0?e:cx,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}}kn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ir={};class IE extends Error{constructor(e,t){super(e),this.response=t}}class Gn extends kn{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Fr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ir[e]!==void 0){Ir[e].push({onLoad:t,onProgress:n,onError:i});return}Ir[e]=[],Ir[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,u=this.responseType;fetch(o).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const f=Ir[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 x=new ReadableStream({start(_){S();function S(){d.read().then(({done:E,value:w})=>{if(E)_.close();else{A+=w.byteLength;const L=new ProgressEvent("progress",{lengthComputable:v,loaded:A,total:g});for(let B=0,F=f.length;B<F;B++){const D=f[B];D.onProgress&&D.onProgress(L)}_.enqueue(w),S()}},E=>{_.error(E)})}}});return new Response(x)}else throw new IE(`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,l));case"json":return h.json();default:if(l==="")return h.text();{const d=/charset="?([^;"\s]*)"?/i.exec(l),p=d&&d[1]?d[1].toLowerCase():void 0,g=new TextDecoder(p);return h.arrayBuffer().then(v=>g.decode(v))}}}).then(h=>{Fr.add(e,h);const f=Ir[e];delete Ir[e];for(let d=0,p=f.length;d<p;d++){const g=f[d];g.onLoad&&g.onLoad(h)}}).catch(h=>{const f=Ir[e];if(f===void 0)throw this.manager.itemError(e),h;delete Ir[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}}class BE extends kn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Gn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=pa.parse(e[n]);t.push(i)}return t}}class PE extends kn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],l=new zh,u=new Gn(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);o[d]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(l.minFilter=Qt),l.image=o,l.format=g.format,l.needsUpdate=!0,t&&t(l))},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++){o[v]={mipmaps:[]};for(let A=0;A<p.mipmapCount;A++)o[v].mipmaps.push(p.mipmaps[v*p.mipmapCount+A]),o[v].format=p.format,o[v].width=p.width,o[v].height=p.height}l.image=o}else l.image.width=p.width,l.image.height=p.height,l.mipmaps=p.mipmaps;p.mipmapCount===1&&(l.minFilter=Qt),l.format=p.format,l.needsUpdate=!0,t&&t(l)},n,i);return l}}class wl extends kn{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,o=Fr.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const l=xl("img");function u(){f(),Fr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(d){f(),i&&i(d),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){l.removeEventListener("load",u,!1),l.removeEventListener("error",h,!1)}return l.addEventListener("load",u,!1),l.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class ux extends kn{constructor(e){super(e)}load(e,t,n,i){const s=new Ul;s.colorSpace=si;const o=new wl(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let l=0;function u(h){o.load(e[h],function(f){s.images[h]=f,l++,l===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class xm extends kn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new $i,l=new Gn(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(s.withCredentials),l.load(e,function(u){let h;try{h=s.parse(u)}catch(f){if(i!==void 0)i(f);else{console.error(f);return}}h.image!==void 0?o.image=h.image:h.data!==void 0&&(o.image.width=h.width,o.image.height=h.height,o.image.data=h.data),o.wrapS=h.wrapS!==void 0?h.wrapS:An,o.wrapT=h.wrapT!==void 0?h.wrapT:An,o.magFilter=h.magFilter!==void 0?h.magFilter:Qt,o.minFilter=h.minFilter!==void 0?h.minFilter:Qt,o.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(o.colorSpace=h.colorSpace),h.flipY!==void 0&&(o.flipY=h.flipY),h.format!==void 0&&(o.format=h.format),h.type!==void 0&&(o.type=h.type),h.mipmaps!==void 0&&(o.mipmaps=h.mipmaps,o.minFilter=Gi),h.mipmapCount===1&&(o.minFilter=Qt),h.generateMipmaps!==void 0&&(o.generateMipmaps=h.generateMipmaps),o.needsUpdate=!0,t&&t(o,h)},n,i),o}}class hx extends kn{constructor(e){super(e)}load(e,t,n,i){const s=new jt,o=new wl(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class ys extends zt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class fx extends ys{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(zt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const kd=new gt,m0=new H,g0=new H;class Am{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new be(512,512),this.map=null,this.mapPass=null,this.matrix=new gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Gl,this._frameExtents=new be(1,1),this._viewportCount=1,this._viewports=[new Jt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;m0.setFromMatrixPosition(e.matrixWorld),t.position.copy(m0),g0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(g0),t.updateMatrixWorld(),kd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kd),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(kd)}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.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 DE extends Am{constructor(){super(new bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ha*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,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 Mm extends ys{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(zt.DEFAULT_UP),this.updateMatrix(),this.target=new zt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new DE}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const v0=new gt,qa=new H,zd=new H;class LE extends Am{constructor(){super(new bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new be(4,2),this._viewportCount=6,this._viewports=[new Jt(2,1,1,1),new Jt(0,1,1,1),new Jt(3,1,1,1),new Jt(1,1,1,1),new Jt(3,0,1,1),new Jt(1,0,1,1)],this._cubeDirections=[new H(1,0,0),new H(-1,0,0),new H(0,0,1),new H(0,0,-1),new H(0,1,0),new H(0,-1,0)],this._cubeUps=[new H(0,1,0),new H(0,1,0),new H(0,1,0),new H(0,1,0),new H(0,0,1),new H(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),qa.setFromMatrixPosition(e.matrixWorld),n.position.copy(qa),zd.copy(n.position),zd.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(zd),n.updateMatrixWorld(),i.makeTranslation(-qa.x,-qa.y,-qa.z),v0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(v0)}}class Sm extends ys{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 LE}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class po extends Fl{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=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=o,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,o){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=o,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,o=n+e,l=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,o=s+h*this.view.width,l-=f*this.view.offsetY,u=l-f*this.view.height}this.projectionMatrix.makeOrthographic(s,o,l,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class FE extends Am{constructor(){super(new po(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Em extends ys{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(zt.DEFAULT_UP),this.updateMatrix(),this.target=new zt,this.shadow=new FE}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class dx extends ys{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class px extends ys{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 mx{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new H)}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,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[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 gx extends ys{constructor(e=new mx,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class nf extends kn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new Gn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.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 Ye().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.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 o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new Ye().setHex(o.value);break;case"v2":i.uniforms[s].value=new be().fromArray(o.value);break;case"v3":i.uniforms[s].value=new H().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Jt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new bt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new gt().fromArray(o.value);break;default:i.uniforms[s].value=o.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 be().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 be().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 nf.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:qy,SpriteMaterial:im,RawShaderMaterial:Qy,ShaderMaterial:vi,PointsMaterial:kh,MeshPhysicalMaterial:zi,MeshStandardMaterial:Xl,MeshPhongMaterial:jy,MeshToonMaterial:$y,MeshNormalMaterial:ex,MeshLambertMaterial:tx,MeshDepthMaterial:mm,MeshDistanceMaterial:gm,MeshBasicMaterial:mi,MeshMatcapMaterial:nx,LineDashedMaterial:ix,LineBasicMaterial:jn,Material:Rn};return new t[e]}}class hs{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 vx extends Rt{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 _x extends kn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Gn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(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 x=g.interleavedBuffers[v],_=s(g,x.buffer),S=qo(x.type,_),E=new Ol(S,x.stride);return E.uuid=x.uuid,t[v]=E,E}function s(g,v){if(n[v]!==void 0)return n[v];const x=g.arrayBuffers[v],_=new Uint32Array(x).buffer;return n[v]=_,_}const o=e.isInstancedBufferGeometry?new vx:new Rt,l=e.data.index;if(l!==void 0){const g=qo(l.type,l.array);o.setIndex(new Yt(g,1))}const u=e.data.attributes;for(const g in u){const v=u[g];let A;if(v.isInterleavedBufferAttribute){const x=i(e.data,v.data);A=new ms(x,v.itemSize,v.offset,v.normalized)}else{const x=qo(v.type,v.array),_=v.isInstancedBufferAttribute?so:Yt;A=new _(x,v.itemSize,v.normalized)}v.name!==void 0&&(A.name=v.name),v.usage!==void 0&&A.setUsage(v.usage),o.setAttribute(g,A)}const h=e.data.morphAttributes;if(h)for(const g in h){const v=h[g],A=[];for(let x=0,_=v.length;x<_;x++){const S=v[x];let E;if(S.isInterleavedBufferAttribute){const w=i(e.data,S.data);E=new ms(w,S.itemSize,S.offset,S.normalized)}else{const w=qo(S.type,S.array);E=new Yt(w,S.itemSize,S.normalized)}S.name!==void 0&&(E.name=S.name),A.push(E)}o.morphAttributes[g]=A}e.data.morphTargetsRelative&&(o.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];o.addGroup(A.start,A.count,A.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const g=new H;p.center!==void 0&&g.fromArray(p.center),o.boundingSphere=new Hn(g,p.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class UE extends kn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?hs.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const l=new Gn(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(d){i!==void 0&&i(d),console.error("THREE: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)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?hs.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Gn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),l=JSON.parse(o),u=l.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(l)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(h)}),l=this.parseTextures(e.textures,o),u=this.parseMaterials(e.materials,l),h=this.parseObject(e.object,s,u,l,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 o)if(o[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),o=this.parseTextures(e.textures,s),l=this.parseMaterials(e.materials,o),u=this.parseObject(e.object,i,l,o,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 io().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,o=e.length;s<o;s++){const l=new Hl().fromJSON(e[s],i);n[l.uuid]=l}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new _x;for(let s=0,o=e.length;s<o;s++){let l;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":l=i.parse(u);break;default:u.type in p0?l=p0[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}l.uuid=u.uuid,u.name!==void 0&&(l.name=u.name),u.userData!==void 0&&(l.userData=u.userData),n[u.uuid]=l}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new nf;s.setTextures(t);for(let o=0,l=e.length;o<l;o++){const u=e[o];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=pa.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(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 l(u){if(typeof u=="string"){const h=u,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return o(f)}else return u.data?{data:qo(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new tf(t);s=new wl(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 x=p[v],_=l(x);_!==null&&(_ instanceof HTMLImageElement?g.push(_):g.push(new $i(_.data,_.width,_.height)))}i[d.uuid]=new cs(g)}else{const g=l(d.url);i[d.uuid]=new cs(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(o){if(typeof o=="string"){const l=o,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:t.resourcePath+l;return await i.loadAsync(u)}else return o.data?{data:qo(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new wl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,l=e.length;o<l;o++){const u=e[o],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 $i(v.data,v.width,v.height)))}n[u.uuid]=new cs(f)}else{const f=await s(u.url);n[u.uuid]=new cs(f)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const l=e[s];l.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),t[l.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",l.image);const u=t[l.image],h=u.data;let f;Array.isArray(h)?(f=new Ul,h.length===6&&(f.needsUpdate=!0)):(h&&h.data?f=new $i:f=new jt,h&&(f.needsUpdate=!0)),f.source=u,f.uuid=l.uuid,l.name!==void 0&&(f.name=l.name),l.mapping!==void 0&&(f.mapping=n(l.mapping,NE)),l.channel!==void 0&&(f.channel=l.channel),l.offset!==void 0&&f.offset.fromArray(l.offset),l.repeat!==void 0&&f.repeat.fromArray(l.repeat),l.center!==void 0&&f.center.fromArray(l.center),l.rotation!==void 0&&(f.rotation=l.rotation),l.wrap!==void 0&&(f.wrapS=n(l.wrap[0],_0),f.wrapT=n(l.wrap[1],_0)),l.format!==void 0&&(f.format=l.format),l.internalFormat!==void 0&&(f.internalFormat=l.internalFormat),l.type!==void 0&&(f.type=l.type),l.colorSpace!==void 0&&(f.colorSpace=l.colorSpace),l.minFilter!==void 0&&(f.minFilter=n(l.minFilter,y0)),l.magFilter!==void 0&&(f.magFilter=n(l.magFilter,y0)),l.anisotropy!==void 0&&(f.anisotropy=l.anisotropy),l.flipY!==void 0&&(f.flipY=l.flipY),l.generateMipmaps!==void 0&&(f.generateMipmaps=l.generateMipmaps),l.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=l.premultiplyAlpha),l.unpackAlignment!==void 0&&(f.unpackAlignment=l.unpackAlignment),l.compareFunction!==void 0&&(f.compareFunction=l.compareFunction),l.userData!==void 0&&(f.userData=l.userData),i[l.uuid]=f}return i}parseObject(e,t,n,i,s){let o;function l(p){return t[p]===void 0&&console.warn("THREE.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 x=p[v];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),g.push(n[x])}return g}return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),n[p]}}function h(p){return i[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),i[p]}let f,d;switch(e.type){case"Scene":o=new Nl,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Ye(e.background):o.background=h(e.background)),e.environment!==void 0&&(o.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new Hh(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Oh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new bn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new po(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new dx(e.color,e.intensity);break;case"DirectionalLight":o=new Em(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Sm(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new px(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Mm(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new fx(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new gx().fromJSON(e);break;case"SkinnedMesh":f=l(e.geometry),d=u(e.material),o=new rm(f,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":f=l(e.geometry),d=u(e.material),o=new un(f,d);break;case"InstancedMesh":f=l(e.geometry),d=u(e.material);const p=e.count,g=e.instanceMatrix,v=e.instanceColor;o=new sm(f,d,p),o.instanceMatrix=new so(new Float32Array(g.array),16),v!==void 0&&(o.instanceColor=new so(new Float32Array(v.array),v.itemSize));break;case"BatchedMesh":f=l(e.geometry),d=u(e.material),o=new Ny(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=f,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(A=>{const x=new Qn;x.min.fromArray(A.boxMin),x.max.fromArray(A.boxMax);const _=new Hn;return _.radius=A.sphereRadius,_.center.fromArray(A.sphereCenter),{boxInitialized:A.boxInitialized,box:x,sphereInitialized:A.sphereInitialized,sphere:_}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=h(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=h(e.colorsTexture.uuid));break;case"LOD":o=new Uy;break;case"Line":o=new Or(l(e.geometry),u(e.material));break;case"LineLoop":o=new om(l(e.geometry),u(e.material));break;case"LineSegments":o=new er(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":o=new am(l(e.geometry),u(e.material));break;case"Sprite":o=new Fy(u(e.material));break;case"Group":o=new Lr;break;case"Bone":o=new Gh;break;default:o=new zt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let g=0;g<p.length;g++)o.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];o.animations.push(s[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const p=e.levels;for(let g=0;g<p.length;g++){const v=p[g],A=o.getObjectByProperty("uuid",v.object);A!==void 0&&o.addLevel(A,v.distance,v.hysteresis)}}return o}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?console.warn("THREE.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 zt}})}}const NE={UVMapping:fs,CubeReflectionMapping:pr,CubeRefractionMapping:ds,EquirectangularReflectionMapping:ia,EquirectangularRefractionMapping:ml,CubeUVReflectionMapping:ga},_0={RepeatWrapping:ps,ClampToEdgeWrapping:An,MirroredRepeatWrapping:ra},y0={NearestFilter:Nn,NearestMipmapNearestFilter:bh,NearestMipmapLinearFilter:Ys,LinearFilter:Qt,LinearMipmapNearestFilter:$o,LinearMipmapLinearFilter:Gi};class yx extends kn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}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,o=Fr.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{i&&i(h)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader;const u=fetch(e,l).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return Fr.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),Fr.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Fr.add(e,u),s.manager.itemStart(e)}}let xu;class wm{static getContext(){return xu===void 0&&(xu=new(window.AudioContext||window.webkitAudioContext)),xu}static setContext(e){xu=e}}class OE extends kn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Gn(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{const h=u.slice(0);wm.getContext().decodeAudioData(h,function(d){t(d)}).catch(l)}catch(h){l(h)}},n,i);function l(u){i?i(u):console.error(u),s.manager.itemError(e)}}}const x0=new gt,A0=new gt,Us=new gt;class HE{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new bn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new bn,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,Us.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(to*t.fov*.5)/t.zoom;let l,u;A0.elements[12]=-i,x0.elements[12]=i,l=-o*t.aspect+s,u=o*t.aspect+s,Us.elements[0]=2*t.near/(u-l),Us.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(Us),l=-o*t.aspect-s,u=o*t.aspect-s,Us.elements[0]=2*t.near/(u-l),Us.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(Us)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(A0),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(x0)}}class xx extends bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e,this.index=0}}class Cm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=M0(),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=M0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function M0(){return performance.now()}const Ns=new H,S0=new qn,GE=new H,Os=new H;class kE extends zt{constructor(){super(),this.type="AudioListener",this.context=wm.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Cm}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,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ns,S0,GE),Os.set(0,0,-1).applyQuaternion(S0),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ns.x,i),t.positionY.linearRampToValueAtTime(Ns.y,i),t.positionZ.linearRampToValueAtTime(Ns.z,i),t.forwardX.linearRampToValueAtTime(Os.x,i),t.forwardY.linearRampToValueAtTime(Os.y,i),t.forwardZ.linearRampToValueAtTime(Os.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Ns.x,Ns.y,Ns.z),t.setOrientation(Os.x,Os.y,Os.z,n.x,n.y,n.z)}}class Ax extends zt{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=!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){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+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){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+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){console.warn("THREE.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?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.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"?(console.warn("THREE.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=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Hs=new H,E0=new qn,zE=new H,Gs=new H;class VE extends Ax{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(Hs,E0,zE),Gs.set(0,0,1).applyQuaternion(E0);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Hs.x,n),t.positionY.linearRampToValueAtTime(Hs.y,n),t.positionZ.linearRampToValueAtTime(Hs.z,n),t.orientationX.linearRampToValueAtTime(Gs.x,n),t.orientationY.linearRampToValueAtTime(Gs.y,n),t.orientationZ.linearRampToValueAtTime(Gs.z,n)}else t.setPosition(Hs.x,Hs.y,Hs.z),t.setOrientation(Gs.x,Gs.y,Gs.z)}}class WE{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 Mx{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,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 o=this.cumulativeWeight;if(o===0){for(let l=0;l!==i;++l)n[s+l]=n[l];o=t}else{o+=t;const l=t/o;this._mixBufferRegion(n,s,0,l,i)}this.cumulativeWeight=o}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,o=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}o>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]){l.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,o=i;s!==o;++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 o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){qn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;qn.multiplyQuaternionsFlat(e,o,e,t,e,n),qn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let l=0;l!==s;++l){const u=t+l;e[u]=e[u]*o+e[n+l]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]+e[n+o]*i}}}const Tm="\\[\\]\\.:\\/",XE=new RegExp("["+Tm+"]","g"),bm="[^"+Tm+"]",JE="[^"+Tm.replace("\\.","")+"]",YE=/((?:WC+[\/:])*)/.source.replace("WC",bm),KE=/(WCOD+)?/.source.replace("WCOD",JE),ZE=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bm),qE=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bm),QE=new RegExp("^"+YE+KE+ZE+qE+"$"),jE=["material","materials","bones","map"];class $E{constructor(e,t,n){const i=n||Wt.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 Wt{constructor(e,t,n){this.path=t,this.parsedPath=n||Wt.parseTrackName(t),this.node=Wt.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 Wt.Composite(e,t,n):new Wt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(XE,"")}static parseTrackName(e){const t=QE.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);jE.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 o=0;o<s.length;o++){const l=s[o];if(l.name===t||l.uuid===t)return l;const u=n(l.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=Wt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let 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){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const o=e[i];if(o===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?l=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(u=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Wt.Composite=$E;Wt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Wt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Wt.prototype.GetterByBindingType=[Wt.prototype._getValue_direct,Wt.prototype._getValue_array,Wt.prototype._getValue_arrayElement,Wt.prototype._getValue_toArray];Wt.prototype.SetterByBindingTypeAndVersioning=[[Wt.prototype._setValue_direct,Wt.prototype._setValue_direct_setNeedsUpdate,Wt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_array,Wt.prototype._setValue_array_setNeedsUpdate,Wt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_arrayElement,Wt.prototype._setValue_arrayElement_setNeedsUpdate,Wt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_fromArray,Wt.prototype._setValue_fromArray_setNeedsUpdate,Wt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class ew{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ci(),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,o=s.length;let l,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,x=o;A!==x;++A)s[A].push(new Wt(p,n[A],i[A]))}else if(v<h){l=e[v];const A=--h,x=e[A];t[x.uuid]=v,e[v]=x,t[g]=A,e[A]=p;for(let _=0,S=o;_!==S;++_){const E=s[_],w=E[A];let L=E[v];E[v]=w,L===void 0&&(L=new Wt(p,n[_],i[_])),E[A]=L}}else e[v]!==l&&console.error("THREE.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 o=0,l=arguments.length;o!==l;++o){const u=arguments[o],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],x=A[d],_=A[f];A[f]=x,A[d]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let l=0,u=arguments.length;l!==u;++l){const h=arguments[l],f=h.uuid,d=t[f];if(d!==void 0)if(delete t[f],d<s){const p=--s,g=e[p],v=--o,A=e[v];t[g.uuid]=d,e[d]=g,t[A.uuid]=p,e[p]=A,e.pop();for(let x=0,_=i;x!==_;++x){const S=n[x],E=S[p],w=S[v];S[d]=E,S[p]=w,S.pop()}}else{const p=--o,g=e[p];p>0&&(t[g.uuid]=d),e[d]=g,e.pop();for(let v=0,A=i;v!==A;++v){const x=n[v];x[d]=x[p],x.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 o=this._paths,l=this._parsedPaths,u=this._objects,h=u.length,f=this.nCachedObjects_,d=new Array(h);i=s.length,n[e]=i,o.push(e),l.push(t),s.push(d);for(let p=f,g=u.length;p!==g;++p){const v=u[p];d[p]=new Wt(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,o=this._bindings,l=o.length-1,u=o[l],h=e[l];t[h]=n,o[n]=u,o.pop(),s[n]=s[l],s.pop(),i[n]=i[l],i.pop()}}}class Sx{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,l=new Array(o),u={endingStart:Ks,endingEnd:Ks};for(let h=0;h!==o;++h){const f=s[h].createInterpolant(null);l[h]=f,f.settings=u}this._interpolantSettings=u,this._interpolants=l,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=dy,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,o=s/i,l=i/s;e.warp(1,o,t),this.warp(l,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,o=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=i._lendControlInterpolant(),this._timeScaleInterpolant=l);const u=l.parameterPositions,h=l.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/o,h[1]=t/o,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 o=this._updateTime(t),l=this._updateWeight(e);if(l>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case qp:for(let f=0,d=u.length;f!==d;++f)u[f].evaluate(o),h[f].accumulateAdditive(l);break;case Fh:default:for(let f=0,d=u.length;f!==d;++f)u[f].evaluate(o),h[f].accumulate(i,l)}}}_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 o=n===py;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===fy){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,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const l=Math.floor(i/t);i-=t*l,s+=Math.abs(l);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,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}
vendor: 9,102 bytes, line 44
44_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Zs,i.endingEnd=Zs):(e?i.endingStart=this.zeroSlopeAtStart?Zs:Ks:i.endingStart=gl,t?i.endingEnd=this.zeroSlopeAtEnd?Zs:Ks:i.endingEnd=gl)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const l=o.parameterPositions,u=o.sampleValues;return l[0]=s,u[0]=t,l[1]=s+e,u[1]=n,this}}const tw=new Float32Array(1);class nw extends vr{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,o=e._propertyBindings,l=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,o[d]=v;else{if(v=o[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 Mx(Wt.create(n,g,A),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,u,g),o[d]=v}l[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 o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const l=o.knownActions;e._byClipCacheIndex=l.length,l.push(e)}e._cacheIndex=i.length,i.push(e),o.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,o=this._actionsByClip,l=o[s],u=l.knownActions,h=u[u.length-1],f=e._byClipCacheIndex;h._byClipCacheIndex=f,u[f]=h,u.pop(),e._byClipCacheIndex=null;const d=l.actionByRoot,p=(e._localRoot||this._root).uuid;delete d[p],u.length===0&&delete o[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 o=i[t];o===void 0&&(o={},i[t]=o),o[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,o=this._bindingsByRootAndName,l=o[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete l[s],Object.keys(l).length===0&&delete o[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,tw),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 o=typeof e=="string"?pa.findByName(i,e):e;const l=o!==null?o.uuid:e,u=this._actionsByClip[l];let h=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Fh),u!==void 0){const d=u.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;h=u.knownActions[0],o===null&&(o=h._clip)}if(o===null)return null;const f=new Sx(this,o,t,n);return this._bindAction(f,h),this._addInactiveAction(f,l,s),f}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?pa.findByName(n,e):e,o=s?s.uuid:e,l=this._actionsByClip[o];return l!==void 0&&l.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),o=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,o);const l=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)l[h].apply(o);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 o=s.knownActions;for(let l=0,u=o.length;l!==u;++l){const h=o[l];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 o in n){const l=n[o].actionByRoot,u=l[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const l=s[o];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class iw extends Uh{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Nh(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class rw extends Uh{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTargetArray=!0,this.depth=n,this.texture=new Ll(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Rm{constructor(e){this.value=e}clone(){return new Rm(this.value.clone===void 0?this.value:this.value.clone())}}let sw=0;class ow extends vr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:sw++}),this.name="",this.usage=_l,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 o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class aw extends Ol{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 lw{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,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 w0=new gt;class Im{constructor(e,t,n=0,i=1/0){this.ray=new va(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new no,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):console.error("THREE.Raycaster:
44Unsupported camera type: "+t.type)}setFromXRController(e){return w0.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(w0),this}intersectObject(e,t=!0,n=[]){return Bp(e,this,n,t),n.sort(C0),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Bp(e[i],this,n,t);return n.sort(C0),n}}function C0(r,e){return r.distance-e.distance}function Bp(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 o=0,l=s.length;o<l;o++)Bp(s[o],e,t,!0)}}class cw{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=St(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(St(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class uw{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 Bm{constructor(e,t,n,i){Bm.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 T0=new be;class hw{constructor(e=new be(1/0,1/0),t=new be(-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=T0.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,T0).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 b0=new H,Au=new H;class fw{constructor(e=new H,t=new H){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){b0.subVectors(e,this.start),Au.subVectors(this.end,this.start);const n=Au.dot(Au);let s=Au.dot(b0)/n;return t&&(s=St(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 13,621 bytes, line 44
44applyMatrix4(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 R0=new H;class dw extends zt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Rt,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 o=0,l=1,u=32;o<u;o++,l++){const h=o/u*Math.PI*2,f=l/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new at(i,3));const s=new jn({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),R0.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(R0),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const ns=new H,Mu=new gt,Vd=new gt;class pw extends er{constructor(e){const t=Ex(e),n=new Rt,i=[],s=[],o=new Ye(0,0,1),l=new Ye(0,1,0);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(o.r,o.g,o.b),s.push(l.r,l.g,l.b))}n.setAttribute("position",new at(i,3)),n.setAttribute("color",new at(s,3));const u=new jn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,u),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Vd.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const l=t[s];l.parent&&l.parent.isBone&&(Mu.multiplyMatrices(Vd,l.matrixWorld),ns.setFromMatrixPosition(Mu),i.setXYZ(o,ns.x,ns.y,ns.z),Mu.multiplyMatrices(Vd,l.parent.matrixWorld),ns.setFromMatrixPosition(Mu),i.setXYZ(o+1,ns.x,ns.y,ns.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ex(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...Ex(r.children[t]));return e}class mw extends un{constructor(e,t,n){const i=new Wl(t,4,2),s=new mi({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 gw=new H,I0=new Ye,B0=new Ye;class vw extends zt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Vl(t);i.rotateY(Math.PI*.5),this.material=new mi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Yt(o,3)),this.add(new un(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");I0.copy(this.light.color),B0.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?I0:B0;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(gw.setFromMatrixPosition(this.light.matrixWorld).negate())}}class _w extends er{constructor(e=10,t=10,n=4473924,i=8947848){n=new Ye(n),i=new Ye(i);const s=t/2,o=e/t,l=e/2,u=[],h=[];for(let p=0,g=0,v=-l;p<=t;p++,v+=o){u.push(-l,0,v,l,0,v),u.push(v,0,-l,v,0,l);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 Rt;f.setAttribute("position",new at(u,3)),f.setAttribute("color",new at(h,3));const d=new jn({vertexColors:!0,toneMapped:!1});super(f,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class yw extends er{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new Ye(s),o=new Ye(o);const l=[],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;l.push(0,0,0),l.push(g,0,v);const A=d&1?s:o;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:o,g=e-e/n*d;for(let v=0;v<i;v++){let A=v/i*(Math.PI*2),x=Math.sin(A)*g,_=Math.cos(A)*g;l.push(x,0,_),u.push(p.r,p.g,p.b),A=(v+1)/i*(Math.PI*2),x=Math.sin(A)*g,_=Math.cos(A)*g,l.push(x,0,_),u.push(p.r,p.g,p.b)}}const h=new Rt;h.setAttribute("position",new at(l,3)),h.setAttribute("color",new at(u,3));const f=new jn({vertexColors:!0,toneMapped:!1});super(h,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const P0=new H,Su=new H,D0=new H;class xw extends zt{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 Rt;i.setAttribute("position",new at([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new jn({fog:!1,toneMapped:!1});this.lightPlane=new Or(i,s),this.add(this.lightPlane),i=new Rt,i.setAttribute("position",new at([0,0,0,0,0,1],3)),this.targetLine=new Or(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),P0.setFromMatrixPosition(this.light.matrixWorld),Su.setFromMatrixPosition(this.light.target.matrixWorld),D0.subVectors(Su,P0),this.lightPlane.lookAt(Su),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(Su),this.targetLine.scale.z=D0.length()}}const Eu=new H,vn=new Fl;class Aw extends er{constructor(e){const t=new Rt,n=new jn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};l("n1","n2"),l("n2","n4"),l("n4","n3"),l("n3","n1"),l("f1","f2"),l("f2","f4"),l("f4","f3"),l("f3","f1"),l("n1","f1"),l("n2","f2"),l("n3","f3"),l("n4","f4"),l("p","n1"),l("p","n2"),l("p","n3"),l("p","n4"),l("u1","u2"),l("u2","u3"),l("u3","u1"),l("c","t"),l("p","c"),l("cn1","cn2"),l("cn3","cn4"),l("cf1","cf2"),l("cf3","cf4");function l(v,A){u(v),u(A)}function u(v){i.push(0,0,0),s.push(0,0,0),o[v]===void 0&&(o[v]=[]),o[v].push(i.length/3-1)}t.setAttribute("position",new at(i,3)),t.setAttribute("color",new at(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=o,this.update();const h=new Ye(16755200),f=new Ye(16711680),d=new Ye(43775),p=new Ye(16777215),g=new Ye(3355443);this.setColors(h,f,d,p,g)}setColors(e,t,n,i,s){const l=this.geometry.getAttribute("color");l.setXYZ(0,e.r,e.g,e.b),l.setXYZ(1,e.r,e.g,e.b),l.setXYZ(2,e.r,e.g,e.b),l.setXYZ(3,e.r,e.g,e.b),l.setXYZ(4,e.r,e.g,e.b),l.setXYZ(5,e.r,e.g,e.b),l.setXYZ(6,e.r,e.g,e.b),l.setXYZ(7,e.r,e.g,e.b),l.setXYZ(8,e.r,e.g,e.b),l.setXYZ(9,e.r,e.g,e.b),l.setXYZ(10,e.r,e.g,e.b),l.setXYZ(11,e.r,e.g,e.b),l.setXYZ(12,e.r,e.g,e.b),l.setXYZ(13,e.r,e.g,e.b),l.setXYZ(14,e.r,e.g,e.b),l.setXYZ(15,e.r,e.g,e.b),l.setXYZ(16,e.r,e.g,e.b),l.setXYZ(17,e.r,e.g,e.b),l.setXYZ(18,e.r,e.g,e.b),l.setXYZ(19,e.r,e.g,e.b),l.setXYZ(20,e.r,e.g,e.b),l.setXYZ(21,e.r,e.g,e.b),l.setXYZ(22,e.r,e.g,e.b),l.setXYZ(23,e.r,e.g,e.b),l.setXYZ(24,t.r,t.g,t.b),l.setXYZ(25,t.r,t.g,t.b),l.setXYZ(26,t.r,t.g,t.b),l.setXYZ(27,t.r,t.g,t.b),l.setXYZ(28,t.r,t.g,t.b),l.setXYZ(29,t.r,t.g,t.b),l.setXYZ(30,t.r,t.g,t.b),l.setXYZ(31,t.r,t.g,t.b),l.setXYZ(32,n.r,n.g,n.b),l.setXYZ(33,n.r,n.g,n.b),l.setXYZ(34,n.r,n.g,n.b),l.setXYZ(35,n.r,n.g,n.b),l.setXYZ(36,n.r,n.g,n.b),l.setXYZ(37,n.r,n.g,n.b),l.setXYZ(38,i.r,i.g,i.b),l.setXYZ(39,i.r,i.g,i.b),l.setXYZ(40,s.r,s.g,s.b),l.setXYZ(41,s.r,s.g,s.b),l.setXYZ(42,s.r,s.g,s.b),l.setXYZ(43,s.r,s.g,s.b),l.setXYZ(44,s.r,s.g,s.b),l.setXYZ(45,s.r,s.g,s.b),l.setXYZ(46,s.r,s.g,s.b),l.setXYZ(47,s.r,s.g,s.b),l.setXYZ(48,s.r,s.g,s.b),l.setXYZ(49,s.r,s.g,s.b),l.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;vn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const s=this.camera.coordinateSystem===ji?-1:0;xn("c",t,e,vn,0,0,s),xn("t",t,e,vn,0,0,1),xn("n1",t,e,vn,-1,-1,s),xn("n2",t,e,vn,n,-1,s),xn("n3",t,e,vn,-1,i,s),xn("n4",t,e,vn,n,i,s),xn("f1",t,e,vn,-1,-1,1),xn("f2",t,e,vn,n,-1,1),xn("f3",t,e,vn,-1,i,1),xn("f4",t,e,vn,n,i,1),xn("u1",t,e,vn,n*.7,i*1.1,s),xn("u2",t,e,vn,-1*.7,i*1.1,s),xn("u3",t,e,vn,0,i*2,s),xn("cf1",t,e,vn,-1,0,1),xn("cf2",t,e,vn,n,0,1),xn("cf3",t,e,vn,0,-1,1),xn("cf4",t,e,vn,0,i,1),xn("cn1",t,e,vn,-1,0,s),xn("cn2",t,e,vn,n,0,s),xn("cn3",t,e,vn,0,-1,s),xn("cn4",t,e,vn,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function xn(r,e,t,n,i,s,o){Eu.set(i,s,o).unproject(n);const l=e[r];if(l!==void 0){const u=t.getAttribute("position");for(let h=0,f=l.length;h<f;h++)u.setXYZ(l[h],Eu.x,Eu.y,Eu.z)}}const wu=new Qn;class Mw 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(24),s=new Rt;s.setIndex(new Yt(n,1)),s.setAttribute("position",new Yt(i,3)),super(s,new jn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&wu.setFromObject(this.object),wu.isEmpty())return;const e=wu.min,t=wu.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()}}class Sw 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 Rt;s.setIndex(new Yt(n,1)),s.setAttribute("position",new at(i,3)),super(s,new jn({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 Ew extends Or{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],o=new Rt;o.setAttribute("position",new at(s,3)),o.computeBoundingSphere(),super(o,new jn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const l=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new Rt;u.setAttribute("position",new at(l,3)),u.computeBoundingSphere(),this.add(new un(u,new mi({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 L0=new H;let Cu,Wd;class ww extends zt{constructor(e=new H(0,0,1),t=new H(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",Cu===void 0&&(Cu=new Rt,Cu.setAttribute("position",new at([0,0,0,0,1,0],3)),Wd=new _a(0,.5,1,5,1),Wd.translate(0,-.5,0)),this.position.copy(t),this.line=new Or(Cu,new jn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new un(Wd,new mi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}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{L0.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(L0,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 Cw 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 Rt;i.setAttribute("position",new at(t,3)),i.setAttribute("color",new at(n,3));const s=new jn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}
vendor: 10,217 bytes, lines 44-107
44setColors(e,t,n){const i=new Ye,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 Tw{constructor(){this.type="ShapePath",this.color=new Ye,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Al,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,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const S=[];for(let E=0,w=_.length;E<w;E++){const L=_[E],B=new io;B.curves=L.curves,S.push(B)}return S}function n(_,S){const E=S.length;let w=!1;for(let L=E-1,B=0;B<E;L=B++){let F=S[L],D=S[B],T=D.x-F.x,b=D.y-F.y;if(Math.abs(b)>Number.EPSILON){if(b<0&&(F=S[B],T=-T,D=S[L],b=-b),_.y<F.y||_.y>D.y)continue;if(_.y===F.y){if(_.x===F.x)return!0}else{const N=b*(_.x-F.x)-T*(_.y-F.y);if(N===0)return!0;if(N<0)continue;w=!w}}else{if(_.y!==F.y)continue;if(D.x<=_.x&&_.x<=F.x||F.x<=_.x&&_.x<=D.x)return!0}}return w}const i=fr.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,l,u;const h=[];if(s.length===1)return l=s[0],u=new io,u.curves=l.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,S=s.length;_<S;_++)l=s[_],A=l.getPoints(),o=i(A),o=e?!o:o,o?(!f&&p[v]&&v++,p[v]={s:new io,p:A},p[v].s.curves=l.curves,f&&v++,g[v]=[]):g[v].push({h:l,p:A[0]});if(!p[0])return t(s);if(p.length>1){let _=!1,S=0;for(let E=0,w=p.length;E<w;E++)d[E]=[];for(let E=0,w=p.length;E<w;E++){const L=g[E];for(let B=0;B<L.length;B++){const F=L[B];let D=!0;for(let T=0;T<p.length;T++)n(F.p,p[T].p)&&(E!==T&&S++,D?(D=!1,d[T].push(F)):_=!0);D&&d[E].push(F)}}S>0&&_===!1&&(g=d)}let x;for(let _=0,S=p.length;_<S;_++){u=p[_].s,h.push(u),x=g[_];for(let E=0,w=x.length;E<w;E++)u.holes.push(x[E].h)}return h}}class bw extends vr{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){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Rw(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 Iw(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 Bw(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Pp(r,e,t,n){const i=Pw(n);switch(t){case Wp:return r*e;case Jp:return r*e;case Yp:return r*e*2;case Pl:return r*e/i.components*i.byteLength;case Dl:return r*e/i.components*i.byteLength;case Kp:return r*e*2/i.components*i.byteLength;case Dh:return r*e*2/i.components*i.byteLength;case Xp:return r*e*3/i.components*i.byteLength;case Mn:return r*e*4/i.components*i.byteLength;case Lh:return r*e*4/i.components*i.byteLength;case ol:case al:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ll:case cl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Qu:case $u:return Math.max(r,16)*Math.max(e,8)/4;case qu:case ju:return Math.max(r,8)*Math.max(e,8)/2;case eh:case th:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case nh:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ih:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case rh:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case sh:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case oh:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case ah:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case lh:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case ch:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case uh:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case hh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case fh:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case dh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case ph:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case mh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case gh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case ul:case vh:case _h:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Zp:case yh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case xh:case Ah:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Pw(r){switch(r){case gi:case Rh:return{byteLength:1,components:1};case sa:case Ih:case Un:return{byteLength:2,components:1};case Bh:case Ph:return{byteLength:2,components:4};case mr:case Bl:case dn:return{byteLength:4,components:1};case Vp:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class Dw{static contain(e,t){return Rw(e,t)}static cover(e,t){return Iw(e,t)}static fill(e){return Bw(e)}static getByteLength(e,t,n,i){return Pp(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Rl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Rl);/** 45 * @license 46 * Copyright 2010-2025 Three.js Authors 47 * SPDX-License-Identifier: MIT 48 */function wx(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),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 Lw(r){const e=new WeakMap;function t(l,u){const h=l.array,f=l.usage,d=h.byteLength,p=r.createBuffer();r.bindBuffer(u,p),r.bufferData(u,h,f),l.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(h instanceof Uint16Array)l.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:l.version,size:d}}function n(l,u,h){const f=u.array,d=u.updateRanges;if(r.bindBuffer(h,l),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(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=e.get(l);u&&(r.deleteBuffer(u.buffer),e.delete(l))}function o(l,u){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const f=e.get(l);(!f||f.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}const h=e.get(l);if(h===void 0)e.set(l,t(l,u));else if(h.version<l.version){if(h.size!==l.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,l,u),h.version=l.version}}return{get:i,remove:s,update:o}}var Fw=`#ifdef USE_ALPHAHASH 49 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 50#endif`,Uw=`#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`,Nw=`#ifdef USE_ALPHAMAP 86 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 87#endif`,Ow=`#ifdef USE_ALPHAMAP 88 uniform sampler2D alphaMap; 89#endif`,Hw=`#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`,Gw=`#ifdef USE_ALPHATEST 97 uniform float alphaTest; 98#endif`,kw=`#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`,zw=`#ifdef USE_AOMAP 112 uniform sampler2D aoMap; 113 uniform float aoMapIntensity; 114#endif`,Vw=`#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`,Ww=`#ifdef USE_BATCHING 149 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 150#endif`,Xw=`vec3 transformed = vec3( position ); 151#ifdef USE_ALPHAHASH 152 vPosition = vec3( position ); 153#endif`,Jw=`vec3 objectNormal = vec3( normal ); 154#ifdef USE_TANGENT 155 vec3 objectTangent = vec3( tangent.xyz ); 156#endif`,Yw=`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`,Kw=`#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`,Zw=`#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`,qw=`#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`,Qw=`#if NUM_CLIPPING_PLANES > 0 301 varying vec3 vClipPosition; 302 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 303#endif`,jw=`#if NUM_CLIPPING_PLANES > 0 304 varying vec3 vClipPosition; 305#endif`,$w=`#if NUM_CLIPPING_PLANES > 0 306 vClipPosition = - mvPosition.xyz; 307#endif`,eC=`#if defined( USE_COLOR_ALPHA ) 308 diffuseColor *= vColor; 309#elif defined( USE_COLOR ) 310 diffuseColor.rgb *= vColor; 311#endif`,tC=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) 314 varying vec3 vColor; 315#endif`,nC=`#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`,iC=`#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`,rC=`#define PI 3.141592653589793 334#define PI2 6.283185307179586 335#define PI_HALF 1.5707963267948966 336#define RECIPROCAL_PI 0.3183098861837907 337#define RECIPROCAL_PI2 0.15915494309189535 338#define EPSILON 1e-6 339#ifndef saturate 340#define saturate( a ) clamp( a, 0.0, 1.0 ) 341#endif 342#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 343float pow2( const in float x ) { return x*x; } 344vec3 pow2( const in vec3 x ) { return x*x; } 345float pow3( const in float x ) { return x*x*x; } 346float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 349highp float rand( const in vec2 uv ) { 350 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 351 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 352 return fract( sin( sn ) * c ); 353} 354#ifdef HIGH_PRECISION 355 float precisionSafeLength( vec3 v ) { return length( v ); } 356#else 357 float precisionSafeLength( vec3 v ) { 358 float maxComponent = max3( abs( v ) ); 359 return length( v / maxComponent ) * maxComponent; 360 } 361#endif 362struct IncidentLight { 363 vec3 color; 364 vec3 direction; 365 bool visible; 366}; 367struct ReflectedLight { 368 vec3 directDiffuse; 369 vec3 directSpecular; 370 vec3 indirectDiffuse; 371 vec3 indirectSpecular; 372}; 373#ifdef USE_ALPHAHASH 374 varying vec3 vPosition; 375#endif 376vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 377 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 378} 379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 381} 382mat3 transposeMat3( const in mat3 m ) { 383 mat3 tmp; 384 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 385 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 386 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 387 return tmp; 388} 389bool isPerspectiveMatrix( mat4 m ) { 390 return m[ 2 ][ 3 ] == - 1.0; 391} 392vec2 equirectUv( in vec3 dir ) { 393 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 394 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 395 return vec2( u, v ); 396}
397vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 398 return RECIPROCAL_PI * diffuseColor; 399} 400vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} 404float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 405 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 406 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 407} // validated`,sC=`#ifdef ENVMAP_TYPE_CUBE_UV 408 #define cubeUV_minMipLevel 4.0 409 #define cubeUV_minTileSize 16.0 410 float getFace( vec3 direction ) { 411 vec3 absDirection = abs( direction ); 412 float face = - 1.0; 413 if ( absDirection.x > absDirection.z ) { 414 if ( absDirection.x > absDirection.y ) 415 face = direction.x > 0.0 ? 0.0 : 3.0; 416 else 417 face = direction.y > 0.0 ? 1.0 : 4.0; 418 } else { 419 if ( absDirection.z > absDirection.y ) 420 face = direction.z > 0.0 ? 2.0 : 5.0; 421 else 422 face = direction.y > 0.0 ? 1.0 : 4.0; 423 } 424 return face; 425 } 426 vec2 getUV( vec3 direction, float face ) { 427 vec2 uv; 428 if ( face == 0.0 ) { 429 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 430 } else if ( face == 1.0 ) { 431 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 432 } else if ( face == 2.0 ) { 433 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 434 } else if ( face == 3.0 ) { 435 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 436 } else if ( face == 4.0 ) { 437 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 438 } else { 439 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 440 } 441 return 0.5 * ( uv + 1.0 ); 442 } 443 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 444 float face = getFace( direction ); 445 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 446 mipInt = max( mipInt, cubeUV_minMipLevel ); 447 float faceSize = exp2( mipInt ); 448 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 449 if ( face > 2.0 ) { 450 uv.y += faceSize; 451 face -= 3.0; 452 } 453 uv.x += face * faceSize; 454 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 455 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 456 uv.x *= CUBEUV_TEXEL_WIDTH; 457 uv.y *= CUBEUV_TEXEL_HEIGHT; 458 #ifdef texture2DGradEXT 459 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 460 #else 461 return texture2D( envMap, uv ).rgb; 462 #endif 463 } 464 #define cubeUV_r0 1.0 465 #define cubeUV_m0 - 2.0 466 #define cubeUV_r1 0.8 467 #define cubeUV_m1 - 1.0 468 #define cubeUV_r4 0.4 469 #define cubeUV_m4 2.0 470 #define cubeUV_r5 0.305 471 #define cubeUV_m5 3.0 472 #define cubeUV_r6 0.21 473 #define cubeUV_m6 4.0 474 float roughnessToMip( float roughness ) { 475 float mip = 0.0; 476 if ( roughness >= cubeUV_r1 ) { 477 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 478 } else if ( roughness >= cubeUV_r4 ) { 479 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 480 } else if ( roughness >= cubeUV_r5 ) { 481 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 482 } else if ( roughness >= cubeUV_r6 ) { 483 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 484 } else { 485 mip = - 2.0 * log2( 1.16 * roughness ); } 486 return mip; 487 } 488 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 489 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 490 float mipF = fract( mip ); 491 float mipInt = floor( mip ); 492 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 493 if ( mipF == 0.0 ) { 494 return vec4( color0, 1.0 ); 495 } else { 496 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 497 return vec4( mix( color0, color1, mipF ), 1.0 ); 498 } 499 } 500#endif`,oC=`vec3 transformedNormal = objectNormal; 501#ifdef USE_TANGENT 502 vec3 transformedTangent = objectTangent; 503#endif 504#ifdef USE_BATCHING 505 mat3 bm = mat3( batchingMatrix ); 506 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 507 transformedNormal = bm * transformedNormal; 508 #ifdef USE_TANGENT 509 transformedTangent = bm * transformedTangent; 510 #endif 511#endif 512#ifdef USE_INSTANCING 513 mat3 im = mat3( instanceMatrix ); 514 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 515 transformedNormal = im * transformedNormal; 516 #ifdef USE_TANGENT 517 transformedTangent = im * transformedTangent; 518 #endif 519#endif 520transformedNormal = normalMatrix * transformedNormal; 521#ifdef FLIP_SIDED 522 transformedNormal = - transformedNormal; 523#endif 524#ifdef USE_TANGENT 525 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 526 #ifdef FLIP_SIDED 527 transformedTangent = - transformedTangent; 528 #endif 529#endif`,aC=`#ifdef USE_DISPLACEMENTMAP 530 uniform sampler2D displacementMap; 531 uniform float displacementScale; 532 uniform float displacementBias; 533#endif`,lC=`#ifdef USE_DISPLACEMENTMAP 534 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
534placementBias ); 535#endif`,cC=`#ifdef USE_EMISSIVEMAP 536 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 537 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 538 emissiveColor = sRGBTransferEOTF( emissiveColor ); 539 #endif 540 totalEmissiveRadiance *= emissiveColor.rgb; 541#endif`,uC=`#ifdef USE_EMISSIVEMAP 542 uniform sampler2D emissiveMap; 543#endif`,hC="gl_FragColor = linearToOutputTexel( gl_FragColor );",fC=`vec4 LinearTransferOETF( in vec4 value ) { 544 return value; 545} 546vec4 sRGBTransferEOTF( in vec4 value ) { 547 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 548} 549vec4 sRGBTransferOETF( in vec4 value ) { 550 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 551}`,dC=`#ifdef USE_ENVMAP 552 #ifdef ENV_WORLDPOS 553 vec3 cameraToFrag; 554 if ( isOrthographic ) { 555 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 556 } else { 557 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 558 } 559 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 560 #ifdef ENVMAP_MODE_REFLECTION 561 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 562 #else 563 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 564 #endif 565 #else 566 vec3 reflectVec = vReflect; 567 #endif 568 #ifdef ENVMAP_TYPE_CUBE 569 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 570 #else 571 vec4 envColor = vec4( 0.0 ); 572 #endif 573 #ifdef ENVMAP_BLENDING_MULTIPLY 574 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 575 #elif defined( ENVMAP_BLENDING_MIX ) 576 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 577 #elif defined( ENVMAP_BLENDING_ADD ) 578 outgoingLight += envColor.xyz * specularStrength * reflectivity; 579 #endif 580#endif`,pC=`#ifdef USE_ENVMAP 581 uniform float envMapIntensity; 582 uniform float flipEnvMap; 583 uniform mat3 envMapRotation; 584 #ifdef ENVMAP_TYPE_CUBE 585 uniform samplerCube envMap; 586 #else 587 uniform sampler2D envMap; 588 #endif 589 590#endif`,mC=`#ifdef USE_ENVMAP 591 uniform float reflectivity; 592 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 593 #define ENV_WORLDPOS 594 #endif 595 #ifdef ENV_WORLDPOS 596 varying vec3 vWorldPosition; 597 uniform float refractionRatio; 598 #else 599 varying vec3 vReflect; 600 #endif 601#endif`,gC=`#ifdef USE_ENVMAP 602 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 603 #define ENV_WORLDPOS 604 #endif 605 #ifdef ENV_WORLDPOS 606 607 varying vec3 vWorldPosition; 608 #else 609 varying vec3 vReflect; 610 uniform float refractionRatio; 611 #endif 612#endif`,vC=`#ifdef USE_ENVMAP 613 #ifdef ENV_WORLDPOS 614 vWorldPosition = worldPosition.xyz; 615 #else 616 vec3 cameraToVertex; 617 if ( isOrthographic ) { 618 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 619 } else {
620 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 621 } 622 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 623 #ifdef ENVMAP_MODE_REFLECTION 624 vReflect = reflect( cameraToVertex, worldNormal ); 625 #else 626 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 627 #endif 628 #endif 629#endif`,_C=`#ifdef USE_FOG 630 vFogDepth = - mvPosition.z; 631#endif`,yC=`#ifdef USE_FOG 632 varying float vFogDepth; 633#endif`,xC=`#ifdef USE_FOG 634 #ifdef FOG_EXP2 635 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 636 #else 637 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 638 #endif 639 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 640#endif`,AC=`#ifdef USE_FOG 641 uniform vec3 fogColor; 642 varying float vFogDepth; 643 #ifdef FOG_EXP2 644 uniform float fogDensity; 645 #else 646 uniform float fogNear; 647 uniform float fogFar; 648 #endif 649#endif`,MC=`#ifdef USE_GRADIENTMAP 650 uniform sampler2D gradientMap; 651#endif 652vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 653 float dotNL = dot( normal, lightDirection ); 654 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 655 #ifdef USE_GRADIENTMAP 656 return vec3( texture2D( gradientMap, coord ).r ); 657 #else 658 vec2 fw = fwidth( coord ) * 0.5; 659 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 660 #endif 661}`,SC=`#ifdef USE_LIGHTMAP 662 uniform sampler2D lightMap; 663 uniform float lightMapIntensity; 664#endif`,EC=`LambertMaterial material; 665material.diffuseColor = diffuseColor.rgb; 666material.specularStrength = specularStrength;`,wC=`varying vec3 vViewPosition; 667struct LambertMaterial { 668 vec3 diffuseColor; 669 float specularStrength; 670}; 671void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 672 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 673 vec3 irradiance = dotNL * directLight.color; 674 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 675} 676void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 677 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 678} 679#define RE_Direct RE_Direct_Lambert 680#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,CC=`uniform bool receiveShadow; 681uniform vec3 ambientLightColor; 682#if defined( USE_LIGHT_PROBES ) 683 uniform vec3 lightProbe[ 9 ]; 684#endif 685vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 686 float x = normal.x, y = normal.y, z = normal.z; 687 vec3 result = shCoefficients[ 0 ] * 0.886227; 688 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 689 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 690 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 691 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 692 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 693 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 694 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 695 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 696 return result; 697} 698vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 699 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 700 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 701 return irradiance; 702} 703vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 704 vec3 irradiance = ambientLightColor; 705 return irradiance; 706} 707float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 708 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 709 if ( cutoffDistance > 0.0 ) { 710 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 711 } 712 return distanceFalloff; 713} 714float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 715 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 716} 717#if NUM_DIR_LIGHTS > 0 718 struct DirectionalLight { 719 vec3 direction; 720 vec3 color; 721 }; 722 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 723 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 724 light.color = directionalLight.color; 725 light.direction = directionalLight.direction; 726 light.visible = true; 727 } 728#endif 729#if NUM_POINT_LIGHTS > 0 730 struct PointLight { 731 vec3 position; 732 vec3 color; 733 float distance; 734 float decay; 735 }; 736 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 737 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 738 vec3 lVector = pointLight.position - geometryPosition; 739 light.direction = normalize( lVector ); 740 float lightDistance = length( lVector ); 741 light.color = pointLight.color; 742 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 743 light.visible = ( light.color != vec3( 0.0 ) ); 744 } 745#endif
746#if NUM_SPOT_LIGHTS > 0 747 struct SpotLight { 748 vec3 position; 749 vec3 direction; 750 vec3 color; 751 float distance; 752 float decay; 753 float coneCos; 754 float penumbraCos; 755 }; 756 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 757 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 758 vec3 lVector = spotLight.position - geometryPosition; 759 light.direction = normalize( lVector ); 760 float angleCos = dot( light.direction, spotLight.direction ); 761 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 762 if ( spotAttenuation > 0.0 ) { 763 float lightDistance = length( lVector ); 764 light.color = spotLight.color * spotAttenuation; 765 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 766 light.visible = ( light.color != vec3( 0.0 ) ); 767 } else { 768 light.color = vec3( 0.0 ); 769 light.visible = false; 770 } 771 } 772#endif 773#if NUM_RECT_AREA_LIGHTS > 0 774 struct RectAreaLight { 775 vec3 color; 776 vec3 position; 777 vec3 halfWidth; 778 vec3 halfHeight; 779 }; 780 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 781 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 782#endif 783#if NUM_HEMI_LIGHTS > 0 784 struct HemisphereLight { 785 vec3 direction; 786 vec3 skyColor; 787 vec3 groundColor; 788 }; 789 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 790 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 791 float dotNL = dot( normal, hemiLight.direction ); 792 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 793 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 794 return irradiance; 795 } 796#endif`,TC=`#ifdef USE_ENVMAP 797 vec3 getIBLIrradiance( const in vec3 normal ) { 798 #ifdef ENVMAP_TYPE_CUBE_UV 799 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 800 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 801 return PI * envMapColor.rgb * envMapIntensity; 802 #else 803 return vec3( 0.0 ); 804 #endif 805 } 806 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 807 #ifdef ENVMAP_TYPE_CUBE_UV 808 vec3 reflectVec = reflect( - viewDir, normal ); 809 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 810 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 811 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 812 return envMapColor.rgb * envMapIntensity; 813 #else 814 return vec3( 0.0 ); 815 #endif 816 } 817 #ifdef USE_ANISOTROPY 818 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 819 #ifdef ENVMAP_TYPE_CUBE_UV 820 vec3 bentNormal = cross( bitangent, viewDir ); 821 bentNormal = normalize( cross( bentNormal, bitangent ) ); 822 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 823 return getIBLRadiance( viewDir, bentNormal, roughness ); 824 #else 825 return vec3( 0.0 ); 826 #endif 827 } 828 #endif 829#endif`,bC=`ToonMaterial material; 830material.diffuseColor = diffuseColor.rgb;`,RC=`varying vec3 vViewPosition; 831struct ToonMaterial { 832 vec3 diffuseColor; 833}; 834void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 835 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 836 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 837} 838void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 839 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 840} 841#define RE_Direct RE_Direct_Toon 842#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,IC=`BlinnPhongMaterial material; 843material.diffuseColor = diffuseColor.rgb; 844material.specularColor = specular; 845material.specularShininess = shininess; 846material.specularStrength = specularStrength;`,BC=`varying vec3 vViewPosition; 847struct BlinnPhongMaterial { 848 vec3 diffuseColor; 849 vec3 specularColor; 850 float specularShininess; 851 float specularStrength; 852}; 853void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
854 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 855 vec3 irradiance = dotNL * directLight.color; 856 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 857 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 858} 859void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 860 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 861} 862#define RE_Direct RE_Direct_BlinnPhong 863#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,PC=`PhysicalMaterial material; 864material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 865vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 866float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 867material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 868material.roughness = min( material.roughness, 1.0 ); 869#ifdef IOR 870 material.ior = ior; 871 #ifdef USE_SPECULAR 872 float specularIntensityFactor = specularIntensity; 873 vec3 specularColorFactor = specularColor; 874 #ifdef USE_SPECULAR_COLORMAP 875 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 876 #endif 877 #ifdef USE_SPECULAR_INTENSITYMAP 878 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 879 #endif 880 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 881 #else 882 float specularIntensityFactor = 1.0; 883 vec3 specularColorFactor = vec3( 1.0 ); 884 material.specularF90 = 1.0; 885 #endif 886 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 887#else 888 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 889 material.specularF90 = 1.0; 890#endif 891#ifdef USE_CLEARCOAT 892 material.clearcoat = clearcoat; 893 material.clearcoatRoughness = clearcoatRoughness; 894 material.clearcoatF0 = vec3( 0.04 ); 895 material.clearcoatF90 = 1.0; 896 #ifdef USE_CLEARCOATMAP 897 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 898 #endif 899 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 900 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 901 #endif 902 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 903 material.clearcoatRoughness += geometryRoughness; 904 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 905#endif 906#ifdef USE_DISPERSION 907 material.dispersion = dispersion; 908#endif 909#ifdef USE_IRIDESCENCE 910 material.iridescence = iridescence; 911 material.iridescenceIOR = iridescenceIOR; 912 #ifdef USE_IRIDESCENCEMAP 913 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 914 #endif 915 #ifdef USE_IRIDESCENCE_THICKNESSMAP 916 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 917 #else 918 material.iridescenceThickness = iridescenceThicknessMaximum; 919 #endif 920#endif 921#ifdef USE_SHEEN 922 material.sheenColor = sheenColor; 923 #ifdef USE_SHEEN_COLORMAP 924 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 925 #endif 926 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 927 #ifdef USE_SHEEN_ROUGHNESSMAP 928 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 929 #endif 930#endif 931#ifdef USE_ANISOTROPY 932 #ifdef USE_ANISOTROPYMAP 933 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 934 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 935 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 936 #else 937 vec2 anisotropyV = anisotropyVector; 938 #endif 939 material.anisotropy = length( anisotropyV ); 940 if( material.anisotropy == 0.0 ) { 941 anisotropyV = vec2( 1.0, 0.0 ); 942 } else { 943 anisotropyV /= material.anisotropy; 944 material.anisotropy = saturate( material.anisotropy ); 945 } 946 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 948 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 949#endif`,DC
vendor: 14,687 bytes, lines 949-1250
949=`struct PhysicalMaterial { 950 vec3 diffuseColor; 951 float roughness; 952 vec3 specularColor; 953 float specularF90; 954 float dispersion; 955 #ifdef USE_CLEARCOAT 956 float clearcoat; 957 float clearcoatRoughness; 958 vec3 clearcoatF0; 959 float clearcoatF90; 960 #endif 961 #ifdef USE_IRIDESCENCE 962 float iridescence; 963 float iridescenceIOR; 964 float iridescenceThickness; 965 vec3 iridescenceFresnel; 966 vec3 iridescenceF0; 967 #endif 968 #ifdef USE_SHEEN 969 vec3 sheenColor; 970 float sheenRoughness; 971 #endif 972 #ifdef IOR 973 float ior; 974 #endif 975 #ifdef USE_TRANSMISSION 976 float transmission; 977 float transmissionAlpha; 978 float thickness; 979 float attenuationDistance; 980 vec3 attenuationColor; 981 #endif 982 #ifdef USE_ANISOTROPY 983 float anisotropy; 984 float alphaT; 985 vec3 anisotropyT; 986 vec3 anisotropyB; 987 #endif 988}; 989vec3 clearcoatSpecularDirect = vec3( 0.0 ); 990vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 991vec3 sheenSpecularDirect = vec3( 0.0 ); 992vec3 sheenSpecularIndirect = vec3(0.0 ); 993vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 994 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 995 float x2 = x * x; 996 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 997 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 998} 999float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1000 float a2 = pow2( alpha ); 1001 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1002 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1003 return 0.5 / max( gv + gl, EPSILON ); 1004} 1005float D_GGX( const in float alpha, const in float dotNH ) { 1006 float a2 = pow2( alpha ); 1007 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1008 return RECIPROCAL_PI * a2 / pow2( denom ); 1009} 1010#ifdef USE_ANISOTROPY 1011 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1012 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1013 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1014 float v = 0.5 / ( gv + gl ); 1015 return saturate(v); 1016 } 1017 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1018 float a2 = alphaT * alphaB; 1019 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1020 highp float v2 = dot( v, v ); 1021 float w2 = a2 / v2; 1022 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1023 } 1024#endif 1025#ifdef USE_CLEARCOAT 1026 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1027 vec3 f0 = material.clearcoatF0; 1028 float f90 = material.clearcoatF90; 1029 float roughness = material.clearcoatRoughness; 1030 float alpha = pow2( roughness ); 1031 vec3 halfDir = normalize( lightDir + viewDir ); 1032 float dotNL = saturate( dot( normal, lightDir ) ); 1033 float dotNV = saturate( dot( normal, viewDir ) ); 1034 float dotNH = saturate( dot( normal, halfDir ) ); 1035 float dotVH = saturate( dot( viewDir, halfDir ) ); 1036 vec3 F = F_Schlick( f0, f90, dotVH ); 1037 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1038 float D = D_GGX( alpha, dotNH ); 1039 return F * ( V * D ); 1040 } 1041#endif 1042vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1043 vec3 f0 = material.specularColor; 1044 float f90 = material.specularF90; 1045 float roughness = material.roughness; 1046 float alpha = pow2( roughness ); 1047 vec3 halfDir = normalize( lightDir + viewDir ); 1048 float dotNL = saturate( dot( normal, lightDir ) ); 1049 float dotNV = saturate( dot( normal, viewDir ) ); 1050 float dotNH = saturate( dot( normal, halfDir ) ); 1051 float dotVH = saturate( dot( viewDir, halfDir ) ); 1052 vec3 F = F_Schlick( f0, f90, dotVH ); 1053 #ifdef USE_IRIDESCENCE 1054 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1055 #endif 1056 #ifdef USE_ANISOTROPY 1057 float dotTL = dot( material.anisotropyT, lightDir ); 1058 float dotTV = dot( material.anisotropyT, viewDir ); 1059 float dotTH = dot( material.anisotropyT, halfDir ); 1060 float dotBL = dot( material.anisotropyB, lightDir ); 1061 float dotBV = dot( material.anisotropyB, viewDir ); 1062 float dotBH = dot( material.anisotropyB, halfDir ); 1063 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1064 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1065 #else 1066 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1067 float D = D_GGX( alpha, dotNH ); 1068 #endif 1069 return F * ( V * D ); 1070} 1071vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1072 const float LUT_SIZE = 64.0; 1073 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1074 const float LUT_BIAS = 0.5 / LUT_SIZE; 1075 float dotNV = saturate( dot( N, V ) ); 1076 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1077 uv = uv * LUT_SCALE + LUT_BIAS; 1078 return uv; 1079} 1080float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1081 float l = length( f ); 1082 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1083} 1084vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1085 float x = dot( v1, v2 ); 1086 float y = abs( x ); 1087 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1088 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1089 float v = a / b; 1090 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1091 return cross( v1, v2 ) * theta_sintheta; 1092} 1093vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1094 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1095 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1096 vec3 lightNormal = cross( v1, v2 ); 1097 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1098 vec3 T1, T2; 1099 T1 = normalize( V - N * dot( V, N ) ); 1100 T2 = - cross( N, T1 ); 1101 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1102 vec3 coords[ 4 ]; 1103 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1104 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1105 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1106 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1107 coords[ 0 ] = normalize( coords[ 0 ] ); 1108 coords[ 1 ] = normalize( coords[ 1 ] ); 1109 coords[ 2 ] = normalize( coords[ 2 ] ); 1110 coords[ 3 ] = normalize( coords[ 3 ] ); 1111 vec3 vectorFormFactor = vec3( 0.0 ); 1112 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1113 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1114 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1115 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1116 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1117 return vec3( result ); 1118} 1119#if defined( USE_SHEEN ) 1120float D_Charlie( float roughness, float dotNH ) { 1121 float alpha = pow2( roughness ); 1122 float invAlpha = 1.0 / alpha; 1123 float cos2h = dotNH * dotNH; 1124 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1125 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1126} 1127float V_Neubelt( float dotNV, float dotNL ) { 1128 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1129} 1130vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1131 vec3 halfDir = normalize( lightDir + viewDir ); 1132 float dotNL = saturate( dot( normal, lightDir ) ); 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 float dotNH = saturate( dot( normal, halfDir ) ); 1135 float D = D_Charlie( sheenRoughness, dotNH ); 1136 float V = V_Neubelt( dotNV, dotNL ); 1137 return sheenColor * ( D * V ); 1138} 1139#endif 1140float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1141 float dotNV = saturate( dot( normal, viewDir ) ); 1142 float r2 = roughness * roughness; 1143 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1144 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1145 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1146 return saturate( DG * RECIPROCAL_PI ); 1147} 1148vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1149 float dotNV = saturate( dot( normal, viewDir ) ); 1150 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1151 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1152 vec4 r = roughness * c0 + c1; 1153 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1154 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1155 return fab; 1156} 1157vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1158 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1159 return specularColor * fab.x + specularF90 * fab.y; 1160} 1161#ifdef USE_IRIDESCENCE 1162void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1163#else 1164void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1165#endif 1166 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1167 #ifdef USE_IRIDESCENCE 1168 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1169 #else 1170 vec3 Fr = specularColor; 1171 #endif 1172 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1173 float Ess = fab.x + fab.y; 1174 float Ems = 1.0 - Ess; 1175 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1176 singleScatter += FssEss; 1177 multiScatter += Fms * Ems; 1178} 1179#if NUM_RECT_AREA_LIGHTS > 0 1180 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1181 vec3 normal = geometryNormal; 1182 vec3 viewDir = geometryViewDir; 1183 vec3 position = geometryPosition; 1184 vec3 lightPos = rectAreaLight.position; 1185 vec3 halfWidth = rectAreaLight.halfWidth; 1186 vec3 halfHeight = rectAreaLight.halfHeight; 1187 vec3 lightColor = rectAreaLight.color; 1188 float roughness = material.roughness; 1189 vec3 rectCoords[ 4 ]; 1190 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1191 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1192 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1193 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1194 vec4 t1 = texture2D( ltc_1, uv ); 1195 vec4 t2 = texture2D( ltc_2, uv ); 1196 mat3 mInv = mat3( 1197 vec3( t1.x, 0, t1.y ), 1198 vec3( 0, 1, 0 ), 1199 vec3( t1.z, 0, t1.w ) 1200 ); 1201 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1202 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1203 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1204 } 1205#endif 1206void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1207 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1208 vec3 irradiance = dotNL * directLight.color; 1209 #ifdef USE_CLEARCOAT 1210 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1211 vec3 ccIrradiance = dotNLcc * directLight.color; 1212 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1213 #endif 1214 #ifdef USE_SHEEN 1215 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1216 #endif 1217 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1218 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1219} 1220void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1221 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1222} 1223void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1224 #ifdef USE_CLEARCOAT 1225 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1226 #endif 1227 #ifdef USE_SHEEN 1228 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1229 #endif 1230 vec3 singleScattering = vec3( 0.0 ); 1231 vec3 multiScattering = vec3( 0.0 ); 1232 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1233 #ifdef USE_IRIDESCENCE 1234 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1235 #else 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1237 #endif 1238 vec3 totalScattering = singleScattering + multiScattering; 1239 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1240 reflectedLight.indirectSpecular += radiance * singleScattering; 1241 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1242 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1243} 1244#define RE_Direct RE_Direct_Physical 1245#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1246#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1247#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1248float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1249 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1250}`,
1250LC=` 1251vec3 geometryPosition = - vViewPosition; 1252vec3 geometryNormal = normal; 1253vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1254vec3 geometryClearcoatNormal = vec3( 0.0 ); 1255#ifdef USE_CLEARCOAT 1256 geometryClearcoatNormal = clearcoatNormal; 1257#endif 1258#ifdef USE_IRIDESCENCE 1259 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1260 if ( material.iridescenceThickness == 0.0 ) { 1261 material.iridescence = 0.0; 1262 } else { 1263 material.iridescence = saturate( material.iridescence ); 1264 } 1265 if ( material.iridescence > 0.0 ) { 1266 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1267 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1268 } 1269#endif 1270IncidentLight directLight; 1271#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1272 PointLight pointLight; 1273 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1274 PointLightShadow pointLightShadow; 1275 #endif 1276 #pragma unroll_loop_start 1277 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1278 pointLight = pointLights[ i ]; 1279 getPointLightInfo( pointLight, geometryPosition, directLight ); 1280 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1281 pointLightShadow = pointLightShadows[ i ]; 1282 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1283 #endif 1284 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1285 } 1286 #pragma unroll_loop_end 1287#endif 1288#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1289 SpotLight spotLight; 1290 vec4 spotColor; 1291 vec3 spotLightCoord; 1292 bool inSpotLightMap; 1293 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1294 SpotLightShadow spotLightShadow; 1295 #endif 1296 #pragma unroll_loop_start 1297 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1298 spotLight = spotLights[ i ]; 1299 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1300 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1301 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1302 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1303 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1304 #else 1305 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1306 #endif 1307 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1308 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1309 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1310 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1311 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1312 #endif 1313 #undef SPOT_LIGHT_MAP_INDEX 1314 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1315 spotLightShadow = spotLightShadows[ i ]; 1316 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1317 #endif 1318 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1319 } 1320 #pragma unroll_loop_end 1321#endif 1322#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1323 DirectionalLight directionalLight; 1324 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1325 DirectionalLightShadow directionalLightShadow; 1326 #endif 1327 #pragma unroll_loop_start 1328 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1329 directionalLight = directionalLights[ i ]; 1330 getDirectionalLightInfo( directionalLight, directLight ); 1331 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1332 directionalLightShadow = directionalLightShadows[ i ]; 1333 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1334 #endif 1335 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1336 } 1337 #pragma unroll_loop_end 1338#endif 1339#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1340 RectAreaLight rectAreaLight; 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1343 rectAreaLight = rectAreaLights[ i ]; 1344 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1345 } 1346 #pragma unroll_loop_end 1347#endif 1348#if defined( RE_IndirectDiffuse ) 1349 vec3 iblIrradiance = vec3( 0.0 ); 1350 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1351 #if defined( USE_LIGHT_PROBES ) 1352 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1353 #endif 1354 #if ( NUM_HEMI_LIGHTS > 0 ) 1355 #pragma unroll_loop_start 1356 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1357 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1358 } 1359 #pragma unroll_loop_end 1360 #endif 1361#endif 1362#if defined( RE_IndirectSpecular ) 1363 vec3 radiance = vec3( 0.0 ); 1364 vec3 clearcoatRadiance = vec3( 0.0 ); 1365#endif`,FC=`#if defined( RE_IndirectDiffuse ) 1366 #ifdef USE_LIGHTMAP 1367 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1368 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1369 irradiance += lightMapIrradiance; 1370 #endif 1371 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1372 iblIrradiance += getIBLIrradiance( geometryNormal ); 1373 #endif 1374#endif 1375#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1376 #ifdef USE_ANISOTROPY 1377 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1378 #else 1379 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1380 #endif 1381 #ifdef USE_CLEARCOAT 1382 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1383 #endif 1384#endif`,UC=`#if defined( RE_IndirectDiffuse ) 1385 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1386#endif 1387#if defined( RE_IndirectSpecular ) 1388 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1389#endif`,NC=`#if defined( USE_LOGDEPTHBUF ) 1390 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1391#endif`,OC=`#if defined( USE_LOGDEPTHBUF ) 1392 uniform float logDepthBufFC; 1393 varying float vFragDepth; 1394 varying float vIsPerspective; 1395#endif`,HC=`#ifdef USE_LOGDEPTHBUF 1396 varying float vFragDepth; 1397 varying float vIsPerspective; 1398#endif`,GC=`#ifdef USE_LOGDEPTHBUF 1399 vFragDepth = 1.0 + gl_Position.w; 1400 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1401#endif`,kC=`#ifdef USE_MAP 1402 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1403 #ifdef DECODE_VIDEO_TEXTURE 1404 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1405 #endif 1406 diffuseColor *= sampledDiffuseColor; 1407#endif`,zC=`#ifdef USE_MAP 1408 uniform sampler2D map; 1409#endif`,VC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1410 #if defined( USE_POINTS_UV ) 1411 vec2 uv = vUv; 1412 #else 1413 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1414 #endif 1415#endif 1416#ifdef USE_MAP 1417 diffuseColor *= texture2D( map, uv ); 1418#endif 1419#ifdef USE_ALPHAMAP 1420 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1421#endif`,WC=`#if defined( USE_POINTS_UV ) 1422 varying vec2 vUv; 1423#else 1424 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1425 uniform mat3 uvTransform; 1426 #endif 1427#endif 1428#ifdef USE_MAP 1429 uniform sampler2D map; 1430#endif 1431#ifdef USE_ALPHAMAP 1432 uniform sampler2D alphaMap; 1433#endif`,XC=`float metalnessFactor = metalness; 1434#ifdef USE_METALNESSMAP 1435 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1436 metalnessFactor *= texelMetalness.b; 1437#endif`,JC=`#ifdef USE_METALNESSMAP 1438 uniform sampler2D metalnessMap; 1439#endif`,YC=`#ifdef USE_INSTANCING_MORPH 1440 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1441 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1442 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1443 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1444 } 1445#endif`,KC=`#if defined( USE_MORPHCOLORS ) 1446 vColor *= morphTargetBaseInfluence; 1447 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1448 #if defined( USE_COLOR_ALPHA ) 1449 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1450 #elif defined( USE_COLOR ) 1451 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1452 #endif 1453 } 1454#endif`,ZC=`#ifdef USE_MORPHNORMALS 1455 objectNormal *= morphTargetBaseInfluence; 1456 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1457 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1458 } 1459#endif`,qC=`#ifdef USE_MORPHTARGETS 1460 #ifndef USE_INSTANCING_MORPH 1461 uniform float morphTargetBaseInfluence; 1462 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1463 #endif 1464 uniform sampler2DArray morphTargetsTexture; 1465 uniform ivec2 morphTargetsTextureSize; 1466 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1467 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1468 int y = texelIndex / morphTargetsTextureSize.x; 1469 int x = texelIndex - y * morphTargetsTextureSize.x; 1470 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1471 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1472 } 1473#endif`,QC=`#ifdef USE_MORPHTARGETS 1474 transformed *= morphTargetBaseInfluence; 1475 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1476 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1477 } 1478#endif`,jC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1479#ifdef FLAT_SHADED 1480 vec3 fdx = dFdx( vViewPosition ); 1481 vec3 fdy = dFdy( vViewPosition ); 1482 vec3 normal = normalize( cross( fdx, fdy ) ); 1483#else 1484 vec3 normal = normalize( vNormal ); 1485 #ifdef DOUBLE_SIDED 1486 normal *= faceDirection; 1487 #endif 1488#endif 1489#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1490 #ifdef USE_TANGENT 1491 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1492 #else 1493 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1494 #if defined( USE_NORMALMAP ) 1495 vNormalMapUv 1496 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1497 vClearcoatNormalMapUv 1498 #else 1499 vUv 1500 #endif 1501 ); 1502 #endif 1503 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1504 tbn[0] *= faceDirection; 1505 tbn[1] *= faceDirection; 1506 #endif 1507#endif 1508#ifdef USE_CLEARCOAT_NORMALMAP 1509 #ifdef USE_TANGENT 1510 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1511 #else 1512 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1513 #endif 1514 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1515 tbn2[0] *= faceDirection; 1516 tbn2[1] *= faceDirection; 1517 #endif 1518#endif 1519vec3 nonPerturbedNormal = normal;`,$C=`#ifdef USE_NORMALMAP_OBJECTSPACE 1520 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1521 #ifdef FLIP_SIDED 1522 normal = - normal; 1523 #endif 1524 #ifdef DOUBLE_SIDED 1525 normal = normal * faceDirection; 1526 #endif 1527 normal = normalize( normalMatrix * normal ); 1528#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1529 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1530 mapN.xy *= normalScale; 1531 normal = normalize( tbn * mapN ); 1532#elif defined( USE_BUMPMAP )
1533 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1534#endif`,eT=`#ifndef FLAT_SHADED 1535 varying vec3 vNormal; 1536 #ifdef USE_TANGENT 1537 varying vec3 vTangent; 1538 varying vec3 vBitangent; 1539 #endif 1540#endif`,tT=`#ifndef FLAT_SHADED 1541 varying vec3 vNormal; 1542 #ifdef USE_TANGENT 1543 varying vec3 vTangent; 1544 varying vec3 vBitangent; 1545 #endif 1546#endif`,nT=`#ifndef FLAT_SHADED 1547 vNormal = normalize( transformedNormal ); 1548 #ifdef USE_TANGENT 1549 vTangent = normalize( transformedTangent ); 1550 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1551 #endif 1552#endif`,iT=`#ifdef USE_NORMALMAP 1553 uniform sampler2D normalMap; 1554 uniform vec2 normalScale; 1555#endif 1556#ifdef USE_NORMALMAP_OBJECTSPACE 1557 uniform mat3 normalMatrix; 1558#endif 1559#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1560 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1561 vec3 q0 = dFdx( eye_pos.xyz ); 1562 vec3 q1 = dFdy( eye_pos.xyz ); 1563 vec2 st0 = dFdx( uv.st ); 1564 vec2 st1 = dFdy( uv.st ); 1565 vec3 N = surf_norm; 1566 vec3 q1perp = cross( q1, N ); 1567 vec3 q0perp = cross( N, q0 ); 1568 vec3 T = q1perp * st0.x + q0perp * st1.x; 1569 vec3 B = q1perp * st0.y + q0perp * st1.y; 1570 float det = max( dot( T, T ), dot( B, B ) ); 1571 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1572 return mat3( T * scale, B * scale, N ); 1573 } 1574#endif`,rT=`#ifdef USE_CLEARCOAT 1575 vec3 clearcoatNormal = nonPerturbedNormal; 1576#endif`,sT=`#ifdef USE_CLEARCOAT_NORMALMAP 1577 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1578 clearcoatMapN.xy *= clearcoatNormalScale; 1579 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1580#endif`,oT=`#ifdef USE_CLEARCOATMAP 1581 uniform sampler2D clearcoatMap; 1582#endif 1583#ifdef USE_CLEARCOAT_NORMALMAP 1584 uniform sampler2D clearcoatNormalMap; 1585 uniform vec2 clearcoatNormalScale; 1586#endif 1587#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1588 uniform sampler2D clearcoatRoughnessMap; 1589#endif`,aT=`#ifdef USE_IRIDESCENCEMAP 1590 uniform sampler2D iridescenceMap; 1591#endif 1592#ifdef USE_IRIDESCENCE_THICKNESSMAP 1593 uniform sampler2D iridescenceThicknessMap; 1594#endif`,lT=`#ifdef OPAQUE 1595diffuseColor.a = 1.0; 1596#endif 1597#ifdef USE_TRANSMISSION 1598diffuseColor.a *= material.transmissionAlpha; 1599#endif 1600gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,cT=`vec3 packNormalToRGB( const in vec3 normal ) { 1601 return normalize( normal ) * 0.5 + 0.5; 1602} 1603vec3 unpackRGBToNormal( const in vec3 rgb ) { 1604 return 2.0 * rgb.xyz - 1.0; 1605} 1606const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1607const float Inv255 = 1. / 255.; 1608const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1609const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1610const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1611const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1612vec4 packDepthToRGBA( const in float v ) { 1613 if( v <= 0.0 ) 1614 return vec4( 0., 0., 0., 0. ); 1615 if( v >= 1.0 ) 1616 return vec4( 1., 1., 1., 1. ); 1617 float vuf; 1618 float af = modf( v * PackFactors.a, vuf ); 1619 float bf = modf( vuf * ShiftRight8, vuf ); 1620 float gf = modf( vuf * ShiftRight8, vuf ); 1621 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1622} 1623vec3 packDepthToRGB( const in float v ) { 1624 if( v <= 0.0 ) 1625 return vec3( 0., 0., 0. ); 1626 if( v >= 1.0 ) 1627 return vec3( 1., 1., 1. ); 1628 float vuf; 1629 float bf = modf( v * PackFactors.b, vuf ); 1630 float gf = modf( vuf * ShiftRight8, vuf ); 1631 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1632} 1633vec2 packDepthToRG( const in float v ) { 1634 if( v <= 0.0 ) 1635 return vec2( 0., 0. ); 1636 if( v >= 1.0 ) 1637 return vec2( 1., 1. ); 1638 float vuf; 1639 float gf = modf( v * 256., vuf ); 1640 return vec2( vuf * Inv255, gf ); 1641} 1642float unpackRGBAToDepth( const in vec4 v ) { 1643 return dot( v, UnpackFactors4 ); 1644} 1645float unpackRGBToDepth( const in vec3 v ) { 1646 return dot( v, UnpackFactors3 ); 1647} 1648float unpackRGToDepth( const in vec2 v ) { 1649 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1650} 1651vec4 pack2HalfToRGBA( const in vec2 v ) {
1652 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1653 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1654} 1655vec2 unpackRGBATo2Half( const in vec4 v ) { 1656 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1657} 1658float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1659 return ( viewZ + near ) / ( near - far ); 1660} 1661float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1662 return depth * ( near - far ) - near; 1663} 1664float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1665 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1666} 1667float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1668 return ( near * far ) / ( ( far - near ) * depth - far ); 1669}`,uT=`#ifdef PREMULTIPLIED_ALPHA 1670 gl_FragColor.rgb *= gl_FragColor.a; 1671#endif`,hT=`vec4 mvPosition = vec4( transformed, 1.0 ); 1672#ifdef USE_BATCHING 1673 mvPosition = batchingMatrix * mvPosition; 1674#endif 1675#ifdef USE_INSTANCING 1676 mvPosition = instanceMatrix * mvPosition; 1677#endif 1678mvPosition = modelViewMatrix * mvPosition; 1679gl_Position = projectionMatrix * mvPosition;`,fT=`#ifdef DITHERING 1680 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1681#endif`,dT=`#ifdef DITHERING 1682 vec3 dithering( vec3 color ) { 1683 float grid_position = rand( gl_FragCoord.xy ); 1684 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1685 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1686 return color + dither_shift_RGB; 1687 } 1688#endif`,pT=`float roughnessFactor = roughness; 1689#ifdef USE_ROUGHNESSMAP 1690 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1691 roughnessFactor *= texelRoughness.g; 1692#endif`,mT=`#ifdef USE_ROUGHNESSMAP 1693 uniform sampler2D roughnessMap; 1694#endif`,gT=
vendor: 8,887 bytes, lines 1694-1880
1694`#if NUM_SPOT_LIGHT_COORDS > 0 1695 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1696#endif 1697#if NUM_SPOT_LIGHT_MAPS > 0 1698 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1699#endif 1700#ifdef USE_SHADOWMAP 1701 #if NUM_DIR_LIGHT_SHADOWS > 0 1702 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1703 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1704 struct DirectionalLightShadow { 1705 float shadowIntensity; 1706 float shadowBias; 1707 float shadowNormalBias; 1708 float shadowRadius; 1709 vec2 shadowMapSize; 1710 }; 1711 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1712 #endif 1713 #if NUM_SPOT_LIGHT_SHADOWS > 0 1714 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1715 struct SpotLightShadow { 1716 float shadowIntensity; 1717 float shadowBias; 1718 float shadowNormalBias; 1719 float shadowRadius; 1720 vec2 shadowMapSize; 1721 }; 1722 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1723 #endif 1724 #if NUM_POINT_LIGHT_SHADOWS > 0 1725 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1726 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1727 struct PointLightShadow { 1728 float shadowIntensity; 1729 float shadowBias; 1730 float shadowNormalBias; 1731 float shadowRadius; 1732 vec2 shadowMapSize; 1733 float shadowCameraNear; 1734 float shadowCameraFar; 1735 }; 1736 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1737 #endif 1738 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1739 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1740 } 1741 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1742 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1743 } 1744 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1745 float occlusion = 1.0; 1746 vec2 distribution = texture2DDistribution( shadow, uv ); 1747 float hard_shadow = step( compare , distribution.x ); 1748 if (hard_shadow != 1.0 ) { 1749 float distance = compare - distribution.x ; 1750 float variance = max( 0.00000, distribution.y * distribution.y ); 1751 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1752 } 1753 return occlusion; 1754 } 1755 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1756 float shadow = 1.0; 1757 shadowCoord.xyz /= shadowCoord.w; 1758 shadowCoord.z += shadowBias; 1759 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1760 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1761 if ( frustumTest ) { 1762 #if defined( SHADOWMAP_TYPE_PCF ) 1763 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1764 float dx0 = - texelSize.x * shadowRadius; 1765 float dy0 = - texelSize.y * shadowRadius; 1766 float dx1 = + texelSize.x * shadowRadius; 1767 float dy1 = + texelSize.y * shadowRadius; 1768 float dx2 = dx0 / 2.0; 1769 float dy2 = dy0 / 2.0; 1770 float dx3 = dx1 / 2.0; 1771 float dy3 = dy1 / 2.0; 1772 shadow = ( 1773 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1774 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1775 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1776 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1777 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1790 ) * ( 1.0 / 17.0 ); 1791 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1792 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1793 float dx = texelSize.x; 1794 float dy = texelSize.y; 1795 vec2 uv = shadowCoord.xy; 1796 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1797 uv -= f * texelSize; 1798 shadow = ( 1799 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1800 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1801 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1802 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1803 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1804 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1805 f.x ) + 1806 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1807 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1808 f.x ) + 1809 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1810 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1811 f.y ) + 1812 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1813 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1814 f.y ) + 1815 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1816 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1817 f.x ), 1818 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1819 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1820 f.x ), 1821 f.y ) 1822 ) * ( 1.0 / 9.0 ); 1823 #elif defined( SHADOWMAP_TYPE_VSM ) 1824 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1825 #else 1826 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1827 #endif 1828 } 1829 return mix( 1.0, shadow, shadowIntensity ); 1830 } 1831 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1832 vec3 absV = abs( v ); 1833 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1834 absV *= scaleToCube; 1835 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1836 vec2 planar = v.xy; 1837 float almostATexel = 1.5 * texelSizeY; 1838 float almostOne = 1.0 - almostATexel; 1839 if ( absV.z >= almostOne ) { 1840 if ( v.z > 0.0 ) 1841 planar.x = 4.0 - v.x; 1842 } else if ( absV.x >= almostOne ) { 1843 float signX = sign( v.x ); 1844 planar.x = v.z * signX + 2.0 * signX; 1845 } else if ( absV.y >= almostOne ) { 1846 float signY = sign( v.y ); 1847 planar.x = v.x + 2.0 * signY + 2.0; 1848 planar.y = v.z * signY - 2.0; 1849 } 1850 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1851 } 1852 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1853 float shadow = 1.0; 1854 vec3 lightToPosition = shadowCoord.xyz; 1855 1856 float lightToPositionLength = length( lightToPosition ); 1857 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1858 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1859 vec3 bd3D = normalize( lightToPosition ); 1860 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1861 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1862 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1863 shadow = ( 1864 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1865 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1866 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1867 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1868 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1869 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1870 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1871 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1873 ) * ( 1.0 / 9.0 ); 1874 #else 1875 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1876 #endif 1877 } 1878 return mix( 1.0, shadow, shadowIntensity ); 1879 } 1880#endif`,
1880vT=`#if NUM_SPOT_LIGHT_COORDS > 0 1881 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1882 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1883#endif 1884#ifdef USE_SHADOWMAP 1885 #if NUM_DIR_LIGHT_SHADOWS > 0 1886 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1887 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1888 struct DirectionalLightShadow { 1889 float shadowIntensity; 1890 float shadowBias; 1891 float shadowNormalBias; 1892 float shadowRadius; 1893 vec2 shadowMapSize; 1894 }; 1895 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1896 #endif 1897 #if NUM_SPOT_LIGHT_SHADOWS > 0 1898 struct SpotLightShadow { 1899 float shadowIntensity; 1900 float shadowBias; 1901 float shadowNormalBias; 1902 float shadowRadius; 1903 vec2 shadowMapSize; 1904 }; 1905 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1906 #endif 1907 #if NUM_POINT_LIGHT_SHADOWS > 0 1908 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1909 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1910 struct PointLightShadow { 1911 float shadowIntensity; 1912 float shadowBias; 1913 float shadowNormalBias; 1914 float shadowRadius; 1915 vec2 shadowMapSize; 1916 float shadowCameraNear; 1917 float shadowCameraFar; 1918 }; 1919 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1920 #endif 1921#endif`,_T=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1922 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1923 vec4 shadowWorldPosition; 1924#endif 1925#if defined( USE_SHADOWMAP ) 1926 #if NUM_DIR_LIGHT_SHADOWS > 0 1927 #pragma unroll_loop_start 1928 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1929 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1930 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1931 } 1932 #pragma unroll_loop_end 1933 #endif 1934 #if NUM_POINT_LIGHT_SHADOWS > 0 1935 #pragma unroll_loop_start 1936 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1937 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1938 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1939 } 1940 #pragma unroll_loop_end 1941 #endif 1942#endif 1943#if NUM_SPOT_LIGHT_COORDS > 0 1944 #pragma unroll_loop_start 1945 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1946 shadowWorldPosition = worldPosition; 1947 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1948 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1949 #endif 1950 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1951 } 1952 #pragma unroll_loop_end 1953#endif`,yT=`float getShadowMask() { 1954 float shadow = 1.0; 1955 #ifdef USE_SHADOWMAP 1956 #if NUM_DIR_LIGHT_SHADOWS > 0 1957 DirectionalLightShadow directionalLight; 1958 #pragma unroll_loop_start 1959 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1960 directionalLight = directionalLightShadows[ i ]; 1961 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1962 } 1963 #pragma unroll_loop_end 1964 #endif 1965 #if NUM_SPOT_LIGHT_SHADOWS > 0 1966 SpotLightShadow spotLight; 1967 #pragma unroll_loop_start 1968 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1969 spotLight = spotLightShadows[ i ]; 1970 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1971 } 1972 #pragma unroll_loop_end 1973 #endif 1974 #if NUM_POINT_LIGHT_SHADOWS > 0 1975 PointLightShadow pointLight; 1976 #pragma unroll_loop_start 1977 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1978 pointLight = pointLightShadows[ i ]; 1979 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1980 } 1981 #pragma unroll_loop_end 1982 #endif 1983 #endif 1984 return shadow; 1985}`,xT=`#ifdef USE_SKINNING 1986 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1987 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1988 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1989 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1990#endif`,AT=`#ifdef USE_SKINNING 1991 uniform mat4 bindMatrix; 1992 uniform mat4 bindMatrixInverse; 1993 uniform highp sampler2D boneTexture; 1994 mat4 getBoneMatrix( const in float i ) { 1995 int size = textureSize( boneTexture, 0 ).x; 1996 int j = int( i ) * 4; 1997 int x = j % size; 1998 int y = j / size; 1999 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2000 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2001 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2002 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2003 return mat4( v1, v2, v3, v4 ); 2004 } 2005#endif`,MT=`#ifdef USE_SKINNING 2006 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2007 vec4 skinned = vec4( 0.0 ); 2008 skinned += boneMatX * skinVertex * skinWeight.x; 2009 skinned += boneMatY * skinVertex * skinWeight.y; 2010 skinned += boneMatZ * skinVertex * skinWeight.z; 2011 skinned += boneMatW * skinVertex * skinWeight.w; 2012 transformed = ( bindMatrixInverse * skinned ).xyz; 2013#endif`,ST=`#ifdef USE_SKINNING 2014 mat4 skinMatrix = mat4( 0.0 ); 2015 skinMatrix += skinWeight.x * boneMatX; 2016 skinMatrix += skinWeight.y * boneMatY; 2017 skinMatrix += skinWeight.z * boneMatZ; 2018 skinMatrix += skinWeight.w * boneMatW; 2019 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2020 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2021 #ifdef USE_TANGENT 2022 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2023 #endif 2024#endif`,ET=`float specularStrength; 2025#ifdef USE_SPECULARMAP 2026 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2027 specularStrength = texelSpecular.r; 2028#else 2029 specularStrength = 1.0; 2030#endif`,wT=`#ifdef USE_SPECULARMAP 2031 uniform sampler2D specularMap; 2032#endif`,CT=`#if defined( TONE_MAPPING ) 2033 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2034#endif`,TT=`#ifndef saturate 2035#define saturate( a ) clamp( a, 0.0, 1.0 ) 2036#endif 2037uniform float toneMappingExposure; 2038vec3 LinearToneMapping( vec3 color ) { 2039 return saturate( toneMappingExposure * color ); 2040} 2041vec3 ReinhardToneMapping( vec3 color ) { 2042 color *= toneMappingExposure; 2043 return saturate( color / ( vec3( 1.0 ) + color ) ); 2044} 2045vec3 CineonToneMapping( vec3 color ) { 2046 color *= toneMappingExposure; 2047 color = max( vec3( 0.0 ), color - 0.004 ); 2048 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2049} 2050vec3 RRTAndODTFit( vec3 v ) { 2051 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2052 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2053 return a / b; 2054} 2055vec3 ACESFilmicToneMapping( vec3 color ) { 2056 const mat3 ACESInputMat = mat3( 2057 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2058 vec3( 0.04823, 0.01566, 0.83777 ) 2059 ); 2060 const mat3 ACESOutputMat = mat3( 2061 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2062 vec3( -0.07367, -0.00605, 1.07602 ) 2063 ); 2064 color *= toneMappingExposure / 0.6; 2065 color = ACESInputMat * color; 2066 color = RRTAndODTFit( color ); 2067 color = ACESOutputMat * color; 2068 return saturate( color ); 2069} 2070const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2071 vec3( 1.6605, - 0.1246, - 0.0182 ), 2072 vec3( - 0.5876, 1.1329, - 0.1006 ), 2073 vec3( - 0.0728, - 0.0083, 1.1187 ) 2074); 2075const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2076 vec3( 0.6274, 0.0691, 0.0164 ), 2077 vec3( 0.3293, 0.9195, 0.0880 ), 2078 vec3( 0.0433, 0.0113, 0.8956 ) 2079); 2080vec3 agxDefaultContrastApprox( vec3 x ) { 2081 vec3 x2 = x * x; 2082 vec3 x4 = x2 * x2; 2083 return + 15.5 * x4 * x2 2084 - 40.14 * x4 * x 2085 + 31.96 * x4 2086 - 6.868 * x2 * x 2087 + 0.4298 * x2 2088 + 0.1191 * x 2089 - 0.00232; 2090} 2091vec3 AgXToneMapping( vec3 color ) { 2092 const mat3 AgXInsetMatrix = mat3( 2093 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2094 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2095 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2096 );
2097 const mat3 AgXOutsetMatrix = mat3( 2098 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2099 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2100 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2101 ); 2102 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2103 color *= toneMappingExposure; 2104 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2105 color = AgXInsetMatrix * color; 2106 color = max( color, 1e-10 ); color = log2( color ); 2107 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2108 color = clamp( color, 0.0, 1.0 ); 2109 color = agxDefaultContrastApprox( color ); 2110 color = AgXOutsetMatrix * color; 2111 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2112 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2113 color = clamp( color, 0.0, 1.0 ); 2114 return color; 2115} 2116vec3 NeutralToneMapping( vec3 color ) { 2117 const float StartCompression = 0.8 - 0.04; 2118 const float Desaturation = 0.15; 2119 color *= toneMappingExposure; 2120 float x = min( color.r, min( color.g, color.b ) ); 2121 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2122 color -= offset; 2123 float peak = max( color.r, max( color.g, color.b ) ); 2124 if ( peak < StartCompression ) return color; 2125 float d = 1. - StartCompression; 2126 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2127 color *= newPeak / peak; 2128 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2129 return mix( color, vec3( newPeak ), g ); 2130} 2131vec3 CustomToneMapping( vec3 color ) { return color; }`,bT=`#ifdef USE_TRANSMISSION 2132 material.transmission = transmission; 2133 material.transmissionAlpha = 1.0; 2134 material.thickness = thickness; 2135 material.attenuationDistance = attenuationDistance; 2136 material.attenuationColor = attenuationColor; 2137 #ifdef USE_TRANSMISSIONMAP 2138 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2139 #endif 2140 #ifdef USE_THICKNESSMAP 2141 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2142 #endif 2143 vec3 pos = vWorldPosition; 2144 vec3 v = normalize( cameraPosition - pos ); 2145 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2146 vec4 transmitted = getIBLVolumeRefraction( 2147 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2148 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2149 material.attenuationColor, material.attenuationDistance ); 2150 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2151 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2152#endif`,RT=`#ifdef USE_TRANSMISSION 2153 uniform float transmission; 2154 uniform float thickness; 2155 uniform float attenuationDistance; 2156 uniform vec3 attenuationColor; 2157 #ifdef USE_TRANSMISSIONMAP 2158 uniform sampler2D transmissionMap; 2159 #endif 2160 #ifdef USE_THICKNESSMAP 2161 uniform sampler2D thicknessMap; 2162 #endif 2163 uniform vec2 transmissionSamplerSize; 2164 uniform sampler2D transmissionSamplerMap; 2165 uniform mat4 modelMatrix; 2166 uniform mat4 projectionMatrix; 2167 varying vec3 vWorldPosition; 2168 float w0( float a ) { 2169 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2170 } 2171 float w1( float a ) { 2172 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2173 } 2174 float w2( float a ){ 2175 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2176 } 2177 float w3( float a ) { 2178 return ( 1.0 / 6.0 ) * ( a * a * a ); 2179 } 2180 float g0( float a ) { 2181 return w0( a ) + w1( a ); 2182 } 2183 float g1( float a ) { 2184 return w2( a ) + w3( a ); 2185 } 2186 float h0( float a ) { 2187 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2188 } 2189 float h1( float a ) { 2190 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2191 } 2192 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2193 uv = uv * texelSize.zw + 0.5; 2194 vec2 iuv = floor( uv ); 2195 vec2 fuv = fract( uv ); 2196 float g0x = g0( fuv.x ); 2197 float g1x = g1( fuv.x ); 2198 float h0x = h0( fuv.x ); 2199 float h1x = h1( fuv.x ); 2200 float h0y = h0( fuv.y ); 2201 float h1y = h1( fuv.y ); 2202 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2203 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2204 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2205 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2206 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2207 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2208 } 2209 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2210 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2211 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2212 vec2 fLodSizeInv = 1.0 / fLodSize; 2213 vec2 cLodSizeInv = 1.0 / cLodSize; 2214 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2215 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2216 return mix( fSample, cSample, fract( lod ) ); 2217 } 2218 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2219 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2220 vec3 modelScale; 2221 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2222 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2223 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2224 return normalize( refractionVector ) * thickness * modelScale; 2225 } 2226 float applyIorToRoughness( const in float roughness, const in float ior ) { 2227 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2228 } 2229 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2230 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2231 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2232 } 2233 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2234 if ( isinf( attenuationDistance ) ) { 2235 return vec3( 1.0 ); 2236 } else { 2237 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2238 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2239 } 2240 } 2241 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2242 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2243 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2244 const in vec3 attenuationColor, const in float attenuationDistance ) { 2245 vec4 transmittedLight; 2246 vec3 transmittance; 2247 #ifdef USE_DISPERSION 2248 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2249 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2250 for ( int i = 0; i < 3; i ++ ) { 2251 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2252 vec3 refractedRayExit = position + transmissionRay; 2253 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2254 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2255 refractionCoords += 1.0; 2256 refractionCoords /= 2.0; 2257 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2258 transmittedLight[ i ] = transmissionSample[ i ]; 2259 transmittedLight.a += transmissionSample.a; 2260 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2261 } 2262 transmittedLight.a /= 3.0; 2263 #else 2264 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2265 vec3 refractedRayExit = position + transmissionRay; 2266 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2267 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2268 refractionCoords += 1.0; 2269 refractionCoords /= 2.0; 2270 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2271 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2272 #endif 2273 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2274 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2275 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2276 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2277 } 2278#endif`,IT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2279 varying vec2 vUv; 2280#endif 2281#ifdef USE_MAP 2282 varying vec2 vMapUv; 2283#endif 2284#ifdef USE_ALPHAMAP
2285 varying vec2 vAlphaMapUv; 2286#endif 2287#ifdef USE_LIGHTMAP 2288 varying vec2 vLightMapUv; 2289#endif 2290#ifdef USE_AOMAP 2291 varying vec2 vAoMapUv; 2292#endif 2293#ifdef USE_BUMPMAP 2294 varying vec2 vBumpMapUv; 2295#endif 2296#ifdef USE_NORMALMAP 2297 varying vec2 vNormalMapUv; 2298#endif 2299#ifdef USE_EMISSIVEMAP 2300 varying vec2 vEmissiveMapUv; 2301#endif 2302#ifdef USE_METALNESSMAP 2303 varying vec2 vMetalnessMapUv; 2304#endif 2305#ifdef USE_ROUGHNESSMAP 2306 varying vec2 vRoughnessMapUv; 2307#endif 2308#ifdef USE_ANISOTROPYMAP 2309 varying vec2 vAnisotropyMapUv; 2310#endif 2311#ifdef USE_CLEARCOATMAP 2312 varying vec2 vClearcoatMapUv; 2313#endif 2314#ifdef USE_CLEARCOAT_NORMALMAP 2315 varying vec2 vClearcoatNormalMapUv; 2316#endif 2317#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2318 varying vec2 vClearcoatRoughnessMapUv; 2319#endif 2320#ifdef USE_IRIDESCENCEMAP 2321 varying vec2 vIridescenceMapUv; 2322#endif 2323#ifdef USE_IRIDESCENCE_THICKNESSMAP 2324 varying vec2 vIridescenceThicknessMapUv; 2325#endif 2326#ifdef USE_SHEEN_COLORMAP 2327 varying vec2 vSheenColorMapUv; 2328#endif 2329#ifdef USE_SHEEN_ROUGHNESSMAP 2330 varying vec2 vSheenRoughnessMapUv; 2331#endif 2332#ifdef USE_SPECULARMAP 2333 varying vec2 vSpecularMapUv; 2334#endif 2335#ifdef USE_SPECULAR_COLORMAP 2336 varying vec2 vSpecularColorMapUv; 2337#endif 2338#ifdef USE_SPECULAR_INTENSITYMAP 2339 varying vec2 vSpecularIntensityMapUv; 2340#endif 2341#ifdef USE_TRANSMISSIONMAP 2342 uniform mat3 transmissionMapTransform; 2343 varying vec2 vTransmissionMapUv; 2344#endif 2345#ifdef USE_THICKNESSMAP 2346 uniform mat3 thicknessMapTransform; 2347 varying vec2 vThicknessMapUv; 2348#endif`,BT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2349 varying vec2 vUv; 2350#endif 2351#ifdef USE_MAP 2352 uniform mat3 mapTransform; 2353 varying vec2 vMapUv; 2354#endif 2355#ifdef USE_ALPHAMAP 2356 uniform mat3 alphaMapTransform; 2357 varying vec2 vAlphaMapUv; 2358#endif 2359#ifdef USE_LIGHTMAP 2360 uniform mat3 lightMapTransform; 2361 varying vec2 vLightMapUv; 2362#endif 2363#ifdef USE_AOMAP 2364 uniform mat3 aoMapTransform; 2365 varying vec2 vAoMapUv; 2366#endif 2367#ifdef USE_BUMPMAP 2368 uniform mat3 bumpMapTransform; 2369 varying vec2 vBumpMapUv; 2370#endif 2371#ifdef USE_NORMALMAP 2372 uniform mat3 normalMapTransform; 2373 varying vec2 vNormalMapUv; 2374#endif 2375#ifdef USE_DISPLACEMENTMAP 2376 uniform mat3 displacementMapTransform; 2377 varying vec2 vDisplacementMapUv; 2378#endif 2379#ifdef USE_EMISSIVEMAP 2380 uniform mat3 emissiveMapTransform; 2381 varying vec2 vEmissiveMapUv; 2382#endif 2383#ifdef USE_METALNESSMAP 2384 uniform mat3 metalnessMapTransform; 2385 varying vec2 vMetalnessMapUv; 2386#endif 2387#ifdef USE_ROUGHNESSMAP 2388 uniform mat3 roughnessMapTransform; 2389 varying vec2 vRoughnessMapUv; 2390#endif 2391#ifdef USE_ANISOTROPYMAP 2392 uniform mat3 anisotropyMapTransform; 2393 varying vec2 vAnisotropyMapUv; 2394#endif 2395#ifdef USE_CLEARCOATMAP 2396 uniform mat3 clearcoatMapTransform; 2397 varying vec2 vClearcoatMapUv; 2398#endif 2399#ifdef USE_CLEARCOAT_NORMALMAP 2400 uniform mat3 clearcoatNormalMapTransform; 2401 varying vec2 vClearcoatNormalMapUv; 2402#endif 2403#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2404 uniform mat3 clearcoatRoughnessMapTransform; 2405 varying vec2 vClearcoatRoughnessMapUv; 2406#endif 2407#ifdef USE_SHEEN_COLORMAP 2408 uniform mat3 sheenColorMapTransform; 2409 varying vec2 vSheenColorMapUv; 2410#endif 2411#ifdef USE_SHEEN_ROUGHNESSMAP 2412 uniform mat3 sheenRoughnessMapTransform; 2413 varying vec2 vSheenRoughnessMapUv; 2414#endif 2415#ifdef USE_IRIDESCENCEMAP 2416 uniform mat3 iridescenceMapTransform; 2417 varying vec2 vIridescenceMapUv; 2418#endif 2419#ifdef USE_IRIDESCENCE_THICKNESSMAP 2420 uniform mat3 iridescenceThicknessMapTransform; 2421 varying vec2 vIridescenceThicknessMapUv; 2422#endif 2423#ifdef USE_SPECULARMAP 2424 uniform mat3 specularMapTransform; 2425 varying vec2 vSpecularMapUv; 2426#endif 2427#ifdef USE_SPECULAR_COLORMAP 2428 uniform mat3 specularColorMapTransform; 2429 varying vec2 vSpecularColorMapUv; 2430#endif 2431#ifdef USE_SPECULAR_INTENSITYMAP 2432 uniform mat3 specularIntensityMapTransform; 2433 varying vec2 vSpecularIntensityMapUv; 2434#endif 2435#ifdef USE_TRANSMISSIONMAP 2436 uniform mat3 transmissionMapTransform; 2437 varying vec2 vTransmissionMapUv; 2438#endif 2439#ifdef USE_THICKNESSMAP 2440 uniform mat3 thicknessMapTransform; 2441 varying vec2 vThicknessMapUv; 2442#endif`,PT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2443 vUv = vec3( uv, 1 ).xy; 2444#endif 2445#ifdef USE_MAP 2446 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2447#endif 2448#ifdef USE_ALPHAMAP 2449 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2450#endif 2451#ifdef USE_LIGHTMAP 2452 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2453#endif 2454#ifdef USE_AOMAP 2455 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2456#endif 2457#ifdef USE_BUMPMAP 2458 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2459#endif 2460#ifdef USE_NORMALMAP 2461 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2462#endif 2463#ifdef USE_DISPLACEMENTMAP 2464 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2465#endif 2466#ifdef USE_EMISSIVEMAP 2467 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2468#endif 2469#ifdef USE_METALNESSMAP 2470 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2471#endif 2472#ifdef USE_ROUGHNESSMAP 2473 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2474#endif 2475#ifdef USE_ANISOTROPYMAP 2476 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2477#endif 2478#ifdef USE_CLEARCOATMAP 2479 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2480#endif 2481#ifdef USE_CLEARCOAT_NORMALMAP 2482 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2483#endif 2484#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2485 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2486#endif
2487#ifdef USE_IRIDESCENCEMAP 2488 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2489#endif 2490#ifdef USE_IRIDESCENCE_THICKNESSMAP 2491 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2492#endif 2493#ifdef USE_SHEEN_COLORMAP 2494 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2495#endif 2496#ifdef USE_SHEEN_ROUGHNESSMAP 2497 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2498#endif 2499#ifdef USE_SPECULARMAP 2500 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2501#endif 2502#ifdef USE_SPECULAR_COLORMAP 2503 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2504#endif 2505#ifdef USE_SPECULAR_INTENSITYMAP 2506 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2507#endif 2508#ifdef USE_TRANSMISSIONMAP 2509 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2510#endif 2511#ifdef USE_THICKNESSMAP 2512 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2513#endif`,DT=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2514 vec4 worldPosition = vec4( transformed, 1.0 ); 2515 #ifdef USE_BATCHING 2516 worldPosition = batchingMatrix * worldPosition; 2517 #endif 2518 #ifdef USE_INSTANCING 2519 worldPosition = instanceMatrix * worldPosition; 2520 #endif 2521 worldPosition = modelMatrix * worldPosition; 2522#endif`;const LT=`varying vec2 vUv; 2523uniform mat3 uvTransform; 2524void main() { 2525 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2526 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2527}`,FT=`uniform sampler2D t2D; 2528uniform float backgroundIntensity; 2529varying vec2 vUv; 2530void main() { 2531 vec4 texColor = texture2D( t2D, vUv ); 2532 #ifdef DECODE_VIDEO_TEXTURE 2533 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 ); 2534 #endif 2535 texColor.rgb *= backgroundIntensity; 2536 gl_FragColor = texColor; 2537 #include <tonemapping_fragment> 2538 #include <colorspace_fragment> 2539}`,UT=`varying vec3 vWorldDirection; 2540#include <common> 2541void main() { 2542 vWorldDirection = transformDirection( position, modelMatrix ); 2543 #include <begin_vertex> 2544 #include <project_vertex> 2545 gl_Position.z = gl_Position.w; 2546}`,NT=`#ifdef ENVMAP_TYPE_CUBE 2547 uniform samplerCube envMap; 2548#elif defined( ENVMAP_TYPE_CUBE_UV ) 2549 uniform sampler2D envMap; 2550#endif 2551uniform float flipEnvMap; 2552uniform float backgroundBlurriness; 2553uniform float backgroundIntensity; 2554uniform mat3 backgroundRotation; 2555varying vec3 vWorldDirection; 2556#include <cube_uv_reflection_fragment> 2557void main() { 2558 #ifdef ENVMAP_TYPE_CUBE 2559 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2560 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2561 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2562 #else 2563 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2564 #endif 2565 texColor.rgb *= backgroundIntensity; 2566 gl_FragColor = texColor; 2567 #include <tonemapping_fragment> 2568 #include <colorspace_fragment> 2569}`,OT=`varying vec3 vWorldDirection; 2570#include <common> 2571void main() { 2572 vWorldDirection = transformDirection( position, modelMatrix ); 2573 #include <begin_vertex> 2574 #include <project_vertex> 2575 gl_Position.z = gl_Position.w; 2576}`,HT=`uniform samplerCube tCube; 2577uniform float tFlip; 2578uniform float opacity; 2579varying vec3 vWorldDirection; 2580void main() { 2581 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2582 gl_FragColor = texColor; 2583 gl_FragColor.a *= opacity; 2584 #include <tonemapping_fragment> 2585 #include <colorspace_fragment> 2586}`,GT=`#include <common> 2587#include <batching_pars_vertex> 2588#include <uv_pars_vertex> 2589#include <displacementmap_pars_vertex> 2590#include <morphtarget_pars_vertex> 2591#include <skinning_pars_vertex> 2592#include <logdepthbuf_pars_vertex> 2593#include <clipping_planes_pars_vertex> 2594varying vec2 vHighPrecisionZW; 2595void main() { 2596 #include <uv_vertex> 2597 #include <batching_vertex> 2598 #include <skinbase_vertex> 2599 #include <morphinstance_vertex> 2600 #ifdef USE_DISPLACEMENTMAP 2601 #include <beginnormal_vertex> 2602 #include <morphnormal_vertex> 2603 #include <skinnormal_vertex> 2604 #endif 2605 #include <begin_vertex> 2606 #include <morphtarget_vertex> 2607 #include <skinning_vertex> 2608 #include <displacementmap_vertex> 2609 #include <project_vertex> 2610 #include <logdepthbuf_vertex> 2611 #include <clipping_planes_vertex> 2612 vHighPrecisionZW = gl_Position.zw; 2613}`,kT=`#if DEPTH_PACKING == 3200 2614 uniform float opacity; 2615#endif 2616#include <common> 2617#include <packing> 2618#include <uv_pars_fragment> 2619#include <map_pars_fragment> 2620#include <alphamap_pars_fragment> 2621#include <alphatest_pars_fragment> 2622#include <alphahash_pars_fragment> 2623#include <logdepthbuf_pars_fragment> 2624#include <clipping_planes_pars_fragment> 2625varying vec2 vHighPrecisionZW; 2626void main() { 2627 vec4 diffuseColor = vec4( 1.0 ); 2628 #include <clipping_planes_fragment> 2629 #if DEPTH_PACKING == 3200 2630 diffuseColor.a = opacity; 2631 #endif 2632 #include <map_fragment> 2633 #include <alphamap_fragment> 2634 #include <alphatest_fragment> 2635 #include <alphahash_fragment> 2636 #include <logdepthbuf_fragment> 2637 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2638 #if DEPTH_PACKING == 3200 2639 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2640 #elif DEPTH_PACKING == 3201 2641 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2642 #elif DEPTH_PACKING == 3202 2643 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2644 #elif DEPTH_PACKING == 3203 2645 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2646 #endif 2647}`,zT=`#define DISTANCE 2648varying vec3 vWorldPosition; 2649#include <common> 2650#include <batching_pars_vertex> 2651#include <uv_pars_vertex> 2652#include <displacementmap_pars_vertex> 2653#include <morphtarget_pars_vertex> 2654#include <skinning_pars_vertex> 2655#include <clipping_planes_pars_vertex> 2656void main() { 2657 #include <uv_vertex> 2658 #include <batching_vertex> 2659 #include <skinbase_vertex> 2660 #include <morphinstance_vertex> 2661 #ifdef USE_DISPLACEMENTMAP 2662 #include <beginnormal_vertex> 2663 #include <morphnormal_vertex> 2664 #include <skinnormal_vertex> 2665 #endif 2666 #include <begin_vertex> 2667 #include <morphtarget_vertex> 2668 #include <skinning_vertex> 2669 #include <displacementmap_vertex> 2670 #include <project_vertex> 2671 #include <worldpos_vertex> 2672 #include <clipping_planes_vertex> 2673 vWorldPosition = worldPosition.xyz; 2674}`,VT=`#define DISTANCE 2675uniform vec3 referencePosition; 2676uniform float nearDistance; 2677uniform float farDistance; 2678varying vec3 vWorldPosition; 2679#include <common> 2680#include <packing> 2681#include <uv_pars_fragment> 2682#include <map_pars_fragment> 2683#include <alphamap_pars_fragment> 2684#include <alphatest_pars_fragment> 2685#include <alphahash_pars_fragment> 2686#include <clipping_planes_pars_fragment> 2687void main () { 2688 vec4 diffuseColor = vec4( 1.0 ); 2689 #include <clipping_planes_fragment> 2690 #include <map_fragment> 2691 #include <alphamap_fragment> 2692 #include <alphatest_fragment> 2693 #include <alphahash_fragment> 2694 float dist = length( vWorldPosition - referencePosition ); 2695 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2696 dist = saturate( dist ); 2697 gl_FragColor = packDepthToRGBA( dist ); 2698}`,WT=`varying vec3 vWorldDirection; 2699#include <common> 2700void main() { 2701 vWorldDirection = transformDirection( position, modelMatrix ); 2702 #include <begin_vertex> 2703 #include <project_vertex> 2704}`,XT=`uniform sampler2D tEquirect; 2705varying vec3 vWorldDirection; 2706#include <common> 2707void main() { 2708 vec3 direction = normalize( vWorldDirection ); 2709 vec2 sampleUV = equirectUv( direction ); 2710 gl_FragColor = texture2D( tEquirect, sampleUV ); 2711 #include <tonemapping_fragment> 2712 #include <colorspace_fragment> 2713}`,JT=`uniform float scale; 2714attribute float lineDistance; 2715varying float vLineDistance; 2716#include <common> 2717#include <uv_pars_vertex> 2718#include <color_pars_vertex> 2719#include <fog_pars_vertex> 2720#include <morphtarget_pars_vertex> 2721#include <logdepthbuf_pars_vertex> 2722#include <clipping_planes_pars_vertex> 2723void main() { 2724 vLineDistance = scale * lineDistance; 2725 #include <uv_vertex> 2726 #include <color_vertex> 2727 #include <morphinstance_vertex> 2728 #include <morphcolor_vertex> 2729 #include <begin_vertex> 2730 #include <morphtarget_vertex> 2731 #include <project_vertex> 2732 #include <logdepthbuf_vertex> 2733 #include <clipping_planes_vertex> 2734 #include <fog_vertex> 2735}`,YT=`uniform vec3 diffuse; 2736uniform float opacity; 2737uniform float dashSize; 2738uniform float totalSize; 2739varying float vLineDistance; 2740#include <common> 2741#include <color_pars_fragment> 2742#include <uv_pars_fragment> 2743#include <map_pars_fragment> 2744#include <fog_pars_fragment> 2745#include <logdepthbuf_pars_fragment> 2746#include <clipping_planes_pars_fragment> 2747void main() { 2748 vec4 diffuseColor = vec4( diffuse, opacity ); 2749 #include <clipping_planes_fragment> 2750 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2751 discard; 2752 } 2753 vec3 outgoingLight = vec3( 0.0 ); 2754 #include <logdepthbuf_fragment> 2755 #include <map_fragment> 2756 #include <color_fragment> 2757 outgoingLight = diffuseColor.rgb; 2758 #include <opaque_fragment> 2759 #include <tonemapping_fragment> 2760 #include <colorspace_fragment> 2761 #include <fog_fragment> 2762 #include <premultiplied_alpha_fragment> 2763}`,KT=`#include <common> 2764#include <batching_pars_vertex> 2765#include <uv_pars_vertex> 2766#include <envmap_pars_vertex> 2767#include <color_pars_vertex> 2768#include <fog_pars_vertex> 2769#include <morphtarget_pars_vertex> 2770#include <skinning_pars_vertex> 2771#include <logdepthbuf_pars_vertex> 2772#include <clipping_planes_pars_vertex> 2773void main() { 2774 #include <uv_vertex> 2775 #include <color_vertex> 2776 #include <morphinstance_vertex> 2777 #include <morphcolor_vertex> 2778 #include <batching_vertex> 2779 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2780 #include <beginnormal_vertex> 2781 #include <morphnormal_vertex> 2782 #include <skinbase_vertex> 2783 #include <skinnormal_vertex> 2784 #include <defaultnormal_vertex> 2785 #endif 2786 #include <begin_vertex> 2787 #include <morphtarget_vertex> 2788 #include <skinning_vertex> 2789 #include <project_vertex> 2790 #include <logdepthbuf_vertex> 2791 #include <clipping_planes_vertex> 2792 #include <worldpos_vertex> 2793 #include <envmap_vertex> 2794 #include <fog_vertex> 2795}`,ZT=`uniform vec3 diffuse; 2796uniform float opacity; 2797#ifndef FLAT_SHADED 2798 varying vec3 vNormal; 2799#endif 2800#include <common> 2801#include <dithering_pars_fragment> 2802#include <color_pars_fragment> 2803#include <uv_pars_fragment> 2804#include <map_pars_fragment> 2805#include <alphamap_pars_fragment> 2806#include <alphatest_pars_fragment> 2807#include <alphahash_pars_fragment> 2808#include <aomap_pars_fragment> 2809#include <lightmap_pars_fragment> 2810#include <envmap_common_pars_fragment> 2811#include <envmap_pars_fragment> 2812#include <fog_pars_fragment> 2813#include <specularmap_pars_fragment> 2814#include <logdepthbuf_pars_fragment> 2815#include <clipping_planes_pars_fragment> 2816void main() { 2817 vec4 diffuseColor = vec4( diffuse, opacity ); 2818 #include <clipping_planes_fragment> 2819 #include <logdepthbuf_fragment> 2820 #include <map_fragment> 2821 #include <color_fragment> 2822 #include <alphamap_fragment> 2823 #include <alphatest_fragment> 2824 #include <alphahash_fragment> 2825 #include <specularmap_fragment> 2826 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2827 #ifdef USE_LIGHTMAP 2828 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2829 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2830 #else 2831 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2832 #endif 2833 #include <aomap_fragment> 2834 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2835 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2836 #include <envmap_fragment> 2837 #include <opaque_fragment> 2838 #include <tonemapping_fragment> 2839 #include <colorspace_fragment> 2840 #include <fog_fragment> 2841 #include <premultiplied_alpha_fragment> 2842 #include <dithering_fragment> 2843}`,qT=`#define LAMBERT 2844varying vec3 vViewPosition; 2845#include <common> 2846#include <batching_pars_vertex> 2847#include <uv_pars_vertex> 2848#include <displacementmap_pars_vertex> 2849#include <envmap_pars_vertex> 2850#include <color_pars_vertex> 2851#include <fog_pars_vertex> 2852#include <normal_pars_vertex> 2853#include <morphtarget_pars_vertex> 2854#include <skinning_pars_vertex> 2855#include <shadowmap_pars_vertex> 2856#include <logdepthbuf_pars_vertex> 2857#include <clipping_planes_pars_vertex> 2858void main() { 2859 #include <uv_vertex> 2860 #include <color_vertex> 2861 #include <morphinstance_vertex> 2862 #include <morphcolor_vertex> 2863 #include <batching_vertex> 2864 #include <beginnormal_vertex> 2865 #include <morphnormal_vertex> 2866 #include <skinbase_vertex> 2867 #include <skinnormal_vertex> 2868 #include <defaultnormal_vertex> 2869 #include <normal_vertex> 2870 #include <begin_vertex> 2871 #include <morphtarget_vertex> 2872 #include <skinning_vertex> 2873 #include <displacementmap_vertex> 2874 #include <project_vertex> 2875 #include <logdepthbuf_vertex> 2876 #include <clipping_planes_vertex> 2877 vViewPosition = - mvPosition.xyz; 2878 #include <worldpos_vertex> 2879 #include <envmap_vertex> 2880 #include <shadowmap_vertex> 2881 #include <fog_vertex> 2882}`,QT=`#define LAMBERT 2883uniform vec3 diffuse; 2884uniform vec3 emissive; 2885uniform float opacity; 2886#include <common> 2887#include <packing> 2888#include <dithering_pars_fragment> 2889#include <color_pars_fragment> 2890#include <uv_pars_fragment> 2891#include <map_pars_fragment> 2892#include <alphamap_pars_fragment> 2893#include <alphatest_pars_fragment> 2894#include <alphahash_pars_fragment> 2895#include <aomap_pars_fragment> 2896#include <lightmap_pars_fragment> 2897#include <emissivemap_pars_fragment> 2898#include <envmap_common_pars_fragment> 2899#include <envmap_pars_fragment> 2900#include <fog_pars_fragment> 2901#include <bsdfs> 2902#include <lights_pars_begin> 2903#include <normal_pars_fragment> 2904#include <lights_lambert_pars_fragment> 2905#include <shadowmap_pars_fragment> 2906#include <bumpmap_pars_fragment> 2907#include <normalmap_pars_fragment> 2908#include <specularmap_pars_fragment> 2909#include <logdepthbuf_pars_fragment> 2910#include <clipping_planes_pars_fragment> 2911void main() { 2912 vec4 diffuseColor = vec4( diffuse, opacity ); 2913 #include <clipping_planes_fragment> 2914 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2915 vec3 totalEmissiveRadiance = emissive; 2916 #include <logdepthbuf_fragment> 2917 #include <map_fragment> 2918 #include <color_fragment> 2919 #include <alphamap_fragment> 2920 #include <alphatest_fragment> 2921 #include <alphahash_fragment> 2922 #include <specularmap_fragment> 2923 #include <normal_fragment_begin> 2924 #include <normal_fragment_maps> 2925 #include <emissivemap_fragment> 2926 #include <lights_lambert_fragment> 2927 #include <lights_fragment_begin> 2928 #include <lights_fragment_maps> 2929 #include <lights_fragment_end> 2930 #include <aomap_fragment> 2931 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2932 #include <envmap_fragment> 2933 #include <opaque_fragment> 2934 #include <tonemapping_fragment> 2935 #include <colorspace_fragment> 2936 #include <fog_fragment> 2937 #include <premultiplied_alpha_fragment> 2938 #include <dithering_fragment> 2939}`,jT=`#define MATCAP 2940varying vec3 vViewPosition; 2941#include <common> 2942#include <batching_pars_vertex> 2943#include <uv_pars_vertex> 2944#include <color_pars_vertex> 2945#include <displacementmap_pars_vertex> 2946#include <fog_pars_vertex> 2947#include <normal_pars_vertex> 2948#include <morphtarget_pars_vertex> 2949#include <skinning_pars_vertex> 2950#include <logdepthbuf_pars_vertex> 2951#include <clipping_planes_pars_vertex> 2952void main() { 2953 #include <uv_vertex> 2954 #include <color_vertex> 2955 #include <morphinstance_vertex> 2956 #include <morphcolor_vertex> 2957 #include <batching_vertex> 2958 #include <beginnormal_vertex> 2959 #include <morphnormal_vertex> 2960 #include <skinbase_vertex> 2961 #include <skinnormal_vertex> 2962 #include <defaultnormal_vertex> 2963 #include <normal_vertex> 2964 #include <begin_vertex> 2965 #include <morphtarget_vertex> 2966 #include <skinning_vertex> 2967 #include <displacementmap_vertex> 2968 #include <project_vertex> 2969 #include <logdepthbuf_vertex> 2970 #include <clipping_planes_vertex> 2971 #include <fog_vertex> 2972 vViewPosition = - mvPosition.xyz; 2973}`,$T=`#define MATCAP 2974uniform vec3 diffuse; 2975uniform float opacity; 2976uniform sampler2D matcap; 2977varying vec3 vViewPosition; 2978#include <common> 2979#include <dithering_pars_fragment> 2980#include <color_pars_fragment> 2981#include <uv_pars_fragment> 2982#include <map_pars_fragment> 2983#include <alphamap_pars_fragment> 2984#include <alphatest_pars_fragment> 2985#include <alphahash_pars_fragment> 2986#include <fog_pars_fragment> 2987#include <normal_pars_fragment> 2988#include <bumpmap_pars_fragment> 2989#include <normalmap_pars_fragment> 2990#include <logdepthbuf_pars_fragment> 2991#include <clipping_planes_pars_fragment> 2992void main() { 2993 ve
2993c4 diffuseColor = vec4( diffuse, opacity ); 2994 #include <clipping_planes_fragment> 2995 #include <logdepthbuf_fragment> 2996 #include <map_fragment> 2997 #include <color_fragment> 2998 #include <alphamap_fragment> 2999 #include <alphatest_fragment> 3000 #include <alphahash_fragment> 3001 #include <normal_fragment_begin> 3002 #include <normal_fragment_maps> 3003 vec3 viewDir = normalize( vViewPosition ); 3004 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3005 vec3 y = cross( viewDir, x ); 3006 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3007 #ifdef USE_MATCAP 3008 vec4 matcapColor = texture2D( matcap, uv ); 3009 #else 3010 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3011 #endif 3012 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3013 #include <opaque_fragment> 3014 #include <tonemapping_fragment> 3015 #include <colorspace_fragment> 3016 #include <fog_fragment> 3017 #include <premultiplied_alpha_fragment> 3018 #include <dithering_fragment> 3019}`,e1=`#define NORMAL 3020#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3021 varying vec3 vViewPosition; 3022#endif 3023#include <common> 3024#include <batching_pars_vertex> 3025#include <uv_pars_vertex> 3026#include <displacementmap_pars_vertex> 3027#include <normal_pars_vertex> 3028#include <morphtarget_pars_vertex> 3029#include <skinning_pars_vertex> 3030#include <logdepthbuf_pars_vertex> 3031#include <clipping_planes_pars_vertex> 3032void main() { 3033 #include <uv_vertex> 3034 #include <batching_vertex> 3035 #include <beginnormal_vertex> 3036 #include <morphinstance_vertex> 3037 #include <morphnormal_vertex> 3038 #include <skinbase_vertex> 3039 #include <skinnormal_vertex> 3040 #include <defaultnormal_vertex> 3041 #include <normal_vertex> 3042 #include <begin_vertex> 3043 #include <morphtarget_vertex> 3044 #include <skinning_vertex> 3045 #include <displacementmap_vertex> 3046 #include <project_vertex> 3047 #include <logdepthbuf_vertex> 3048 #include <clipping_planes_vertex> 3049#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3050 vViewPosition = - mvPosition.xyz; 3051#endif 3052}`,t1=`#define NORMAL 3053uniform float opacity; 3054#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3055 varying vec3 vViewPosition; 3056#endif 3057#include <packing> 3058#include <uv_pars_fragment> 3059#include <normal_pars_fragment> 3060#include <bumpmap_pars_fragment> 3061#include <normalmap_pars_fragment> 3062#include <logdepthbuf_pars_fragment> 3063#include <clipping_planes_pars_fragment> 3064void main() { 3065 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3066 #include <clipping_planes_fragment> 3067 #include <logdepthbuf_fragment> 3068 #include <normal_fragment_begin> 3069 #include <normal_fragment_maps> 3070 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3071 #ifdef OPAQUE 3072 gl_FragColor.a = 1.0; 3073 #endif 3074}`,n1=`#define PHONG 3075varying vec3 vViewPosition; 3076#include <common> 3077#include <batching_pars_vertex> 3078#include <uv_pars_vertex> 3079#include <displacementmap_pars_vertex> 3080#include <envmap_pars_vertex> 3081#include <color_pars_vertex> 3082#include <fog_pars_vertex> 3083#include <normal_pars_vertex> 3084#include <morphtarget_pars_vertex> 3085#include <skinning_pars_vertex> 3086#include <shadowmap_pars_vertex> 3087#include <logdepthbuf_pars_vertex> 3088#include <clipping_planes_pars_vertex> 3089void main() { 3090 #include <uv_vertex> 3091 #include <color_vertex> 3092 #include <morphcolor_vertex> 3093 #include <batching_vertex> 3094 #include <beginnormal_vertex> 3095 #include <morphinstance_vertex> 3096 #include <morphnormal_vertex> 3097 #include <skinbase_vertex> 3098 #include <skinnormal_vertex> 3099 #include <defaultnormal_vertex> 3100 #include <normal_vertex> 3101 #include <begin_vertex> 3102 #include <morphtarget_vertex> 3103 #include <skinning_vertex> 3104 #include <displacementmap_vertex> 3105 #include <project_vertex> 3106 #include <logdepthbuf_vertex> 3107 #include <clipping_planes_vertex> 3108 vViewPosition = - mvPosition.xyz; 3109 #include <worldpos_vertex> 3110 #include <envmap_vertex> 3111 #include <shadowmap_vertex> 3112 #include <fog_vertex> 3113}`,i1=`#define PHONG 3114uniform vec3 diffuse; 3115uniform vec3 emissive; 3116uniform vec3 specular; 3117uniform float shininess; 3118uniform float opacity; 3119#include <common> 3120#include <packing> 3121#include <dithering_pars_fragment> 3122#include <color_pars_fragment> 3123#include <uv_pars_fragment> 3124#include <map_pars_fragment> 3125#include <alphamap_pars_fragment> 3126#include <alphatest_pars_fragment> 3127#include <alphahash_pars_fragment> 3128#include <aomap_pars_fragment> 3129#include <lightmap_pars_fragment> 3130#include <emissivemap_pars_fragment> 3131#include <envmap_common_pars_fragment> 3132#include <envmap_pars_fragment> 3133#include <fog_pars_fragment> 3134#include <bsdfs> 3135#include <lights_pars_begin> 3136#include <normal_pars_fragment> 3137#include <lights_phong_pars_fragment> 3138#include <shadowmap_pars_fragment> 3139#include <bumpmap_pars_fragment> 3140#include <normalmap_pars_fragment> 3141#include <specularmap_pars_fragment> 3142#include <logdepthbuf_pars_fragment> 3143#include <clipping_planes_pars_fragment> 3144void main() { 3145 vec4 diffuseColor = vec4( diffuse, opacity ); 3146 #include <clipping_planes_fragment> 3147 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3148 vec3 totalEmissiveRadiance = emissive; 3149 #include <logdepthbuf_fragment> 3150 #include <map_fragment> 3151 #include <color_fragment> 3152 #include <alphamap_fragment> 3153 #include <alphatest_fragment> 3154 #include <alphahash_fragment> 3155 #include <specularmap_fragment> 3156 #include <normal_fragment_begin> 3157 #include <normal_fragment_maps> 3158 #include <emissivemap_fragment> 3159 #include <lights_phong_fragment> 3160 #include <lights_fragment_begin> 3161 #include <lights_fragment_maps> 3162 #include <lights_fragment_end> 3163 #include <aomap_fragment> 3164 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3165 #include <envmap_fragment> 3166 #include <opaque_fragment> 3167 #include <tonemapping_fragment> 3168 #include <colorspace_fragment> 3169 #include <fog_fragment> 3170 #include <premultiplied_alpha_fragment> 3171 #include <dithering_fragment> 3172}`,r1=`#define STANDARD 3173varying vec3 vViewPosition; 3174#ifdef USE_TRANSMISSION 3175 varying vec3 vWorldPosition; 3176#endif 3177#include <common> 3178#include <batching_pars_vertex> 3179#include <uv_pars_vertex> 3180#include <displacementmap_pars_vertex> 3181#include <color_pars_vertex> 3182#include <fog_pars_vertex> 3183#include <normal_pars_vertex> 3184#include <morphtarget_pars_vertex> 3185#include <skinning_pars_vertex> 3186#include <shadowmap_pars_vertex> 3187#include <logdepthbuf_pars_vertex> 3188#include <clipping_planes_pars_vertex> 3189void main() { 3190 #include <uv_vertex> 3191 #include <color_vertex> 3192 #include <morphinstance_vertex> 3193 #include <morphcolor_vertex> 3194 #include <batching_vertex> 3195 #include <beginnormal_vertex> 3196 #include <morphnormal_vertex> 3197 #include <skinbase_vertex> 3198 #include <skinnormal_vertex> 3199 #include <defaultnormal_vertex> 3200 #include <normal_vertex> 3201 #include <begin_vertex> 3202 #include <morphtarget_vertex> 3203 #include <skinning_vertex> 3204 #include <displacementmap_vertex> 3205 #include <project_vertex> 3206 #include <logdepthbuf_vertex> 3207 #include <clipping_planes_vertex> 3208 vViewPosition = - mvPosition.xyz; 3209 #include <worldpos_vertex> 3210 #include <shadowmap_vertex> 3211 #include <fog_vertex> 3212#ifdef USE_TRANSMISSION 3213 vWorldPosition = worldPosition.xyz; 3214#endif 3215}`,s1=`#define STANDARD 3216#ifdef PHYSICAL 3217 #define IOR 3218 #define USE_SPECULAR 3219#endif 3220uniform vec3 diffuse; 3221uniform vec3 emissive; 3222uniform float roughness; 3223uniform float metalness; 3224uniform float opacity; 3225#ifdef IOR 3226 uniform float ior; 3227#endif 3228#ifdef USE_SPECULAR 3229 uniform float specularIntensity; 3230 uniform vec3 specularColor; 3231 #ifdef USE_SPECULAR_COLORMAP 3232 uniform sampler2D specularColorMap; 3233 #endif 3234 #ifdef USE_SPECULAR_INTENSITYMAP 3235 uniform sampler2D specularIntensityMap; 3236 #endif 3237#endif 3238#ifdef USE_CLEARCOAT 3239 uniform float clearcoat; 3240 uniform float clearcoatRoughness; 3241#endif 3242#ifdef USE_DISPERSION 3243 uniform float dispersion; 3244#endif
3245#ifdef USE_IRIDESCENCE 3246 uniform float iridescence; 3247 uniform float iridescenceIOR; 3248 uniform float iridescenceThicknessMinimum; 3249 uniform float iridescenceThicknessMaximum; 3250#endif 3251#ifdef USE_SHEEN 3252 uniform vec3 sheenColor; 3253 uniform float sheenRoughness; 3254 #ifdef USE_SHEEN_COLORMAP 3255 uniform sampler2D sheenColorMap; 3256 #endif 3257 #ifdef USE_SHEEN_ROUGHNESSMAP 3258 uniform sampler2D sheenRoughnessMap; 3259 #endif 3260#endif 3261#ifdef USE_ANISOTROPY 3262 uniform vec2 anisotropyVector; 3263 #ifdef USE_ANISOTROPYMAP 3264 uniform sampler2D anisotropyMap; 3265 #endif 3266#endif 3267varying vec3 vViewPosition; 3268#include <common> 3269#include <packing> 3270#include <dithering_pars_fragment> 3271#include <color_pars_fragment> 3272#include <uv_pars_fragment> 3273#include <map_pars_fragment> 3274#include <alphamap_pars_fragment> 3275#include <alphatest_pars_fragment> 3276#include <alphahash_pars_fragment> 3277#include <aomap_pars_fragment> 3278#include <lightmap_pars_fragment> 3279#include <emissivemap_pars_fragment> 3280#include <iridescence_fragment> 3281#include <cube_uv_reflection_fragment> 3282#include <envmap_common_pars_fragment> 3283#include <envmap_physical_pars_fragment> 3284#include <fog_pars_fragment> 3285#include <lights_pars_begin> 3286#include <normal_pars_fragment> 3287#include <lights_physical_pars_fragment> 3288#include <transmission_pars_fragment> 3289#include <shadowmap_pars_fragment> 3290#include <bumpmap_pars_fragment> 3291#include <normalmap_pars_fragment> 3292#include <clearcoat_pars_fragment> 3293#include <iridescence_pars_fragment> 3294#include <roughnessmap_pars_fragment> 3295#include <metalnessmap_pars_fragment> 3296#include <logdepthbuf_pars_fragment> 3297#include <clipping_planes_pars_fragment> 3298void main() { 3299 vec4 diffuseColor = vec4( diffuse, opacity ); 3300 #include <clipping_planes_fragment> 3301 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3302 vec3 totalEmissiveRadiance = emissive; 3303 #include <logdepthbuf_fragment> 3304 #include <map_fragment> 3305 #include <color_fragment> 3306 #include <alphamap_fragment> 3307 #include <alphatest_fragment> 3308 #include <alphahash_fragment> 3309 #include <roughnessmap_fragment> 3310 #include <metalnessmap_fragment> 3311 #include <normal_fragment_begin> 3312 #include <normal_fragment_maps> 3313 #include <clearcoat_normal_fragment_begin> 3314 #include <clearcoat_normal_fragment_maps> 3315 #include <emissivemap_fragment> 3316 #include <lights_physical_fragment> 3317 #include <lights_fragment_begin> 3318 #include <lights_fragment_maps> 3319 #include <lights_fragment_end> 3320 #include <aomap_fragment> 3321 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3322 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3323 #include <transmission_fragment> 3324 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3325 #ifdef USE_SHEEN 3326 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3327 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3328 #endif 3329 #ifdef USE_CLEARCOAT 3330 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3331 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3332 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3333 #endif 3334 #include <opaque_fragment> 3335 #include <tonemapping_fragment> 3336 #include <colorspace_fragment> 3337 #include <fog_fragment> 3338 #include <premultiplied_alpha_fragment> 3339 #include <dithering_fragment> 3340}`,o1=`#define TOON 3341varying vec3 vViewPosition; 3342#include <common> 3343#include <batching_pars_vertex> 3344#include <uv_pars_vertex> 3345#include <displacementmap_pars_vertex> 3346#include <color_pars_vertex> 3347#include <fog_pars_vertex> 3348#include <normal_pars_vertex> 3349#include <morphtarget_pars_vertex> 3350#include <skinning_pars_vertex> 3351#include <shadowmap_pars_vertex> 3352#include <logdepthbuf_pars_vertex> 3353#include <clipping_planes_pars_vertex> 3354void main() { 3355 #include <uv_vertex> 3356 #include <color_vertex> 3357 #include <morphinstance_vertex> 3358 #include <morphcolor_vertex> 3359 #include <batching_vertex> 3360 #include <beginnormal_vertex> 3361 #include <morphnormal_vertex> 3362 #include <skinbase_vertex> 3363 #include <skinnormal_vertex> 3364 #include <defaultnormal_vertex> 3365 #include <normal_vertex> 3366 #include <begin_vertex> 3367 #include <morphtarget_vertex> 3368 #include <skinning_vertex> 3369 #include <displacementmap_vertex> 3370 #include <project_vertex> 3371 #include <logdepthbuf_vertex> 3372 #include <clipping_planes_vertex> 3373 vViewPosition = - mvPosition.xyz; 3374 #include <worldpos_vertex> 3375 #include <shadowmap_vertex> 3376 #include <fog_vertex> 3377}`,a1=`#define TOON 3378uniform vec3 diffuse; 3379uniform vec3 emissive; 3380uniform float opacity; 3381#include <common> 3382#include <packing> 3383#include <dithering_pars_fragment> 3384#include <color_pars_fragment> 3385#include <uv_pars_fragment> 3386#include <map_pars_fragment> 3387#include <alphamap_pars_fragment> 3388#include <alphatest_pars_fragment> 3389#include <alphahash_pars_fragment> 3390#include <aomap_pars_fragment> 3391#include <lightmap_pars_fragment> 3392#include <emissivemap_pars_fragment> 3393#include <gradientmap_pars_fragment> 3394#include <fog_pars_fragment> 3395#include <bsdfs> 3396#include <lights_pars_begin> 3397#include <normal_pars_fragment> 3398#include <lights_toon_pars_fragment> 3399#include <shadowmap_pars_fragment> 3400#include <bumpmap_pars_fragment> 3401#include <normalmap_pars_fragment> 3402#include <logdepthbuf_pars_fragment> 3403#include <clipping_planes_pars_fragment> 3404void main() { 3405 vec4 diffuseColor = vec4( diffuse, opacity ); 3406 #include <clipping_planes_fragment> 3407 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3408 vec3 totalEmissiveRadiance = emissive; 3409 #include <logdepthbuf_fragment> 3410 #include <map_fragment> 3411 #include <color_fragment> 3412 #include <alphamap_fragment> 3413 #include <alphatest_fragment> 3414 #include <alphahash_fragment> 3415 #include <normal_fragment_begin> 3416 #include <normal_fragment_maps> 3417 #include <emissivemap_fragment> 3418 #include <lights_toon_fragment> 3419 #include <lights_fragment_begin> 3420 #include <lights_fragment_maps> 3421 #include <lights_fragment_end> 3422 #include <aomap_fragment> 3423 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3424 #include <opaque_fragment> 3425 #include <tonemapping_fragment> 3426 #include <colorspace_fragment> 3427 #include <fog_fragment> 3428 #include <premultiplied_alpha_fragment> 3429 #include <dithering_fragment> 3430}`,l1=`uniform float size; 3431uniform float scale; 3432#include <common> 3433#include <color_pars_vertex> 3434#include <fog_pars_vertex> 3435#include <morphtarget_pars_vertex> 3436#include <logdepthbuf_pars_vertex> 3437#include <clipping_planes_pars_vertex> 3438#ifdef USE_POINTS_UV 3439 varying vec2 vUv; 3440 uniform mat3 uvTransform; 3441#endif 3442void main() { 3443 #ifdef USE_POINTS_UV 3444 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3445 #endif 3446 #include <color_vertex> 3447 #include <morphinstance_vertex> 3448 #include <morphcolor_vertex> 3449 #include <begin_vertex> 3450 #include <morphtarget_vertex> 3451 #include <project_vertex> 3452 gl_PointSize = size; 3453 #ifdef USE_SIZEATTENUATION 3454 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3455 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3456 #endif 3457 #include <logdepthbuf_vertex> 3458 #include <clipping_planes_vertex> 3459 #include <worldpos_vertex> 3460 #include <fog_vertex> 3461}`,c1=`uniform vec3 diffuse; 3462uniform float opacity; 3463#include <common> 3464#include <color_pars_fragment> 3465#include <map_particle_pars_fragment> 3466#include <alphatest_pars_fragment> 3467#include <alphahash_pars_fragment> 3468#include <fog_pars_fragment> 3469#include <logdepthbuf_pars_fragment> 3470#include <clipping_planes_pars_fragment> 3471void main() { 3472 vec4 diffuseColor = vec4( diffuse, opacity ); 3473 #include <clipping_planes_fragment> 3474 vec3 outgoingLight = vec3( 0.0 ); 3475 #include <logdepthbuf_fragment> 3476 #include <map_particle_fragment> 3477 #include <color_fragment> 3478 #include <alphatest_fragment> 3479 #include <alphahash_fragment> 3480 outgoingLight = diffuseColor.rgb; 3481 #include <opaque_fragment> 3482 #include <tonemapping_fragment> 3483 #include <colorspace_fragment> 3484 #include <fog_fragment> 3485 #include <premultiplied_alpha_fragment> 3486}`,u1=`#include <common> 3487#include <batching_pars_vertex> 3488#include <fog_pars_vertex> 3489#include <morphtarget_pars_vertex> 3490#include <skinning_pars_vertex> 3491#include <logdepthbuf_pars_vertex> 3492#include <shadowmap_pars_vertex> 3493void main() { 3494 #include <batching_vertex> 3495 #include <beginnormal_vertex> 3496 #include <morphinstance_vertex> 3497 #include <morphnormal_vertex> 3498 #include <skinbase_vertex> 3499 #include <skinnormal_vertex> 3500 #include <defaultnormal_vertex> 3501 #include <begin_vertex> 3502 #include <morphtarget_vertex> 3503 #include <skinning_vertex> 3504 #include <project_vertex> 3505 #include <logdepthbuf_vertex> 3506 #include <worldpos_vertex> 3507 #include <shadowmap_vertex> 3508 #include <fog_vertex> 3509}`,h1=`uniform vec3 color; 3510uniform float opacity; 3511#include <common> 3512#include <packing> 3513#include <fog_pars_fragment> 3514#include <bsdfs> 3515#include <lights_pars_begin> 3516#include <logdepthbuf_pars_fragment> 3517#include <shadowmap_pars_fragment> 3518#include <shadowmask_pars_fragment> 3519void main() { 3520 #include <logdepthbuf_fragment> 3521 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3522 #include <tonemapping_fragment> 3523 #include <colorspace_fragment> 3524 #include <fog_fragment> 3525}`,f1=`uniform float rotation; 3526uniform vec2 center; 3527#include <common> 3528#include <uv_pars_vertex> 3529#include <fog_pars_vertex> 3530#include <logdepthbuf_pars_vertex> 3531#include <clipping_planes_pars_vertex> 3532void main() { 3533 #include <uv_vertex> 3534 vec4 mvPosition = modelViewMatrix[ 3 ]; 3535 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3536 #ifndef USE_SIZEATTENUATION 3537 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3538 if ( isPerspective ) scale *= - mvPosition.z; 3539 #endif 3540 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3541 vec2 rotatedPosition; 3542 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3543 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3544 mvPosition.xy += rotatedPosition; 3545 gl_Position = projectionMatrix * mvPosition; 3546 #include <logdepthbuf_vertex> 3547 #include <clipping_planes_vertex> 3548 #include <fog_vertex> 3549}`,d1=`uniform vec3 diffuse; 3550uniform float opacity; 3551#include <common> 3552#include <uv_pars_fragment> 3553#include <map_pars_fragment> 3554#include <alphamap_pars_fragment> 3555#include <alphatest_pars_fragment> 3556#include <alphahash_pars_fragment> 3557#include <fog_pars_fragment> 3558#include <logdepthbuf_pars_fragment> 3559#include <clipping_planes_pars_fragment> 3560void main() { 3561 vec4 diffuseColor = vec4( diffuse, opacity ); 3562 #include <clipping_planes_fragment> 3563 vec3 outgoingLight = vec3( 0.0 ); 3564 #include <logdepthbuf_fragment> 3565 #include <map_fragment> 3566 #include <alphamap_fragment> 3567 #include <alphatest_fragment> 3568 #include <alphahash_fragment> 3569 outgoingLight = diffuseColor.rgb; 3570 #include <opaque_fragment> 3571 #include <tonemapping_fragment> 3572 #include <colorspace_fragment> 3573 #include <fog_fragment> 3574}`,Dt={alphahash_fragment:Fw,alphahash_pars_fragment:Uw,alphamap_fragment:Nw,alphamap_pars_fragment:Ow,alph
vendor: 7,299 bytes, line 3574
3574atest_fragment:Hw,alphatest_pars_fragment:Gw,aomap_fragment:kw,aomap_pars_fragment:zw,batching_pars_vertex:Vw,batching_vertex:Ww,begin_vertex:Xw,beginnormal_vertex:Jw,bsdfs:Yw,iridescence_fragment:Kw,bumpmap_pars_fragment:Zw,clipping_planes_fragment:qw,clipping_planes_pars_fragment:Qw,clipping_planes_pars_vertex:jw,clipping_planes_vertex:$w,color_fragment:eC,color_pars_fragment:tC,color_pars_vertex:nC,color_vertex:iC,common:rC,cube_uv_reflection_fragment:sC,defaultnormal_vertex:oC,displacementmap_pars_vertex:aC,displacementmap_vertex:lC,emissivemap_fragment:cC,emissivemap_pars_fragment:uC,colorspace_fragment:hC,colorspace_pars_fragment:fC,envmap_fragment:dC,envmap_common_pars_fragment:pC,envmap_pars_fragment:mC,envmap_pars_vertex:gC,envmap_physical_pars_fragment:TC,envmap_vertex:vC,fog_vertex:_C,fog_pars_vertex:yC,fog_fragment:xC,fog_pars_fragment:AC,gradientmap_pars_fragment:MC,lightmap_pars_fragment:SC,lights_lambert_fragment:EC,lights_lambert_pars_fragment:wC,lights_pars_begin:CC,lights_toon_fragment:bC,lights_toon_pars_fragment:RC,lights_phong_fragment:IC,lights_phong_pars_fragment:BC,lights_physical_fragment:PC,lights_physical_pars_fragment:DC,lights_fragment_begin:LC,lights_fragment_maps:FC,lights_fragment_end:UC,logdepthbuf_fragment:NC,logdepthbuf_pars_fragment:OC,logdepthbuf_pars_vertex:HC,logdepthbuf_vertex:GC,map_fragment:kC,map_pars_fragment:zC,map_particle_fragment:VC,map_particle_pars_fragment:WC,metalnessmap_fragment:XC,metalnessmap_pars_fragment:JC,morphinstance_vertex:YC,morphcolor_vertex:KC,morphnormal_vertex:ZC,morphtarget_pars_vertex:qC,morphtarget_vertex:QC,normal_fragment_begin:jC,normal_fragment_maps:$C,normal_pars_fragment:eT,normal_pars_vertex:tT,normal_vertex:nT,normalmap_pars_fragment:iT,clearcoat_normal_fragment_begin:rT,clearcoat_normal_fragment_maps:sT,clearcoat_pars_fragment:oT,iridescence_pars_fragment:aT,opaque_fragment:lT,packing:cT,premultiplied_alpha_fragment:uT,project_vertex:hT,dithering_fragment:fT,dithering_pars_fragment:dT,roughnessmap_fragment:pT,roughnessmap_pars_fragment:mT,shadowmap_pars_fragment:gT,shadowmap_pars_vertex:vT,shadowmap_vertex:_T,shadowmask_pars_fragment:yT,skinbase_vertex:xT,skinning_pars_vertex:AT,skinning_vertex:MT,skinnormal_vertex:ST,specularmap_fragment:ET,specularmap_pars_fragment:wT,tonemapping_fragment:CT,tonemapping_pars_fragment:TT,transmission_fragment:bT,transmission_pars_fragment:RT,uv_pars_fragment:IT,uv_pars_vertex:BT,uv_vertex:PT,worldpos_vertex:DT,background_vert:LT,background_frag:FT,backgroundCube_vert:UT,backgroundCube_frag:NT,cube_vert:OT,cube_frag:HT,depth_vert:GT,depth_frag:kT,distanceRGBA_vert:zT,distanceRGBA_frag:VT,equirect_vert:WT,equirect_frag:XT,linedashed_vert:JT,linedashed_frag:YT,meshbasic_vert:KT,meshbasic_frag:ZT,meshlambert_vert:qT,meshlambert_frag:QT,meshmatcap_vert:jT,meshmatcap_frag:$T,meshnormal_vert:e1,meshnormal_frag:t1,meshphong_vert:n1,meshphong_frag:i1,meshphysical_vert:r1,meshphysical_frag:s1,meshtoon_vert:o1,meshtoon_frag:a1,points_vert:l1,points_frag:c1,shadow_vert:u1,shadow_frag:h1,sprite_vert:f1,sprite_frag:d1},Je={common:{diffuse:{value:new Ye(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new bt}},envmap:{envMap:{value:null},envMapRotation:{value:new bt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new bt},normalScale:{value:new be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ye(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 Ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0},uvTransform:{value:new bt}},sprite:{diffuse:{value:new Ye(16777215)},opacity:{value:1},center:{value:new be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}}},Qi={basic:{uniforms:ii([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.fog]),vertexShader:Dt.meshbasic_vert,fragmentShader:Dt.meshbasic_frag},lambert:{uniforms:ii([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new Ye(0)}}]),vertexShader:Dt.meshlambert_vert,fragmentShader:Dt.meshlambert_frag},phong:{uniforms:ii([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30}}]),vertexShader:Dt.meshphong_vert,fragmentShader:Dt.meshphong_frag},standard:{uniforms:ii([Je.common,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.roughnessmap,Je.metalnessmap,Je.fog,Je.lights,{emissive:{value:new Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Dt.meshphysical_vert,fragmentShader:Dt.meshphysical_frag},toon:{uniforms:ii([Je.common,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.gradientmap,Je.fog,Je.lights,{emissive:{value:new Ye(0)}}]),vertexShader:Dt.meshtoon_vert,fragmentShader:Dt.meshtoon_frag},matcap:{uniforms:ii([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,{matc
vendor: 5,280 bytes, line 3574
3574ap:{value:null}}]),vertexShader:Dt.meshmatcap_vert,fragmentShader:Dt.meshmatcap_frag},points:{uniforms:ii([Je.points,Je.fog]),vertexShader:Dt.points_vert,fragmentShader:Dt.points_frag},dashed:{uniforms:ii([Je.common,Je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Dt.linedashed_vert,fragmentShader:Dt.linedashed_frag},depth:{uniforms:ii([Je.common,Je.displacementmap]),vertexShader:Dt.depth_vert,fragmentShader:Dt.depth_frag},normal:{uniforms:ii([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,{opacity:{value:1}}]),vertexShader:Dt.meshnormal_vert,fragmentShader:Dt.meshnormal_frag},sprite:{uniforms:ii([Je.sprite,Je.fog]),vertexShader:Dt.sprite_vert,fragmentShader:Dt.sprite_frag},background:{uniforms:{uvTransform:{value:new bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Dt.background_vert,fragmentShader:Dt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new bt}},vertexShader:Dt.backgroundCube_vert,fragmentShader:Dt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Dt.cube_vert,fragmentShader:Dt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Dt.equirect_vert,fragmentShader:Dt.equirect_frag},distanceRGBA:{uniforms:ii([Je.common,Je.displacementmap,{referencePosition:{value:new H},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Dt.distanceRGBA_vert,fragmentShader:Dt.distanceRGBA_frag},shadow:{uniforms:ii([Je.lights,Je.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:Dt.shadow_vert,fragmentShader:Dt.shadow_frag}};Qi.physical={uniforms:ii([Qi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new bt},clearcoatNormalScale:{value:new be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new bt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new bt},sheen:{value:0},sheenColor:{value:new Ye(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new bt},transmissionSamplerSize:{value:new be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new bt},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new bt},anisotropyVector:{value:new be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new bt}}]),vertexShader:Dt.meshphysical_vert,fragmentShader:Dt.meshphysical_frag};const Tu={r:0,b:0,g:0},ks=new Ti,p1=new gt;function m1(r,e,t,n,i,s,o){const l=new Ye(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 L=v(E);L===null?_(l,u):L&&L.isColor&&(_(L,1),w=!0);const B=r.xr.getEnvironmentBlendMode();B==="additive"?n.buffers.color.setClear(0,0,0,1,o):B==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(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 x(E,w){const L=v(w);L&&(L.isCubeTexture||L.mapping===ga)?(f===void 0&&(f=new un(new uo(1,1,1),new vi({name:"BackgroundCubeMaterial",uniforms:fa(Qi.backgroundCube.uniforms),vertexShader:Qi.backgroundCube.vertexShader,fragmentShader:Qi.backgroundCube.fragmentShader,side:ai,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(B,F,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),ks.copy(w.backgroundRotation),ks.x*=-1,ks.y*=-1,ks.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(ks.y*=-1,ks.z*=-1),f.material.uniforms.envMap.value=L,f.material.uniforms.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(p1.makeRotationFromEuler(ks)),f.material.toneMapped=Xt.getTransfer(L.colorSpace)!==$t,(d!==L||p!==L.version||g!==r.toneMapping)&&(f.material.needsUpdate=!0,d=L,p=L.version,g=r.toneMapping),f.layers.enableAll(),E.unshift(f,f.geometry,f.material,0,0,null)):L&&L.isTexture&&(h===void 0&&(h=new un(new _s(2,2),new vi({name:"Backgroun
3574dMaterial",uniforms:fa(Qi.background.uniforms),vertexShader:Qi.background.vertexShader,fragmentShader:Qi.background.fragmentShader,side:dr,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=L,h.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,h.material.toneMapped=Xt.getTransfer(L.colorSpace)!==$t,L.matrixAutoUpdate===!0&&L.updateMatrix(),h.material.uniforms.uvTransform.value.copy(L.matrix),(d!==L||p!==L.version||g!==r.toneMapping)&&(h.material.needsUpdate=!0,d=L,p=L.version,g=r.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null))}function _(E,w){E.getRGB(Tu,By(r)),n.buffers.color.setClear(Tu.r,Tu.g,Tu.b,w,o)}function S(){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 l},setClearColor:function(E,w=1){l.set(E),u=w,_(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(E){u=E,_(l,u)},render:A,addToRenderList:x,dispose:S}}function g1(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=p(null);let s=i,o=!1;function l(b,N,Y,K,Q){let oe=!1;const ee=d(K,Y,N);s!==ee&&(s=ee,h(s.object)),oe=g(b,K,Y,Q),oe&&v(b,K,Y,Q),Q!==null&&e.update(Q,r.ELEMENT_ARRAY_BUFFER),(oe||o)&&(o=!1,w(b,N,Y,K),Q!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(Q).buffer))}function u(){return r.createVertexArray()}function h(b){return r.bindVertexArray(b)}function f(b){return r.deleteVertexArray(b)}function d(b,N,Y){const K=Y.wireframe===!0;let Q=n[b.id];Q===void 0&&(Q={},n[b.id]=Q);let oe=Q[N.id];oe===void 0&&(oe={},Q[N.id]=oe);let ee=oe[K];return ee===void 0&&(ee=p(u()),oe[K]=ee),ee}function p(b){const N=[],Y=[],K=[];for(let Q=0;Q<t;Q++)N[Q]=0,Y[Q]=0,K[Q]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:Y,attributeDivisors:K,object:b,attributes:{},index:null}}function g(b,N,Y,K){const Q=s.attributes,oe=N.attributes;let ee=0;const Me=Y.getAttributes();for(const G in Me)if(Me[G].location>=0){const q=Q[G];let ce=oe[G];if(ce===void 0&&(G==="instanceMatrix"&&b.instanceMatrix&&(ce=b.instanceMatrix),G==="instanceColor"&&b.instanceColor&&(ce=b.instanceColor)),q===void 0||q.attribute!==ce||ce&&q.data!==ce.data)return!0;ee++}return s.attributesNum!==ee||s.index!==K}function v(b,N,Y,K){const Q={},oe=N.attributes;let ee=0;const Me=Y.getAttributes();for(const G in Me)if(Me[G].location>=0){let q=oe[G];q===void 0&&(G==="instanceMatrix"&&b.instanceMatrix&&(q=b.instanceMatrix),G==="instanceColor"&&b.instanceColor&&(q=b.instanceColor));const ce={};ce.attribute=q,q&&q.data&&(ce.data=q.data),Q[G]=ce,ee++}s.attributes=Q,s.attributesNum=ee,s.index=K}function A(){const b=s.newAttributes;for(let N=0,Y=b.length;N<Y;N++)b[N]=0}function x(b){_(b,0)}function _(b,N){const Y=s.newAttributes,K=s.enabledAttributes,Q=s.attributeDivisors;Y[b]=1,K[b]===0&&(r.enableVertexAttribArray(b),K[b]=1),Q[b]!==N&&(r.vertexAttribDivisor(b,N),Q[b]=N)}function S(){const b=s.newAttributes,N=s.enabledAttributes;for(let Y=0,K=N.length;Y<K;Y++)N[Y]!==b[Y]&&(r.disableVertexAttribArray(Y),N[Y]=0)}function E(b,N,Y,K,Q,oe,ee){ee===!0?r.vertexAttribIPointer(b,N,Y,Q,oe):r.vertexAttribPointer(b,N,Y,K,Q,oe)}function w(b,N,Y,K){A();const Q=K.attributes,oe=Y.getAttributes(),ee=N.defaultAttributeValues;for(const Me in oe){const G=oe[Me];if(G.location>=0){let te=Q[Me];if(te===void 0&&(Me==="instanceMatrix"&&b.instanceMatrix&&(te=b.instanceMatrix),Me==="instanceColor"&&b.instanceColor&&(te=b.instanceColor)),te!==void 0){const q=te.normalized,ce=te.itemSize,Se=e.get(te);if(Se===void 0)continue;const Ge=Se.buffer,le=Se.type,Re=Se.bytesPerElement,we=le===r.INT||le===r.UNSIGNED_INT||te.gpuType===Bl;if(te.isInterleavedBufferAttribute){const Le=te.data,ot=Le.stride,Ut=te.offset;if(Le.isInstancedInterleavedBuffer){for(let ft=0;ft<G.locationSize;ft++)_(G.location+ft,Le.meshPerAttribute);b.isInstancedMesh!==!0&&K._maxInstanceCount===void 0&&(K._maxInstanceCount=Le.meshPerAttribute*Le.count)}else for(let ft=0;ft<G.locationSize;ft++)x(G.location+ft);r.bindBuffer(r.ARRAY_BUFFER,Ge);for(let ft=0;ft<G.locationSize;ft++)E(G.location+ft,ce/G.locationSize,le,q,ot*Re,(Ut+ce/G.locationSize*ft)*Re,we)}else{if(te.isInstancedBufferAttribute){for(let Le=0;Le<G.locationSize;Le++)_(G.location+Le,te.meshPerAttribute);b.isInstancedMesh!==!0&&K._maxInstanceCount===void 0&&(K._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let Le=0;Le<G.locationSize;Le++)x(G.location+Le);r.bindBuffer(r.ARRAY_BUFFER,Ge);for(let Le=0;Le<G.locationSize;Le++)E(G.location+Le,ce/G.locationSize,le,q,ce*Re,ce/G.locationSize*Le*Re,we)}}else if(ee!==void 0){const q=ee[Me];if(q!==void 0)switch(q.length){case 2:r.vertexAttrib2fv(G.location,q);break;case 3:r.vertexAttrib3fv(G.location,q);break;case 4:r.vertexAttrib4fv(G.location,q);break;default:r.vertexAttrib1fv(G.location,q)}}}}S()}function L(){D();for(const b in n){const N=n[b];for(const Y in N){const K=N[Y];
vendor: 1,092 bytes, line 3574
3574for(const Q in K)f(K[Q].object),delete K[Q];delete N[Y]}delete n[b]}}function B(b){if(n[b.id]===void 0)return;const N=n[b.id];for(const Y in N){const K=N[Y];for(const Q in K)f(K[Q].object),delete K[Q];delete N[Y]}delete n[b.id]}function F(b){for(const N in n){const Y=n[N];if(Y[b.id]===void 0)continue;const K=Y[b.id];for(const Q in K)f(K[Q].object),delete K[Q];delete Y[b.id]}}function D(){T(),o=!0,s!==i&&(s=i,h(s.object))}function T(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:l,reset:D,resetDefaultState:T,dispose:L,releaseStatesOfGeometry:B,releaseStatesOfProgram:F,initAttributes:A,enableAttribute:x,disableUnusedAttributes:S}}function v1(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 o(h,f,d){d!==0&&(r.drawArraysInstanced(n,h,f,d),t.update(f,n,d))}function l(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++)o(h[v],f[v],p[v]);
vendor: 12,567 bytes, lines 3574-3649
3574else{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=o,this.renderMultiDraw=l,this.renderMultiDrawInstances=u}function _1(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const F=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(F){return!(F!==Mn&&n.convert(F)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(F){const D=F===Un&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==gi&&n.convert(F)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==dn&&!D)}function u(F){if(F==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="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&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",f,"instead."),h=f);const d=t.logarithmicDepthBuffer===!0,p=t.reverseDepthBuffer===!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),x=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),_=r.getParameter(r.MAX_VERTEX_ATTRIBS),S=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),L=v>0,B=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:d,reverseDepthBuffer:p,maxTextures:g,maxVertexTextures:v,maxTextureSize:A,maxCubemapSize:x,maxAttributes:_,maxVertexUniforms:S,maxVaryings:E,maxFragmentUniforms:w,vertexTextures:L,maxSamples:B}}function y1(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new os,l=new bt,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,x=d.clipShadows,_=r.get(d);if(!i||v===null||v.length===0||s&&!x)s?f(null):h();else{const S=s?0:n,E=S*4;let w=_.clippingState||null;u.value=w,w=f(v,p,E,g);for(let L=0;L!==E;++L)w[L]=t[L];_.clippingState=w,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=S}};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 x=null;if(A!==0){if(x=u.value,v!==!0||x===null){const _=g+A*4,S=p.matrixWorldInverse;l.getNormalMatrix(S),(x===null||x.length<_)&&(x=new Float32Array(_));for(let E=0,w=g;E!==A;++E,w+=4)o.copy(d[E]).applyMatrix4(S,l),o.normal.toArray(x,w),x[w+3]=o.constant}u.value=x,u.needsUpdate=!0}return e.numPlanes=A,e.numIntersection=0,x}}function x1(r){let e=new WeakMap;function t(o,l){return l===ia?o.mapping=pr:l===ml&&(o.mapping=ds),o}function n(o){if(o&&o.isTexture){const l=o.mapping;if(l===ia||l===ml)if(e.has(o)){const u=e.get(o).texture;return t(u,o.mapping)}else{const u=o.image;if(u&&u.height>0){const h=new nm(u.height);return h.fromEquirectangularTexture(r,o),e.set(o,h),o.addEventListener("dispose",i),t(h.texture,o.mapping)}else return null}}return o}function i(o){const l=o.target;l.removeEventListener("dispose",i);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Qo=4,F0=[.125,.215,.35,.446,.526,.582],Js=20,Xd=new po,U0=new Ye;let Jd=null,Yd=0,Kd=0,Zd=!1;const Xs=(1+Math.sqrt(5))/2,Jo=1/Xs,N0=[new H(-Xs,Jo,0),new H(Xs,Jo,0),new H(-Jo,0,Xs),new H(Jo,0,Xs),new H(0,Xs,-Jo),new H(0,Xs,Jo),new H(-1,1,-1),new H(1,1,-1),new H(-1,1,1),new H(1,1,1)],A1=new H;class Dp{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100,s={}){const{size:o=256,position:l=A1}=s;Jd=this._renderer.getRenderTarget(),Yd=this._renderer.getActiveCubeFace(),Kd=this._renderer.getActiveMipmapLevel(),Zd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,l),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=G0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=H0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Jd,Yd,Kd),this._renderer.xr.enabled=Zd,e.scissorTest=!1,bu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pr||e.mapping===ds?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Jd=this._renderer.getRenderTarget(),Yd=this._renderer.getActiveCubeFace(),Kd=this._renderer.getActiveMipmapLevel(),Zd=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:Qt,minFilter:Qt,generateMipmaps:!1,type:Un,format:Mn,colorSpace:gr,depthBuffer:!1},i=O0(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=O0(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=M1(s)),this._blurMaterial=S1(s,e,t)}return i}_compileMaterial(e){const t=new un(this._lodPlanes[0],e);this._renderer.compile(t,Xd)}_sceneToCubeUV(e,t,n,i,s){const u=new bn(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(U0),d.toneMapping=hr,d.autoClear=!1;const v=new mi({name:"PMREM.Background",side:ai,depthWrite:!1,depthTest:!1}),A=new un(new uo,v);let x=!1;const _=e.background;_?_.isColor&&(v.color.copy(_),e.background=null,x=!0):(v.color.copy(U0),x=!0);for(let S=0;S<6;S++){const E=S%3;E===0?(u.up.set(0,h[S],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x+f[S],s.y,s.z)):E===1?(u.up.set(0,0,h[S]),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y+f[S],s.z)):(u.up.set(0,h[S],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y,s.z+f[S]));const w=this._cubeSize;bu(i,E*w,S>2?w:0,w,w),d.setRenderTarget(i),x&&d.render(A,u),d.render(e,u)}A.geometry.dispose(),A.material.dispose(),d.toneMapping=g,d.autoClear=p,e.background=_}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===pr||e.mapping===ds;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=G0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=H0());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new un(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const u=this._cubeSize;bu(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(o,Xd)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),l=N0[(i-s-1)%N0.length];this._blur(e,s-1,s,o,l)}t.autoClear=n}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,l){const u=this._renderer,h=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,d=new un(this._lodPlanes[i],h),p=h.uniforms,g=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Js-1),A=s/v,x=isFinite(s)?1+Math.floor(f*A):Js;x>Js&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Js}`);const _=[];let S=0;for(let F=0;F<Js;++F){const D=F/A,T=Math.exp(-D*D/2);_.push(T),F===0?S+=T:F<x&&(S+=2*T)}for(let F=0;F<_.length;F++)_[F]=_[F]/S;p.envMap.value=e.texture,p.samples.value=x,p.weights.value=_,p.latitudinal.value=o==="latitudinal",l&&(p.poleAxis.value=l);const{_lodMax:E}=this;p.dTheta.value=v,p.mipInt.value=E-n;const w=this._sizeLods[i],L=3*w*(i>E-Qo?i-E+Qo:0),B=4*(this._cubeSize-w);bu(t,L,B,3*w,2*w),u.setRenderTarget(t),u.render(d,Xd)}}function M1(r){const e=[],t=[],n=[];let i=r;const s=r-Qo+1+F0.length;for(let o=0;o<s;o++){const l=Math.pow(2,i);t.push(l);let u=1/l;o>r-Qo?u=F0[o-r+Qo-1]:o===0&&(u=0),n.push(u);const h=1/(l-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,x=2,_=1,S=new Float32Array(A*v*g),E=new Float32Array(x*v*g),w=new Float32Array(_*v*g);for(let B=0;B<g;B++){const F=B%3*2/3-1,D=B>2?0:-1,T=[F,D,0,F+2/3,D,0,F+2/3,D+1,0,F,D,0,F+2/3,D+1,0,F,D+1,0];S.set(T,A*v*B),E.set(p,x*v*B);const b=[B,B,B,B,B,B];w.set(b,_*v*B)}const L=new Rt;L.setAttribute("position",new Yt(S,A)),L.setAttribute("uv",new Yt(E,x)),L.setAttribute("faceIndex",new Yt(w,_)),e.push(L),i>Qo&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function O0(r,e,t){const n=new ki(r,e,t);return n.texture.mapping=ga,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function bu(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function S1(r,e,t){const n=new Float32Array(Js),i=new H(0,1,0);return new vi({name:"SphericalGaussianBlur",defines:{n:Js,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:Pm(),fragmentShader:` 3575 3576 precision mediump float; 3577 precision mediump int; 3578 3579 varying vec3 vOutputDirection; 3580 3581 uniform sampler2D envMap; 3582 uniform int samples; 3583 uniform float weights[ n ]; 3584 uniform bool latitudinal; 3585 uniform float dTheta; 3586 uniform float mipInt; 3587 uniform vec3 poleAxis; 3588 3589 #define ENVMAP_TYPE_CUBE_UV 3590 #include <cube_uv_reflection_fragment> 3591 3592 vec3 getSample( float theta, vec3 axis ) { 3593 3594 float cosTheta = cos( theta ); 3595 // Rodrigues' axis-angle rotation 3596 vec3 sampleDirection = vOutputDirection * cosTheta 3597 + cross( axis, vOutputDirection ) * sin( theta ) 3598 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3599 3600 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3601 3602 } 3603 3604 void main() { 3605 3606 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3607 3608 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3609 3610 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3611 3612 } 3613 3614 axis = normalize( axis ); 3615 3616 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3617 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3618 3619 for ( int i = 1; i < n; i++ ) { 3620 3621 if ( i >= samples ) { 3622 3623 break; 3624 3625 } 3626 3627 float theta = dTheta * float( i ); 3628 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3629 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3630 3631 } 3632 3633 } 3634 `,blending:ur,depthTest:!1,depthWrite:!1})}function H0(){return new vi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Pm(),fragmentShader:` 3635 3636 precision mediump float; 3637 precision mediump int; 3638 3639 varying vec3 vOutputDirection; 3640 3641 uniform sampler2D envMap; 3642 3643 #include <common> 3644 3645 void main() { 3646 3647 vec3 outputDirection = normalize( vOutputDirection ); 3648 vec2 uv = equirectUv( outputDirection ); 3649
3650 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3651 3652 } 3653 `,blending:ur,depthTest:!1,depthWrite:!1})}function G0(){return new vi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Pm(),fragmentShader:` 3654 3655 precision mediump float; 3656 precision mediump int; 3657 3658 uniform float flipEnvMap; 3659 3660 varying vec3 vOutputDirection; 3661 3662 uniform samplerCube envMap; 3663 3664 void main() { 3665 3666 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3667 3668 } 3669 `,blending:ur,depthTest:!1,depthWrite:!1})}function Pm(){return` 3670 3671 precision mediump float; 3672 precision mediump int; 3673 3674 attribute float faceIndex; 3675 3676 varying vec3 vOutputDirection; 3677 3678 // RH coordinate system; PMREM face-indexing convention 3679 vec3 getDirection( vec2 uv, float face ) { 3680 3681 uv = 2.0 * uv - 1.0; 3682 3683 vec3 direction = vec3( uv, 1.0 ); 3684 3685 if ( face == 0.0 ) { 3686 3687 direction = direction.zyx; // ( 1, v, u ) pos x 3688 3689 } else if ( face == 1.0 ) { 3690 3691 direction = direction.xzy; 3692 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3693 3694 } else if ( face == 2.0 ) { 3695 3696 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3697 3698 } else if ( face == 3.0 ) { 3699 3700 direction = direction.zyx; 3701 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3702 3703 } else if ( face == 4.0 ) { 3704 3705 direction = direction.xzy; 3706 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3707 3708 } else if ( face == 5.0 ) { 3709 3710 direction.z *= -1.0; // ( u, v, -1 ) neg z 3711 3712 } 3713 3714 return direction; 3715 3716 } 3717 3718 void main() { 3719 3720 vOutputDirection = getDirection( uv, faceIndex ); 3721 gl_Position = vec4( position, 1.0 ); 3722 3723 } 3724 `}function E1(r){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,h=u===ia||u===ml,f=u===pr||u===ds;if(h||f){let d=e.get(l);const p=d!==void 0?d.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==p)return t===null&&(t=new Dp(r)),d=h?t.fromEquirectangular(l,d):t.fromCubemap(l,d),d.texture.pmremVersion=l.pmremVersion,e.set(l,d),d.texture;if(d!==void 0)return d.texture;{const g=l.image;return h&&g&&g.height>0||f&&g&&i(g)?(t===null&&(t=new Dp(r)),d=h?t.fromEquirectangular(l):t.fromCubemap(l),d.texture.pmremVersion=l.pmremVersion,e.set(l,d),l.addEventListener("dispose",s),d.texture):null}}}return l}function i(l){let u=0;const h=6;for(let f=0;f<h;f++)l[f]!==void 0&&u++;return u===h}function s(l){const u=l.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function w1(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return 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&&Nu("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function C1(r,e,t,n){const i={},s=new WeakMap;function o(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",o),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 l(d,p){return i[p.id]===!0||(p.addEventListener("dispose",o),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 S=g.array;A=g.version;for(let E=0,w=S.length;E<w;E+=3){const L=S[E+0],B=S[E+1],F=S[E+2];p.push(L,B,B,F,F,L)}}else if(v!==void 0){const S=v.array;A=v.version;for(let E=0,w=S.length/3-1;E<w;E+=3){const L=E+0,B=E+1,F=E+2;p.push(L,B,B,F,F,L)}}else return;const x=new(Ty(p)?tm:em)(p,1);x.version=A;const _=s.get(d);_&&e.remove(_),s.set(d,x)}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:l,update:u,getWireframeAttribute:f}}function T1(r,e,t){let n;function i(p){n=p}let s,o;function l(p){s=p.type,o=p.bytesPerElement}function u(p,g){r.drawElements(n,g,s,p*o),t.update(g,n,1)}function h(p,g,v){v!==0&&(r.drawElementsInstanced(n,g,s,p*o,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 x=0;for(let _=0;_<v;
vendor: 8,583 bytes, line 3724
3724_++)x+=g[_];t.update(x,n,1)}function d(p,g,v,A){if(v===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let _=0;_<p.length;_++)h(p[_]/o,g[_],A[_]);else{x.multiDrawElementsInstancedWEBGL(n,g,0,s,p,0,A,0,v);let _=0;for(let S=0;S<v;S++)_+=g[S]*A[S];t.update(_,n,1)}}this.setMode=i,this.setIndex=l,this.render=u,this.renderInstances=h,this.renderMultiDraw=f,this.renderMultiDrawInstances=d}function b1(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,l){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=l*(s/3);break;case r.LINES:t.lines+=l*(s/2);break;case r.LINE_STRIP:t.lines+=l*(s-1);break;case r.LINE_LOOP:t.lines+=l*s;break;case r.POINTS:t.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);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 R1(r,e,t){const n=new WeakMap,i=new Jt;function s(o,l,u){const h=o.morphTargetInfluences,f=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,d=f!==void 0?f.length:0;let p=n.get(l);if(p===void 0||p.count!==d){let T=function(){F.dispose(),n.delete(l),l.removeEventListener("dispose",T)};p!==void 0&&p.texture.dispose();const g=l.morphAttributes.position!==void 0,v=l.morphAttributes.normal!==void 0,A=l.morphAttributes.color!==void 0,x=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],S=l.morphAttributes.color||[];let E=0;g===!0&&(E=1),v===!0&&(E=2),A===!0&&(E=3);let w=l.attributes.position.count*E,L=1;w>e.maxTextureSize&&(L=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const B=new Float32Array(w*L*4*d),F=new Ll(B,w,L,d);F.type=dn,F.needsUpdate=!0;const D=E*4;for(let b=0;b<d;b++){const N=x[b],Y=_[b],K=S[b],Q=w*L*4*b;for(let oe=0;oe<N.count;oe++){const ee=oe*D;g===!0&&(i.fromBufferAttribute(N,oe),B[Q+ee+0]=i.x,B[Q+ee+1]=i.y,B[Q+ee+2]=i.z,B[Q+ee+3]=0),v===!0&&(i.fromBufferAttribute(Y,oe),B[Q+ee+4]=i.x,B[Q+ee+5]=i.y,B[Q+ee+6]=i.z,B[Q+ee+7]=0),A===!0&&(i.fromBufferAttribute(K,oe),B[Q+ee+8]=i.x,B[Q+ee+9]=i.y,B[Q+ee+10]=i.z,B[Q+ee+11]=K.itemSize===4?i.w:1)}}p={count:d,texture:F,size:new be(w,L)},n.set(l,p),l.addEventListener("dispose",T)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)u.getUniforms().setValue(r,"morphTexture",o.morphTexture,t);else{let g=0;for(let A=0;A<h.length;A++)g+=h[A];const v=l.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 I1(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",l)===!1&&u.addEventListener("dispose",l),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 o(){i=new WeakMap}function l(u){const h=u.target;h.removeEventListener("dispose",l),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:o}}const Cx=new jt,k0=new lm(1,1),Tx=new Ll,bx=new Nh,Rx=new Ul,z0=[],V0=[],W0=new Float32Array(16),X0=new Float32Array(9),J0=new Float32Array(4);function xa(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=z0[i];if(s===void 0&&(s=new Float32Array(i),z0[i]=s),e!==0){n.toArray(s,0);for(let o=1,l=0;o!==e;++o)l+=t,r[o].toArray(s,l)}return s}function In(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 Bn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function rf(r,e){let t=V0[e];t===void 0&&(t=new Int32Array(e),V0[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function B1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function P1(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(In(t,e))return;r.uniform2fv(this.addr,e),Bn(t,e)}}function D1(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(In(t,e))return;r.uniform3fv(this.addr,e),Bn(t,e)}}function L1(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(In(t,e))return;r.uniform4fv(this.addr,e),Bn(t,e)}}function F1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(In(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Bn(t,e)}else{if(In(t,n))return;J0.set(n),r.uniformMatrix2fv(this.addr,!1,J0),Bn(t,n)}}function U1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(In(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Bn(t,e)}else{if(In(t,n))return;X0.set(n),r.uniformMatrix3fv(this.addr,!1,X0),Bn(t,n)}}function N1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(In(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Bn(t,e)}else{if(In(t,n))return;W0.set(n),r.uniformMatrix4fv(this.addr,!1,W0),Bn(t,n)}}function O1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function H1(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(In(t,e))return;r.uniform2iv(this.addr,e),Bn(t,e)}}function G1(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(In(t,e))return;r.uniform3iv(this.addr,e),Bn(t,e)}}function k1(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(In(t,e))return;r.uniform4iv(this.addr,e),Bn(t,e)}}function z1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function V1(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(In(t,e))return;r.uniform2uiv(this.addr,e),Bn(t,e)}}function W1(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(In(t,e))return;r.uniform3uiv(this.addr,e),Bn(t,e)}}function X1(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(In(t,e))return;r.uniform4uiv(this.addr,e),Bn(t,e)}}function J1(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?(k0.compareFunction=jp,s=k0):s=Cx,t.setTexture2D(e||s,i)}function Y1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||bx,i)}function K1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Rx,i)}function Z1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Tx,i)}function q1(r){switch(r){case 5126:return B1;case 35664:return P1;case 35665:return D1;case 35666:return L1;case 35674:return F1;case 35675:return U1;case 35676:return N1;case 5124:case 35670:return O1;case 35667:case 35671:return H1;case 35668:case 35672:return G1;case 35669:case 35673:return k1;case 5125:return z1;case 36294:return V1;case 36295:return W1;case 36296:return X1;case 35678:case 36198:case 36298:case 36306:case 35682:return J1;case 35679:case 36299:case 36307:return Y1;case 35680:case 36300:case 36308:case 36293:return K1;case 36289:case 36303:case 36311:case 36292:return Z1}}function Q1(r,e){r.uniform1fv(this.addr,e)}function j1(r,e){const t=xa(e,this.size,2);r.uniform2fv(this.addr,t)}function $1(r,e){const t=xa(e,this.size,3);r.uniform3fv(this.addr,t)}function eb(r,e){const t=xa(e,this.size,4);r.uniform4fv(this.addr,t)}function tb(r,e){const t=xa(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function nb(r,e){const t=xa(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function ib(r,e){const t=xa(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function rb(r,e){r.uniform1iv(this.addr,e)}
3724function sb(r,e){r.uniform2iv(this.addr,e)}function ob(r,e){r.uniform3iv(this.addr,e)}function ab(r,e){r.uniform4iv(this.addr,e)}function lb(r,e){r.uniform1uiv(this.addr,e)}function cb(r,e){r.uniform2uiv(this.addr,e)}function ub(r,e){r.uniform3uiv(this.addr,e)}function hb(r,e){r.uniform4uiv(this.addr,e)}function fb(r,e,t){const n=this.cache,i=e.length,s=rf(t,i);In(n,s)||(r.uniform1iv(this.addr,s),Bn(n,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||Cx,s[o])}function db(r,e,t){const n=this.cache,i=e.length,s=rf(t,i);In(n,s)||(r.uniform1iv(this.addr,s),Bn(n,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||bx,s[o])}function pb(r,e,t){const n=this.cache,i=e.length,s=rf(t,i);In(n,s)||(r.uniform1iv(this.addr,s),Bn(n,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||Rx,s[o])}function mb(r,e,t){const n=this.cache,i=e.length,s=rf(t,i);In(n,s)||(r.uniform1iv(this.addr,s),Bn(n,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||Tx,s[o])}function gb(r){switch(r){case 5126:return Q1;case 35664:return j1;case 35665:return $1;case 35666:return eb;case 35674:return tb;case 35675:return nb;case 35676:return ib;case 5124:case 35670:return rb;case 35667:case 35671:return sb;case 35668:case 35672:return ob;
vendor: 8,895 bytes, lines 3724-3759
3724case 35669:case 35673:return ab;case 5125:return lb;case 36294:return cb;case 36295:return ub;case 36296:return hb;case 35678:case 36198:case 36298:case 36306:case 35682:return fb;case 35679:case 36299:case 36307:return db;case 35680:case 36300:case 36308:case 36293:return pb;case 36289:case 36303:case 36311:case 36292:return mb}}class vb{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=q1(t.type)}}class _b{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=gb(t.type)}}class yb{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const l=i[s];l.setValue(e,t[l.id],n)}}}const qd=/(\w+)(\])?(\[|\.)?/g;function Y0(r,e){r.seq.push(e),r.map[e.id]=e}function xb(r,e,t){const n=r.name,i=n.length;for(qd.lastIndex=0;;){const s=qd.exec(n),o=qd.lastIndex;let l=s[1];const u=s[2]==="]",h=s[3];if(u&&(l=l|0),h===void 0||h==="["&&o+2===i){Y0(t,h===void 0?new vb(l,r,e):new _b(l,r,e));break}else{let d=t.map[l];d===void 0&&(d=new yb(l),Y0(t,d)),t=d}}}class Hu{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);xb(s,o,this)}}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,o=t.length;s!==o;++s){const l=t[s],u=n[l.id];u.needsUpdate!==!1&&l.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function K0(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const Ab=37297;let Mb=0;function Sb(r,e){const t=r.split(` 3725`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const l=o+1;n.push(`${l===e?">":" "} ${l}: ${t[o]}`)}return n.join(` 3726`)}const Z0=new bt;function Eb(r){Xt._getMatrix(Z0,Xt.workingColorSpace,r);const e=`mat3( ${Z0.elements.map(t=>t.toFixed(4))} )`;switch(Xt.getTransfer(r)){case vl:return[e,"LinearTransferOETF"];case $t:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function q0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` 3727 3728`+i+` 3729 3730`+Sb(r.getShaderSource(e),o)}else return i}function wb(r,e){const t=Eb(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3731`)}function Cb(r,e){let t;switch(e){case sy:t="Linear";break;case oy:t="Reinhard";break;case ay:t="Cineon";break;case zp:t="ACESFilmic";break;case cy:t="AgX";break;case uy:t="Neutral";break;case ly:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ru=new H;function Tb(){Xt.getLuminanceCoefficients(Ru);const r=Ru.x.toFixed(4),e=Ru.y.toFixed(4),t=Ru.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3732`)}function bb(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(rl).join(` 3733`)}function Rb(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3734`)}function Ib(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),o=s.name;let l=1;s.type===r.FLOAT_MAT2&&(l=2),s.type===r.FLOAT_MAT3&&(l=3),s.type===r.FLOAT_MAT4&&(l=4),t[o]={type:s.type,location:r.getAttribLocation(e,o),locationSize:l}}return t}function rl(r){return r!==""}function Q0(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 j0(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Bb=/^[ \t]*#include +<([\w\d./]+)>/gm;function Lp(r){return r.replace(Bb,Db)}const Pb=new Map;function Db(r,e){let t=Dt[e];if(t===void 0){const n=Pb.get(e);if(n!==void 0)t=Dt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Lp(t)}const Lb=/#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 $0(r){return r.replace(Lb,Fb)}function Fb(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 e_(r){let e=`precision ${r.precision} float; 3735 precision ${r.precision} int; 3736 precision ${r.precision} sampler2D; 3737 precision ${r.precision} samplerCube; 3738 precision ${r.precision} sampler3D; 3739 precision ${r.precision} sampler2DArray; 3740 precision ${r.precision} sampler2DShadow; 3741 precision ${r.precision} samplerCubeShadow; 3742 precision ${r.precision} sampler2DArrayShadow; 3743 precision ${r.precision} isampler2D; 3744 precision ${r.precision} isampler3D; 3745 precision ${r.precision} isamplerCube; 3746 precision ${r.precision} isampler2DArray; 3747 precision ${r.precision} usampler2D; 3748 precision ${r.precision} usampler3D; 3749 precision ${r.precision} usamplerCube; 3750 precision ${r.precision} usampler2DArray; 3751 `;return r.precision==="highp"?e+=` 3752#define HIGH_PRECISION`:r.precision==="mediump"?e+=` 3753#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=` 3754#define LOW_PRECISION`),e}function Ub(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Th?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===sl?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===qi&&(e="SHADOWMAP_TYPE_VSM"),e}function Nb(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case pr:case ds:e="ENVMAP_TYPE_CUBE";break;case ga:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Ob(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case ds:e="ENVMAP_MODE_REFRACTION";break}return e}function Hb(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case Il:e="ENVMAP_BLENDING_MULTIPLY";break;case iy:e="ENVMAP_BLENDING_MIX";break;case ry:e="ENVMAP_BLENDING_ADD";break}return e}function Gb(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),112)),texelHeight:n,maxMip:t}}function kb(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,l=t.fragmentShader;const u=Ub(t),h=Nb(t),f=Ob(t),d=Hb(t),p=Gb(t),g=bb(t),v=Rb(s),A=i.createProgram();let x,_,S=t.glslVersion?"#version "+t.glslVersion+` 3755`:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(rl).join(` 3756`),x.length>0&&(x+=` 3757`),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(rl).join(` 3758`),_.length>0&&(_+=` 3759`)):(x=[e_(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&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_IR
3759IDESCENCEMAP":"",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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3760`].filter(rl).join(` 3761`),_=[e_(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
3761IDESCENCE":"",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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==hr?"#define TONE_MAPPING":"",t.toneMapping!==hr?Dt.tonemapping_pars_fragment:"",t.toneMapping!==hr?Cb("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Dt.colorspace_pars_fragment,wb("linearToOutputTexel",t.outputColorSpace),Tb(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3762`].filter(rl).join(` 3763`)),o=Lp(o),o=Q0(o,t),o=j0(o,t),l=Lp(l),l=Q0(l,t),l=j0(l,t),o=$0(o),l=$0(l),t.isRawShaderMaterial!==!0&&(S=`#version 300 es 3764`,x=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3765`)+` 3766`+x,_=["#define varying in",t.glslVersion===Cp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Cp?"":"#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(` 3767`)+` 3768`+_);const E=S+x+o,w=S+_+l,L=K0(i,i.VERTEX_SHADER,E),B=K0(i,i.FRAGMENT_SHADER,w);i.attachShader(A,L),i.attachShader(A,B),t.index0AttributeName!==void 0?i.bindAttribLocation(A,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(A,0,"position"),i.linkProgram(A);function F(N){if(r.debug.checkShaderErrors){const Y=i.getProgramInfoLog(A).trim(),K=i.getShaderInfoLog(L).trim(),Q=i.getShaderInfoLog(B).trim();let oe=!0,ee=!0;if(i.getProgramParameter(A,i.LINK_STATUS)===!1)if(oe=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,A,L,B);else{const Me=q0(i,L,"vertex"),G=q0(i,B,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(A,i.VALIDATE_STATUS)+` 3769 3770Material Name: `+N.name+` 3771Material Type: `+N.type+` 3772 3773Program Info Log: `+Y+` 3774`+Me+` 3775`+G)}else Y!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Y):(K===""||Q==="")&&(ee=!1);ee&&(N.diagnostics={runnable:oe,programLog:Y,vertexShader:{log:K,prefix:x},fragmentShader:{log:Q,prefix:_}})}i.deleteShader(L),i.deleteShader(B),D=new Hu(i,A),T=Ib(i,A)}let D;this.getUniforms=function(){return D===void 0&&F(this),D};let T;this.getAttributes=function(){return T===void 0&&F(this),T};let b=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return b===!1&&(b=i.getProgramParameter(A,Ab)),b},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(A),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Mb++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=L,this.fragmentShader=B,this}let zb=0;class Vb{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),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.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 Wb(e),t.set(e,n)),n}}class Wb{constructor(e){this.id=zb++,this.code=e,this.usedTimes=0}}function Xb(r,e,t,n,i,s,o){const l=new no,u=new Vb,h=new Set,f=[],d=i.logarithmicDepthBuffer,p=i.vertexTextures;let g=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(T){return h.add(T),T===0?"uv":`uv${T}`}function x(T,b,N,Y,K){const Q=Y.fog,oe=K.geometry,ee=T.isMeshStandardMaterial?Y.environment:null,Me=(T.isMeshStandardMaterial?t:e).get(T.envMap||ee),G=Me&&Me.mapping===ga?Me.image.height:null,te=v[T.type];T.precision!==null&&(g=i.getMaxPrecision(T.precision),g!==T.precision&&console.warn("THREE.WebGLProgram.getParameters:",T.precision,"not supported, using",g,"instead."));const q=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,ce=q!==void 0?q.length:0;let Se=0;oe.morphAttributes.position!==void 0&&(Se=1),oe.morphAttributes.normal!==void 0&&(Se=2),oe.morphAttributes.color!==void 0&&(Se=3);let Ge,le,Re,we;if(te){const Vt=Qi[te];Ge=Vt.vertexShader,le=Vt.fragmentShader}else Ge=T.vertexShader,le=T.fragmentShader,u.update(T),Re=u.getVertexShaderID(T),we=u.getFragmentShaderID(T);const Le=r.getRenderTarget(),ot=r.state.buffers.depth.getReversed(),Ut=K.isInstancedMesh===!0,ft=K.isBatchedMesh===!0,xt=!!T.map,kt=!!T.matcap,pt=!!Me,X=!!T.aoMap,tn=!!T.lightMap,Ee=!!T.bumpMap,Ie=!!T.normalMap,Ae=!!T.displacementMap,ze=!!T.emissiveMap,ye=!!T.metalnessMap,O
vendor: 20,232 bytes, lines 3775-3803
3775=!!T.roughnessMap,P=T.anisotropy>0,ne=T.clearcoat>0,he=T.dispersion>0,xe=T.iridescence>0,ve=T.sheen>0,tt=T.transmission>0,Oe=P&&!!T.anisotropyMap,Ke=ne&&!!T.clearcoatMap,Lt=ne&&!!T.clearcoatNormalMap,Fe=ne&&!!T.clearcoatRoughnessMap,$e=xe&&!!T.iridescenceMap,ut=xe&&!!T.iridescenceThicknessMap,it=ve&&!!T.sheenColorMap,je=ve&&!!T.sheenRoughnessMap,Et=!!T.specularMap,dt=!!T.specularColorMap,Mt=!!T.specularIntensityMap,$=tt&&!!T.transmissionMap,ue=tt&&!!T.thicknessMap,de=!!T.gradientMap,Ce=!!T.alphaMap,qe=T.alphaTest>0,We=!!T.alphaHash,At=!!T.extensions;let rn=hr;T.toneMapped&&(Le===null||Le.isXRRenderTarget===!0)&&(rn=r.toneMapping);const _n={shaderID:te,shaderType:T.type,shaderName:T.name,vertexShader:Ge,fragmentShader:le,defines:T.defines,customVertexShaderID:Re,customFragmentShaderID:we,isRawShaderMaterial:T.isRawShaderMaterial===!0,glslVersion:T.glslVersion,precision:g,batching:ft,batchingColor:ft&&K._colorsTexture!==null,instancing:Ut,instancingColor:Ut&&K.instanceColor!==null,instancingMorph:Ut&&K.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:Le===null?r.outputColorSpace:Le.isXRRenderTarget===!0?Le.texture.colorSpace:gr,alphaToCoverage:!!T.alphaToCoverage,map:xt,matcap:kt,envMap:pt,envMapMode:pt&&Me.mapping,envMapCubeUVHeight:G,aoMap:X,lightMap:tn,bumpMap:Ee,normalMap:Ie,displacementMap:p&&Ae,emissiveMap:ze,normalMapObjectSpace:Ie&&T.normalMapType===_y,normalMapTangentSpace:Ie&&T.normalMapType===gs,metalnessMap:ye,roughnessMap:O,anisotropy:P,anisotropyMap:Oe,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Lt,clearcoatRoughnessMap:Fe,dispersion:he,iridescence:xe,iridescenceMap:$e,iridescenceThicknessMap:ut,sheen:ve,sheenColorMap:it,sheenRoughnessMap:je,specularMap:Et,specularColorMap:dt,specularIntensityMap:Mt,transmission:tt,transmissionMap:$,thicknessMap:ue,gradientMap:de,opaque:T.transparent===!1&&T.blending===eo&&T.alphaToCoverage===!1,alphaMap:Ce,alphaTest:qe,alphaHash:We,combine:T.combine,mapUv:xt&&A(T.map.channel),aoMapUv:X&&A(T.aoMap.channel),lightMapUv:tn&&A(T.lightMap.channel),bumpMapUv:Ee&&A(T.bumpMap.channel),normalMapUv:Ie&&A(T.normalMap.channel),displacementMapUv:Ae&&A(T.displacementMap.channel),emissiveMapUv:ze&&A(T.emissiveMap.channel),metalnessMapUv:ye&&A(T.metalnessMap.channel),roughnessMapUv:O&&A(T.roughnessMap.channel),anisotropyMapUv:Oe&&A(T.anisotropyMap.channel),clearcoatMapUv:Ke&&A(T.clearcoatMap.channel),clearcoatNormalMapUv:Lt&&A(T.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Fe&&A(T.clearcoatRoughnessMap.channel),iridescenceMapUv:$e&&A(T.iridescenceMap.channel),iridescenceThicknessMapUv:ut&&A(T.iridescenceThicknessMap.channel),sheenColorMapUv:it&&A(T.sheenColorMap.channel),sheenRoughnessMapUv:je&&A(T.sheenRoughnessMap.channel),specularMapUv:Et&&A(T.specularMap.channel),specularColorMapUv:dt&&A(T.specularColorMap.channel),specularIntensityMapUv:Mt&&A(T.specularIntensityMap.channel),transmissionMapUv:$&&A(T.transmissionMap.channel),thicknessMapUv:ue&&A(T.thicknessMap.channel),alphaMapUv:Ce&&A(T.alphaMap.channel),vertexTangents:!!oe.attributes.tangent&&(Ie||P),vertexColors:T.vertexColors,vertexAlphas:T.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,pointsUvs:K.isPoints===!0&&!!oe.attributes.uv&&(xt||Ce),fog:!!Q,useFog:T.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:T.flatShading===!0,sizeAttenuation:T.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:ot,skinning:K.isSkinnedMesh===!0,morphTargets:oe.morphAttributes.position!==void 0,morphNormals:oe.morphAttributes.normal!==void 0,morphColors:oe.morphAttributes.color!==void 0,morphTargetsCount:ce,morphTextureStride:Se,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:T.dithering,shadowMapEnabled:r.shadowMap.enabled&&N.length>0,shadowMapType:r.shadowMap.type,toneMapping:rn,decodeVideoTexture:xt&&T.map.isVideoTexture===!0&&Xt.getTransfer(T.map.colorSpace)===$t,decodeVideoTextureEmissive:ze&&T.emissiveMap.isVideoTexture===!0&&Xt.getTransfer(T.emissiveMap.colorSpace)===$t,premultipliedAlpha:T.premultipliedAlpha,doubleSided:T.side===Oi,flipSided:T.side===ai,useDepthPacking:T.depthPacking>=0,depthPacking:T.depthPacking||0,index0AttributeName:T.index0AttributeName,extensionClipCullDistance:At&&T.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&T.extensions.multiDraw===!0||ft)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:T.customProgramCacheKey()};return _n.vertexUv1s=h.has(1),_n.vertexUv2s=h.has(2),_n.vertexUv3s=h.has(3),h.clear(),_n}function _(T){const b=[];if(T.shaderID?b.push(T.shaderID):(b.push(T.customVertexShaderID),b.push(T.customFragmentShaderID)),T.defines!==void 0)for(const N in T.defines)b.push(N),b.push(T.defines[N]);return T.isRawShaderMaterial===!1&&(S(b,T),E(b,T),b.push(r.outputColorSpace)),b.push(T.customProgramCacheKey),b.join()}function S(T,b){T.push(b.precision),T.push(b.outputColorSpace),T.push(b.envMapMode),T.push(b.envMapCubeUVHeight),T.push(b.mapUv),T.push(b.alphaMapUv),T.push(b.lightMapUv),T.push(b.aoMapUv),T.push(b.bumpMapUv),T.push(b.normalMapUv),T.push(b.displacementMapUv),T.push(b.emissiveMapUv),T.push(b.metalnessMapUv),T.push(b.roughnessMapUv),T.push(b.anisotropyMapUv),T.push(b.clearcoatMapUv),T.push(b.clearcoatNormalMapUv),T.push(b.clearcoatRoughnessMapUv),T.push(b.iridescenceMapUv),T.push(b.iridescenceThicknessMapUv),T.push(b.sheenColorMapUv),T.push(b.sheenRoughnessMapUv),T.push(b.specularMapUv),T.push(b.specularColorMapUv),T.push(b.specularIntensityMapUv),T.push(b.transmissionMapUv),T.push(b.thicknessMapUv),T.push(b.combine),T.push(b.fogExp2),T.push(b.sizeAttenuation),T.push(b.morphTargetsCount),T.push(b.morphAttributeCount),T.push(b.numDirLights),T.push(b.numPointLights),T.push(b.numSpotLights),T.push(b.numSpotLightMaps),T.push(b.numHemiLights),T.push(b.numRectAreaLights),T.push(b.numDirLightShadows),T.push(b.numPointLightShadows),T.push(b.numSpotLightShadows),T.push(b.numSpotLightShadowsWithMaps),T.push(b.numLightProbes),T.push(b.shadowMapType),T.push(b.toneMapping),T.push(b.numClippingPlanes),T.push(b.numClipIntersection),T.push(b.depthPacking)}function E(T,b){l.disableAll(),b.supportsVertexTextures&&l.enable(0),b.instancing&&l.enable(1),b.instancingColor&&l.enable(2),b.instancingMorph&&l.enable(3),b.matcap&&l.enable(4),b.envMap&&l.enable(5),b.normalMapObjectSpace&&l.enable(6),b.normalMapTangentSpace&&l.enable(7),b.clearcoat&&l.enable(8),b.iridescence&&l.enable(9),b.alphaTest&&l.enable(10),b.vertexColors&&l.enable(11),b.vertexAlphas&&l.enable(12),b.vertexUv1s&&l.enable(13),b.vertexUv2s&&l.enable(14),b.vertexUv3s&&l.enable(15),b.vertexTangents&&l.enable(16),b.anisotropy&&l.enable(17),b.alphaHash&&l.enable(18),b.batching&&l.enable(19),b.dispersion&&l.enable(20),b.batchingColor&&l.enable(21),T.push(l.mask),l.disableAll(),b.fog&&l.enable(0),b.useFog&&l.enable(1),b.flatShading&&l.enable(2),b.logarithmicDepthBuffer&&l.enable(3),b.reverseDepthBuffer&&l.enable(4),b.skinning&&l.enable(5),b.morphTargets&&l.enable(6),b.morphNormals&&l.enable(7),b.morphColors&&l.enable(8),b.premultipliedAlpha&&l.enable(9),b.shadowMapEnabled&&l.enable(10),b.doubleSided&&l.enable(11),b.flipSided&&l.enable(12),b.useDepthPacking&&l.enable(13),b.dithering&&l.enable(14),b.transmission&&l.enable(15),b.sheen&&l.enable(16),b.opaque&&l.enable(17),b.pointsUvs&&l.enable(18),b.decodeVideoTexture&&l.enable(19),b.decodeVideoTextureEmissive&&l.enable(20),b.alphaToCoverage&&l.enable(21),T.push(l.mask)}function w(T){const b=v[T.type];let N;if(b){const Y=Qi[b];N=Py.clone(Y.uniforms)}else N=T.uniforms;return N}function L(T,b){let N;for(let Y=0,K=f.length;Y<K;Y++){const Q=f[Y];if(Q.cacheKey===b){N=Q,++N.usedTimes;break}}return N===void 0&&(N=new kb(r,b,T,s),f.push(N)),N}function B(T){if(--T.usedTimes===0){const b=f.indexOf(T);f[b]=f[f.length-1],f.pop(),T.destroy()}}function F(T){u.remove(T)}function D(){u.dispose()}return{getParameters:x,getProgramCacheKey:_,getUniforms:w,acquireProgram:L,releaseProgram:B,releaseShaderCache:F,programs:f,dispose:D}}function Jb(){let r=new WeakMap;function e(o){return r.has(o)}function t(o){let l=r.get(o);return l===void 0&&(l={},r.set(o,l)),l}function n(o){r.delete(o)}function i(o,l,u){r.get(o)[l]=u}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function Yb(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 t_(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 n_(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(d,p,g,v,A,x){let _=r[e];return _===void 0?(_={id:d.id,object:d,geometry:p,material:g,groupOrder:v,renderOrder:d.renderOrder,z:A,group:x},r[e]=_):(_.id=d.id,_.object=d,_.geometry=p,_.material=g,_.groupOrder=v,_.renderOrder=d.renderOrder,_.z=A,_.group=x),e++,_}function l(d,p,g,v,A,x){const _=o(d,p,g,v,A,x);g.transmission>0?n.push(_):g.transparent===!0?i.push(_):t.push(_)}function u(d,p,g,v,A,x){const _=o(d,p,g,v,A,x);g.transmission>0?n.unshift(_):g.transparent===!0?i.unshift(_):t.unshift(_)}function h(d,p){t.length>1&&t.sort(d||Yb),n.length>1&&n.sort(p||t_),i.length>1&&i.sort(p||t_)}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:l,unshift:u,finish:f,sort:h}}function Kb(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new n_,r.set(n,[o])):i>=s.length?(o=new n_,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function Zb(){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 H,color:new Ye};break;case"SpotLight":t={position:new H,direction:new H,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new H,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new H,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new H,halfWidth:new H,halfHeight:new H};break}return r[e.id]=t,t}}}function qb(){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 be};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Qb=0;function jb(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function $b(r){const e=new Zb,t=qb(),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 H);const i=new H,s=new gt,o=new gt;function l(h){let f=0,d=0,p=0;for(let T=0;T<9;T++)n.probe[T].set(0,0,0);let g=0,v=0,A=0,x=0,_=0,S=0,E=0,w=0,L=0,B=0,F=0;h.sort(jb);for(let T=0,b=h.length;T<b;T++){const N=h[T],Y=N.color,K=N.intensity,Q=N.distance,oe=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)f+=Y.r*K,d+=Y.g*K,p+=Y.b*K;else if(N.isLightProbe){for(let ee=0;ee<9;ee++)n.probe[ee].addScaledVector(N.sh.coefficients[ee],K);F++}else if(N.isDirectionalLight){const ee=e.get(N);if(ee.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const Me=N.shadow,G=t.get(N);G.shadowIntensity=Me.intensity,G.shadowBias=Me.bias,G.shadowNormalBias=Me.normalBias,G.shadowRadius=Me.radius,G.shadowMapSize=Me.mapSize,n.directionalShadow[g]=G,n.directionalShadowMap[g]=oe,n.directionalShadowMatrix[g]=N.shadow.matrix,S++}n.directional[g]=ee,g++}else if(N.isSpotLight){const ee=e.get(N);ee.position.setFromMatrixPosition(N.matrixWorld),ee.color.copy(Y).multiplyScalar(K),ee.distance=Q,ee.coneCos=Math.cos(N.angle),ee.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),ee.decay=N.decay,n.spot[A]=ee;const Me=N.shadow;if(N.map&&(n.spotLightMap[L]=N.map,L++,Me.updateMatrices(N),N.castShadow&&B++),n.spotLightMatrix[A]=Me.matrix,N.castShadow){const G=t.get(N);G.shadowIntensity=Me.intensity,G.shadowBias=Me.bias,G.shadowNormalBias=Me.normalBias,G.shadowRadius=Me.radius,G.shadowMapSize=Me.mapSize,n.spotShadow[A]=G,n.spotShadowMap[A]=oe,w++}A++}else if(N.isRectAreaLight){const ee=e.get(N);ee.color.copy(Y).multiplyScalar(K),ee.halfWidth.set(N.width*.5,0,0),ee.halfHeight.set(0,N.height*.5,0),n.rectArea[x]=ee,x++}else if(N.isPointLight){const ee=e.get(N);if(ee.color.copy(N.color).multiplyScalar(N.intensity),ee.distance=N.distance,ee.decay=N.decay,N.castShadow){const Me=N.shadow,G=t.get(N);G.shadowIntensity=Me.intensity,G.shadowBias=Me.bias,G.shadowNormalBias=Me.normalBias,G.shadowRadius=Me.radius,G.shadowMapSize=Me.mapSize,G.shadowCameraNear=Me.camera.near,G.shadowCameraFar=Me.camera.far,n.pointShadow[v]=G,n.pointShadowMap[v]=oe,n.pointShadowMatrix[v]=N.shadow.matrix,E++}n.point[v]=ee,v++}else if(N.isHemisphereLight){const ee=e.get(N);ee.skyColor.copy(N.color).multiplyScalar(K),ee.groundColor.copy(N.groundColor).multiplyScalar(K),n.hemi[_]=ee,_++}}x>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Je.LTC_FLOAT_1,n.rectAreaLTC2=Je.LTC_FLOAT_2):(n.rectAreaLTC1=Je.LTC_HALF_1,n.rectAreaLTC2=Je.LTC_HALF_2)),n.ambient[0]=f,n.ambient[1]=d,n.ambient[2]=p;const D=n.hash;(D.directionalLength!==g||D.pointLength!==v||D.spotLength!==A||D.rectAreaLength!==x||D.hemiLength!==_||D.numDirectionalShadows!==S||D.numPointShadows!==E||D.numSpotShadows!==w||D.numSpotMaps!==L||D.numLightProbes!==F)&&(n.directional.length=g,n.spot.length=A,n.rectArea.length=x,n.point.length=v,n.hemi.length=_,n.directionalShadow.length=S,n.directionalShadowMap.length=S,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=w,n.spotShadowMap.length=w,n.directionalShadowMatrix.length=S,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=w+L-B,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=B,n.numLightProbes=F,D.directionalLength=g,D.pointLength=v,D.spotLength=A,D.rectAreaLength=x,D.hemiLength=_,D.numDirectionalShadows=S,D.numPointShadows=E,D.numSpotShadows=w,D.numSpotMaps=L,D.numLightProbes=F,n.version=Qb++)}function u(h,f){let d=0,p=0,g=0,v=0,A=0;const x=f.matrixWorldInverse;for(let _=0,S=h.length;_<S;_++){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(x),d++}else if(E.isSpotLight){const w=n.spot[g];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(x),w.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(x),g++}else if(E.isRectAreaLight){const w=n.rectArea[v];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(x),o.identity(),s.copy(E.matrixWorld),s.premultiply(x),o.extractRotation(s),w.halfWidth.set(E.width*.5,0,0),w.halfHeight.set(0,E.height*.5,0),w.halfWidth.applyMatrix4(o),w.halfHeight.applyMatrix4(o),v++}else if(E.isPointLight){const w=n.point[p];w.position.setFromMatrixPosition(E.matrixWorld),w.position.applyMatrix4(x),p++}else if(E.isHemisphereLight){const w=n.hemi[A];w.direction.setFromMatrixPosition(E.matrixWorld),w.direction.transformDirection(x),A++}}}return{setup:l,setupView:u,state:n}}function i_(r){const e=new $b(r),t=[],n=[];function i(f){h.camera=f,t.length=0,n.length=0}function s(f){t.push(f)}function o(f){n.push(f)}function l(){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:l,setupLightsView:u,pushLight:s,pushShadow:o}}function eR(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let l;return o===void 0?(l=new i_(r),e.set(i,[l])):s>=o.length?(l=new i_(r),o.push(l)):l=o[s],l}function n(){e=new WeakMap}return{get:t,dispose:n}}const tR=`void main() { 3776 gl_Position = vec4( position, 1.0 ); 3777}`,nR=`uniform sampler2D shadow_pass; 3778uniform vec2 resolution; 3779uniform float radius; 3780#include <packing> 3781void main() { 3782 const float samples = float( VSM_SAMPLES ); 3783 float mean = 0.0; 3784 float squared_mean = 0.0; 3785 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3786 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3787 for ( float i = 0.0; i < samples; i ++ ) { 3788 float uvOffset = uvStart + i * uvStride; 3789 #ifdef HORIZONTAL_PASS 3790 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3791 mean += distribution.x; 3792 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3793 #else 3794 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3795 mean += depth; 3796 squared_mean += depth * depth; 3797 #endif 3798 } 3799 mean = mean / samples; 3800 squared_mean = squared_mean / samples; 3801 float std_dev = sqrt( squared_mean - mean * mean ); 3802 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3803}`;function iR(r,e,t){let n=new Gl;const i=new be,s=new be,o=new Jt,l=new mm({depthPacking:vy}),u=new gm,h={},f=t.maxTextureSize,d={[dr]:ai,[ai]:dr,[Oi]:Oi},p=new vi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new be},radius:{value:4}},vertexShader:tR,fragmentShader:nR}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const v=new Rt;v.setAttribute("position",new Yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new un(v,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Th;let _=this.type;this.render=function(B,F,D){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||B.length===0)return;const T=r.getRenderTarget(),b=r.getActiveCubeFace(),N=r.getActiveMipmapLevel(),Y=r.state;Y.setBlending(ur),Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);const K=_!==qi&&this.type===qi,Q=_===qi&&this.type!==qi;for(let oe=0,ee=B.length;oe<ee;oe++){const Me=B[oe],G=Me.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",Me,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;i.copy(G.mapSize);const te=G.getFrameExtents();if(i.multiply(te),s.copy(G.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(s.x=Math.floor(f/te.x),i.x=s.x*te.x,G.mapSize.x=s.x),i.y>f&&(s.y=Math.floor(f/te.y),i.y=s.y*te.y,G.mapSize.y=s.y)),G.map===null||K===!0||Q===!0){const ce=this.type!==qi?{minFilter:Nn,magFilter:Nn}:{};G.map!==null&&G.map.dispose(),G.map=new ki(i.x,i.y,ce),G.map.texture.name=Me.name+".shadowMap",G.camera.updateProjectionMatrix()}r.setRenderTarget(G.map),r.clear();const q=G.getViewportCount();for(let ce=0;ce<q;ce++){const Se=G.getViewport(ce);o.set(s.x*Se.x,s.y*Se.y,s.x*Se.z,s.y*Se.w),Y.viewport(o),G.updateMatrices(Me,ce),n=G.getFrustum(),w(F,D,G.camera,Me,this.type)}G.isPointLightShadow!==!0&&this.type===qi&&S(G,D),G.needsUpdate=!1}_=this.type,x.needsUpdate=!1,r.setRenderTarget(T,b,N)};function S(B,F){const D=e.update(A);
vendor: 7,266 bytes, line 3803
3803p.defines.VSM_SAMPLES!==B.blurSamples&&(p.defines.VSM_SAMPLES=B.blurSamples,g.defines.VSM_SAMPLES=B.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),B.mapPass===null&&(B.mapPass=new ki(i.x,i.y)),p.uniforms.shadow_pass.value=B.map.texture,p.uniforms.resolution.value=B.mapSize,p.uniforms.radius.value=B.radius,r.setRenderTarget(B.mapPass),r.clear(),r.renderBufferDirect(F,null,D,p,A,null),g.uniforms.shadow_pass.value=B.mapPass.texture,g.uniforms.resolution.value=B.mapSize,g.uniforms.radius.value=B.radius,r.setRenderTarget(B.map),r.clear(),r.renderBufferDirect(F,null,D,g,A,null)}function E(B,F,D,T){let b=null;const N=D.isPointLight===!0?B.customDistanceMaterial:B.customDepthMaterial;if(N!==void 0)b=N;else if(b=D.isPointLight===!0?u:l,r.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0){const Y=b.uuid,K=F.uuid;let Q=h[Y];Q===void 0&&(Q={},h[Y]=Q);let oe=Q[K];oe===void 0&&(oe=b.clone(),Q[K]=oe,F.addEventListener("dispose",L)),b=oe}if(b.visible=F.visible,b.wireframe=F.wireframe,T===qi?b.side=F.shadowSide!==null?F.shadowSide:F.side:b.side=F.shadowSide!==null?F.shadowSide:d[F.side],b.alphaMap=F.alphaMap,b.alphaTest=F.alphaTest,b.map=F.map,b.clipShadows=F.clipShadows,b.clippingPlanes=F.clippingPlanes,b.clipIntersection=F.clipIntersection,b.displacementMap=F.displacementMap,b.displacementScale=F.displacementScale,b.displacementBias=F.displacementBias,b.wireframeLinewidth=F.wireframeLinewidth,b.linewidth=F.linewidth,D.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const Y=r.properties.get(b);Y.light=D}return b}function w(B,F,D,T,b){if(B.visible===!1)return;if(B.layers.test(F.layers)&&(B.isMesh||B.isLine||B.isPoints)&&(B.castShadow||B.receiveShadow&&b===qi)&&(!B.frustumCulled||n.intersectsObject(B))){B.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,B.matrixWorld);const K=e.update(B),Q=B.material;if(Array.isArray(Q)){const oe=K.groups;for(let ee=0,Me=oe.length;ee<Me;ee++){const G=oe[ee],te=Q[G.materialIndex];if(te&&te.visible){const q=E(B,te,T,b);B.onBeforeShadow(r,B,F,D,K,q,G),r.renderBufferDirect(D,null,K,q,B,G),B.onAfterShadow(r,B,F,D,K,q,G)}}}else if(Q.visible){const oe=E(B,Q,T,b);B.onBeforeShadow(r,B,F,D,K,oe,null),r.renderBufferDirect(D,null,K,oe,B,null),B.onAfterShadow(r,B,F,D,K,oe,null)}}const Y=B.children;for(let K=0,Q=Y.length;K<Q;K++)w(Y[K],F,D,T,b)}function L(B){B.target.removeEventListener("dispose",L);for(const D in h){const T=h[D],b=B.target.uuid;b in T&&(T[b].dispose(),delete T[b])}}}const rR={[Vu]:Wu,[Xu]:Ku,[Ju]:Zu,[ro]:Yu,[Wu]:Vu,[Ku]:Xu,[Zu]:Ju,[Yu]:ro};function sR(r,e){function t(){let $=!1;const ue=new Jt;let de=null;const Ce=new Jt(0,0,0,0);return{setMask:function(qe){de!==qe&&!$&&(r.colorMask(qe,qe,qe,qe),de=qe)},setLocked:function(qe){$=qe},setClear:function(qe,We,At,rn,_n){_n===!0&&(qe*=rn,We*=rn,At*=rn),ue.set(qe,We,At,rn),Ce.equals(ue)===!1&&(r.clearColor(qe,We,At,rn),Ce.copy(ue))},reset:function(){$=!1,de=null,Ce.set(-1,0,0,0)}}}function n(){let $=!1,ue=!1,de=null,Ce=null,qe=null;return{setReversed:function(We){if(ue!==We){const At=e.get("EXT_clip_control");We?At.clipControlEXT(At.LOWER_LEFT_EXT,At.ZERO_TO_ONE_EXT):At.clipControlEXT(At.LOWER_LEFT_EXT,At.NEGATIVE_ONE_TO_ONE_EXT),ue=We;const rn=qe;qe=null,this.setClear(rn)}},getReversed:function(){return ue},setTest:function(We){We?Le(r.DEPTH_TEST):ot(r.DEPTH_TEST)},setMask:function(We){de!==We&&!$&&(r.depthMask(We),de=We)},setFunc:function(We){if(ue&&(We=rR[We]),Ce!==We){switch(We){case Vu:r.depthFunc(r.NEVER);break;case Wu:r.depthFunc(r.ALWAYS);break;case Xu:r.depthFunc(r.LESS);break;case ro:r.depthFunc(r.LEQUAL);break;case Ju:r.depthFunc(r.EQUAL);break;case Yu:r.depthFunc(r.GEQUAL);break;case Ku:r.depthFunc(r.GREATER);break;case Zu:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Ce=We}},setLocked:function(We){$=We},setClear:function(We){qe!==We&&(ue&&(We=1-We),r.clearDepth(We),qe=We)},reset:function(){$=!1,de=null,Ce=null,qe=null,ue=!1}}}function i(){let $=!1,ue=null,de=null,Ce=null,qe=null,We=null,At=null,rn=null,_n=null;return{setTest:function(Vt){$||(Vt?Le(r.STENCIL_TEST):ot(r.STENCIL_TEST))},setMask:function(Vt){ue!==Vt&&!$&&(r.stencilMask(Vt),ue=Vt)},setFunc:function(Vt,zn,_i){(de!==Vt||Ce!==zn||qe!==_i)&&(r.stencilFunc(Vt,zn,_i),de=Vt,Ce=zn,qe=_i)},setOp:function(Vt,zn,_i){(We!==Vt||At!==zn||rn!==_i)&&(r.stencilOp(Vt,zn,_i),We=Vt,At=zn,rn=_i)},setLocked:function(Vt){$=Vt},setClear:function(Vt){_n!==Vt&&(r.clearStencil(Vt),_n=Vt)},reset:function(){$=!1,ue=null,de=null,Ce=null,qe=null,We=null,At=null,rn=null,_n=null}}}const s=new t,o=new n,l=new i,u=new WeakMap,h=new WeakMap;let f={},d={},p=new WeakMap,g=[],v=null,A=!1,x=null,_=null,S=null,E=null,w=null,L=null,B=null,F=new Ye(0,0,0),D=0,T=!1,b=null,N=null,Y=null,K=null,Q=null;const oe=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ee=!1,Me=0;const G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(Me=parseFloat(/^WebGL (\d)/.exec(G)[1]),ee=Me>=1):G.indexOf("OpenGL ES")!==-1&&(Me=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),ee=Me>=2);let te=null,q={};const ce=r.getParameter(r.SCISSOR_BOX),Se=r.getParameter(r.VIEWPORT),Ge=new Jt().fromArray(ce),le=new Jt().fromArray(Se);function Re($,ue,de,Ce){const qe=new Uint8Array(4),We=r.createTexture();r.bindTexture($,We),r.texParameteri($,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri($,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let At=0;At<de;At++)$===r.TEXTURE_3D||$===r.TEXTURE_2D_ARRAY?r.texImage3D(ue,0,r.RGBA,1,1,Ce,0,r.RGBA,r.UNSIGNED_BYTE,qe):r.texImage2D(ue+At,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,qe);return We}const we={};we[r.TEXTURE_2D]=Re(r.TEXTURE_2D,r.TEXTURE_2D,1),we[r.TEXTURE_CUBE_MAP]=Re(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),we[r.TEXTURE_2D_ARRAY]=Re(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),we[r.TEXTURE_3D]=Re(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),l.setClear(0),Le(r.DEPTH_TEST),o.setFunc(ro),Ee(!1),Ie(yp),Le(r.CULL_FACE),X(ur);function Le($){f[$]!==!0&&(r.enable($),f[$]=!0)}function ot($){f[$]!==!1&&(r.disable($),f[$]=!1)}function Ut($,ue){return d[$]!==ue?(r.bindFramebuffer($,ue),d[$]=ue,$===r.DRAW_FRAMEBUFFER&&(d[r.FRAMEBUFFER]=ue),$===r.FRAMEBUFFER&&(d[r.DRAW_FRAMEBUFFER]=ue),!0):!1}function ft($,ue){let de=g,Ce=!1;if($){de=p.get(ue),de===void 0&&(de=[],p.set(ue,de));const qe=$.textures;if(de.length!==qe.length||de[0]!==r.COLOR_ATTACHMENT0){for(let We=0,At=qe.length;We<At;We++)de[We]=r.COLOR_ATTACHMENT0+We;de.length=qe.length,Ce=!0}}else de[0]!==r.BACK&&(de[0]=r.BACK,Ce=!0);Ce&&r.drawBuffers(de)}function xt($){return v!==$?(r.useProgram($),v=$,!0):!1}const kt={[ls]:r.FUNC_ADD,[G_]:r.FUNC_SUBTRACT,[k_]:r.FUNC_REVERSE_SUBTRACT};kt[z_]=r.MIN,kt[V_]=r.MAX;const pt={[W_]:r.ZERO,[X_]:r.ONE,[J_]:r.SRC_COLOR,[ku]:r.SRC_ALPHA,[j_]:r.SRC_ALPHA_SATURATE,[q_]:r.DST_COLOR,[K_]:r.DST_ALPHA,[Y_]:r.ONE_MINUS_SRC_COLOR,[zu]:r.ONE_MINUS_SRC_ALPHA,[Q_]:r.ONE_MINUS_DST_COLOR,[Z_]:r.ONE_MINUS_DST_ALPHA,[$_]:r.CONSTANT_COLOR,[ey]:r.ONE_MINUS_CONSTANT_COLOR,[ty]:r.CONSTANT_ALPHA,[ny]:r.ONE_MINUS_CONSTANT_ALPHA};function X($,ue,de,Ce,qe,We,At,rn,_n,Vt){if($===ur){A===!0&&(ot(r.BLEND),A=!1);return}if(A===!1&&(Le(r.BLEND),A=!0),$!==H_){if($!==x||Vt!==T){if((_!==ls||w!==ls)&&
vendor: 4,461 bytes, line 3803
3803(r.blendEquation(r.FUNC_ADD),_=ls,w=ls),Vt)switch($){case eo:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case xp:r.blendFunc(r.ONE,r.ONE);break;case Ap:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Mp:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",$);break}else switch($){case eo:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case xp:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Ap:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Mp:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",$);break}S=null,E=null,L=null,B=null,F.set(0,0,0),D=0,x=$,T=Vt}return}qe=qe||ue,We=We||de,At=At||Ce,(ue!==_||qe!==w)&&(r.blendEquationSeparate(kt[ue],kt[qe]),_=ue,w=qe),(de!==S||Ce!==E||We!==L||At!==B)&&(r.blendFuncSeparate(pt[de],pt[Ce],pt[We],pt[At]),S=de,E=Ce,L=We,B=At),(rn.equals(F)===!1||_n!==D)&&(r.blendColor(rn.r,rn.g,rn.b,_n),F.copy(rn),D=_n),x=$,T=!1}function tn($,ue){$.side===Oi?ot(r.CULL_FACE):Le(r.CULL_FACE);let de=$.side===ai;ue&&(de=!de),Ee(de),$.blending===eo&&$.transparent===!1?X(ur):X($.blending,$.blendEquation,$.blendSrc,$.blendDst,$.blendEquationAlpha,$.blendSrcAlpha,$.blendDstAlpha,$.blendColor,$.blendAlpha,$.premultipliedAlpha),o.setFunc($.depthFunc),o.setTest($.depthTest),o.setMask($.depthWrite),s.setMask($.colorWrite);const Ce=$.stencilWrite;l.setTest(Ce),Ce&&(l.setMask($.stencilWriteMask),l.setFunc($.stencilFunc,$.stencilRef,$.stencilFuncMask),l.setOp($.stencilFail,$.stencilZFail,$.stencilZPass)),ze($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),$.alphaToCoverage===!0?Le(r.SAMPLE_ALPHA_TO_COVERAGE):ot(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ee($){b!==$&&($?r.frontFace(r.CW):r.frontFace(r.CCW),b=$)}function Ie($){$!==U_?(Le(r.CULL_FACE),$!==N&&($===yp?r.cullFace(r.BACK):$===N_?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):ot(r.CULL_FACE),N=$}function Ae($){$!==Y&&(ee&&r.lineWidth($),Y=$)}function ze($,ue,de){$?(Le(r.POLYGON_OFFSET_FILL),(K!==ue||Q!==de)&&(r.polygonOffset(ue,de),K=ue,Q=de)):ot(r.POLYGON_OFFSET_FILL)}function ye($){$?Le(r.SCISSOR_TEST):ot(r.SCISSOR_TEST)}function O($){$===void 0&&($=r.TEXTURE0+oe-1),te!==$&&(r.activeTexture($),te=$)}function P($,ue,de){de===void 0&&(te===null?de=r.TEXTURE0+oe-1:de=te);let Ce=q[de];Ce===void 0&&(Ce={type:void 0,texture:void 0},q[de]=Ce),(Ce.type!==$||Ce.texture!==ue)&&(te!==de&&(r.activeTexture(de),te=de),r.bindTexture($,ue||we[$]),Ce.type=$,Ce.texture=ue)}function ne(){const $=q[te];$!==void 0&&$.type!==void 0&&(r.bindTexture($.type,null),$.type=void 0,$.texture=void 0)}function he(){try{r.compressedTexImage2D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function xe(){try{r.compressedTexImage3D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function ve(){try{r.texSubImage2D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function tt(){try{r.texSubImage3D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function Oe(){try{r.compressedTexSubImage2D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function Ke(){try{r.compressedTexSubImage3D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function Lt(){try{r.texStorage2D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function Fe(){try{r.texStorage3D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function $e(){try{r.texImage2D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function ut(){try{r.texImage3D(...arguments)}catch($){console.error("THREE.WebGLState:",$)}}function it($){Ge.equals($)===!1&&(r.scissor($.x,$.y,$.z,$.w),Ge.copy($))}function je($){le.equals($)===!1&&(r.viewport($.x,$.y,$.z,$.w),le.copy($))}function Et($,ue){let de=h.get(ue);de===void 0&&(de=new WeakMap,h.set(ue,de));let Ce=de.get($);Ce===void 0&&(Ce=r.getUniformBlockIndex(ue,$.name),de.set($,Ce))}function dt($,ue){const Ce=h.get(ue).get($);u.get(ue)!==Ce&&(r.uniformBlockBinding(ue,Ce,$.__bindingPointIndex),u.set(ue,Ce))}function Mt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor
vendor: 5,783 bytes, line 3803
3803(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),o.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={},te=null,q={},d={},p=new WeakMap,g=[],v=null,A=!1,x=null,_=null,S=null,E=null,w=null,L=null,B=null,F=new Ye(0,0,0),D=0,T=!1,b=null,N=null,Y=null,K=null,Q=null,Ge.set(0,0,r.canvas.width,r.canvas.height),le.set(0,0,r.canvas.width,r.canvas.height),s.reset(),o.reset(),l.reset()}return{buffers:{color:s,depth:o,stencil:l},enable:Le,disable:ot,bindFramebuffer:Ut,drawBuffers:ft,useProgram:xt,setBlending:X,setMaterial:tn,setFlipSided:Ee,setCullFace:Ie,setLineWidth:Ae,setPolygonOffset:ze,setScissorTest:ye,activeTexture:O,bindTexture:P,unbindTexture:ne,compressedTexImage2D:he,compressedTexImage3D:xe,texImage2D:$e,texImage3D:ut,updateUBOMapping:Et,uniformBlockBinding:dt,texStorage2D:Lt,texStorage3D:Fe,texSubImage2D:ve,texSubImage3D:tt,compressedTexSubImage2D:Oe,compressedTexSubImage3D:Ke,scissor:it,viewport:je,reset:Mt}}function oR(r,e,t,n,i,s,o){const l=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 be,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(O,P){return g?new OffscreenCanvas(O,P):xl("canvas")}function A(O,P,ne){let he=1;const xe=ye(O);if((xe.width>ne||xe.height>ne)&&(he=ne/Math.max(xe.width,xe.height)),he<1)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap||typeof VideoFrame<"u"&&O instanceof VideoFrame){const ve=Math.floor(he*xe.width),tt=Math.floor(he*xe.height);d===void 0&&(d=v(ve,tt));const Oe=P?v(ve,tt):d;return Oe.width=ve,Oe.height=tt,Oe.getContext("2d").drawImage(O,0,0,ve,tt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+xe.width+"x"+xe.height+") to ("+ve+"x"+tt+")."),Oe}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+xe.width+"x"+xe.height+")."),O;return O}function x(O){return O.generateMipmaps}function _(O){r.generateMipmap(O)}function S(O){return O.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:O.isWebGL3DRenderTarget?r.TEXTURE_3D:O.isWebGLArrayRenderTarget||O.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function E(O,P,ne,he,xe=!1){if(O!==null){if(r[O]!==void 0)return r[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let ve=P;if(P===r.RED&&(ne===r.FLOAT&&(ve=r.R32F),ne===r.HALF_FLOAT&&(ve=r.R16F),ne===r.UNSIGNED_BYTE&&(ve=r.R8)),P===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ve=r.R8UI),ne===r.UNSIGNED_SHORT&&(ve=r.R16UI),ne===r.UNSIGNED_INT&&(ve=r.R32UI),ne===r.BYTE&&(ve=r.R8I),ne===r.SHORT&&(ve=r.R16I),ne===r.INT&&(ve=r.R32I)),P===r.RG&&(ne===r.FLOAT&&(ve=r.RG32F),ne===r.HALF_FLOAT&&(ve=r.RG16F),ne===r.UNSIGNED_BYTE&&(ve=r.RG8)),P===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ve=r.RG8UI),ne===r.UNSIGNED_SHORT&&(ve=r.RG16UI),ne===r.UNSIGNED_INT&&(ve=r.RG32UI),ne===r.BYTE&&(ve=r.RG8I),ne===r.SHORT&&(ve=r.RG16I),ne===r.INT&&(ve=r.RG32I)),P===r.RGB_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ve=r.RGB8UI),ne===r.UNSIGNED_SHORT&&(ve=r.RGB16UI),ne===r.UNSIGNED_INT&&(ve=r.RGB32UI),ne===r.BYTE&&(ve=r.RGB8I),ne===r.SHORT&&(ve=r.RGB16I),ne===r.INT&&(ve=r.RGB32I)),P===r.RGBA_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ve=r.RGBA8UI),ne===r.UNSIGNED_SHORT&&(ve=r.RGBA16UI),ne===r.UNSIGNED_INT&&(ve=r.RGBA32UI),ne===r.BYTE&&(ve=r.RGBA8I),ne===r.SHORT&&(ve=r.RGBA16I),ne===r.INT&&(ve=r.RGBA32I)),P===r.RGB&&ne===r.UNSIGNED_INT_5_9_9_9_REV&&(ve=r.RGB9_E5),P===r.RGBA){const tt=xe?vl:Xt.getTransfer(he);ne===r.FLOAT&&(ve=r.RGBA32F),ne===r.HALF_FLOAT&&(ve=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(ve=tt===$t?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(ve=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(ve=r.RGB5_A1)}return(ve===r.R16F||ve===r.R32F||ve===r.RG16F||ve===r.RG32F||ve===r.RGBA16F||ve===r.RGBA32F)&&e.get("EXT_color_buffer_float"),ve}function w(O,P){let ne;return O?P===null||P===mr||P===oa?ne=r.DEPTH24_STENCIL8:P===dn?ne=r.DEPTH32F_STENCIL8:P===sa&&(ne=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):P===null||P===mr||P===oa?ne=r.DEPTH_COMPONENT24:P===dn?ne=r.DEPTH_COMPONENT32F:P===sa&&(ne=r.DEPTH_COMPONENT16),ne}function L(O,P){return x(O)===!0||O.isFramebufferTexture&&O.minFilter!==Nn&&O.minFilter!==Qt?Math.log2(Math.max(P.width,P.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?P.mipmaps.length:1}function B(O){const P=O.target;P.removeEventListener("dispose",B),D(P),P.isVideoTexture&&f.delete(P)}function F(O){const P=O.target;P.removeEventListener("dispose",F),b(P)}function D(O){const P=n.get(O);if(P.__webglInit===void 0)return;const ne=O.source,he=p.get(ne);if(he){const xe=he[P.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&T(O),Object.keys(he).length===0&&p.delete(ne)}n.remove(O)}function T(O){const P=n.get(O);r.deleteTexture(P.__webglTexture);const ne=O.source,he=p.get(ne);delete he[P.__cacheKey],o.memory.textures--}function b(O){const P=n.get(O);if(O.depthTexture&&(O.depthTexture.dispose(),n.remove(O.depthTexture)),O.isWebGLCubeRen
vendor: 4,852 bytes, line 3803
3803derTarget)for(let he=0;he<6;he++){if(Array.isArray(P.__webglFramebuffer[he]))for(let xe=0;xe<P.__webglFramebuffer[he].length;xe++)r.deleteFramebuffer(P.__webglFramebuffer[he][xe]);else r.deleteFramebuffer(P.__webglFramebuffer[he]);P.__webglDepthbuffer&&r.deleteRenderbuffer(P.__webglDepthbuffer[he])}else{if(Array.isArray(P.__webglFramebuffer))for(let he=0;he<P.__webglFramebuffer.length;he++)r.deleteFramebuffer(P.__webglFramebuffer[he]);else r.deleteFramebuffer(P.__webglFramebuffer);if(P.__webglDepthbuffer&&r.deleteRenderbuffer(P.__webglDepthbuffer),P.__webglMultisampledFramebuffer&&r.deleteFramebuffer(P.__webglMultisampledFramebuffer),P.__webglColorRenderbuffer)for(let he=0;he<P.__webglColorRenderbuffer.length;he++)P.__webglColorRenderbuffer[he]&&r.deleteRenderbuffer(P.__webglColorRenderbuffer[he]);P.__webglDepthRenderbuffer&&r.deleteRenderbuffer(P.__webglDepthRenderbuffer)}const ne=O.textures;for(let he=0,xe=ne.length;he<xe;he++){const ve=n.get(ne[he]);ve.__webglTexture&&(r.deleteTexture(ve.__webglTexture),o.memory.textures--),n.remove(ne[he])}n.remove(O)}let N=0;function Y(){N=0}function K(){const O=N;return O>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+i.maxTextures),N+=1,O}function Q(O){const P=[];return P.push(O.wrapS),P.push(O.wrapT),P.push(O.wrapR||0),P.push(O.magFilter),P.push(O.minFilter),P.push(O.anisotropy),P.push(O.internalFormat),P.push(O.format),P.push(O.type),P.push(O.generateMipmaps),P.push(O.premultiplyAlpha),P.push(O.flipY),P.push(O.unpackAlignment),P.push(O.colorSpace),P.join()}function oe(O,P){const ne=n.get(O);if(O.isVideoTexture&&Ae(O),O.isRenderTargetTexture===!1&&O.version>0&&ne.__version!==O.version){const he=O.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(ne,O,P);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+P)}function ee(O,P){const ne=n.get(O);if(O.version>0&&ne.__version!==O.version){le(ne,O,P);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+P)}function Me(O,P){const ne=n.get(O);if(O.version>0&&ne.__version!==O.version){le(ne,O,P);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+P)}function G(O,P){const ne=n.get(O);if(O.version>0&&ne.__version!==O.version){Re(ne,O,P);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+P)}const te={[ps]:r.REPEAT,[An]:r.CLAMP_TO_EDGE,[ra]:r.MIRRORED_REPEAT},q={[Nn]:r.NEAREST,[bh]:r.NEAREST_MIPMAP_NEAREST,[Ys]:r.NEAREST_MIPMAP_LINEAR,[Qt]:r.LINEAR,[$o]:r.LINEAR_MIPMAP_NEAREST,[Gi]:r.LINEAR_MIPMAP_LINEAR},ce={[yy]:r.NEVER,[wy]:r.ALWAYS,[xy]:r.LESS,[jp]:r.LEQUAL,[Ay]:r.EQUAL,[Ey]:r.GEQUAL,[My]:r.GREATER,[Sy]:r.NOTEQUAL};function Se(O,P){if(P.type===dn&&e.has("OES_texture_float_linear")===!1&&(P.magFilter===Qt||P.magFilter===$o||P.magFilter===Ys||P.magFilter===Gi||P.minFilter===Qt||P.minFilter===$o||P.minFilter===Ys||P.minFilter===Gi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(O,r.TEXTURE_WRAP_S,te[P.wrapS]),r.texParameteri(O,r.TEXTURE_WRAP_T,te[P.wrapT]),(O===r.TEXTURE_3D||O===r.TEXTURE_2D_ARRAY)&&r.texParameteri(O,r.TEXTURE_WRAP_R,te[P.wrapR]),r.texParameteri(O,r.TEXTURE_MAG_FILTER,q[P.magFilter]),r.texParameteri(O,r.TEXTURE_MIN_FILTER,q[P.minFilter]),P.compareFunction&&(r.texParameteri(O,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(O,r.TEXTURE_COMPARE_FUNC,ce[P.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(P.magFilter===Nn||P.minFilter!==Ys&&P.minFilter!==Gi||P.type===dn&&e.has("OES_texture_float_linear")===!1)return;if(P.anisotropy>1||n.get(P).__currentAnisotropy){const ne=e.get("EXT_texture_filter_anisotropic");r.texParameterf(O,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,i.getMaxAnisotropy())),n.get(P).__currentAnisotropy=P.anisotropy}}}function Ge(O,P){let ne=!1;O.__webglInit===void 0&&(O.__webglInit=!0,P.addEventListener("dispose",B));const he=P.source;let xe=p.get(he);xe===void 0&&(xe={},p.set(he,xe));const ve=Q(P);if(ve!==O.__cacheKey){xe[ve]===void 0&&(xe[ve]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),xe[ve].usedTimes++;const tt=xe[O.__cacheKey];tt!==void 0&&(xe[O.__cacheKey].usedTimes--,tt.usedTimes===0&&T(P)),O.__cacheKey=ve,O.__webglTexture=xe[ve].texture}return ne}function le(O,P,ne){let he=r.TEXTURE_2D;(P.isDataArrayTexture||P.isCompressedArrayTexture)&&(he=r.TEXTURE_2D_ARRAY),P.isData3DTexture&&(he=r.TEXTURE_3D);const xe=Ge(O,P),ve=P.source;t.bindTexture(he,O.__webglTexture,r.TEXTURE0+ne);const tt=n.get(ve);if(ve.version!==tt.__version||xe===!0){t.activeTexture(r.TEXTURE0+ne);
vendor: 22,002 bytes, line 3803
3803const Oe=Xt.getPrimaries(Xt.workingColorSpace),Ke=P.colorSpace===Pr?null:Xt.getPrimaries(P.colorSpace),Lt=P.colorSpace===Pr||Oe===Ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Lt);let Fe=A(P.image,!1,i.maxTextureSize);Fe=ze(P,Fe);const $e=s.convert(P.format,P.colorSpace),ut=s.convert(P.type);let it=E(P.internalFormat,$e,ut,P.colorSpace,P.isVideoTexture);Se(he,P);let je;const Et=P.mipmaps,dt=P.isVideoTexture!==!0,Mt=tt.__version===void 0||xe===!0,$=ve.dataReady,ue=L(P,Fe);if(P.isDepthTexture)it=w(P.format===la,P.type),Mt&&(dt?t.texStorage2D(r.TEXTURE_2D,1,it,Fe.width,Fe.height):t.texImage2D(r.TEXTURE_2D,0,it,Fe.width,Fe.height,0,$e,ut,null));else if(P.isDataTexture)if(Et.length>0){dt&&Mt&&t.texStorage2D(r.TEXTURE_2D,ue,it,Et[0].width,Et[0].height);for(let de=0,Ce=Et.length;de<Ce;de++)je=Et[de],dt?$&&t.texSubImage2D(r.TEXTURE_2D,de,0,0,je.width,je.height,$e,ut,je.data):t.texImage2D(r.TEXTURE_2D,de,it,je.width,je.height,0,$e,ut,je.data);P.generateMipmaps=!1}else dt?(Mt&&t.texStorage2D(r.TEXTURE_2D,ue,it,Fe.width,Fe.height),$&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Fe.width,Fe.height,$e,ut,Fe.data)):t.texImage2D(r.TEXTURE_2D,0,it,Fe.width,Fe.height,0,$e,ut,Fe.data);else if(P.isCompressedTexture)if(P.isCompressedArrayTexture){dt&&Mt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ue,it,Et[0].width,Et[0].height,Fe.depth);for(let de=0,Ce=Et.length;de<Ce;de++)if(je=Et[de],P.format!==Mn)if($e!==null)if(dt){if($)if(P.layerUpdates.size>0){const qe=Pp(je.width,je.height,P.format,P.type);for(const We of P.layerUpdates){const At=je.data.subarray(We*qe/je.data.BYTES_PER_ELEMENT,(We+1)*qe/je.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,de,0,0,We,je.width,je.height,1,$e,At)}P.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,de,0,0,0,je.width,je.height,Fe.depth,$e,je.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,de,it,je.width,je.height,Fe.depth,0,je.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else dt?$&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,de,0,0,0,je.width,je.height,Fe.depth,$e,ut,je.data):t.texImage3D(r.TEXTURE_2D_ARRAY,de,it,je.width,je.height,Fe.depth,0,$e,ut,je.data)}else{dt&&Mt&&t.texStorage2D(r.TEXTURE_2D,ue,it,Et[0].width,Et[0].height);for(let de=0,Ce=Et.length;de<Ce;de++)je=Et[de],P.format!==Mn?$e!==null?dt?$&&t.compressedTexSubImage2D(r.TEXTURE_2D,de,0,0,je.width,je.height,$e,je.data):t.compressedTexImage2D(r.TEXTURE_2D,de,it,je.width,je.height,0,je.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):dt?$&&t.texSubImage2D(r.TEXTURE_2D,de,0,0,je.width,je.height,$e,ut,je.data):t.texImage2D(r.TEXTURE_2D,de,it,je.width,je.height,0,$e,ut,je.data)}else if(P.isDataArrayTexture)if(dt){if(Mt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ue,it,Fe.width,Fe.height,Fe.depth),$)if(P.layerUpdates.size>0){const de=Pp(Fe.width,Fe.height,P.format,P.type);for(const Ce of P.layerUpdates){const qe=Fe.data.subarray(Ce*de/Fe.data.BYTES_PER_ELEMENT,(Ce+1)*de/Fe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Ce,Fe.width,Fe.height,1,$e,ut,qe)}P.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Fe.width,Fe.height,Fe.depth,$e,ut,Fe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,it,Fe.width,Fe.height,Fe.depth,0,$e,ut,Fe.data);else if(P.isData3DTexture)dt?(Mt&&t.texStorage3D(r.TEXTURE_3D,ue,it,Fe.width,Fe.height,Fe.depth),$&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Fe.width,Fe.height,Fe.depth,$e,ut,Fe.data)):t.texImage3D(r.TEXTURE_3D,0,it,Fe.width,Fe.height,Fe.depth,0,$e,ut,Fe.data);else if(P.isFramebufferTexture){if(Mt)if(dt)t.texStorage2D(r.TEXTURE_2D,ue,it,Fe.width,Fe.height);else{let de=Fe.width,Ce=Fe.height;for(let qe=0;qe<ue;qe++)t.texImage2D(r.TEXTURE_2D,qe,it,de,Ce,0,$e,ut,null),de>>=1,Ce>>=1}}else if(Et.length>0){if(dt&&Mt){const de=ye(Et[0]);t.texStorage2D(r.TEXTURE_2D,ue,it,de.width,de.height)}for(let de=0,Ce=Et.length;de<Ce;de++)je=Et[de],dt?$&&t.texSubImage2D(r.TEXTURE_2D,de,0,0,$e,ut,je):t.texImage2D(r.TEXTURE_2D,de,it,$e,ut,je);P.generateMipmaps=!1}else if(dt){if(Mt){const de=ye(Fe);t.texStorage2D(r.TEXTURE_2D,ue,it,de.width,de.height)}$&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$e,ut,Fe)}else t.texImage2D(r.TEXTURE_2D,0,it,$e,ut,Fe);x(P)&&_(he),tt.__version=ve.version,P.onUpdate&&P.onUpdate(P)}O.__version=P.version}function Re(O,P,ne){if(P.image.length!==6)return;const he=Ge(O,P),xe=P.source;t.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+ne);const ve=n.get(xe);if(xe.version!==ve.__version||he===!0){t.activeTexture(r.TEXTURE0+ne);const tt=Xt.getPrimaries(Xt.workingColorSpace),Oe=P.colorSpace===Pr?null:Xt.getPrimaries(P.colorSpace),Ke=P.colorSpace===Pr||tt===Oe?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ke);const Lt=P.isCompressedTexture||P.image[0].isCompressedTexture,Fe=P.image[0]&&P.image[0].isDataTexture,$e=[];for(let Ce=0;Ce<6;Ce++)!Lt&&!Fe?$e[Ce]=A(P.image[Ce],!0,i.maxCubemapSize):$e[Ce]=Fe?P.image[Ce].image:P.image[Ce],$e[Ce]=ze(P,$e[Ce]);const ut=$e[0],it=s.convert(P.format,P.colorSpace),je=s.convert(P.type),Et=E(P.internalFormat,it,je,P.colorSpace),dt=P.isVideoTexture!==!0,Mt=ve.__version===void 0||he===!0,$=xe.dataReady;let ue=L(P,ut);Se(r.TEXTURE_CUBE_MAP,P);let de;if(Lt){dt&&Mt&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ue,Et,ut.width,ut.height);for(let Ce=0;Ce<6;Ce++){de=$e[Ce].mipmaps;for(let qe=0;qe<de.length;qe++){const We=de[qe];P.format!==Mn?it!==null?dt?$&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe,0,0,We.width,We.height,it,We.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe,Et,We.width,We.height,0,We.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):dt?$&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe,0,0,We.width,We.height,it,je,We.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe,Et,We.width,We.height,0,it,je,We.data)}}}else{if(de=P.mipmaps,dt&&Mt){de.length>0&&ue++;const Ce=ye($e[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ue,Et,Ce.width,Ce.height)}for(let Ce=0;Ce<6;Ce++)if(Fe){dt?$&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,$e[Ce].width,$e[Ce].height,it,je,$e[Ce].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Et,$e[Ce].width,$e[Ce].height,0,it,je,$e[Ce].data);for(let qe=0;qe<de.length;qe++){const At=de[qe].image[Ce].image;dt?$&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe+1,0,0,At.width,At.height,it,je,At.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe+1,Et,At.width,At.height,0,it,je,At.data)}}else{dt?$&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,it,je,$e[Ce]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Et,it,je,$e[Ce]);for(let qe=0;qe<de.length;qe++){const We=de[qe];dt?$&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe+1,0,0,it,je,We.image[Ce]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,qe+1,Et,it,je,We.image[Ce])}}}x(P)&&_(r.TEXTURE_CUBE_MAP),ve.__version=xe.version,P.onUpdate&&P.onUpdate(P)}O.__version=P.version}function we(O,P,ne,he,xe,ve){const tt=s.convert(ne.format,ne.colorSpace),Oe=s.convert(ne.type),Ke=E(ne.internalFormat,tt,Oe,ne.colorSpace),Lt=n.get(P),Fe=n.get(ne);if(Fe.__renderTarget=P,!Lt.__hasExternalTextures){const $e=Math.max(1,P.width>>ve),ut=Math.max(1,P.height>>ve);xe===r.TEXTURE_3D||xe===r.TEXTURE_2D_ARRAY?t.texImage3D(xe,ve,Ke,$e,ut,P.depth,0,tt,Oe,null):t.texImage2D(xe,ve,Ke,$e,ut,0,tt,Oe,null)}t.bindFramebuffer(r.FRAMEBUFFER,O),Ie(P)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,he,xe,Fe.__webglTexture,0,Ee(P)):(xe===r.TEXTURE_2D||xe>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,he,xe,Fe.__webglTexture,ve),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Le(O,P,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,O),P.depthBuffer){const he=P.depthTexture,xe=he&&he.isDepthTexture?he.type:null,ve=w(P.stencilBuffer,xe),tt=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Oe=Ee(P);Ie(P)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Oe,ve,P.width,P.height):ne?r.renderbufferStorageMultisample(r.RENDERBUFFER,Oe,ve,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,ve,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,tt,r.RENDERBUFFER,O)}else{const he=P.textures;for(let xe=0;xe<he.length;xe++){const ve=he[xe],tt=s.convert(ve.format,ve.colorSpace),Oe=s.convert(ve.type),Ke=E(ve.internalFormat,tt,Oe,ve.colorSpace),Lt=Ee(P);ne&&Ie(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Lt,Ke,P.width,P.height):Ie(P)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Lt,Ke,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,Ke,P.width,P.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function ot(O,P){if(P&&P.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,O),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const he=n.get(P.depthTexture);he.__renderTarget=P,(!he.__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),oe(P.depthTexture,0);const xe=he.__webglTexture,ve=Ee(P);if(P.depthTexture.format===aa)Ie(P)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,xe,0,ve):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,xe,0);else if(P.depthTexture.format===la)Ie(P)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,xe,0,ve):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,xe,0);else throw new Error("Unknown depthTexture format")}function Ut(O){const P=n.get(O),ne=O.isWebGLCubeRenderTarget===!0;if(P.__boundDepthTexture!==O.depthTexture){const he=O.depthTexture;if(P.__depthDisposeCallback&&P.__depthDisposeCallback(),he){const xe=()=>{delete P.__boundDepthTexture,delete P.__depthDisposeCallback,he.removeEventListener("dispose",xe)};he.addEventListener("dispose",xe),P.__depthDisposeCallback=xe}P.__boundDepthTexture=he}if(O.depthTexture&&!P.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");ot(P.__webglFramebuffer,O)}else if(ne){P.__webglDepthbuffer=[];for(let he=0;he<6;he++)if(t.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer[he]),P.__webglDepthbuffer[he]===void 0)P.__webglDepthbuffer[he]=r.createRenderbuffer(),Le(P.__webglDepthbuffer[he],O,!1);else{const xe=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ve=P.__webglDepthbuffer[he];r.bindRenderbuffer(r.RENDERBUFFER,ve),r.framebufferRenderbuffer(r.FRAMEBUFFER,xe,r.RENDERBUFFER,ve)}}else if(t.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer),P.__webglDepthbuffer===void 0)P.__webglDepthbuffer=r.createRenderbuffer(),Le(P.__webglDepthbuffer,O,!1);else{const he=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,xe=P.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,xe),r.framebufferRenderbuffer(r.FRAMEBUFFER,he,r.RENDERBUFFER,xe)}t.bindFramebuffer(r.FRAMEBUFFER,null)}function ft(O,P,ne){const he=n.get(O);P!==void 0&&we(he.__webglFramebuffer,O,O.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&Ut(O)}function xt(O){const P=O.texture,ne=n.get(O),he=n.get(P);O.addEventListener("dispose",F);const xe=O.textures,ve=O.isWebGLCubeRenderTarget===!0,tt=xe.length>1;if(tt||(he.__webglTexture===void 0&&(he.__webglTexture=r.createTexture()),he.__version=P.version,o.memory.textures++),ve){ne.__webglFramebuffer=[];for(let Oe=0;Oe<6;Oe++)if(P.mipmaps&&P.mipmaps.length>0){ne.__webglFramebuffer[Oe]=[];for(let Ke=0;Ke<P.mipmaps.length;Ke++)ne.__webglFramebuffer[Oe][Ke]=r.createFramebuffer()}else ne.__webglFramebuffer[Oe]=r.createFramebuffer()}else{if(P.mipmaps&&P.mipmaps.length>0){ne.__webglFramebuffer=[];for(let Oe=0;Oe<P.mipmaps.length;Oe++)ne.__webglFramebuffer[Oe]=r.createFramebuffer()}else ne.__webglFramebuffer=r.createFramebuffer();if(tt)for(let Oe=0,Ke=xe.length;Oe<Ke;Oe++){const Lt=n.get(xe[Oe]);Lt.__webglTexture===void 0&&(Lt.__webglTexture=r.createTexture(),o.memory.textures++)}if(O.samples>0&&Ie(O)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Oe=0;Oe<xe.length;Oe++){const Ke=xe[Oe];ne.__webglColorRenderbuffer[Oe]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ne.__webglColorRenderbuffer[Oe]);const Lt=s.convert(Ke.format,Ke.colorSpace),Fe=s.convert(Ke.type),$e=E(Ke.internalFormat,Lt,Fe,Ke.colorSpace,O.isXRRenderTarget===!0),ut=Ee(O);r.renderbufferStorageMultisample(r.RENDERBUFFER,ut,$e,O.width,O.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Oe,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Oe])}r.bindRenderbuffer(r.RENDERBUFFER,null),O.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),Le(ne.__webglDepthRenderbuffer,O,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ve){t.bindTexture(r.TEXTURE_CUBE_MAP,he.__webglTexture),Se(r.TEXTURE_CUBE_MAP,P);for(let Oe=0;Oe<6;Oe++)if(P.mipmaps&&P.mipmaps.length>0)for(let Ke=0;Ke<P.mipmaps.length;Ke++)we(ne.__webglFramebuffer[Oe][Ke],O,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,Ke);else we(ne.__webglFramebuffer[Oe],O,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0);x(P)&&_(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(tt){for(let Oe=0,Ke=xe.length;Oe<Ke;Oe++){const Lt=xe[Oe],Fe=n.get(Lt);t.bindTexture(r.TEXTURE_2D,Fe.__webglTexture),Se(r.TEXTURE_2D,Lt),we(ne.__webglFramebuffer,O,Lt,r.COLOR_ATTACHMENT0+Oe,r.TEXTURE_2D,0),x(Lt)&&_(r.TEXTURE_2D)}t.unbindTexture()}else{let Oe=r.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(Oe=O.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Oe,he.__webglTexture),Se(Oe,P),P.mipmaps&&P.mipmaps.length>0)for(let Ke=0;Ke<P.mipmaps.length;Ke++)we(ne.__webglFramebuffer[Ke],O,P,r.COLOR_ATTACHMENT0,Oe,Ke);else we(ne.__webglFramebuffer,O,P,r.COLOR_ATTACHMENT0,Oe,0);x(P)&&_(Oe),t.unbindTexture()}O.depthBuffer&&Ut(O)}function kt(O){const P=O.textures;for(let ne=0,he=P.length;ne<he;ne++){const xe=P[ne];if(x(xe)){const ve=S(O),tt=n.get(xe).__webglTexture;t.bindTexture(ve,tt),_(ve),t.unbindTexture()}}}const pt=[],X=[];function tn(O){if(O.samples>0){if(Ie(O)===!1){const P=O.textures,ne=O.width,he=O.height;let xe=r.COLOR_BUFFER_BIT;const ve=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,tt=n.get(O),Oe=P.length>1;if(Oe)for(let Ke=0;Ke<P.length;Ke++)t.bindFramebuffer(r.FRAMEBUFFER,tt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ke,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,tt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ke,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,tt.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,tt.__webglFramebuffer);for(let Ke=0;Ke<P.length;Ke++){if(O.resolveDepthBuffer&&(O.depthBuffer&&(xe|=r.DEPTH_BUFFER_BIT),O.stencilBuffer&&O.resolveStencilBuffer&&(xe|=r.STENCIL_BUFFER_BIT)),Oe){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,tt.__webglColorRenderbuffer[Ke]);const Lt=n.get(P[Ke]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Lt,0)}r.blitFramebuffer(0,0,ne,he,0,0,ne,he,xe,r.NEAREST),u===!0&&(pt.length=0,X.length=0,pt.push(r.COLOR_ATTACHMENT0+Ke),O.depthBuffer&&O.resolveDepthBuffer===!1&&(pt.push(ve),X.push(ve),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,X)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,pt))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Oe)for(let Ke=0;Ke<P.length;Ke++){t.bindFramebuffer(r.FRAMEBUFFER,tt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ke,r.RENDERBUFFER,tt.__webglColorRenderbuffer[Ke]);const Lt=n.get(P[Ke]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,tt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ke,r.TEXTURE_2D,Lt,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,tt.__webglMultisampledFramebuffer)}else if(O.depthBuffer&&O.resolveDepthBuffer===!1&&u){const P=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[P])}}}function Ee(O){return Math.min(i.maxSamples,O.samples)}function Ie(O){const P=n.get(O);return O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function Ae(O){const P=o.render.frame;f.get(O)!==P&&(f.set(O,P),O.update())}function ze(O,P){const ne=O.colorSpace,he=O.format,xe=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||ne!==gr&&ne!==Pr&&(Xt.getTransfer(ne)===$t?(he!==Mn||xe!==gi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),P}function ye(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(h.width=O.naturalWidth||O.width,h.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(h.width=O.displayWidth,h.height=O.displayHeight):(h.width=O.width,h.height=O.height),h}this.allocateTextureUnit=K,this.resetTextureUnits=Y,this.setTexture2D=oe,this.setTexture2DArray=ee,this.setTexture3D=Me,this.setTextureCube=G,this.rebindTextures=ft,this.setupRenderTarget=xt,this.updateRenderTargetMipmap=kt,this.updateMultisampleRenderTarget=tn,this.setupDepthRenderbuffer=Ut,this.setupFrameBufferTexture=we,this.useMultisampledRTT=Ie}function Ix(r,e){function t(n,i=Pr){let s;const o=Xt.getTransfer(i);if(n===gi)return r.UNSIGNED_BYTE;if(n===Bh)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Ph)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Vp)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Rh)return r.BYTE;if(n===Ih)return r.SHORT;if(n===sa)return r.UNSIGNED_SHORT;if(n===Bl)return r.INT;if(n===mr)return r.UNSIGNED_INT;if(n===dn)return r.FLOAT;if(n===Un)return r.HALF_FLOAT;if(n===Wp)return r.ALPHA;if(n===Xp)return r.RGB;if(n===Mn)return r.RGBA;if(n===Jp)return r.LUMINANCE;if(n===Yp)return r.LUMINANCE_ALPHA;if(n===aa)return r.DEPTH_COMPONENT;if(n===la)return r.DEPTH_STENCIL;if(n===Pl)return r.RED;if(n===Dl)return r.RED_INTEGER;if(n===Kp)return r.RG;if(n===Dh)return r.RG_INTEGER;if(n===Lh)return r.RGBA_INTEGER;if(n===ol||n===al||n===ll||n===cl)if(o===$t)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===ol)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===al)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ll)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===cl)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===al)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ll)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===cl)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===qu||n===Qu||n===ju||n===$u)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===qu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Qu)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ju)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$u)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===eh||n===th||n===nh)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===eh||n===th)return o===$t?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===nh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ih||n===rh||n===sh||n===oh||n===ah||n===lh||n===ch||n===uh||n===hh||n===fh||n===dh||n===ph||n===mh||n===gh)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ih)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===rh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===sh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===oh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ah)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===lh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ch)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===uh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===hh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===fh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===dh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ph)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===gh)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===ul||n===vh||n===_h)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===ul)return o===$t?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===vh)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===_h)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Zp||n===yh||n===xh||n===Ah)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===ul)return s.COMPRESSED_RED_RGT
vendor: 9,251 bytes, lines 3803-3827
3803C1_EXT;if(n===yh)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ah)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===oa?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const aR=` 3804void main() { 3805 3806 gl_Position = vec4( position, 1.0 ); 3807 3808}`,lR=` 3809uniform sampler2DArray depthColor; 3810uniform float depthWidth; 3811uniform float depthHeight; 3812 3813void main() { 3814 3815 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3816 3817 if ( coord.x >= 1.0 ) { 3818 3819 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3820 3821 } else { 3822 3823 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3824 3825 } 3826 3827}`;class cR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new jt,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new vi({vertexShader:aR,fragmentShader:lR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new un(new _s(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class uR extends vr{constructor(e,t){super();const n=this;let i=null,s=1,o=null,l="local-floor",u=1,h=null,f=null,d=null,p=null,g=null,v=null;const A=new cR,x=t.getContextAttributes();let _=null,S=null;const E=[],w=[],L=new be;let B=null;const F=new bn;F.viewport=new Jt;const D=new bn;D.viewport=new Jt;const T=[F,D],b=new xx;let N=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Re=E[le];return Re===void 0&&(Re=new Ou,E[le]=Re),Re.getTargetRaySpace()},this.getControllerGrip=function(le){let Re=E[le];return Re===void 0&&(Re=new Ou,E[le]=Re),Re.getGripSpace()},this.getHand=function(le){let Re=E[le];return Re===void 0&&(Re=new Ou,E[le]=Re),Re.getHandSpace()};function K(le){const Re=w.indexOf(le.inputSource);if(Re===-1)return;const we=E[Re];we!==void 0&&(we.update(le.inputSource,le.frame,h||o),we.dispatchEvent({type:le.type,data:le.inputSource}))}function Q(){i.removeEventListener("select",K),i.removeEventListener("selectstart",K),i.removeEventListener("selectend",K),i.removeEventListener("squeeze",K),i.removeEventListener("squeezestart",K),i.removeEventListener("squeezeend",K),i.removeEventListener("end",Q),i.removeEventListener("inputsourceschange",oe);for(let le=0;le<E.length;le++){const Re=w[le];Re!==null&&(w[le]=null,E[le].disconnect(Re))}N=null,Y=null,A.reset(),e.setRenderTarget(_),g=null,p=null,d=null,i=null,S=null,Ge.stop(),n.isPresenting=!1,e.setPixelRatio(B),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){s=le,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){l=le,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||o},this.setReferenceSpace=function(le){h=le},this.getBaseLayer=function(){return p!==null?p:g},this.getBinding=function(){return d},this.getFrame=function(){return v},this.getSession=function(){return i},this.setSession=async function(le){if(i=le,i!==null){if(_=e.getRenderTarget(),i.addEventListener("select",K),i.addEventListener("selectstart",K),i.addEventListener("selectend",K),i.addEventListener("squeeze",K),i.addEventListener("squeezestart",K),i.addEventListener("squeezeend",K),i.addEventListener("end",Q),i.addEventListener("inputsourceschange",oe),x.xrCompatible!==!0&&await t.makeXRCompatible(),B=e.getPixelRatio(),e.getSize(L),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let we=null,Le=null,ot=null;x.depth&&(ot=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,we=x.stencil?la:aa,Le=x.stencil?oa:mr);const Ut={colorFormat:t.RGBA8,depthFormat:ot,scaleFactor:s};d=new XRWebGLBinding(i,t),p=d.createProjectionLayer(Ut),i.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),S=new ki(p.textureWidth,p.textureHeight,{format:Mn,type:gi,depthTexture:new lm(p.textureWidth,p.textureHeight,Le,void 0,void 0,void 0,void 0,void 0,void 0,we),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const we={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,we),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),S=new ki(g.framebufferWidth,g.framebufferHeight,{format:Mn,type:gi,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(u),h=null,o=await i.requestReferenceSpace(l),Ge.setContext(i),Ge.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return A.getDepthTexture()};function oe(le){for(let Re=0;Re<le.removed.length;Re++){const we=le.removed[Re],Le=w.indexOf(we);Le>=0&&(w[Le]=null,E[Le].disconnect(we))}for(let Re=0;Re<le.added.length;Re++){const we=le.added[Re];let Le=w.indexOf(we);if(Le===-1){for(let Ut=0;Ut<E.length;Ut++)if(Ut>=w.length){w.push(we),Le=Ut;break}else if(w[Ut]===null){w[Ut]=we,Le=Ut;break}if(Le===-1)break}const ot=E[Le];ot&&ot.connect(we)}}const ee=new H,Me=new H;function G(le,Re,we){ee.setFromMatrixPosition(Re.matrixWorld),Me.setFromMatrixPosition(we.matrixWorld);const Le=ee.distanceTo(Me),ot=Re.projectionMatrix.elements,Ut=we.projectionMatrix.elements,ft=ot[14]/(ot[10]-1),xt=ot[14]/(ot[10]+1),kt=(ot[9]+1)/ot[5],pt=(ot[9]-1)/ot[5],X=(ot[8]-1)/ot[0],tn=(Ut[8]+1)/Ut[0],Ee=ft*X,Ie=ft*tn,Ae=Le/(-X+tn),ze=Ae*-X;if(Re.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(ze),le.translateZ(Ae),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),ot[10]===-1)le.projectionMatrix.copy(Re.projectionMatrix),le.projectionMatrixInverse.copy(Re.projectionMatrixInverse);else{const ye=ft+Ae,O=xt+Ae,P=Ee-ze,ne=Ie+(Le-ze),he=kt*xt/O*ye,xe=pt*xt/O*ye;le.projectionMatrix.makePerspective(P,ne,he,xe,ye,O),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function te(le,Re){Re===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Re.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Re=le.near,we=le.far;A.texture!==null&&(A.depthNear>0&&(Re=A.depthNear),A.depthFar>0&&(we=A.depthFar)),b.near=D.near=F.near=Re,b.far=D.far=F.far=we,(N!==b.near||Y!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),N=b.near,Y=b.far),F.layers.mask=le.layers.mask|2,D.layers.mask=le.layers.mask|4,b.layers.mask=F.layers.mask|D.layers.mask;const Le=le.parent,ot=b.cameras;te(b,Le);for(let Ut=0;Ut<ot.length;Ut++)te(ot[Ut],Le);ot.length===2?G(b,F,D):b.projectionMatrix.copy(F.projectionMatrix),q(le,b,Le)};function q(le,Re,we){we===null?le.matrix.copy(Re.matrixWorld):(le.matrix.copy(we.matrixWorld),le.matrix.invert(),le.matrix.multiply(Re.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(Re.projectionMatrix),le.projectionMatrixInverse.copy(Re.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=ha*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return b},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 A.texture!==null},this.getDepthSensingMesh=function(){return A.getMesh(b)};let ce=null;function Se(le,Re){if(f=Re.getViewerPose(h||o),v=Re,f!==null){const we=f.views;g!==null&&(e.setRenderTargetFramebuffer(S,g.framebuffer),e.setRenderTarget(S));let Le=!1;we.length!==b.cameras.length&&(b.cameras.length=0,Le=!0);for(let ft=0;ft<we.length;ft++){const xt=we[ft];let kt=null;if(g!==null)kt=g.getViewport(xt);else{const X=d.getViewSubImage(p,xt);kt=X.viewport,ft===0&&(e.setRenderTargetTextures(S,X.colorTexture,X.depthStencilTexture),e.setRenderTarget(S))}let pt=T[ft];pt===void 0&&(pt=new bn,pt.layers.enable(ft),pt.viewport=new Jt,T[ft]=pt),pt.matrix.fromArray(xt.transform.matrix),pt.matrix.decompose(pt.position,pt.quaternion,pt.scale),pt.projectionMatrix.fromArray(xt.projectionMatrix),pt.projectionMatrixInverse.copy(pt.projectionMatrix).invert(),pt.viewport.set(kt.x,kt.y,kt.width,kt.height),ft===0&&(b.matrix.copy(pt.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),Le===!0&&b.cameras.push(pt)}const ot=i.enabledFeatures;if(ot&&ot.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&d){const ft
vendor: 13,407 bytes, line 3827
3827=d.getDepthInformation(we[0]);ft&&ft.isValid&&ft.texture&&A.init(e,ft,i.renderState)}}for(let we=0;we<E.length;we++){const Le=w[we],ot=E[we];Le!==null&&ot!==void 0&&ot.update(Le,Re,h||o)}ce&&ce(le,Re),Re.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Re}),v=null}const Ge=new wx;Ge.setAnimationLoop(Se),this.setAnimationLoop=function(le){ce=le},this.dispose=function(){}}}const zs=new Ti,hR=new gt;function fR(r,e){function t(x,_){x.matrixAutoUpdate===!0&&x.updateMatrix(),_.value.copy(x.matrix)}function n(x,_){_.color.getRGB(x.fogColor.value,By(r)),_.isFog?(x.fogNear.value=_.near,x.fogFar.value=_.far):_.isFogExp2&&(x.fogDensity.value=_.density)}function i(x,_,S,E,w){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(x,_):_.isMeshToonMaterial?(s(x,_),d(x,_)):_.isMeshPhongMaterial?(s(x,_),f(x,_)):_.isMeshStandardMaterial?(s(x,_),p(x,_),_.isMeshPhysicalMaterial&&g(x,_,w)):_.isMeshMatcapMaterial?(s(x,_),v(x,_)):_.isMeshDepthMaterial?s(x,_):_.isMeshDistanceMaterial?(s(x,_),A(x,_)):_.isMeshNormalMaterial?s(x,_):_.isLineBasicMaterial?(o(x,_),_.isLineDashedMaterial&&l(x,_)):_.isPointsMaterial?u(x,_,S,E):_.isSpriteMaterial?h(x,_):_.isShadowMaterial?(x.color.value.copy(_.color),x.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(x,_){x.opacity.value=_.opacity,_.color&&x.diffuse.value.copy(_.color),_.emissive&&x.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(x.map.value=_.map,t(_.map,x.mapTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.bumpMap&&(x.bumpMap.value=_.bumpMap,t(_.bumpMap,x.bumpMapTransform),x.bumpScale.value=_.bumpScale,_.side===ai&&(x.bumpScale.value*=-1)),_.normalMap&&(x.normalMap.value=_.normalMap,t(_.normalMap,x.normalMapTransform),x.normalScale.value.copy(_.normalScale),_.side===ai&&x.normalScale.value.negate()),_.displacementMap&&(x.displacementMap.value=_.displacementMap,t(_.displacementMap,x.displacementMapTransform),x.displacementScale.value=_.displacementScale,x.displacementBias.value=_.displacementBias),_.emissiveMap&&(x.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,x.emissiveMapTransform)),_.specularMap&&(x.specularMap.value=_.specularMap,t(_.specularMap,x.specularMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest);const S=e.get(_),E=S.envMap,w=S.envMapRotation;E&&(x.envMap.value=E,zs.copy(w),zs.x*=-1,zs.y*=-1,zs.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(zs.y*=-1,zs.z*=-1),x.envMapRotation.value.setFromMatrix4(hR.makeRotationFromEuler(zs)),x.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=_.reflectivity,x.ior.value=_.ior,x.refractionRatio.value=_.refractionRatio),_.lightMap&&(x.lightMap.value=_.lightMap,x.lightMapIntensity.value=_.lightMapIntensity,t(_.lightMap,x.lightMapTransform)),_.aoMap&&(x.aoMap.value=_.aoMap,x.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,x.aoMapTransform))}function o(x,_){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,_.map&&(x.map.value=_.map,t(_.map,x.mapTransform))}function l(x,_){x.dashSize.value=_.dashSize,x.totalSize.value=_.dashSize+_.gapSize,x.scale.value=_.scale}function u(x,_,S,E){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,x.size.value=_.size*S,x.scale.value=E*.5,_.map&&(x.map.value=_.map,t(_.map,x.uvTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest)}function h(x,_){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,x.rotation.value=_.rotation,_.map&&(x.map.value=_.map,t(_.map,x.mapTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest)}function f(x,_){x.specular.value.copy(_.specular),x.shininess.value=Math.max(_.shininess,1e-4)}function d(x,_){_.gradientMap&&(x.gradientMap.value=_.gradientMap)}function p(x,_){x.metalness.value=_.metalness,_.metalnessMap&&(x.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,x.metalnessMapTransform)),x.roughness.value=_.roughness,_.roughnessMap&&(x.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,x.roughnessMapTransform)),_.envMap&&(x.envMapIntensity.value=_.envMapIntensity)}function g(x,_,S){x.ior.value=_.ior,_.sheen>0&&(x.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),x.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(x.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,x.sheenColorMapTransform)),_.sheenRoughnessMap&&(x.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,x.sheenRoughnessMapTransform))),_.clearcoat>0&&(x.clearcoat.value=_.clearcoat,x.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(x.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,x.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(x.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===ai&&x.clearcoatNormalScale.value.negate())),_.dispersion>0&&(x.dispersion.value=_.dispersion),_.iridescence>0&&(x.iridescence.value=_.iridescence,x.iridescenceIOR.value=_.iridescenceIOR,x.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(x.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,x.iridescenceMapTransform)),_.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),_.transmission>0&&(x.transmission.value=_.transmission,x.transmissionSamplerMap.value=S.texture,x.transmissionSamplerSize.value.set(S.width,S.height),_.transmissionMap&&(x.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,x.transmissionMapTransform)),x.thickness.value=_.thickness,_.thicknessMap&&(x.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=_.attenuationDistance,x.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(x.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(x.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=_.specularIntensity,x.specularColor.value.copy(_.specularColor),_.specularColorMap&&(x.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,x.specularColorMapTransform)),_.specularIntensityMap&&(x.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,x.specularIntensityMapTransform))}function v(x,_){_.matcap&&(x.matcap.value=_.matcap)}function A(x,_){const S=e.get(_).light;x.referencePosition.value.setFromMatrixPosition(S.matrixWorld),x.nearDistance.value=S.shadow.camera.near,x.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function dR(r,e,t,n){let i={},s={},o=[];const l=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function u(S,E){const w=E.program;n.uniformBlockBinding(S,w)}function h(S,E){let w=i[S.id];w===void 0&&(v(S),w=f(S),i[S.id]=w,S.addEventListener("dispose",x));const L=E.program;n.updateUBOMapping(S,L);const B=e.render.frame;s[S.id]!==B&&(p(S),s[S.id]=B)}function f(S){const E=d();S.__bindingPointIndex=E;const w=r.createBuffer(),L=S.__size,B=S.usage;return r.bindBuffer(r.UNIFORM_BUFFER,w),r.bufferData(r.UNIFORM_BUFFER,L,B),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,E,w),w}function d(){for(let S=0;S<l;S++)if(o.indexOf(S)===-1)return o.push(S),S;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(S){const E=i[S.id],w=S.uniforms,L=S.__cache;r.bindBuffer(r.UNIFORM_BUFFER,E);for(let B=0,F=w.length;B<F;B++){const D=Array.isArray(w[B])?w[B]:[w[B]];for(let T=0,b=D.length;T<b;T++){const N=D[T];if(g(N,B,T,L)===!0){const Y=N.__offset,K=Array.isArray(N.value)?N.value:[N.value];let Q=0;for(let oe=0;oe<K.length;oe++){const ee=K[oe],Me=A(ee);typeof ee=="number"||typeof ee=="boolean"?(N.__data[0]=ee,r.bufferSubData(r.UNIFORM_BUFFER,Y+Q,N.__data)):ee.isMatrix3?(N.__data[0]=ee.elements[0],N.__data[1]=ee.elements[1],N.__data[2]=ee.elements[2],N.__data[3]=0,N.__data[4]=ee.elements[3],N.__data[5]=ee.elements[4],N.__data[6]=ee.elements[5],N.__data[7]=0,N.__data[8]=ee.elements[6],N.__data[9]=ee.elements[7],N.__data[10]=ee.elements[8],N.__data[11]=0):(ee.toArray(N.__data,Q),Q+=Me.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,Y,N.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(S,E,w,L){const B=S.value,F=E+"_"+w;if(L[F]===void 0)return typeof B=="number"||typeof B=="boolean"?L[F]=B:L[F]=B.clone(),!0;{const D=L[F];if(typeof B=="number"||typeof B=="boolean"){if(D!==B)return L[F]=B,!0}else if(D.equals(B)===!1)return D.copy(B),!0}return!1}function v(S){const E=S.uniforms;let w=0;const L=16;for(let F=0,D=E.length;F<D;F++){const T=Array.isArray(E[F])?E[F]:[E[F]];for(let b=0,N=T.length;b<N;b++){const Y=T[b],K=Array.isArray(Y.value)?Y.value:[Y.value];for(let Q=0,oe=K.length;Q<oe;Q++){const ee=K[Q],Me=A(ee),G=w%L,te=G%Me.boundary,q=G+te;w+=te,q!==0&&L-q<Me.storage&&(w+=L-q),Y.__data=new Float32Array(Me.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=w,w+=Me.storage}}}const B=w%L;return B>0&&(w+=L-B),S.__size=w,S.__cache={},this}function A(S){const E={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(E.boundary=4,E.storage=4):S.isVector2?(E.boundary=8,E.storage=8):S.isVector3||S.isColor?(E.boundary=16,E.storage=12):S.isVector4?(E.boundary=16,E.storage=16):S.isMatrix3?(E.boundary=48,E.storage=48):S.isMatrix4?(E.boundary=64,E.storage=64):S.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",S),E}function x(S){const E=S.target;E.removeEventListener("dispose",x);const w=o.indexOf(E.__bindingPointIndex);o.splice(w,1),r.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function _(){for(const S in i)r.deleteBuffer(i[S]);o=[],i={},s={}}return{bind:u,update:h,dispose:_}}class Dm{constructor(e={}){const{canvas:t=by(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;const v=new Uint32Array(4),A=new Int32Array(4);let x=null,_=null;const S=[],E=[];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=hr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const w=this;let L=!1;this._outputColorSpace=si;let B=0,F=0,D=null,T=-1,b=null;const N=new Jt,Y=new Jt;let K=null;const Q=new Ye(0);let oe=0,ee=t.width,Me=t.height,G=1,te=null,q=null;const ce=new Jt(0,0,ee,Me),Se=new Jt(0,0,ee,Me);let Ge=!1;const le=new Gl;let Re=!1,we=!1;const Le=new gt,ot=new gt,Ut=new H,ft=new Jt,xt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let kt=!1;function pt(){return D===null?G:1}let X=n;function tn(I,z){return t.getContext(I,z)}try{const I={alpha:!0,depth:i,stencil:s,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:f,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Rl}`),t.addEventListener("webglcontextlost",Ce,!1),t.addEventListener("webglcontextrestored",qe,!1),t.addEventListener("webglcontextcreationerror",We,!1),X===null){const z="webgl2";if(X=tn(z,I),X===null)throw tn(z)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let Ee,Ie,Ae,ze,ye,O,P,ne,he,xe,ve,tt,Oe,Ke,Lt,Fe,$e,ut,it,je,Et,dt,Mt,$;function ue(){Ee=new w1(X),Ee.init(),dt=new Ix(X,Ee),Ie=new _1(X,Ee,e,dt),Ae=new sR(X,Ee),Ie.reverseDepthBuffer&&p&&Ae.buffers.depth.setReversed(!0),ze=new b1(X),ye=new Jb,O=new oR(X,Ee,Ae,ye,Ie,dt,ze),P=new x1(w),ne=new E1(w),he=new Lw(X),Mt=new g1(X,he),xe=new C1(X,he,ze,Mt),ve=new I1(X,xe,he,ze),it=new R1(X,Ie,O),Fe=new y1(ye),tt=new Xb(w,P,ne,Ee,Ie,Mt,Fe),Oe=new fR(w,ye),Ke=new Kb,Lt=new eR(Ee),ut=new m1(w,P,ne,Ae,ve,g,u),$e=new iR(w,ve,Ie),$=new dR(X,ze,Ie,Ae),je=new v1(X,Ee,ze),Et=new T1(X,Ee,ze),ze.programs=tt.programs,w.capabilities=Ie,w.extensions=Ee,w.properties=ye,w.renderLists=Ke,w.shadowMap=$e,w.state=Ae,w.info=ze}ue();const de=new uR(w,X);this.xr=de,this.getContext=function(){return X},this.getContextAttributes=function(){return X.getContextAttributes()},this.forceContextLoss=function(){const I=Ee.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=Ee.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(I){I!==void 0&&(G=I,this.setSize(ee,Me,!1))}
vendor: 8,750 bytes, line 3827
3827,this.getSize=function(I){return I.set(ee,Me)},this.setSize=function(I,z,W=!0){if(de.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ee=I,Me=z,t.width=Math.floor(I*G),t.height=Math.floor(z*G),W===!0&&(t.style.width=I+"px",t.style.height=z+"px"),this.setViewport(0,0,I,z)},this.getDrawingBufferSize=function(I){return I.set(ee*G,Me*G).floor()},this.setDrawingBufferSize=function(I,z,W){ee=I,Me=z,G=W,t.width=Math.floor(I*W),t.height=Math.floor(z*W),this.setViewport(0,0,I,z)},this.getCurrentViewport=function(I){return I.copy(N)},this.getViewport=function(I){return I.copy(ce)},this.setViewport=function(I,z,W,V){I.isVector4?ce.set(I.x,I.y,I.z,I.w):ce.set(I,z,W,V),Ae.viewport(N.copy(ce).multiplyScalar(G).round())},this.getScissor=function(I){return I.copy(Se)},this.setScissor=function(I,z,W,V){I.isVector4?Se.set(I.x,I.y,I.z,I.w):Se.set(I,z,W,V),Ae.scissor(Y.copy(Se).multiplyScalar(G).round())},this.getScissorTest=function(){return Ge},this.setScissorTest=function(I){Ae.setScissorTest(Ge=I)},this.setOpaqueSort=function(I){te=I},this.setTransparentSort=function(I){q=I},this.getClearColor=function(I){return I.copy(ut.getClearColor())},this.setClearColor=function(){ut.setClearColor(...arguments)},this.getClearAlpha=function(){return ut.getClearAlpha()},this.setClearAlpha=function(){ut.setClearAlpha(...arguments)},this.clear=function(I=!0,z=!0,W=!0){let V=0;if(I){let Z=!1;if(D!==null){const re=D.texture.format;Z=re===Lh||re===Dh||re===Dl}if(Z){const re=D.texture.type,ge=re===gi||re===mr||re===sa||re===oa||re===Bh||re===Ph,Te=ut.getClearColor(),Be=ut.getClearAlpha(),Ve=Te.r,ke=Te.g,De=Te.b;ge?(v[0]=Ve,v[1]=ke,v[2]=De,v[3]=Be,X.clearBufferuiv(X.COLOR,0,v)):(A[0]=Ve,A[1]=ke,A[2]=De,A[3]=Be,X.clearBufferiv(X.COLOR,0,A))}else V|=X.COLOR_BUFFER_BIT}z&&(V|=X.DEPTH_BUFFER_BIT),W&&(V|=X.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),X.clear(V)},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",Ce,!1),t.removeEventListener("webglcontextrestored",qe,!1),t.removeEventListener("webglcontextcreationerror",We,!1),ut.dispose(),Ke.dispose(),Lt.dispose(),ye.dispose(),P.dispose(),ne.dispose(),ve.dispose(),Mt.dispose(),$.dispose(),tt.dispose(),de.dispose(),de.removeEventListener("sessionstart",mo),de.removeEventListener("sessionend",go),$n.stop()};function Ce(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function qe(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const I=ze.autoReset,z=$e.enabled,W=$e.autoUpdate,V=$e.needsUpdate,Z=$e.type;ue(),ze.autoReset=I,$e.enabled=z,$e.autoUpdate=W,$e.needsUpdate=V,$e.type=Z}function We(I){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function At(I){const z=I.target;z.removeEventListener("dispose",At),rn(z)}function rn(I){_n(I),ye.remove(I)}function _n(I){const z=ye.get(I).programs;z!==void 0&&(z.forEach(function(W){tt.releaseProgram(W)}),I.isShaderMaterial&&tt.releaseShaderCache(I))}this.renderBufferDirect=function(I,z,W,V,Z,re){z===null&&(z=xt);const ge=Z.isMesh&&Z.matrixWorld.determinant()<0,Te=J(I,z,W,V,Z);Ae.setMaterial(V,ge);let Be=W.index,Ve=1;if(V.wireframe===!0){if(Be=xe.getWireframeAttribute(W),Be===void 0)return;Ve=2}const ke=W.drawRange,De=W.attributes.position;let Xe=ke.start*Ve,nt=(ke.start+ke.count)*Ve;re!==null&&(Xe=Math.max(Xe,re.start*Ve),nt=Math.min(nt,(re.start+re.count)*Ve)),Be!==null?(Xe=Math.max(Xe,0),nt=Math.min(nt,Be.count)):De!=null&&(Xe=Math.max(Xe,0),nt=Math.min(nt,De.count));const _t=nt-Xe;if(_t<0||_t===1/0)return;Mt.setup(Z,V,Te,W,Be);let st,lt=je;if(Be!==null&&(st=he.get(Be),lt=Et,lt.setIndex(st)),Z.isMesh)V.wireframe===!0?(Ae.setLineWidth(V.wireframeLinewidth*pt()),lt.setMode(X.LINES)):lt.setMode(X.TRIANGLES);else if(Z.isLine){let et=V.linewidth;et===void 0&&(et=1),Ae.setLineWidth(et*pt()),Z.isLineSegments?lt.setMode(X.LINES):Z.isLineLoop?lt.setMode(X.LINE_LOOP):lt.setMode(X.LINE_STRIP)}else Z.isPoints?lt.setMode(X.POINTS):Z.isSprite&<.setMode(X.TRIANGLES);if(Z.isBatchedMesh)if(Z._multiDrawInstances!==null)Nu("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),lt.renderMultiDrawInstances(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount,Z._multiDrawInstances);else if(Ee.get("WEBGL_multi_draw"))lt.renderMultiDraw(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount);else{const et=Z._multiDrawStarts,Ot=Z._multiDrawCounts,yt=Z._multiDrawCount,Bt=Be?he.get(Be).bytesPerElement:1,sn=ye.get(V).currentProgram.getUniforms();for(let wt=0;wt<yt;wt++)sn.setValue(X,"_gl_DrawID",wt),lt.render(et[wt]/Bt,Ot[wt])}else if(Z.isInstancedMesh)lt.renderInstances(Xe,_t,Z.count);else if(W.isInstancedBufferGeometry){const et=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Ot=Math.min(W.instanceCount,et);lt.renderInstances(Xe,_t,Ot)}else lt.render(Xe,_t)};function Vt(I,z,W){I.transparent===!0&&I.side===Oi&&I.forceSinglePass===!1?(I.side=ai,I.needsUpdate=!0,Gr(I,z,W),I.side=dr,I.needsUpdate=!0,Gr(I,z,W),I.side=Oi):Gr(I,z,W)}this.compile=function(I,z,W=null){W===null&&(W=I),_=Lt.get(W),_.init(z),E.push(_),W.traverseVisible(function(Z){Z.isLight&&Z.layers.test(z.layers)&&(_.pushLight(Z),Z.castShadow&&_.pushShadow(Z))}),I!==W&&I.traverseVisible(function(Z){Z.isLight&&Z.layers.test(z.layers)&&(_.pushLight(Z),Z.castShadow&&_.pushShadow(Z))}),_.setupLights();const V=new Set;return I.traverse(function(Z){if(!(Z.isMesh||Z.isPoints||Z.isLine||Z.isSprite))return;const re=Z.material;if(re)if(Array.isArray(re))for(let ge=0;ge<re.length;ge++){const Te=re[ge];Vt(Te,W,Z),V.add(Te)}else Vt(re,W,Z),V.add(re)}),_=E.pop(),V},this.compileAsync=function(I,z,W=null){const V=this.compile(I,z,W);return new Promise(Z=>{function re(){if(V.forEach(function(ge){ye.get(ge).currentProgram.isReady()&&V.delete(ge)}),V.size===0){Z(I);return}setTimeout(re,10)}Ee.get("KHR_parallel_shader_compile")!==null?re():setTimeout(re,10)})};let zn=null;function _i(I){zn&&zn(I)}function mo(){$n.stop()}function go(){$n.start()}const $n=new wx;$n.setAnimationLoop(_i),typeof self<"u"&&$n.setContext(self),this.setAnimationLoop=function(I){zn=I,de.setAnimationLoop(I),I===null?$n.stop():$n.start()},de.addEventListener("sessionstart",mo),de.addEventListener("sessionend",go),this.render=function(I,z){if(z!==void 0&&z.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),z.parent===null&&z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),de.enabled===!0&&de.isPresenting===!0&&(de.cameraAutoUpdate===!0&&de.updateCamera(z),z=de.getCamera()),I.isScene===!0&&I.onBeforeRender(w,I,z,D),_=Lt.get(I,E.length),_.init(z),E.push(_),ot.multiplyMatrices(z.projectionMatrix,z.matrixWorldInverse),le.setFromProjectionMatrix(ot),we=this.localClippingEnabled,Re=Fe.init(this.clippingPlanes,we),x=Ke.get(I,S.length),x.init(),S.push(x),de.enabled===!0&&de.isPresenting===!0){const re=w.xr.getDepthSensingMesh();re!==null&&_r(re,z,-1/0,w.sortObjects)}_r(I,z,0,w.sortObjects),x.finish(),w.sortObjects===!0&&x.sort(te,q),kt=de.enabled===!1||de.isPresenting===!1||de.hasDepthSensing()===!1,kt&&ut.addToRenderList(x,I),this.info.render.frame++,Re===!0&&Fe.beginShadows();const W=_.state.shadowsArray;$e.render(W,I,z),Re===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset();const V=x.opaque,Z=x.transmissive;if(_.setupLights(),z.isArrayCamera){const re=z.cameras;if(Z.length>0)for(let ge=0,Te=re.length;ge<Te;ge++){const Be=re[ge];li(V,Z,I,Be)}kt&&ut.render(I);for(let ge=0,Te=re.length;ge<Te;ge++){const Be=re[ge];nr(x,I,Be,Be.viewport)}}else Z.length>0&&li(V,Z,I,z),kt&&ut.render(I),nr(x,I,z);D!==null&&F===0&&(O.updateMultisampleRenderTarget(D),O.updateRenderTargetMipmap(D)),I.isScene===!0&&I.onAfterRender(w,I,z),Mt.resetDefaultState(),T=-1,b=null,E.pop(),E.length>0?(_=E[E.length-1],Re===!0&&Fe.setGlobalState(w.clippingPlanes,_.state.camera)):_=null,S.pop(),S.length>0?x=S[S.length-1]:x=null};function _r(I,z,W,V){if(I.visible===!1)return;if(I.layers.test(z.layers)){if(I.isGroup)W=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(z);else if(I.isLight)_.pushLight(I),I.castShadow&&_.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||le.intersectsSprite(I)){V&&ft.setFromMatrixPosition(I.matrixWorld).applyMatrix4(ot);const ge=ve.update(I),Te=I.material;Te.visible&&x.push(I,ge,Te,W,ft.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||le.intersectsObject(I
vendor: 19,571 bytes, line 3827
3827))){const ge=ve.update(I),Te=I.material;if(V&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),ft.copy(I.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),ft.copy(ge.boundingSphere.center)),ft.applyMatrix4(I.matrixWorld).applyMatrix4(ot)),Array.isArray(Te)){const Be=ge.groups;for(let Ve=0,ke=Be.length;Ve<ke;Ve++){const De=Be[Ve],Xe=Te[De.materialIndex];Xe&&Xe.visible&&x.push(I,ge,Xe,W,ft.z,De)}}else Te.visible&&x.push(I,ge,Te,W,ft.z,null)}}const re=I.children;for(let ge=0,Te=re.length;ge<Te;ge++)_r(re[ge],z,W,V)}function nr(I,z,W,V){const Z=I.opaque,re=I.transmissive,ge=I.transparent;_.setupLightsView(W),Re===!0&&Fe.setGlobalState(w.clippingPlanes,W),V&&Ae.viewport(N.copy(V)),Z.length>0&&It(Z,z,W),re.length>0&&It(re,z,W),ge.length>0&&It(ge,z,W),Ae.buffers.depth.setTest(!0),Ae.buffers.depth.setMask(!0),Ae.buffers.color.setMask(!0),Ae.setPolygonOffset(!1)}function li(I,z,W,V){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[V.id]===void 0&&(_.state.transmissionRenderTarget[V.id]=new ki(1,1,{generateMipmaps:!0,type:Ee.has("EXT_color_buffer_half_float")||Ee.has("EXT_color_buffer_float")?Un:gi,minFilter:Gi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xt.workingColorSpace}));const re=_.state.transmissionRenderTarget[V.id],ge=V.viewport||N;re.setSize(ge.z*w.transmissionResolutionScale,ge.w*w.transmissionResolutionScale);const Te=w.getRenderTarget();w.setRenderTarget(re),w.getClearColor(Q),oe=w.getClearAlpha(),oe<1&&w.setClearColor(16777215,.5),w.clear(),kt&&ut.render(W);const Be=w.toneMapping;w.toneMapping=hr;const Ve=V.viewport;if(V.viewport!==void 0&&(V.viewport=void 0),_.setupLightsView(V),Re===!0&&Fe.setGlobalState(w.clippingPlanes,V),It(I,W,V),O.updateMultisampleRenderTarget(re),O.updateRenderTargetMipmap(re),Ee.has("WEBGL_multisampled_render_to_texture")===!1){let ke=!1;for(let De=0,Xe=z.length;De<Xe;De++){const nt=z[De],_t=nt.object,st=nt.geometry,lt=nt.material,et=nt.group;if(lt.side===Oi&&_t.layers.test(V.layers)){const Ot=lt.side;lt.side=ai,lt.needsUpdate=!0,xs(_t,W,V,st,lt,et),lt.side=Ot,lt.needsUpdate=!0,ke=!0}}ke===!0&&(O.updateMultisampleRenderTarget(re),O.updateRenderTargetMipmap(re))}w.setRenderTarget(Te),w.setClearColor(Q,oe),Ve!==void 0&&(V.viewport=Ve),w.toneMapping=Be}function It(I,z,W){const V=z.isScene===!0?z.overrideMaterial:null;for(let Z=0,re=I.length;Z<re;Z++){const ge=I[Z],Te=ge.object,Be=ge.geometry,Ve=ge.group;let ke=ge.material;ke.allowOverride===!0&&V!==null&&(ke=V),Te.layers.test(W.layers)&&xs(Te,z,W,Be,ke,Ve)}}function xs(I,z,W,V,Z,re){I.onBeforeRender(w,z,W,V,Z,re),I.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),Z.onBeforeRender(w,z,W,V,I,re),Z.transparent===!0&&Z.side===Oi&&Z.forceSinglePass===!1?(Z.side=ai,Z.needsUpdate=!0,w.renderBufferDirect(W,z,V,Z,I,re),Z.side=dr,Z.needsUpdate=!0,w.renderBufferDirect(W,z,V,Z,I,re),Z.side=Oi):w.renderBufferDirect(W,z,V,Z,I,re),I.onAfterRender(w,z,W,V,Z,re)}function Gr(I,z,W){z.isScene!==!0&&(z=xt);const V=ye.get(I),Z=_.state.lights,re=_.state.shadowsArray,ge=Z.state.version,Te=tt.getParameters(I,Z.state,re,z,W),Be=tt.getProgramCacheKey(Te);let Ve=V.programs;V.environment=I.isMeshStandardMaterial?z.environment:null,V.fog=z.fog,V.envMap=(I.isMeshStandardMaterial?ne:P).get(I.envMap||V.environment),V.envMapRotation=V.environment!==null&&I.envMap===null?z.environmentRotation:I.envMapRotation,Ve===void 0&&(I.addEventListener("dispose",At),Ve=new Map,V.programs=Ve);let ke=Ve.get(Be);if(ke!==void 0){if(V.currentProgram===ke&&V.lightsStateVersion===ge)return U(I,Te),ke}else Te.uniforms=tt.getUniforms(I),I.onBeforeCompile(Te,w),ke=tt.acquireProgram(Te,Be),Ve.set(Be,ke),V.uniforms=Te.uniforms;const De=V.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(De.clippingPlanes=Fe.uniform),U(I,Te),V.needsLights=pe(I),V.lightsStateVersion=ge,V.needsLights&&(De.ambientLightColor.value=Z.state.ambient,De.lightProbe.value=Z.state.probe,De.directionalLights.value=Z.state.directional,De.directionalLightShadows.value=Z.state.directionalShadow,De.spotLights.value=Z.state.spot,De.spotLightShadows.value=Z.state.spotShadow,De.rectAreaLights.value=Z.state.rectArea,De.ltc_1.value=Z.state.rectAreaLTC1,De.ltc_2.value=Z.state.rectAreaLTC2,De.pointLights.value=Z.state.point,De.pointLightShadows.value=Z.state.pointShadow,De.hemisphereLights.value=Z.state.hemi,De.directionalShadowMap.value=Z.state.directionalShadowMap,De.directionalShadowMatrix.value=Z.state.directionalShadowMatrix,De.spotShadowMap.value=Z.state.spotShadowMap,De.spotLightMatrix.value=Z.state.spotLightMatrix,De.spotLightMap.value=Z.state.spotLightMap,De.pointShadowMap.value=Z.state.pointShadowMap,De.pointShadowMatrix.value=Z.state.pointShadowMatrix),V.currentProgram=ke,V.uniformsList=null,ke}function R(I){if(I.uniformsList===null){const z=I.currentProgram.getUniforms();I.uniformsList=Hu.seqWithValue(z.seq,I.uniforms)}return I.uniformsList}function U(I,z){const W=ye.get(I);W.outputColorSpace=z.outputColorSpace,W.batching=z.batching,W.batchingColor=z.batchingColor,W.instancing=z.instancing,W.instancingColor=z.instancingColor,W.instancingMorph=z.instancingMorph,W.skinning=z.skinning,W.morphTargets=z.morphTargets,W.morphNormals=z.morphNormals,W.morphColors=z.morphColors,W.morphTargetsCount=z.morphTargetsCount,W.numClippingPlanes=z.numClippingPlanes,W.numIntersection=z.numClipIntersection,W.vertexAlphas=z.vertexAlphas,W.vertexTangents=z.vertexTangents,W.toneMapping=z.toneMapping}function J(I,z,W,V,Z){z.isScene!==!0&&(z=xt),O.resetTextureUnits();const re=z.fog,ge=V.isMeshStandardMaterial?z.environment:null,Te=D===null?w.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:gr,Be=(V.isMeshStandardMaterial?ne:P).get(V.envMap||ge),Ve=V.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,ke=!!W.attributes.tangent&&(!!V.normalMap||V.anisotropy>0),De=!!W.morphAttributes.position,Xe=!!W.morphAttributes.normal,nt=!!W.morphAttributes.color;let _t=hr;V.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(_t=w.toneMapping);const st=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,lt=st!==void 0?st.length:0,et=ye.get(V),Ot=_.state.lights;if(Re===!0&&(we===!0||I!==b)){const on=I===b&&V.id===T;Fe.setState(V,I,on)}let yt=!1;V.version===et.__version?(et.needsLights&&et.lightsStateVersion!==Ot.state.version||et.outputColorSpace!==Te||Z.isBatchedMesh&&et.batching===!1||!Z.isBatchedMesh&&et.batching===!0||Z.isBatchedMesh&&et.batchingColor===!0&&Z.colorTexture===null||Z.isBatchedMesh&&et.batchingColor===!1&&Z.colorTexture!==null||Z.isInstancedMesh&&et.instancing===!1||!Z.isInstancedMesh&&et.instancing===!0||Z.isSkinnedMesh&&et.skinning===!1||!Z.isSkinnedMesh&&et.skinning===!0||Z.isInstancedMesh&&et.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&et.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&et.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&et.instancingMorph===!1&&Z.morphTexture!==null||et.envMap!==Be||V.fog===!0&&et.fog!==re||et.numClippingPlanes!==void 0&&(et.numClippingPlanes!==Fe.numPlanes||et.numIntersection!==Fe.numIntersection)||et.vertexAlphas!==Ve||et.vertexTangents!==ke||et.morphTargets!==De||et.morphNormals!==Xe||et.morphColors!==nt||et.toneMapping!==_t||et.morphTargetsCount!==lt)&&(yt=!0):(yt=!0,et.__version=V.version);let Bt=et.currentProgram;yt===!0&&(Bt=Gr(V,z,Z));let sn=!1,wt=!1,Ht=!1;const vt=Bt.getUniforms(),pn=et.uniforms;if(Ae.useProgram(Bt.program)&&(sn=!0,wt=!0,Ht=!0),V.id!==T&&(T=V.id,wt=!0),sn||b!==I){Ae.buffers.depth.getReversed()?(Le.copy(I.projectionMatrix),oS(Le),aS(Le),vt.setValue(X,"projectionMatrix",Le)):vt.setValue(X,"projectionMatrix",I.projectionMatrix),vt.setValue(X,"viewMatrix",I.matrixWorldInverse);const Cn=vt.map.cameraPosition;Cn!==void 0&&Cn.setValue(X,Ut.setFromMatrixPosition(I.matrixWorld)),Ie.logarithmicDepthBuffer&&vt.setValue(X,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial)&&vt.setValue(X,"isOrthographic",I.isOrthographicCamera===!0),b!==I&&(b=I,wt=!0,Ht=!0)}if(Z.isSkinnedMesh){vt.setOptional(X,Z,"bindMatrix"),vt.setOptional(X,Z,"bindMatrixInverse");const on=Z.skeleton;on&&(on.boneTexture===null&&on.computeBoneTexture(),vt.setValue(X,"boneTexture",on.boneTexture,O))}Z.isBatchedMesh&&(vt.setOptional(X,Z,"batchingTexture"),vt.setValue(X,"batchingTexture",Z._matricesTexture,O),vt.setOptional(X,Z,"batchingIdTexture"),vt.setValue(X,"batchingIdTexture",Z._indirectTexture,O),vt.setOptional(X,Z,"batchingColorTexture"),Z._colorsTexture!==null&&vt.setValue(X,"batchingColorTexture",Z._colorsTexture,O));const en=W.morphAttributes;if((en.position!==void 0||en.normal!==void 0||en.color!==void 0)&&it.update(Z,W,Bt),(wt||et.receiveShadow!==Z.receiveShadow)&&(et.receiveShadow=Z.receiveShadow,vt.setValue(X,"receiveShadow",Z.receiveShadow)),V.isMeshGouraudMaterial&&V.envMap!==null&&(pn.envMap.value=Be,pn.flipEnvMap.value=Be.isCubeTexture&&Be.isRenderTargetTexture===!1?-1:1),V.isMeshStandardMaterial&&V.envMap===null&&z.environment!==null&&(pn.envMapIntensity.value=z.environmentIntensity),wt&&(vt.setValue(X,"toneMappingExposure",w.toneMappingExposure),et.needsLights&&ae(pn,Ht),re&&V.fog===!0&&Oe.refreshFogUniforms(pn,re),Oe.refreshMaterialUniforms(pn,V,G,Me,_.state.transmissionRenderTarget[I.id]),Hu.upload(X,R(et),pn,O)),V.isShaderMaterial&&V.uniformsNeedUpdate===!0&&(Hu.upload(X,R(et),pn,O),V.uniformsNeedUpdate=!1),V.isSpriteMaterial&&vt.setValue(X,"center",Z.center),vt.setValue(X,"modelViewMatrix",Z.modelViewMatrix),vt.setValue(X,"normalMatrix",Z.normalMatrix),vt.setValue(X,"modelMatrix",Z.matrixWorld),V.isShaderMaterial||V.isRawShaderMaterial){const on=V.uniformsGroups;for(let Cn=0,kr=on.length;Cn<kr;Cn++){const yi=on[Cn];$.update(yi,Bt),$.bind(yi,Bt)}}return Bt}function ae(I,z){I.ambientLightColor.needsUpdate=z,I.lightProbe.needsUpdate=z,I.directionalLights.needsUpdate=z,I.directionalLightShadows.needsUpdate=z,I.pointLights.needsUpdate=z,I.pointLightShadows.needsUpdate=z,I.spotLights.needsUpdate=z,I.spotLightShadows.needsUpdate=z,I.rectAreaLights.needsUpdate=z,I.hemisphereLights.needsUpdate=z}function pe(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(I,z,W){const V=ye.get(I);V.__autoAllocateDepthBuffer=I.resolveDepthBuffer===!1,V.__autoAllocateDepthBuffer===!1&&(V.__useRenderToTexture=!1),ye.get(I.texture).__webglTexture=z,ye.get(I.depthTexture).__webglTexture=V.__autoAllocateDepthBuffer?void 0:W,V.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(I,z){const W=ye.get(I);W.__webglFramebuffer=z,W.__useDefaultFramebuffer=z===void 0};const me=X.createFramebuffer();this.setRenderTarget=function(I,z=0,W=0){D=I,B=z,F=W;let V=!0,Z=null,re=!1,ge=!1;if(I){const Be=ye.get(I);if(Be.__useDefaultFramebuffer!==void 0)Ae.bindFramebuffer(X.FRAMEBUFFER,null),V=!1;else if(Be.__webglFramebuffer===void 0)O.setupRenderTarget(I);else if(Be.__hasExternalTextures)O.rebindTextures(I,ye.get(I.texture).__webglTexture,ye.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){const De=I.depthTexture;if(Be.__boundDepthTexture!==De){if(De!==null&&ye.has(De)&&(I.width!==De.image.width||I.height!==De.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(I)}}const Ve=I.texture;(Ve.isData3DTexture||Ve.isDataArrayTexture||Ve.isCompressedArrayTexture)&&(ge=!0);const ke=ye.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(ke[z])?Z=ke[z][W]:Z=ke[z],re=!0):I.samples>0&&O.useMultisampledRTT(I)===!1?Z=ye.get(I).__webglMultisampledFramebuffer:Array.isArray(ke)?Z=ke[W]:Z=ke,N.copy(I.viewport),Y.copy(I.scissor),K=I.scissorTest}else N.copy(ce).multiplyScalar(G).floor(),Y.copy(Se).multiplyScalar(G).floor(),K=Ge;if(W!==0&&(Z=me),Ae.bindFramebuffer(X.FRAMEBUFFER,Z)&&V&&Ae.drawBuffers(I,Z),Ae.viewport(N),Ae.scissor(Y),Ae.setScissorTest(K),re){const Be=ye.get(I.texture);X.framebufferTexture2D(X.FRAMEBUFFER,X.COLOR_ATTACHMENT0,X.TEXTURE_CUBE_MAP_POSITIVE_X+z,Be.__webglTexture,W)}else if(ge){const Be=ye.get(I.texture),Ve=z;X.framebufferTextureLayer(X.FRAMEBUFFER,X.COLOR_ATTACHMENT0,Be.__webglTexture,W,Ve)}else if(I!==null&&W!==0){const Be=ye.get(I.texture);X.framebufferTexture2D(X.FRAMEBUFFER,X.COLOR_ATTACHMENT0,X.TEXTURE_2D,Be.__webglTexture,W)}T=-1},this.readRenderTargetPixels=function(I,z,W,V,Z,re,ge){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=ye.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){Ae.bindFramebuffer(X.FRAMEBUFFER,Te);try{const Be=I.texture,Ve=Be.format,ke=Be.type;if(!Ie.textureFormatReadable(Ve)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ie.textureTypeReadable(ke)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=I.width-V&&W>=0&&W<=I.height-Z&&X.readPixels(z,W,V,Z,dt.convert(Ve),dt.convert(ke),re)}finally{const Be=D!==null?ye.get(D).__webglFramebuffer:null;Ae.bindFramebuffer(X.FRAMEBUFFER,Be)}}},this.readRenderTargetPixelsAsync=async function(I,z,W,V,Z,re,ge){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=ye.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te)if(z>=0&&z<=I.width-V&&W>=0&&W<=I.height-Z){Ae.bindFramebuffer(X.FRAMEBUFFER,Te);const Be=I.texture,Ve=Be.format,ke=Be.type;if(!Ie.textureFormatReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ie.textureTypeReadable(ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const De=X.createBuffer();X.bindBuffer(X.PIXEL_PACK_BUFFER,De),X.bufferData(X.PIXEL_PACK_BUFFER,re.byteLength,X.STREAM_READ),X.readPixels(z,W,V,Z,dt.convert(Ve),dt.convert(ke),0);const Xe=D!==null?ye.get(D).__webglFramebuffer:null;Ae.bindFramebuffer(X.FRAMEBUFFER,Xe);const nt=X.fenceSync(X.SYNC_GPU_COMMANDS_COMPLETE,0);return X.flush(),await sS(X,nt,4),X.bindBuffer(X.PIXEL_PACK_BUFFER,De),X.getBufferSubData(X.PIXEL_PACK_BUFFER,0,re),X.deleteBuffer(De),X.deleteSync(nt),re}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(I,z=null,W=0){const V=Math.pow(2,-W),Z=Math.floor(I.image.width*V),re=Math.floor(I.image.height*V),ge=z!==null?z.x:0,Te=z!==null?z.y:0;O.setTexture2D(I,0),X.copyTexSubImage2D(X.TEXTURE_2D,W,0,0,ge,Te,Z,re),Ae.unbindTexture()};const Ue=X.createFramebuffer(),Pe=X.createFramebuffer();this.copyTextureToTexture=function(I,z,W=null,V=null,Z=0,re=null){re===null&&(Z!==0?(Nu("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),re=Z,Z=0):re=0);let ge,Te,Be,Ve,ke,De,Xe,nt,_t;const st=I.isCompressedTexture?I.mipmaps[re]:I.image;if(W!==null)ge=W.max.x-W.min.x,Te=W.max.y-W.min.y,Be=W.isBox3?W.max.z-W.min.z:1,Ve=W.min.x,ke=W.min.y,De=W.isBox3?W.min.z:0;else{const en=Math.pow(2,-Z);ge=Math.floor(st.width*en),Te=Math.floor(st.height*en),I.isDataArrayTexture?Be=st.depth:I.isData3DTexture?Be=Math.floor(st.depth*en):Be=1,Ve=0,ke=0,De=0}V!==null?(Xe=V.x,nt=V.y,_t=V.z):(Xe=0,nt=0,_t=0);const lt=dt.convert(z.format),et=dt.convert(z.type);let Ot;z.isData3DTexture?(O.setTexture3D(z,0),Ot=X.TEXTURE_3D):z.isDataArrayTexture||z.isCompressedArrayTexture?(O.setTexture2DArray(z,0),Ot=X.TEXTURE_2D_ARRAY):(O.setTexture2D(z,0),Ot=X.TEXTURE_2D),X.pixelStorei(X.UNPACK_FLIP_Y_WEBGL,z.flipY),X.pixelStorei(X.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),X.pixelStorei(X.UNPACK_ALIGNMENT,z.unpackAlignment);const yt=X.getParameter(X.UNPACK_ROW_LENGTH),Bt=X.getParameter(X.UNPACK_IMAGE_HEIGHT),sn=X.getParameter(X.UNPACK_SKIP_PIXELS),wt=X.getParameter(X.UNPACK_SKIP_ROWS),Ht=X.getParameter(X.UNPACK_SKIP_IMAGES);X.pixelStorei(X.UNPACK_ROW_LENGTH,st.width),X.pixelStorei(X.UNPACK_IMAGE_HEIGHT,st.height),X.pixelStorei(X.UNPACK_SKIP_PIXELS,Ve),X.pixelStorei(X.UNPACK_SKIP_ROWS,ke),X.pixelStorei(X.UNPACK_SKIP_IMAGES,De);const vt=I.isDataArrayTexture||I.isData3DTexture,pn=z.isDataArrayTexture||z.isData3DTexture;if(I.isDepthTexture){const en=ye.get(I),on=ye.get(z),Cn=ye.get(en.__renderTarget),kr=ye.get(on.__renderTarget);Ae.bindFramebuffer(X.READ_FRAMEBUFFER,Cn.__webglFramebuffer),Ae.bindFramebuffer(X.DRAW_FRAMEBUFFER,kr.__webglFramebuffer);for(let yi=0;yi<Be;yi++)vt&&(X.framebufferTextureLayer(X.READ_FRAMEBUFFER,X.COLOR_ATTACHMENT0,ye.get(I).__webglTexture,Z,De+yi),X.framebufferTextureLayer(X.DRAW_FRAMEBUFFER,X.COLOR_ATTACHMENT0,ye.get(z).__webglTexture,re,_t+yi)),X.blitFramebuffer(Ve,ke,ge,Te,Xe,nt,ge,Te,X.DEPTH_BUFFER_BIT,X.NEAREST);Ae.bindFramebuffer(X.READ_FRAMEBUFFER,null),Ae.bindFramebuffer(X.DRAW_FRAMEBUFFER,null)}else if(Z!==0||I.isRenderTargetTexture||ye.has(I)){const en=ye.get(I),on=ye.get(z);Ae.bindFramebuffer(X.READ_FRAMEBUFFER,Ue),Ae.bindFramebuffer(X.DRAW_FRAMEBUFFER,Pe);for(let Cn=0;Cn<Be;Cn++)vt?X.framebufferTextureLayer(X.READ_FRAMEBUFFER,X.COLOR_ATTACHMENT0,en.__webglTexture,Z,De+Cn):X.framebufferTexture2D(X.READ_FRAMEBUFFER,X.COLOR_ATTACHMENT0,X.TEXTURE_2D,en.__webglTexture,Z),pn?X.framebufferTextureLayer(X.DRAW_FRAMEBUFFER,X.COLOR_ATTACHMENT0,on.__webglTexture,re,_t+Cn):X.framebufferTexture2D(X.DRAW_FRAMEBUFFER,X.COLOR_ATTACHMENT0,X.TEXTURE_2D,on.__webglTexture,re),Z!==0?X.blitFramebuffer(Ve,ke,ge,Te,Xe,nt,ge,Te,X.COLOR_BUFFER_BIT,X.NEAREST):pn?X.copyTexSubImage3D(Ot,re,Xe,nt,_t+Cn,Ve,ke,ge,Te):X.copyTexSubImage2D(Ot,re,Xe,nt,Ve,ke,ge,Te);Ae.bindFramebuffer(X.READ_FRAMEBUFFER,null),Ae.bindFramebuffer(X.DRAW_FRAMEBUFFER,null)}else pn?I.isDataTexture||I.isData3DTexture?X.texSubImage3D(Ot,re,Xe,nt,_t,ge,Te,Be,lt,et,st.data):z.isCompressedArrayTexture?X.compressedTexSubImage3D(Ot,re,Xe,nt,_t,ge,Te,Be,lt,st.data):X.texSubImage3D(Ot,re,Xe,nt,_t,ge,Te,Be,lt,et,st):I.isDataTexture?X.texSubImage2D(X.TEXTURE_2D,re,Xe,nt,ge,Te,lt,et,st.data):I.isCompressedTexture?X.compressedTexSubImage2D(X.TEXTURE_2D,re,Xe,nt,st.width,st.height,lt,st.data):X.texSubImage2D(X.TEXTURE_2D,re,Xe,nt,ge,Te,lt,et,st);X.pixelStorei(X.UNPACK_ROW_LENGTH,yt),X.pixelStorei(X.UNPACK_IMAGE_HEIGHT,Bt),X.pixelStorei(X.UNPACK_SKIP_PIXELS,sn),X.pixelStorei(X.UNPACK_SKIP_ROWS,wt),X.pixelStorei(X.UNPACK_SKIP_IMAGES,Ht),re===0&&z.generateMipmaps&&X.generateMipmap(Ot),Ae.unbindTexture()},this.copyTextureToTexture3D=function(I,z,W=null,V=null,Z=0){return Nu('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(I,z,W,V,Z)},this.initRenderTarget=function(I){ye.get(I).__webglFramebuffer===void 0&&O.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?O.setTextureCube(I,0):I.isData3DTexture?O.setTexture3D(I,0
vendor: 5,269 bytes, line 3827
3827):I.isDataArrayTexture||I.isCompressedArrayTexture?O.setTexture2DArray(I,0):O.setTexture2D(I,0),Ae.unbindTexture()},this.resetState=function(){B=0,F=0,D=null,Ae.reset(),Mt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ji}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Xt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Xt._getUnpackColorSpace()}}const pR=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:zp,AddEquation:ls,AddOperation:ry,AdditiveAnimationBlendMode:qp,AdditiveBlending:xp,AgXToneMapping:cy,AlphaFormat:Wp,AlwaysCompare:wy,AlwaysDepth:Wu,AlwaysStencilFunc:wp,AmbientLight:dx,AnimationAction:Sx,AnimationClip:pa,AnimationLoader:BE,AnimationMixer:nw,AnimationObjectGroup:ew,AnimationUtils:TE,ArcCurve:Hy,ArrayCamera:xx,ArrowHelper:ww,AttachedBindMode:Sp,Audio:Ax,AudioAnalyser:WE,AudioContext:wm,AudioListener:kE,AudioLoader:OE,AxesHelper:Cw,BackSide:ai,BasicDepthPacking:gy,BasicShadowMap:O_,BatchedMesh:Ny,Bone:Gh,BooleanKeyframeTrack:ho,Box2:hw,Box3:Qn,Box3Helper:Sw,BoxGeometry:uo,BoxHelper:Mw,BufferAttribute:Yt,BufferGeometry:Rt,BufferGeometryLoader:_x,ByteType:Rh,Cache:Fr,Camera:Fl,CameraHelper:Aw,CanvasTexture:qS,CapsuleGeometry:Wh,CatmullRomCurve3:Gy,CineonToneMapping:ay,CircleGeometry:Xh,ClampToEdgeWrapping:An,Clock:Cm,Color:Ye,ColorKeyframeTrack:ym,ColorManagement:Xt,CompressedArrayTexture:KS,CompressedCubeTexture:ZS,CompressedTexture:zh,CompressedTextureLoader:PE,ConeGeometry:Jh,ConstantAlphaFactor:ty,ConstantColorFactor:$_,Controls:bw,CubeCamera:Dy,CubeReflectionMapping:pr,CubeRefractionMapping:ds,CubeTexture:Ul,CubeTextureLoader:ux,CubeUVReflectionMapping:ga,CubicBezierCurve:um,CubicBezierCurve3:ky,CubicInterpolant:ox,CullFaceBack:yp,CullFaceFront:N_,CullFaceFrontBack:hM,CullFaceNone:U_,Curve:tr,CurvePath:Vy,CustomBlending:H_,CustomToneMapping:ly,CylinderGeometry:_a,Cylindrical:uw,Data3DTexture:Nh,DataArrayTexture:Ll,DataTexture:$i,DataTextureLoader:xm,DataUtils:qs,DecrementStencilOp:AM,DecrementWrapStencilOp:SM,DefaultLoadingManager:cx,DepthFormat:aa,DepthStencilFormat:la,DepthTexture:lm,DetachedBindMode:hy,DirectionalLight:Em,DirectionalLightHelper:xw,DiscreteInterpolant:ax,DodecahedronGeometry:Yh,DoubleSide:Oi,DstAlphaFactor:K_,DstColorFactor:q_,DynamicCopyUsage:OM,DynamicDrawUsage:PM,DynamicReadUsage:FM,EdgesGeometry:Wy,EllipseCurve:Vh,EqualCompare:Ay,EqualDepth:Ju,EqualStencilFunc:TM,EquirectangularReflectionMapping:ia,EquirectangularRefractionMapping:ml,Euler:Ti,EventDispatcher:vr,ExtrudeGeometry:Kh,FileLoader:Gn,Float16BufferAttribute:bS,Float32BufferAttribute:at,FloatType:dn,Fog:Hh,FogExp2:Oh,FramebufferTexture:YS,FrontSide:dr,Frustum:Gl,GLBufferAttribute:lw,GLSL1:GM,GLSL3:Cp,GreaterCompare:My,GreaterDepth:Ku,GreaterEqualCompare:Ey,GreaterEqualDepth:Yu,GreaterEqualStencilFunc:BM,GreaterStencilFunc:RM,GridHelper:_w,Group:Lr,HalfFloatType:Un,HemisphereLight:fx,HemisphereLightHelper:vw,IcosahedronGeometry:zl,ImageBitmapLoader:yx,ImageLoader:wl,ImageUtils:Ry,IncrementStencilOp:xM,IncrementWrapStencilOp:MM,InstancedBufferAttribute:so,InstancedBufferGeometry:vx,InstancedInterleavedBuffer:aw,InstancedMesh:sm,Int16BufferAttribute:CS,Int32BufferAttribute:TS,Int8BufferAttribute:SS,IntType:Bl,InterleavedBuffer:Ol,InterleavedBufferAttribute:ms,Interpolant:ya,InterpolateDiscrete:ca,InterpolateLinear:ua,InterpolateSmooth:Uu,InvertStencilOp:EM,KeepStencilOp:Ws,KeyframeTrack:Vi,LOD:Uy,LatheGeometry:kl,Layers:no,LessCompare:xy,LessDepth:Xu,LessEqualCompare:jp,LessEqualDepth:ro,LessEqualStencilFunc:bM,LessStencilFunc:CM,Light:ys,LightProbe:gx,Line:Or,Line3:fw,LineBasicMaterial:jn,LineCurve:hm,LineCurve3:zy,LineDashedMaterial:ix,LineLoop:om,LineSegments:er,LinearFilter:Qt,LinearInterpolant:_m,LinearMipMapLinearFilter:Ep,LinearMipMapNearestFilter:pM,LinearMipmapLinearFilter:Gi,LinearMipmapNearestFilter:$o,LinearSRGBColorSpace:gr,LinearToneMapping:sy,LinearTransfer:vl,Loader:kn,LoaderUtils:hs,LoadingManager:tf,LoopOnce:fy,LoopPingPong:py,LoopRepeat:dy,LuminanceAlphaFormat:Yp,LuminanceFormat:Jp,MOUSE:cM,Material:Rn,MaterialLoader:nf,MathUtils:Cy,Matrix2:Bm,Matrix3:bt,Matrix4:gt,MaxEquation:V_,Mesh:un,MeshBasicMaterial:mi,MeshDepthMaterial:mm,MeshDistanceMaterial:gm,MeshLambertMaterial:tx,MeshMatcapMaterial:nx,MeshNormalMaterial:ex,MeshPhongMaterial:jy,MeshPhysicalMaterial:zi,MeshStandardMaterial:Xl,MeshToonMaterial:$y,MinEquation:z_,MirroredRepeatWrapping:ra,MixOperation:iy,MultiplyBlending:Mp,MultiplyOperation:Il,NearestFilter:Nn,NearestMipMapLinearFilter:dM,NearestMipMapNearestFilter:fM,NearestMipmapLinearFilter:Ys,NearestMipmapNearestFilter:bh,NeutralToneMapping:uy,NeverCompare:yy,NeverDepth:Vu,NeverStencilFunc:wM,NoBlending:ur,NoColorSpace:Pr,NoToneMapping:hr,NormalAnimationBlendMode:Fh,NormalBlending:eo,NotEqualCompare:Sy,NotEqualDepth:Zu,NotEqualStencilFunc:IM,NumberKeyframeTrack:ao,Object3D:zt,ObjectLoader:UE,ObjectSpaceNormalMap:_y,OctahedronGeometry:Vl,OneFactor:X_,OneMinusConstantAlphaFactor:ny,OneMinusConstantColorFactor:ey,OneMinusDstAlphaFactor:Z_,OneMinusDstColorFactor:Q_,OneMinusSrcAlphaFactor:zu,OneMinusSrcColorFactor:Y_,Orthogra
3827phicCamera:po,PCFShadowMap:Th,PCFSoftShadowMap:sl,PMREMGenerator:Dp,Path:Al,PerspectiveCamera:bn,Plane:os,PlaneGeometry:_s,PlaneHelper:Ew,PointLight:Sm,PointLightHelper:mw,Points:am,PointsMaterial:kh,PolarGridHelper:yw,PolyhedronGeometry:vs,PositionalAudio:VE,PropertyBinding:Wt,PropertyMixer:Mx,QuadraticBezierCurve:fm,QuadraticBezierCurve3:dm,Quaternion:qn,QuaternionKeyframeTrack:lo,QuaternionLinearInterpolant:lx,RED_GREEN_RGTC2_Format:xh,RED_RGTC1_Format:Zp,REVISION:Rl,RGBADepthPacking:vy,RGBAFormat:Mn,RGBAIntegerFormat:Lh,RGBA_ASTC_10x10_Format:ph,RGBA_ASTC_10x5_Format:hh,RGBA_ASTC_10x6_Format:fh,RGBA_ASTC_10x8_Format:dh,RGBA_ASTC_12x10_Format:mh,RGBA_ASTC_12x12_Format:gh,RGBA_ASTC_4x4_Format:ih,RGBA_ASTC_5x4_Format:rh,RGBA_ASTC_5x5_Format:sh,RGBA_ASTC_6x5_Format:oh,RGBA_ASTC_6x6_Format:ah,RGBA_ASTC_8x5_Format:lh,RGBA_ASTC_8x6_Format:ch,RGBA_ASTC_8x8_Format:uh,RGBA_BPTC_Format:ul,RGBA_ETC2_EAC_Format:nh,RGBA_PVRTC_2BPPV1_Format:$u,RGBA_PVRTC_4BPPV1_Format:ju,RGBA_S3TC_DXT1_Format:al,RGBA_S3TC_DXT3_Format:ll,RGBA_S3TC_DXT5_Format:cl,RGBDepthPacking:gM,RGBFormat:Xp,RGBIntegerFormat:mM,RGB_BPTC_SIGNED_Format:vh,RGB_BPTC_UNSIGNED_Format:_h,RGB_ETC1_Format:eh,RGB_ETC2_Format:th,RGB_PVRTC_2BPPV1_Format:Qu,RGB_PVRTC_4BPPV1_Format:qu,RGB_S3TC_DXT1_Format:ol,RGDepthPacking:vM,RGFormat:Kp,RGIntegerFormat:Dh,RawShaderMaterial:Qy,Ray:va,Raycaster:Im,RectAreaLight:px,RedFormat:Pl,RedIntegerFormat:Dl,ReinhardToneMapping:oy,RenderTarget:Uh,RenderTarget3D:iw,RenderTargetArray:rw,RepeatWrapping:ps,ReplaceStencilOp:yM,ReverseSubtractEquation:k_,RingGeometry:Zh,SIGNED_RED_GREEN_RGTC2_Format:Ah,SIGNED_RED_RGTC1_Format:yh,SRGBColorSpace:si,SRGBTransfer:$t,Scene:Nl,ShaderChunk:Dt,ShaderLib:Qi,ShaderMaterial:vi,ShadowMaterial:qy,Shape:io,ShapeGeometry:qh,ShapePath:Tw,ShapeUtils:fr,ShortType:Ih,Skeleton:Hl,SkeletonHelper:pw,SkinnedMesh:rm,Source:cs,Sphere:Hn,SphereGeometry:Wl,Spherical:cw,SphericalHarmonics3:mx,SplineCurve:pm,SpotLight:Mm,SpotLightHelper:dw,Sprite:Fy,SpriteMaterial:im,SrcAlphaFactor:ku,SrcAlphaSaturateFactor:j_,SrcColorFactor:J_,StaticCopyUsage:NM,StaticDrawUsage:_l,StaticReadUsage:LM,StereoCamera:HE,StreamCopyUsage:HM,StreamDrawUsage:DM,StreamReadUsage:UM,StringKeyframeTrack:fo,SubtractEquation:G_,SubtractiveBlending:Ap,TOUCH:uM,TangentSpaceNormalMap:gs,TetrahedronGeometry:Qh,Texture:jt,TextureLoader:hx,TextureUtils:Dw,TimestampQuery:kM,TorusGeometry:jh,TorusKnotGeometry:$h,Triangle:pi,TriangleFanDrawMode:Mh,TriangleStripDrawMode:Qp,TrianglesDrawMode:my,TubeGeometry:ef,UVMapping:fs,Uint16BufferAttribute:em,Uint32BufferAttribute:tm,Uint8BufferAttribute:ES,Uint8ClampedBufferAttribute:wS,Uniform:Rm,UniformsGroup:ow,UniformsLib:Je,UniformsUtils:Py,UnsignedByteType:gi,UnsignedInt248Type:oa,UnsignedInt5999Type:Vp,UnsignedIntType:mr,UnsignedShort4444Type:Bh,UnsignedShort5551Type:Ph,UnsignedShortType:sa,VSMShadowMap:qi,Vector2:be,Vector3:H,Vector4:Jt,VectorKeyframeTrack:co,VideoFrameTexture:JS,VideoTexture:Oy,WebGL3DRenderTarget:fS,WebGLArrayRenderTarget:hS,WebGLCoordinateSystem:ji,WebGLCubeRenderTarget:nm,WebGLRenderTarget:ki,WebGLRenderer:Dm,WebGLUtils:Ix,WebGPUCoordinateSystem:yl,WebXRController:Ou,WireframeGeometry:Zy,WrapAroundEnding:gl,ZeroCurvatureEnding:Ks,ZeroFactor:W_,ZeroSlopeEnding:Zs,ZeroStencilOp:_M,createCanvasElement:by},Symbol.toStringTag,{value:"Module"}));var Qd={exports:{}},is={};/** 3828 * @license React 3829 * react-reconciler-constants.production.min.js 3830 * 3831 * Copyright (c) Facebook, Inc. and its affiliates. 3832 * 3833 * This source code is licensed under the MIT license found in the 3834 * LICENSE file in the root directory of this source tree. 3835 */var r_;function mR(){return r_||(r_=1,is.ConcurrentRoot=1,is.ContinuousEventPriority=4,is.DefaultEventPriority=16,is.DiscreteEventPriority=1,is.IdleEventPriority=536870912,is.LegacyRoot=0),is}var s_;function gR(){return s_||(s_=1,Qd.exports=mR()),Qd.exports}var jo=gR();function vR(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);
vendor: 4,153 bytes, lines 3835-3843
3835if(!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 _R=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),o_=_R?He.useEffect:He.useLayoutEffect;function Bx(r){const e=typeof r=="function"?vR(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=He.useReducer(x=>x+1,0),o=e.getState(),l=He.useRef(o),u=He.useRef(n),h=He.useRef(i),f=He.useRef(!1),d=He.useRef();d.current===void 0&&(d.current=n(o));let p,g=!1;(l.current!==o||u.current!==n||h.current!==i||f.current)&&(p=n(o),g=!i(d.current,p)),o_(()=>{g&&(d.current=p),l.current=o,u.current=n,h.current=i,f.current=!1});const v=He.useRef(o);o_(()=>{const x=()=>{try{const S=e.getState(),E=u.current(S);h.current(d.current,E)||(l.current=S,d.current=E,s())}catch{f.current=!0,s()}},_=e.subscribe(x);return e.getState()!==v.current&&x(),_},[]);const A=g?p:d.current;return He.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 yR=r=>typeof r=="object"&&typeof r.then=="function",js=[];function Px(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 Dx(r,e=null,t=!1,n={}){e===null&&(e=[r]);for(const s of js)if(Px(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=js.indexOf(i);s!==-1&&js.splice(s,1)},promise:(yR(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(js.push(i),!t)throw i.promise}const xR=(r,e,t)=>Dx(r,e,!1,t),AR=(r,e,t)=>void Dx(r,e,!0,t),MR=r=>{if(r===void 0||r.length===0)js.splice(0,js.length);else{const e=js.find(t=>Px(r,t.keys,t.equal));e&&e.remove()}};var jd={exports:{}},$d={exports:{}},ep={};/** 3836 * @license React 3837 * scheduler.production.min.js 3838 * 3839 * Copyright (c) Facebook, Inc. and its affiliates. 3840 * 3841 * This source code is licensed under the MIT license found in the 3842 * LICENSE file in the root directory of this source tree. 3843 */var a_;function SR(){return a_||(a_=1,(function(r){function e(G,te){var q=G.length;G.push(te);e:for(;0<q;){var ce=q-1>>>1,Se=G[ce];if(0<i(Se,te))G[ce]=te,G[q]=Se,q=ce;else break e}}function t(G){return G.length===0?null:G[0]}function n(G){if(G.length===0)return null;var te=G[0],q=G.pop();if(q!==te){G[0]=q;e:for(var ce=0,Se=G.length,Ge=Se>>>1;ce<Ge;){var le=2*(ce+1)-1,Re=G[le],we=le+1,Le=G[we];if(0>i(Re,q))we<Se&&0>i(Le,Re)?(G[ce]=Le,G[we]=q,ce=we):(G[ce]=Re,G[le]=q,ce=le);else if(we<Se&&0>i(Le,q))G[ce]=Le,G[we]=q,ce=we;else break e}}return te}function i(G,te){var q=G.sortIndex-te.sortIndex;return q!==0?q:G.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();r.unstable_now=function(){return o.now()-l}}var u=[],h=[],f=1,d=null,p=3,g=!1,v=!1,A=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=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(G){for(var te=t(h);te!==null;){if(te.callback===null)n(h);else if(te.startTime<=G)n(h),te.sortIndex=te.expirationTime,e(u,te);else break;te=t(h)}}function w(G){if(A=!1,E(G),!v)if(t(u)!==null)v=!0,ee(L);else{var te=t(h);te!==null&&Me(w,te.startTime-G)}}function L(G,te){v=!1,A&&(A=!1,_(D),D=-1),g=!0;var q=p;try{for(E(te),d=t(u);d!==null&&(!(d.expirationTime>te)||G&&!N());){var ce=d.callback;
vendor: 6,272 bytes, lines 3843-3851
3843if(typeof ce=="function"){d.callback=null,p=d.priorityLevel;var Se=ce(d.expirationTime<=te);te=r.unstable_now(),typeof Se=="function"?d.callback=Se:d===t(u)&&n(u),E(te)}else n(u);d=t(u)}if(d!==null)var Ge=!0;else{var le=t(h);le!==null&&Me(w,le.startTime-te),Ge=!1}return Ge}finally{d=null,p=q,g=!1}}var B=!1,F=null,D=-1,T=5,b=-1;function N(){return!(r.unstable_now()-b<T)}function Y(){if(F!==null){var G=r.unstable_now();b=G;var te=!0;try{te=F(!0,G)}finally{te?K():(B=!1,F=null)}}else B=!1}var K;if(typeof S=="function")K=function(){S(Y)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,oe=Q.port2;Q.port1.onmessage=Y,K=function(){oe.postMessage(null)}}else K=function(){x(Y,0)};function ee(G){F=G,B||(B=!0,K())}function Me(G,te){D=x(function(){G(r.unstable_now())},te)}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(G){G.callback=null},r.unstable_continueExecution=function(){v||g||(v=!0,ee(L))},r.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<G?Math.floor(1e3/G):5},r.unstable_getCurrentPriorityLevel=function(){return p},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(G){switch(p){case 1:case 2:case 3:var te=3;break;default:te=p}var q=p;p=te;try{return G()}finally{p=q}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(G,te){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var q=p;p=G;try{return te()}finally{p=q}},r.unstable_scheduleCallback=function(G,te,q){var ce=r.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?ce+q:ce):q=ce,G){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=q+Se,G={id:f++,callback:te,priorityLevel:G,startTime:q,expirationTime:Se,sortIndex:-1},q>ce?(G.sortIndex=q,e(h,G),t(u)===null&&G===t(h)&&(A?(_(D),D=-1):A=!0,Me(w,q-ce))):(G.sortIndex=Se,e(u,G),v||g||(v=!0,ee(L))),G},r.unstable_shouldYield=N,r.unstable_wrapCallback=function(G){var te=p;return function(){var q=p;p=te;try{return G.apply(this,arguments)}finally{p=q}}}})(ep)),ep}var l_;function ER(){return l_||(l_=1,$d.exports=SR()),$d.exports}/** 3844 * @license React 3845 * react-reconciler.production.min.js 3846 * 3847 * Copyright (c) Facebook, Inc. and its affiliates. 3848 * 3849 * This source code is licensed under the MIT license found in the 3850 * LICENSE file in the root directory of this source tree. 3851 */var tp,c_;function wR(){return c_||(c_=1,tp=function(e){var t={},n=rM(),i=ER(),s=Object.assign;function o(a){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+a,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=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"),x=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),L=Symbol.iterator;function B(a){return a===null||typeof a!="object"?null:(a=L&&a[L]||a["@@iterator"],typeof a=="function"?a:null)}function F(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case f:return"Fragment";case h:return"Portal";case p:return"Profiler";case d:return"StrictMode";case x:return"Suspense";case _:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case v:return(a.displayName||"Context")+".Consumer";case g:return(a._context.displayName||"Context")+".Provider";case A:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case S:return c=a.displayName||null,c!==null?c:F(a.type)||"Memo";case E:c=a._payload,a=a._init;try{return F(a(c))}catch{}}return null}function D(a){var c=a.type;switch(a.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 a=c.render,a=a.displayName||a.name||"",c.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return F(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 T(a){var c=a,m=a;if(a.alternate)for(;c.return;)c=c.return;else{a=c;do c=a,(c.flags&4098)!==0&&(m=c.return),a=c.return;while(a)}return c.tag===3?m:null}function b(a){if(T(a)!==a)throw Error(o(188))}function N(a){var c=a.alternate;if(!c){if(c=T(a),c===null)throw Error(o(188));return c!==a?null:a}for(var m=a,y=c;;){var M=m.return;if(M===null)break;var C=M.alternate;if(C===null){if(y=M.return,y!==null){m=y;continue}break}if(M.child===C.child){for(C=M.child;C;){if(C===m)return b(M),a;if(C===y)return b(M),c;C=C.sibling}throw Error(o(188))}if(m.return!==y.return)m=M,y=C;else{for(var k=!1,j=M.child;j;){if(j===m){k=!0,m=M,y=C;break}if(j===y){k=!0,y=M,m=C;break}j=j.sibling}if(!k){for(j=C.child;j;){if(j===m){k=!0,m=C,y=M;break}if(j===y){k=!0,y=C,m=M;break}j=j.sibling}if(!k)throw Error(o(189))}}if(m.alternate!==y)throw Error(o(190))}if(m.tag!==3)throw Error(o(188));return m.stateNode.current===m?a:c}function Y(a){return a=N(a),a!==null?K(a):null}function K(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var c=K(a);if(c!==null)return c;a=a.sibling}return null}
vendor: 63,778 bytes, lines 3851-3857
3851function Q(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){if(a.tag!==4){var c=Q(a);if(c!==null)return c}a=a.sibling}return null}var oe=Array.isArray,ee=e.getPublicInstance,Me=e.getRootHostContext,G=e.getChildHostContext,te=e.prepareForCommit,q=e.resetAfterCommit,ce=e.createInstance,Se=e.appendInitialChild,Ge=e.finalizeInitialChildren,le=e.prepareUpdate,Re=e.shouldSetTextContent,we=e.createTextInstance,Le=e.scheduleTimeout,ot=e.cancelTimeout,Ut=e.noTimeout,ft=e.isPrimaryRenderer,xt=e.supportsMutation,kt=e.supportsPersistence,pt=e.supportsHydration,X=e.getInstanceFromNode,tn=e.preparePortalMount,Ee=e.getCurrentEventPriority,Ie=e.detachDeletedInstance,Ae=e.supportsMicrotasks,ze=e.scheduleMicrotask,ye=e.supportsTestSelectors,O=e.findFiberRoot,P=e.getBoundingRect,ne=e.getTextContent,he=e.isHiddenSubtree,xe=e.matchAccessibilityRole,ve=e.setFocusIfFocusable,tt=e.setupIntersectionObserver,Oe=e.appendChild,Ke=e.appendChildToContainer,Lt=e.commitTextUpdate,Fe=e.commitMount,$e=e.commitUpdate,ut=e.insertBefore,it=e.insertInContainerBefore,je=e.removeChild,Et=e.removeChildFromContainer,dt=e.resetTextContent,Mt=e.hideInstance,$=e.hideTextInstance,ue=e.unhideInstance,de=e.unhideTextInstance,Ce=e.clearContainer,qe=e.cloneInstance,We=e.createContainerChildSet,At=e.appendChildToContainerChildSet,rn=e.finalizeContainerChildren,_n=e.replaceContainerChildren,Vt=e.cloneHiddenInstance,zn=e.cloneHiddenTextInstance,_i=e.canHydrateInstance,mo=e.canHydrateTextInstance,go=e.canHydrateSuspenseInstance,$n=e.isSuspenseInstancePending,_r=e.isSuspenseInstanceFallback,nr=e.registerSuspenseInstanceRetry,li=e.getNextHydratableSibling,It=e.getFirstHydratableChild,xs=e.getFirstHydratableChildWithinContainer,Gr=e.getFirstHydratableChildWithinSuspenseInstance,R=e.hydrateInstance,U=e.hydrateTextInstance,J=e.hydrateSuspenseInstance,ae=e.getNextHydratableInstanceAfterSuspenseInstance,pe=e.commitHydratedContainer,me=e.commitHydratedSuspenseInstance,Ue=e.clearSuspenseBoundary,Pe=e.clearSuspenseBoundaryFromContainer,I=e.shouldDeleteUnhydratedTailInstances,z=e.didNotMatchHydratedContainerTextInstance,W=e.didNotMatchHydratedTextInstance,V;function Z(a){if(V===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);V=c&&c[1]||""}return` 3852`+V+a}var re=!1;function ge(a,c){if(!a||re)return"";re=!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(Ne){var y=Ne}Reflect.construct(a,[],c)}else{try{c.call()}catch(Ne){y=Ne}a.call(c.prototype)}else{try{throw Error()}catch(Ne){y=Ne}a()}}catch(Ne){if(Ne&&y&&typeof Ne.stack=="string"){for(var M=Ne.stack.split(` 3853`),C=y.stack.split(` 3854`),k=M.length-1,j=C.length-1;1<=k&&0<=j&&M[k]!==C[j];)j--;for(;1<=k&&0<=j;k--,j--)if(M[k]!==C[j]){if(k!==1||j!==1)do if(k--,j--,0>j||M[k]!==C[j]){var _e=` 3855`+M[k].replace(" at new "," at ");return a.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",a.displayName)),_e}while(1<=k&&0<=j);break}}}finally{re=!1,Error.prepareStackTrace=m}return(a=a?a.displayName||a.name:"")?Z(a):""}var Te=Object.prototype.hasOwnProperty,Be=[],Ve=-1;function ke(a){return{current:a}}function De(a){0>Ve||(a.current=Be[Ve],Be[Ve]=null,Ve--)}function Xe(a,c){Ve++,Be[Ve]=a.current,a.current=c}var nt={},_t=ke(nt),st=ke(!1),lt=nt;function et(a,c){var m=a.type.contextTypes;if(!m)return nt;var y=a.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===c)return y.__reactInternalMemoizedMaskedChildContext;var M={},C;for(C in m)M[C]=c[C];return y&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=c,a.__reactInternalMemoizedMaskedChildContext=M),M}function Ot(a){return a=a.childContextTypes,a!=null}function yt(){De(st),De(_t)}function Bt(a,c,m){if(_t.current!==nt)throw Error(o(168));Xe(_t,c),Xe(st,m)}function sn(a,c,m){var y=a.stateNode;if(c=c.childContextTypes,typeof y.getChildContext!="function")return m;y=y.getChildContext();for(var M in y)if(!(M in c))throw Error(o(108,D(a)||"Unknown",M));return s({},m,y)}function wt(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||nt,lt=_t.current,Xe(_t,a),Xe(st,st.current),!0}function Ht(a,c,m){var y=a.stateNode;if(!y)throw Error(o(169));m?(a=sn(a,c,lt),y.__reactInternalMemoizedMergedChildContext=a,De(st),De(_t),Xe(_t,a)):De(st),Xe(st,m)}var vt=Math.clz32?Math.clz32:on,pn=Math.log,en=Math.LN2;function on(a){return a>>>=0,a===0?32:31-(pn(a)/en|0)|0}var Cn=64,kr=4194304;function yi(a){switch(a&-a){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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Kl(a,c){var m=a.pendingLanes;if(m===0)return 0;var y=0,M=a.suspendedLanes,C=a.pingedLanes,k=m&268435455;if(k!==0){var j=k&~M;j!==0?y=yi(j):(C&=k,C!==0&&(y=yi(C)))}else k=m&~M,k!==0?y=yi(k):C!==0&&(y=yi(C));if(y===0)return 0;if(c!==0&&c!==y&&(c&M)===0&&(M=y&-y,C=c&-c,M>=C||M===16&&(C&4194240)!==0))return c;if((y&4)!==0&&(y|=m&16),c=a.entangledLanes,c!==0)for(a=a.entanglements,c&=y;0<c;)m=31-vt(c),M=1<<m,y|=a[m],c&=~M;return y}function dA(a,c){switch(a){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 pA(a,c){for(var m=a.suspendedLanes,y=a.pingedLanes,M=a.expirationTimes,C=a.pendingLanes;0<C;){var k=31-vt(C),j=1<<k,_e=M[k];_e===-1?((j&m)===0||(j&y)!==0)&&(M[k]=dA(j,c)):_e<=c&&(a.expiredLanes|=j),C&=~j}}function of(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function af(a){for(var c=[],m=0;31>m;m++)c.push(a);return c}function Aa(a,c,m){a.pendingLanes|=c,c!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,c=31-vt(c),a[c]=m}function mA(a,c){var m=a.pendingLanes&~c;a.pendingLanes=c,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=c,a.mutableReadLanes&=c,a.entangledLanes&=c,c=a.entanglements;var y=a.eventTimes;for(a=a.expirationTimes;0<m;){var M=31-vt(m),C=1<<M;c[M]=0,y[M]=-1,a[M]=-1,m&=~C}}function lf(a,c){var m=a.entangledLanes|=c;for(a=a.entanglements;m;){var y=31-vt(m),M=1<<y;M&c|a[y]&c&&(a[y]|=c),m&=~M}}var Kt=0;function Km(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var cf=i.unstable_scheduleCallback,Zm=i.unstable_cancelCallback,gA=i.unstable_shouldYield,vA=i.unstable_requestPaint,Pn=i.unstable_now,uf=i.unstable_ImmediatePriority,_A=i.unstable_UserBlockingPriority,hf=i.unstable_NormalPriority,yA=i.unstable_IdlePriority,Zl=null,ir=null;function xA(a){if(ir&&typeof ir.onCommitFiberRoot=="function")try{ir.onCommitFiberRoot(Zl,a,void 0,(a.current.flags&128)===128)}catch{}}function AA(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var rr=typeof Object.is=="function"?Object.is:AA,yr=null,ql=!1,ff=!1;function qm(a){yr===null?yr=[a]:yr.push(a)}function MA(a){ql=!0,qm(a)}function sr(){if(!ff&&yr!==null){ff=!0;var a=0,c=Kt;try{var m=yr;for(Kt=1;a<m.length;a++){var y=m[a];do y=y(!0);while(y!==null)}yr=null,ql=!1}catch(M){throw yr!==null&&(yr=yr.slice(a+1)),cf(uf,sr),M}finally{Kt=c,ff=!1}}return null}var SA=l.ReactCurrentBatchConfig;function Ql(a,c){if(rr(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var m=Object.keys(a),y=Object.keys(c);if(m.length!==y.length)return!1;for(y=0;y<m.length;y++){var M=m[y];if(!Te.call(c,M)||!rr(a[M],c[M]))return!1}return!0}function EA(a){switch(a.tag){case 5:return Z(a.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return a=ge(a.type,!1),a;case 11:return a=ge(a.type.render,!1),a;case 1:return a=ge(a.type,!0),a;default:return""}}function Wi(a,c){if(a&&a.defaultProps){c=s({},c),a=a.defaultProps;for(var m in a)c[m]===void 0&&(c[m]=a[m]);return c}return c}var jl=ke(null),$l=null,vo=null,df=null;function pf(){df=vo=$l=null}function Qm(a,c,m){ft?(Xe(jl,c._currentValue),c._currentValue=m):(Xe(jl,c._currentValue2),c._currentValue2=m)}function mf(a){var c=jl.current;De(jl),ft?a._currentValue=c:a._currentValue2=c}function gf(a,c,m){for(;a!==null;){var y=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,y!==null&&(y.childLanes|=c)):y!==null&&(y.childLanes&c)!==c&&(y.childLanes|=c),a===m)break;a=a.return}}function _o(a,c){$l=a,df=vo=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&c)!==0&&(Mi=!0),a.firstContext=null)}function bi(a){var c=ft?a._currentValue:a._currentValue2;if(df!==a)if(a={context:a,memoizedValue:c,next:null},vo===null){if($l===null)throw Error(o(308));vo=a,$l.dependencies={lanes:0,firstContext:a}}else vo=vo.next=a;return c}var or=null,zr=!1;function vf(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jm(a,c){a=a.updateQueue,c.updateQueue===a&&(c.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function xr(a,c){return{eventTime:a,lane:c,tag:0,payload:null,callback:null,next:null}}function Vr(a,c){var m=a.updateQueue;m!==null&&(m=m.shared,Sn!==null&&(a.mode&1)!==0&&(Nt&2)===0?(a=m.interleaved,a===null?(c.next=c,or===null?or=[m]:or.push(m)):(c.next=a.next,a.next=c),m.interleaved=c):(a=m.pending,a===null?c.next=c:(c.next=a.next,a.next=c),m.pending=c))}function ec(a,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var y=c.lanes;y&=a.pendingLanes,m|=y,c.lanes=m,lf(a,m)}}function $m(a,c){var m=a.updateQueue,y=a.alternate;if(y!==null&&(y=y.updateQueue,m===y)){var M=null,C=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};C===null?M=C=k:C=C.next=k,m=m.next}while(m!==null);C===null?M=C=c:C=C.next=c}else M=C=c;m={baseState:y.baseState,firstBaseUpdate:M,lastBaseUpdate:C,shared:y.shared,effects:y.effects},a.updateQueue=m;return}a=m.lastBaseUpdate,a===null?m.firstBaseUpdate=c:a.next=c,m.lastBaseUpdate=c}function tc(a,c,m,y){var M=a.updateQueue;zr=!1;var C=M.firstBaseUpdate,k=M.lastBaseUpdate,j=M.shared.pending;if(j!==null){M.shared.pending=null;var _e=j,Ne=_e.next;_e.next=null,k===null?C=Ne:k.next=Ne,k=_e;var rt=a.alternate;rt!==null&&(rt=rt.updateQueue,j=rt.lastBaseUpdate,j!==k&&(j===null?rt.firstBaseUpdate=Ne:j.next=Ne,rt.lastBaseUpdate=_e))}if(C!==null){var Ct=M.baseState;k=0,rt=Ne=_e=null,j=C;do{var mt=j.lane,nn=j.eventTime;if((y&mt)===mt){rt!==null&&(rt=rt.next={eventTime:nn,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var ht=a,Jn=j;switch(mt=c,nn=m,Jn.tag){case 1:if(ht=Jn.payload,typeof ht=="function"){Ct=ht.call(nn,Ct,mt);break e}Ct=ht;break e;case 3:ht.flags=ht.flags&-65537|128;case 0:if(ht=Jn.payload,mt=typeof ht=="function"?ht.call(nn,Ct,mt):ht,mt==null)break e;Ct=s({},Ct,mt);break e;case 2:zr=!0}}j.callback!==null&&j.lane!==0&&(a.flags|=64,mt=M.effects,mt===null?M.effects=[j]:mt.push(j))}else nn={eventTime:nn,lane:mt,tag:j.tag,payload:j.payload,callback:j.callback,next:null},rt===null?(Ne=rt=nn,_e=Ct):rt=rt.next=nn,k|=mt;if(j=j.next,j===null){if(j=M.shared.pending,j===null)break;mt=j,j=mt.next,mt.next=null,M.lastBaseUpdate=mt,M.shared.pending=null}}while(!0);if(rt===null&&(_e=Ct),M.baseState=_e,M.firstBaseUpdate=Ne,M.lastBaseUpdate=rt,c=M.shared.interleaved,c!==null){M=c;do k|=M.lane,M=M.next;while(M!==c)}else C===null&&(M.shared.lanes=0);To|=k,a.lanes=k,a.memoizedState=Ct}}function eg(a,c,m){if(a=c.effects,c.effects=null,a!==null)for(c=0;c<a.length;c++){var y=a[c],M=y.callback;if(M!==null){if(y.callback=null,y=m,typeof M!="function")throw Error(o(191,M));M.call(y)}}}var tg=new n.Component().refs;function _f(a,c,m,y){c=a.memoizedState,m=m(y,c),m=m==null?c:s({},c,m),a.memoizedState=m,a.lanes===0&&(a.updateQueue.baseState=m)}var nc={isMounted:function(a){return(a=a._reactInternals)?T(a)===a:!1},enqueueSetState:function(a,c,m){a=a._reactInternals;var y=ti(),M=Jr(a),C=xr(y,M);C.payload=c,m!=null&&(C.callback=m),Vr(a,C),c=Di(a,M,y),c!==null&&ec(c,a,M)},enqueueReplaceState:function(a,c,m){a=a._reactInternals;var y=ti(),M=Jr(a),C=xr(y,M);C.tag=1,C.payload=c,m!=null&&(C.callback=m),Vr(a,C),c=Di(a,M,y),c!==null&&ec(c,a,M)},enqueueForceUpdate:function(a,c){a=a._reactInternals;var m=ti(),y=Jr(a),M=xr(m,y);M.tag=2,c!=null&&(M.callback=c),Vr(a,M),c=Di(a,y,m),c!==null&&ec(c,a,y)}};function ng(a,c,m,y,M,C,k){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(y,C,k):c.prototype&&c.prototype.isPureReactComponent?!Ql(m,y)||!Ql(M,C):!0}function ig(a,c,m){var y=!1,M=nt,C=c.contextType;return typeof C=="object"&&C!==null?C=bi(C):(M=Ot(c)?lt:_t.current,y=c.contextTypes,C=(y=y!=null)?et(a,M):nt),c=new c(m,C),a.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=nc,a.stateNode=c,c._reactInternals=a,y&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=M,a.__reactInternalMemoizedMaskedChildContext=C),c}function rg(a,c,m,y){a=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,y),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,y),c.state!==a&&nc.enqueueReplaceState(c,c.state,null)}function yf(a,c,m,y){var M=a.stateNode;M.props=m,M.state=a.memoizedState,M.refs=tg,vf(a);var C=c.contextType;typeof C=="object"&&C!==null?M.context=bi(C):(C=Ot(c)?lt:_t.current,M.context=et(a,C)),M.state=a.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(_f(a,c,C,m),M.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(c=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),c!==M.state&&nc.enqueueReplaceState(M,M.state,null),tc(a,m,M,y),M.state=a.memoizedState),typeof M.componentDidMount=="function"&&(a.flags|=4194308)}var yo=[],xo=0,ic=null,rc=0,Ri=[],Ii=0,As=null,Ar=1,Mr="";function Ms(a,c){yo[xo++]=rc,yo[xo++]=ic,ic=a,rc=c}function sg(a,c,m){Ri[Ii++]=Ar,Ri[Ii++]=Mr,Ri[Ii++]=As,As=a;var y=Ar;a=Mr;var M=32-vt(y)-1;y&=~(1<<M),m+=1;var C=32-vt(c)+M;if(30<C){var k=M-M%5;C=(y&(1<<k)-1).toString(32),y>>=k,M-=k,Ar=1<<32-vt(c)+M|m<<M|y,Mr=C+a}else Ar=1<<C|m<<M|y,Mr=a}function xf(a){a.return!==null&&(Ms(a,1),sg(a,1,0))}function Af(a){for(;a===ic;)ic=yo[--xo],yo[xo]=null,rc=yo[--xo],yo[xo]=null;for(;a===As;)As=Ri[--Ii],Ri[Ii]=null,Mr=Ri[--Ii],Ri[Ii]=null,Ar=Ri[--Ii],Ri[Ii]=null}var xi=null,Ai=null,cn=!1,Ma=!1,Xi=null;function og(a,c){var m=Li(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=a,c=a.deletions,c===null?(a.deletions=[m],a.flags|=16):c.push(m)}function ag(a,c){switch(a.tag){case 5:return c=_i(c,a.type,a.pendingProps),c!==null?(a.stateNode=c,xi=a,Ai=It(c),!0):!1;case 6:return c=mo(c,a.pendingProps),c!==null?(a.stateNode=c,xi=a,Ai=null,!0):!1;case 13:if(c=go(c),c!==null){var m=As!==null?{id:Ar,overflow:Mr}:null;return a.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=Li(18,null,null,0),m.stateNode=c,m.return=a,a.child=m,xi=a,Ai=null,!0}return!1;default:return!1}}function Mf(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Sf(a){if(cn){var c=Ai;if(c){var m=c;if(!ag(a,c)){if(Mf(a))throw Error(o(418));c=li(m);var y=xi;c&&ag(a,c)?og(y,m):(a.flags=a.flags&-4097|2,cn=!1,xi=a)}}else{if(Mf(a))throw Error(o(418));a.flags=a.flags&-4097|2,cn=!1,xi=a}}}function lg(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;xi=a}function Sa(a){if(!pt||a!==xi)return!1;if(!cn)return lg(a),cn=!0,!1;if(a.tag!==3&&(a.tag!==5||I(a.type)&&!Re(a.type,a.memoizedProps))){var c=Ai;if(c){if(Mf(a)){for(a=Ai;a;)a=li(a);throw Error(o(418))}for(;c;)og(a,c),c=li(c)}}if(lg(a),a.tag===13){if(!pt)throw Error(o(316));if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));Ai=ae(a)}else Ai=xi?li(a.stateNode):null;return!0}function Ao(){pt&&(Ai=xi=null,Ma=cn=!1)}function Ef(a){Xi===null?Xi=[a]:Xi.push(a)}function Ea(a,c,m){if(a=m.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(o(309));var y=m.stateNode}if(!y)throw Error(o(147,a));var M=y,C=""+a;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===C?c.ref:(c=function(k){var j=M.refs;j===tg&&(j=M.refs={}),k===null?delete j[C]:j[C]=k},c._stringRef=C,c)}if(typeof a!="string")throw Error(o(284));if(!m._owner)throw Error(o(290,a))}return a}function sc(a,c){throw a=Object.prototype.toString.call(c),Error(o(31,a==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":a))}function cg(a){var c=a._init;return c(a._payload)}function ug(a){function c(se,ie){if(a){var fe=se.deletions;fe===null?(se.deletions=[ie],se.flags|=16):fe.push(ie)}}function m(se,ie){if(!a)return null;for(;ie!==null;)c(se,ie),ie=ie.sibling;return null}function y(se,ie){for(se=new Map;ie!==null;)ie.key!==null?se.set(ie.key,ie):se.set(ie.index,ie),ie=ie.sibling;return se}function M(se,ie){return se=Kr(se,ie),se.index=0,se.sibling=null,se}function C(se,ie,fe){return se.index=fe,a?(fe=se.alternate,fe!==null?(fe=fe.index,fe<ie?(se.flags|=2,ie):fe):(se.flags|=2,ie)):(se.flags|=1048576,ie)}function k(se){return a&&se.alternate===null&&(se.flags|=2),se}function j(se,ie,fe,Qe){return ie===null||ie.tag!==6?(ie=ad(fe,se.mode,Qe),ie.return=se,ie):(ie=M(ie,fe),ie.return=se,ie)}function _e(se,ie,fe,Qe){var ct=fe.type;return ct===f?rt(se,ie,fe.props.children,Qe,fe.key):ie!==null&&(ie.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===E&&cg(ct)===ie.type)?(Qe=M(ie,fe.props),Qe.ref=Ea(se,ie,fe),Qe.return=se,Qe):(Qe=Uc(fe.type,fe.key,fe.props,null,se.mode,Qe),Qe.ref=Ea(se,ie,fe),Qe.return=se,Qe)}function Ne(se,ie,fe,Qe){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==fe.containerInfo||ie.stateNode.implementation!==fe.implementation?(ie=ld(fe,se.mode,Qe),ie.return=se,ie):(ie=M(ie,fe.children||[]),ie.return=se,ie)}function rt(se,ie,fe,Qe,ct){return ie===null||ie.tag!==7?(ie=Rs(fe,se.mode,Qe,ct),ie.return=se,ie):(ie=M(ie,fe),ie.return=se,ie)}function Ct(se,ie,fe){if(typeof ie=="string"&&ie!==""||typeof ie=="number")return ie=ad(""+ie,se.mode,fe),ie.return=se,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case u:return fe=Uc(ie.type,ie.key,ie.props,null,se.mode,fe),fe.ref=Ea(se,null,ie),fe.return=se,fe;case h:return ie=ld(ie,se.mode,fe),ie.return=se,ie;case E:var Qe=ie._init;return Ct(se,Qe(ie._payload),fe)}if(oe(ie)||B(ie))return ie=Rs(ie,se.mode,fe,null),ie.return=se,ie;sc(se,ie)}return null}function mt(se,ie,fe,Qe){var ct=ie!==null?ie.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number")return ct!==null?null:j(se,ie,""+fe,Qe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case u:return fe.key===ct?_e(se,ie,fe,Qe):null;case h:return fe.key===ct?Ne(se,ie,fe,Qe):null;case E:return ct=fe._init,mt(se,ie,ct(fe._payload),Qe)}if(oe(fe)||B(fe))return ct!==null?null:rt(se,ie,fe,Qe,null);sc(se,fe)}return null}function nn(se,ie,fe,Qe,ct){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number")return se=se.get(fe)||null,j(ie,se,""+Qe,ct);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case u:return se=se.get(Qe.key===null?fe:Qe.key)||null,_e(ie,se,Qe,ct);case h:return se=se.get(Qe.key===null?fe:Qe.key)||null,Ne(ie,se,Qe,ct);case E:var Ft=Qe._init;return nn(se,ie,fe,Ft(Qe._payload),ct)}if(oe(Qe)||B(Qe))return se=se.get(fe)||null,rt(ie,se,Qe,ct,null);sc(ie,Qe)}return null}function ht(se,ie,fe,Qe){for(var ct=null,Ft=null,Tt=ie,Zt=ie=0,Ln=null;Tt!==null&&Zt<fe.length;Zt++){Tt.index>Zt?(Ln=Tt,Tt=null):Ln=Tt.sibling;var qt=mt(se,Tt,fe[Zt],Qe);if(qt===null){Tt===null&&(Tt=Ln);break}a&&Tt&&qt.alternate===null&&c(se,Tt),ie=C(qt,ie,Zt),Ft===null?ct=qt:Ft.sibling=qt,Ft=qt,Tt=Ln}if(Zt===fe.length)return m(se,Tt),cn&&Ms(se,Zt),ct;if(Tt===null){for(;Zt<fe.length;Zt++)Tt=Ct(se,fe[Zt],Qe),Tt!==null&&(ie=C(Tt,ie,Zt),Ft===null?ct=Tt:Ft.sibling=Tt,Ft=Tt);return cn&&Ms(se,Zt),ct}for(Tt=y(se,Tt);Zt<fe.length;Zt++)Ln=nn(Tt,se,Zt,fe[Zt],Qe),Ln!==null&&(a&&Ln.alternate!==null&&Tt.delete(Ln.key===null?Zt:Ln.key),ie=C(Ln,ie,Zt),Ft===null?ct=Ln:Ft.sibling=Ln,Ft=Ln);return a&&Tt.forEach(function(Zr){return c(se,Zr)}),cn&&Ms(se,Zt),ct}function Jn(se,ie,fe,Qe){var ct=B(fe);if(typeof ct!="function")throw Error(o(150));if(fe=ct.call(fe),fe==null)throw Error(o(151));for(var Ft=ct=null,Tt=ie,Zt=ie=0,Ln=null,qt=fe.next();Tt!==null&&!qt.done;Zt++,qt=fe.next()){Tt.index>Zt?(Ln=Tt,Tt=null):Ln=Tt.sibling;var Zr=mt(se,Tt,qt.value,Qe);if(Zr===null){Tt===null&&(Tt=Ln);break}a&&Tt&&Zr.alternate===null&&c(se,Tt),ie=C(Zr,ie,Zt),Ft===null?ct=Zr:Ft.sibling=Zr,Ft=Zr,Tt=Ln}if(qt.done)return m(se,Tt),cn&&Ms(se,Zt),ct;if(Tt===null){for(;!qt.done;Zt++,qt=fe.next())qt=Ct(se,qt.value,Qe),qt!==null&&(ie=C(qt,ie,Zt),Ft===null?ct=qt:Ft.sibling=qt,Ft=qt);return cn&&Ms(se,Zt),ct}for(Tt=y(se,Tt);!qt.done;Zt++,qt=fe.next())qt=nn(Tt,se,Zt,qt.value,Qe),qt!==null&&(a&&qt.alternate!==null&&Tt.delete(qt.key===null?Zt:qt.key),ie=C(qt,ie,Zt),Ft===null?ct=qt:Ft.sibling=qt,Ft=qt);return a&&Tt.forEach(function(eM){return c(se,eM)}),cn&&Ms(se,Zt),ct}function Fi(se,ie,fe,Qe){if(typeof fe=="object"&&fe!==null&&fe.type===f&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case u:e:{for(var ct=fe.key,Ft=ie;Ft!==null;){if(Ft.key===ct){if(ct=fe.type,ct===f){if(Ft.tag===7){m(se,Ft.sibling),ie=M(Ft,fe.props.children),ie.return=se,se=ie;break e}}else if(Ft.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===E&&cg(ct)===Ft.type){m(se,Ft.sibling),ie=M(Ft,fe.props),ie.ref=Ea(se,Ft,fe),ie.return=se,se=ie;break e}m(se,Ft);break}else c(se,Ft);Ft=Ft.sibling}fe.type===f?(ie=Rs(fe.props.children,se.mode,Qe,fe.key),ie.return=se,se=ie):(Qe=Uc(fe.type,fe.key,fe.props,null,se.mode,Qe),Qe.ref=Ea(se,ie,fe),Qe.return=se,se=Qe)}return k(se);case h:e:{for(Ft=fe.key;ie!==null;){if(ie.key===Ft)if(ie.tag===4&&ie.stateNode.containerInfo===fe.containerInfo&&ie.stateNode.implementation===fe.implementation){m(se,ie.sibling),ie=M(ie,fe.children||[]),ie.return=se,se=ie;break e}else{m(se,ie);break}else c(se,ie);ie=ie.sibling}ie=ld(fe,se.mode,Qe),ie.return=se,se=ie}return k(se);case E:return Ft=fe._init,Fi(se,ie,Ft(fe._payload),Qe)}if(oe(fe))return ht(se,ie,fe,Qe);if(B(fe))return Jn(se,ie,fe,Qe);sc(se,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,ie!==null&&ie.tag===6?(m(se,ie.sibling),ie=M(ie,fe),ie.return=se,se=ie):(m(se,ie),ie=ad(fe,se.mode,Qe),ie.return=se,se=ie),k(se)):m(se,ie)}return Fi}var Mo=ug(!0),hg=ug(!1),wa={},Bi=ke(wa),Ca=ke(wa),So=ke(wa);function ar(a){if(a===wa)throw Error(o(174));return a}function wf(a,c){Xe(So,c),Xe(Ca,a),Xe(Bi,wa),a=Me(c),De(Bi),Xe(Bi,a)}function Eo(){De(Bi),De(Ca),De(So)}function fg(a){var c=ar(So.current),m=ar(Bi.current);c=G(m,a.type,c),m!==c&&(Xe(Ca,a),Xe(Bi,c))}function Cf(a){Ca.current===a&&(De(Bi),De(Ca))}var hn=ke(0);function oc(a){for(var c=a;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||$n(m)||_r(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Tf=[];function bf(){for(var a=0;a<Tf.length;a++){var c=Tf[a];ft?c._workInProgressVersionPrimary=null:c._workInProgressVersionSecondary=null}Tf.length=0}var ac=l.ReactCurrentDispatcher,Pi=l.ReactCurrentBatchConfig,wo=0,mn=null,Vn=null,Dn=null,lc=!1,Ta=!1,ba=0,wA=0;function Wn(){throw Error(o(321))}function Rf(a,c){if(c===null)return!1;for(var m=0;m<c.length&&m<a.length;m++)if(!rr(a[m],c[m]))return!1;return!0}function If(a,c,m,y,M,C){if(wo=C,mn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,ac.current=a===null||a.memoizedState===null?RA:IA,a=m(y,M),Ta){C=0;do{if(Ta=!1,ba=0,25<=C)throw Error(o(301));C+=1,Dn=Vn=null,c.updateQueue=null,ac.current=BA,a=m(y,M)}while(Ta)}if(ac.current=dc,c=Vn!==null&&Vn.next!==null,wo=0,Dn=Vn=mn=null,lc=!1,c)throw Error(o(300));return a}function Bf(){var a=ba!==0;return ba=0,a}function Sr(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dn===null?mn.memoizedState=Dn=a:Dn=Dn.next=a,Dn}function lr(){if(Vn===null){var a=mn.alternate;a=a!==null?a.memoizedState:null}else a=Vn.next;var c=Dn===null?mn.memoizedState:Dn.next;if(c!==null)Dn=c,Vn=a;else{if(a===null)throw Error(o(310));Vn=a,a={memoizedState:Vn.memoizedState,baseState:Vn.baseState,baseQueue:Vn.baseQueue,queue:Vn.queue,next:null},Dn===null?mn.memoizedState=Dn=a:Dn=Dn.next=a}return Dn}function Ss(a,c){return typeof c=="function"?c(a):c}function cc(a){var c=lr(),m=c.queue;if(m===null)throw Error(o(311));m.lastRenderedReducer=a;var y=Vn,M=y.baseQueue,C=m.pending;if(C!==null){if(M!==null){var k=M.next;M.next=C.next,C.next=k}y.baseQueue=M=C,m.pending=null}if(M!==null){C=M.next,y=y.baseState;var j=k=null,_e=null,Ne=C;do{var rt=Ne.lane;if((wo&rt)===rt)_e!==null&&(_e=_e.next={lane:0,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null}),y=Ne.hasEagerState?Ne.eagerState:a(y,Ne.action);else{var Ct={lane:rt,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null};_e===null?(j=_e=Ct,k=y):_e=_e.next=Ct,mn.lanes|=rt,To|=rt}Ne=Ne.next}while(Ne!==null&&Ne!==C);_e===null?k=y:_e.next=j,rr(y,c.memoizedState)||(Mi=!0),c.memoizedState=y,c.baseState=k,c.baseQueue=_e,m.lastRenderedState=y}if(a=m.interleaved,a!==null){M=a;do C=M.lane,mn.lanes|=C,To|=C,M=M.next;while(M!==a)}else M===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function uc(a){var c=lr(),m=c.queue;if(m===null)throw Error(o(311));m.lastRenderedReducer=a;var y=m.dispatch,M=m.pending,C=c.memoizedState;if(M!==null){m.pending=null;var k=M=M.next;do C=a(C,k.action),k=k.next;while(k!==M);rr(C,c.memoizedState)||(Mi=!0),c.memoizedState=C,c.baseQueue===null&&(c.baseState=C),m.lastRenderedState=C}return[C,y]}function dg(){}function pg(a,c){var m=mn,y=lr(),M=c(),C=!rr(y.memoizedState,M);if(C&&(y.memoizedState=M,Mi=!0),y=y.queue,Ia(vg.bind(null,m,y,a),[a]),y.getSnapshot!==c||C||Dn!==null&&Dn.memoizedState.tag&1){if(m.flags|=2048,Ra(9,gg.bind(null,m,y,M,c),void 0,null),Sn===null)throw Error(o(349));(wo&30)!==0||mg(m,c,M)}return M}function mg(a,c,m){a.flags|=16384,a={getSnapshot:c,value:m},c=mn.updateQueue,c===null?(c={lastEffect:null,stores:null},mn.updateQueue=c,c.stores=[a]):(m=c.stores,m===null?c.stores=[a]:m.push(a))}function gg(a,c,m,y){c.value=m,c.getSnapshot=y,_g(c)&&Di(a,1,-1)}function vg(a,c,m){return m(function(){_g(c)&&Di(a,1,-1)})}function _g(a){var c=a.getSnapshot;a=a.value;try{var m=c();return!rr(a,m)}catch{return!0}}function Pf(a){var c=Sr();return typeof a=="function"&&(a=a()),c.memoizedState=c.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:a},c.queue=a,a=a.dispatch=bA.bind(null,mn,a),[c.memoizedState,a]}function Ra(a,c,m,y){return a={tag:a,create:c,destroy:m,deps:y,next:null},c=mn.updateQueue,c===null?(c={lastEffect:null,stores:null},mn.updateQueue=c,c.lastEffect=a.next=a):(m=c.lastEffect,m===null?c.lastEffect=a.next=a:(y=m.next,m.next=a,a.next=y,c.lastEffect=a)),a}function yg(){return lr().memoizedState}function hc(a,c,m,y){var M=Sr();mn.flags|=a,M.memoizedState=Ra(1|c,m,void 0,y===void 0?null:y)}function fc(a,c,m,y){var M=lr();y=y===void 0?null:y;var C=void 0;if(Vn!==null){var k=Vn.memoizedState;if(C=k.destroy,y!==null&&Rf(y,k.deps)){M.memoizedState=Ra(c,m,C,y);return}}mn.flags|=a,M.memoizedState=Ra(1|c,m,C,y)}function Df(a,c){return hc(8390656,8,a,c)}function Ia(a,c){return fc(2048,8,a,c)}function xg(a,c){return fc(4,2,a,c)}function Ag(a,c){return fc(4,4,a,c)}function Mg(a,c){if(typeof c=="function")return a=a(),c(a),function(){c(null)};if(c!=null)return a=a(),c.current=a,function(){c.current=null}}function Sg(a,c,m){return m=m!=null?m.concat([a]):null,fc(4,4,Mg.bind(null,c,a),m)}function Lf(){}function Eg(a,c){var m=lr();c=c===void 0?null:c;var y=m.memoizedState;return y!==null&&c!==null&&Rf(c,y[1])?y[0]:(m.memoizedState=[a,c],a)}function wg(a,c){var m=lr();c=c===void 0?null:c;var y=m.memoizedState;return y!==null&&c!==null&&Rf(c,y[1])?y[0]:(a=a(),m.memoizedState=[a,c],a)}function CA(a,c){var m=Kt;Kt=m!==0&&4>m?m:4,a(!0);var y=Pi.transition;Pi.transition={};try{a(!1),c()}finally{Kt=m,Pi.transition=y}}function Cg(){return lr().memoizedState}function TA(a,c,m){var y=Jr(a);m={lane:y,action:m,hasEagerState:!1,eagerState:null,next:null},Tg(a)?bg(c,m):(Rg(a,c,m),m=ti(),a=Di(a,y,m),a!==null&&Ig(a,c,y))}function bA(a,c,m){var y=Jr(a),M={lane:y,action:m,hasEagerState:!1,eagerState:null,next:null};if(Tg(a))bg(c,M);else{Rg(a,c,M);var C=a.alternate;if(a.lanes===0&&(C===null||C.lanes===0)&&(C=c.lastRenderedReducer,C!==null))try{var k=c.lastRenderedState,j=C(k,m);if(M.hasEagerState=!0,M.eagerState=j,rr(j,k))return}catch{}finally{}m=ti(),a=Di(a,y,m),a!==null&&Ig(a,c,y)}}function Tg(a){var c=a.alternate;return a===mn||c!==null&&c===mn}function bg(a,c){Ta=lc=!0;var m=a.pending;m===null?c.next=c:(c.next=m.next,m.next=c),a.pending=c}function Rg(a,c,m){Sn!==null&&(a.mode&1)!==0&&(Nt&2)===0?(a=c.interleaved,a===null?(m.next=m,or===null?or=[c]:or.push(c)):(m.next=a.next,a.next=m),c.interleaved=m):(a=c.pending,a===null?m.next=m:(m.next=a.next,a.next=m),c.pending=m)}function Ig(a,c,m){if((m&4194240)!==0){var y=c.lanes;y&=a.pendingLanes,m|=y,c.lanes=m,lf(a,m)}}var dc={readContext:bi,useCallback:Wn,useContext:Wn,useEffect:Wn,useImperativeHandle:Wn,useInsertionEffect:Wn,useLayoutEffect:Wn,useMemo:Wn,useReducer:Wn,useRef:Wn,useState:Wn,useDebugValue:Wn,useDeferredValue:Wn,useTransition:Wn,useMutableSource:Wn,useSyncExternalStore:Wn,useId:Wn,unstable_isNewReconciler:!1},RA={readContext:bi,useCallback:function(a,c){return Sr().memoizedState=[a,c===void 0?null:c],a},useContext:bi,useEffect:Df,useImperativeHandle:function(a,c,m){return m=m!=null?m.concat([a]):null,hc(4194308,4,Mg.bind(null,c,a),m)},useLayoutEffect:function(a,c){return hc(4194308,4,a,c)},useInsertionEffect:function(a,c){return hc(4,2,a,c)},useMemo:function(a,c){var m=Sr();return c=c===void 0?null:c,a=a(),m.memoizedState=[a,c],a},useReducer:function(a,c,m){var y=Sr();return c=m!==void 0?m(c):c,y.memoizedState=y.baseState=c,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:c},y.queue=a,a=a.dispatch=TA.bind(null,mn,a),[y.memoizedState,a]},useRef:function(a){var c=Sr();return a={current:a},c.memoizedState=a},useState:Pf,useDebugValue:Lf,useDeferredValue:function(a){var c=Pf(a),m=c[0],y=c[1];return Df(function(){var M=Pi.transition;Pi.transition={};try{y(a)}finally{Pi.transition=M}},[a]),m},useTransition:function(){var a=Pf(!1),c=a[0];return a=CA.bind(null,a[1]),Sr().memoizedState=a,[c,a]},useMutableSource:function(){},useSyncExternalStore:function(a,c,m){var y=mn,M=Sr();if(cn){if(m===void 0)throw Error(o(407));m=m()}else{if(m=c(),Sn===null)throw Error(o(349));(wo&30)!==0||mg(y,c,m)}M.memoizedState=m;var C={value:m,getSnapshot:c};return M.queue=C,Df(vg.bind(null,y,C,a),[a]),y.flags|=2048,Ra(9,gg.bind(null,y,C,m,c),void 0,null),m},useId:function(){var a=Sr(),c=Sn.identifierPrefix;if(cn){var m=Mr,y=Ar;m=(y&~(1<<32-vt(y)-1)).toString(32)+m,c=":"+c+"R"+m,m=ba++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=wA++,c=":"+c+"r"+m.toString(32)+":";return a.memoizedState=c},unstable_isNewReconciler:!1},IA={readContext:bi,useCallback:Eg,useContext:bi,useEffect:Ia,useImperativeHandle:Sg,useInsertionEffect:xg,useLayoutEffect:Ag,useMemo:wg,useReducer:cc,useRef:yg,useState:function(){return cc(Ss)},useDebugValue:Lf,useDeferredValue:function(a){var c=cc(Ss),m=c[0],y=c[1];return Ia(function(){var M=Pi.transition;Pi.transition={};try{y(a)}finally{Pi.transition=M}},[a]),m},useTransition:function(){var a=cc(Ss)[0],c=lr().memoizedState;return[a,c]},useMutableSource:dg,useSyncExternalStore:pg,useId:Cg,unstable_isNewReconciler:!1},BA={readContext:bi,useCallback:Eg,useContext:bi,useEffect:Ia,useImperativeHandle:Sg,useInsertionEffect:xg,useLayoutEffect:Ag,useMemo:wg,useReducer:uc,useRef:yg,useState:function(){return uc(Ss)},useDebugValue:Lf,useDeferredValue:function(a){var c=uc(Ss),m=c[0],y=c[1];return Ia(function(){var M=Pi.transition;Pi.transition={};try{y(a)}finally{Pi.transition=M}},[a]),m},useTransition:function(){var a=uc(Ss)[0],c=lr().memoizedState;return[a,c]},useMutableSource:dg,useSyncExternalStore:pg,useId:Cg,unstable_isNewReconciler:!1};function Ff(a,c){try{var m="",y=c;do m+=EA(y),y=y.return;while(y);var M=m}catch(C){M=` 3856Error generating stack: `+C.message+` 3857`+C.stack}return{value:a,source:c,stack:M}}function Uf(a,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var PA=typeof WeakMap=="function"?WeakMap:Map;function Bg(a,c,m){m=xr(-1,m),m.tag=3,m.payload={element:null};var y=c.value;return m.callback=function(){Rc||(Rc=!0,ed=y),Uf(a,c)},m}function Pg(a,c,m){m=xr(-1,m),m.tag=3;var y=a.type.getDerivedStateFromError;if(typeof y=="function"){var M=c.value;m.payload=function(){return y(M)},m.callback=function(){Uf(a,c)}}var C=a.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(m.callback=function(){Uf(a,c),typeof y!="function"&&(Wr===null?Wr=new Set([this]):Wr.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})}),m}function Dg(a,c,m){var y=a.pingCache;if(y===null){y=a.pingCache=new PA;var M=new Set;y.set(c,M)}else M=y.get(c),M===void 0&&(M=new Set,y.set(c,M));M.has(m)||(M.add(m),a=JA.bind(null,a,c,m),c.then(a,a))}function Lg(a){do{var c;if((c=a.tag===13)&&(c=a.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return a;a=a.return}while(a!==null);return null}function Fg(a,c,m,y,M){return(a.mode&1)===0?(a===c?a.flags|=65536:(a.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=xr(-1,1),c.tag=2,Vr(m,c))),m.lanes|=1),a):(a.flags|=65536,a.lanes=M,a)}function cr(a){a.flags|=4}function Ug(a,c){if(a!==null&&a.child===c.child)return!0;if((c.flags&16)!==0)return!1;for(a=c.child;a!==null;){if((a.flags&12854)!==0||(a.subtreeFlags&12854)!==0)return!1;a=a.sibling}return!0}var Ba,Pa,pc,mc;if(xt)Ba=function(a,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)Se(a,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}},Pa=function(){},pc=function(a,c,m,y,M){if(a=a.memoizedProps,a!==y){var C=c.stateNode,k=ar(Bi.current);m=le(C,m,a,y,M,k),(c.updateQueue=m)&&cr(c)}},mc=function(a,c,m,y){m!==y&&cr(c)};else if(kt){Ba=function(a,c,m,y){for(var M=c.child;M!==null;){if(M.tag===5){var C=M.stateNode;m&&y&&(C=Vt(C,M.type,M.memoizedProps,M)),Se(a,C)}else if(M.tag===6)C=M.stateNode,m&&y&&(C=zn(C,M.memoizedProps,M)),Se(a,C);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)C=M.child,C!==null&&(C.return=M),Ba(a,M,!0,!0);else if(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}};var Ng=function(a,c,m,y){for(var M=c.child;M!==null;){if(M.tag===5){var C=M.stateNode;m&&y&&(C=Vt(C,M.type,M.memoizedProps,M)),At(a,C)}else if(M.tag===6)C=M.stateNode,m&&y&&(C=zn(C,M.memoizedProps,M)),At(a,C);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)C=M.child,C!==null&&(C.return=M),Ng(a,M,!0,!0);else if(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}};Pa=function(a,c){var m=c.stateNode;if(!Ug(a,c)){a=m.containerInfo;var y=We(a);Ng(y,c,!1,!1),m.pendingChildren=y,cr(c),rn(a,y)}},pc=function(a,c,m,y,M){var C=a.stateNode,k=a.memoizedProps;if((a=Ug(a,c))&&k===y)c.stateNode=C;else{var j=c.stateNode,_e=ar(Bi.current),Ne=null;k!==y&&(Ne=le(j,m,k,y,M,_e)),a&&Ne===null?c.stateNode=C:(C=qe(C,Ne,m,k,y,c,a,j),Ge(C,m,y,M,_e)&&cr(c),c.stateNode=C,a?cr(c):Ba(C,c,!1,!1))}},mc=function(a,c,m,y){m!==y?(a=ar(So.current),m=ar(Bi.current),c.stateNode=we(y,a,m,c),cr(c)):c.stateNode=a.stateNode}}else Pa=function(){},pc=function(){},mc=function(){};function Da(a,c){if(!cn)switch(a.tailMode){case"hidden":c=a.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?a.tail=null:m.sibling=null;break;case"collapsed":m=a.tail;for(var y=null;m!==null;)m.alternate!==null&&(y=m),m=m.sibling;y===null?c||a.tail===null?a.tail=null:a.tail.sibling=null:y.sibling=null}}function Xn(a){var c=a.alternate!==null&&a.alternate.child===a.child,m=0,y=0;if(c)for(var M=a.child;M!==null;)m|=M.lanes|M.childLanes,y|=M.subtreeFlags&14680064,y|=M.flags&14680064,M.return=a,M=M.sibling;else for(M=a.child;M!==null;)m|=M.lanes|M.childLanes,y|=M.subtreeFlags,y|=M.flags,M.return=a,M=M.sibling;return a.subtreeFlags|=y,a.childLanes=m,c}function DA(a,c,m){var y=c.pendingProps;switch(Af(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xn(c),null;case 1:return Ot(c.type)&&yt(),Xn(c),null;case 3:return y=c.stateNode,Eo(),De(st),De(_t),bf(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(a===null||a.child===null)&&(Sa(c)?cr(c):a===null||a.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Xi!==null&&(id(Xi),Xi=null))),Pa(a,c),Xn(c),null;case 5:Cf(c),m=ar(So.current);var M=c.type;if(a!==null&&c.stateNode!=null)pc(a,c,M,y,m),a.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!y){if(c.stateNode===null)throw Error(o(166));return Xn(c),null}if(a=ar(Bi.current),Sa(c)){if(!pt)throw Error(o(175));a=R(c.stateNode,c.type,c.memoizedProps,m,a,c,!Ma),c.updateQueue=a,a!==null&&cr(c)}else{var C=ce(M,y,m,a,c);Ba(C,c,!1,!1),c.stateNode=C,Ge(C,M,y,m,a)&&cr(c)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Xn(c),null;case 6:if(a&&c.stateNode!=null)mc(a,c,a.memoizedProps,y);else{if(typeof y!="string"&&c.stateNode===null)throw Error(o(166));if(a=ar(So.current),m=ar(Bi.current),Sa(c)){if(!pt)throw Error(o(176));if(a=c.stateNode,y=c.memoizedProps,(m=U(a,y,c,!Ma))&&(M=xi,M!==null))switch(C=(M.mode&1)!==0,M.tag){case 3:z(M.stateNode.containerInfo,a,y,C);break;case 5:W(M.type,M.memoizedProps,M.stateNode,a,y,C)}m&&cr(c)}else c.stateNode=we(y,a,m,c)}return Xn(c),null;case 13:if(De(hn),y=c.memoizedState,cn&&Ai!==null&&(c.mode&1)!==0&&(c.flags&128)===0){for(a=Ai;a;)a=li(a);return Ao(),c.flags|=98560,c}if(y!==null&&y.dehydrated!==null){if(y=Sa(c),a===null){if(!y)throw Error(o(318));if(!pt)throw Error(o(344));if(a=c.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));J(a,c)}else Ao(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;return Xn(c),null}return Xi!==null&&(id(Xi),Xi=null),(c.flags&128)!==0?(c.lanes=m,c):(y=y!==null,m=!1,a===null?Sa(c):m=a.memoizedState!==null,y&&!m&&(c.child.flags|=8192,(c.mode&1)!==0&&(a===null||(hn.current&1)!==0?Tn===0&&(Tn=3):sd())),c.updateQueue!==null&&(c.flags|=4),Xn(c),null);case 4:return Eo(),Pa(a,c),a===null&&tn(c.stateNode.containerInfo),Xn(c),null;case 10:return mf(c.type._context),Xn(c),null;case 17:return Ot(c.type)&&yt(),Xn(c),null;case 19:if(De(hn),M=c.memoizedState,M===null)return Xn(c),null;if(y=(c.flags&128)!==0,C=M.rendering,C===null)if(y)Da(M,!1);else{if(Tn!==0||a!==null&&(a.flags&128)!==0)for(a=c.child;a!==null;){if(C=oc(a),C!==null){for(c.flags|=128,Da(M,!1),a=C.updateQueue,a!==null&&(c.updateQueue=a,c.flags|=4),c.subtreeFlags=0,a=m,y=c.child;y!==null;)m=y,M=a,m.flags&=14680066,C=m.alternate,C===null?(m.childLanes=0,m.lanes=M,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=C.childLanes,m.lanes=C.lanes,m.child=C.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=C.memoizedProps,m.memoizedState=C.memoizedState,m.updateQueue=C.updateQueue,m.type=C.type,M=C.dependencies,m.dependencies=M===null?null:{lanes:M.lanes,firstContext:M.firstContext}),y=y.sibling;return Xe(hn,hn.current&1|2),c.child}a=a.sibling}M.tail!==null&&Pn()>$f&&(c.flags|=128,y=!0,Da(M,!1),c.lanes=4194304)}else{if(!y)if(a=oc(C),a!==null){if(c.flags|=128,y=!0,a=a.updateQueue,a!==null&&(c.updateQueue=a,c.flags|=4),Da(M,!0),M.tail===null&&M.tailMode==="hidden"&&!C.alternate&&!cn)return Xn(c),null}else 2*Pn()-M.renderingStartTime>$f&&m!==1073741824&&(c.flags|=128,y=!0,Da(M,!1),c.lanes=4194304);M.isBackwards?(C.sibling=c.child,c.child=C):(a=M.last,a!==null?a.sibling=C:c.child=C,M.last=C)}return M.tail!==null?(c=M.tail,M.rendering=c,M.tail=c.sibling,M.renderingStartTime=Pn(),c.sibling=null,a=hn.current,Xe(hn,y?a&1|2:a&1),c):(Xn(c),null);case 22:case 23:return rd(),y=c.memoizedState!==null,a!==null&&a.memoizedState!==null!==y&&(c.flags|=8192),y&&(c.mode&1)!==0?(Si&1073741824)!==0&&(Xn(c),xt&&c.subtreeFlags&6&&(c.flags|=8192)):Xn(c),null;case 24:return null;case 25:return null}throw Error(o(156,c.tag))}var LA=l.ReactCurrentOwner,Mi=!1;function ei(a,c,m,y){c.child=a===null?hg(c,null,m,y):Mo(c,a.child,m,y)}function Og(a,c,m,y,M){m=m.render;var C=c.ref;return _o(c,M),y=If(a,c,m,y,C,M),m=Bf(),a!==null&&!Mi?(c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~M,Er(a,c,M)):(cn&&m&&xf(c),c.flags|=1,ei(a,c,y,M),c.child)}function Hg(a,c,m,y,M){if(a===null){var C=m.type;return typeof C=="function"&&!od(C)&&C.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=C,Gg(a,c,C,y,M)):(a=Uc(m.type,null,y,c,c.mode,M),a.ref=c.ref,a.return=c,c.child=a)}if(C=a.child,(a.lanes&M)===0){var k=C.memoizedProps;if(m=m.compare,m=m!==null?m:Ql,m(k,y)&&a.ref===c.ref)return Er(a,c,M)}return c.flags|=1,a=Kr(C,y),a.ref=c.ref,a.return=c,c.child=a}function Gg(a,c,m,y,M){if(a!==null&&Ql(a.memoizedProps,y)&&a.ref===c.ref)if(Mi=!1,(a.lanes&M)!==0)(a.flags&131072)!==0&&(Mi=!0);else return c.lanes=a.lanes,Er(a,c,M);return Nf(a,c,m,y,M)}function kg(a,c,m){var y=c.pendingProps,M=y.children,C=a!==null?a.memoizedState:null;if(y.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null},Xe(Co,Si),Si|=m;else if((m&1073741824)!==0)c.memoizedState={baseLanes:0,cachePool:null},y=C!==null?C.baseLanes:m,Xe(Co,Si),Si|=y;else return a=C!==null?C.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:a,cachePool:null},c.updateQueue=null,Xe(Co,Si),Si|=a,null;else C!==null?(y=C.baseLanes|m,c.memoizedState=null):y=m,Xe(Co,Si),Si|=y;return ei(a,c,M,m),c.child}function zg(a,c){var m=c.ref;(a===null&&m!==null||a!==null&&a.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function Nf(a,c,m,y,M){var C=Ot(m)?lt:_t.current;return C=et(c,C),_o(c,M),m=If(a,c,m,y,C,M),y=Bf(),a!==null&&!Mi?(c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~M,Er(a,c,M)):(cn&&y&&xf(c),c.flags|=1,ei(a,c,m,M),c.child)}function Vg(a,c,m,y,M){if(Ot(m)){var C=!0;wt(c)}else C=!1;if(_o(c,M),c.stateNode===null)a!==null&&(a.alternate=null,c.alternate=null,c.flags|=2),ig(c,m,y),yf(c,m,y,M),y=!0;else if(a===null){var k=c.stateNode,j=c.memoizedProps;k.props=j;var _e=k.context,Ne=m.contextType;typeof Ne=="object"&&Ne!==null?Ne=bi(Ne):(Ne=Ot(m)?lt:_t.current,Ne=et(c,Ne));var rt=m.getDerivedStateFromProps,Ct=typeof rt=="function"||typeof k.getSnapshotBeforeUpdate=="function";Ct||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(j!==y||_e!==Ne)&&rg(c,k,y,Ne),zr=!1;var mt=c.memoizedState;k.state=mt,tc(c,y,k,M),_e=c.memoizedState,j!==y||mt!==_e||st.current||zr?(typeof rt=="function"&&(_f(c,m,rt,y),_e=c.memoizedState),(j=zr||ng(c,m,j,y,mt,_e,Ne))?(Ct||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=y,c.memoizedState=_e),k.props=y,k.state=_e,k.context=Ne,y=j):(typeof k.componentDidMount=="function"&&(c.flags|=4194308),y=!1)}else{k=c.stateNode,jm(a,c),j=c.memoizedProps,Ne=c.type===c.elementType?j:Wi(c.type,j),k.props=Ne,Ct=c.pendingProps,mt=k.context,_e=m.contextType,typeof _e=="object"&&_e!==null?_e=bi(_e):(_e=Ot(m)?lt:_t.current,_e=et(c,_e));var nn=m.getDerivedStateFromProps;(rt=typeof nn=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(j!==Ct||mt!==_e)&&rg(c,k,y,_e),zr=!1,mt=c.memoizedState,k.state=mt,tc(c,y,k,M);var ht=c.memoizedState;j!==Ct||mt!==ht||st.current||zr?(typeof nn=="function"&&(_f(c,m,nn,y),ht=c.memoizedState),(Ne=zr||ng(c,m,Ne,y,mt,ht,_e)||!1)?(rt||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(y,ht,_e),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(y,ht,_e)),typeof k.componentDidUpdate=="function"&&(c.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof k.componentDidUpdate!="function"||j===a.memoizedProps&&mt===a.memoizedState||(c.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||j===a.memoizedProps&&mt===a.memoizedState||(c.flags|=1024),c.memoizedProps=y,c.memoizedState=ht),k.props=y,k.state=ht,k.context=_e,y=Ne):(typeof k.componentDidUpdate!="function"||j===a.memoizedProps&&mt===a.memoizedState||(c.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||j===a.memoizedProps&&mt===a.memoizedState||(c.flags|=1024),y=!1)}return Of(a,c,m,y,C,M)}function Of(a,c,m,y,M,C){zg(a,c);var k=(c.flags&128)!==0;if(!y&&!k)return M&&Ht(c,m,!1),Er(a,c,C);y=c.stateNode,LA.current=c;var j=k&&typeof m.getDerivedStateFromError!="function"?null:y.render();return c.flags|=1,a!==null&&k?(c.child=Mo(c,a.child,null,C),c.child=Mo(c,null,j,C)):ei(a,c,j,C),c.memoizedState=y.state,M&&Ht(c,m,!0),c.child}function Wg(a){var c=a.stateNode;c.pendingContext?Bt(a,c.pendingContext,c.pendingContext!==c.context):c.context&&Bt(a,c.context,!1),wf(a,c.containerInfo)}function Xg(a,c,m,y,M){return Ao(),Ef(M),c.flags|=256,ei(a,c,m,y),c.child}var gc={dehydrated:null,treeContext:null,retryLane:0};function vc(a){return{baseLanes:a,cachePool:null}}function Jg(a,c,m){var y=c.pendingProps,M=hn.current,C=!1,k=(c.flags&128)!==0,j;if((j=k)||(j=a!==null&&a.memoizedState===null?!1:(M&2)!==0),j?(C=!0,c.flags&=-129):(a===null||a.memoizedState!==null)&&(M|=1),Xe(hn,M&1),a===null)return Sf(c),a=c.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((c.mode&1)===0?c.lanes=1:_r(a)?c.lanes=8:c.lanes=1073741824,null):(M=y.children,a=y.fallback,C?(y=c.mode,C=c.child,M={mode:"hidden",children:M},(y&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=M):C=Nc(M,y,0,null),a=Rs(a,y,m,null),C.return=c,a.return=c,C.sibling=a,c.child=C,c.child.memoizedState=vc(m),c.memoizedState=gc,a):Hf(c,M));if(M=a.memoizedState,M!==null){if(j=M.dehydrated,j!==null){if(k)return c.flags&256?(c.flags&=-257,_c(a,c,m,Error(o(422)))):c.memoizedState!==null?(c.child=a.child,c.flags|=128,null):(C=y.fallback,M=c.mode,y=Nc({mode:"visible",children:y.children},M,0,null),C=Rs(C,M,m,null),C.flags|=2,y.return=c,C.return=c,y.sibling=C,c.child=y,(c.mode&1)!==0&&Mo(c,a.child,null,m),c.child.memoizedState=vc(m),c.memoizedState=gc,C);if((c.mode&1)===0)c=_c(a,c,m,null);else if(_r(j))c=_c(a,c,m,Error(o(419)));else if(y=(m&a.childLanes)!==0,Mi||y){if(y=Sn,y!==null){switch(m&-m){case 4:C=2;break;case 16:C=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:C=32;break;case 536870912:C=268435456;break;default:C=0}y=(C&(y.suspendedLanes|m))!==0?0:C,y!==0&&y!==M.retryLane&&(M.retryLane=y,Di(a,y,-1))}sd(),c=_c(a,c,m,Error(o(421)))}else $n(j)?(c.flags|=128,c.child=a.child,c=YA.bind(null,a),nr(j,c),c=null):(m=M.treeContext,pt&&(Ai=Gr(j),xi=c,cn=!0,Xi=null,Ma=!1,m!==null&&(Ri[Ii++]=Ar,Ri[Ii++]=Mr,Ri[Ii++]=As,Ar=m.id,Mr=m.overflow,As=c)),c=Hf(c,c.pendingProps.children),c.flags|=4096);return c}return C?(y=Kg(a,c,y.children,y.fallback,m),C=c.child,M=a.child.memoizedState,C.memoizedState=M===null?vc(m):{baseLanes:M.baseLanes|m,cachePool:null},C.childLanes=a.childLanes&~m,c.memoizedState=gc,y):(m=Yg(a,c,y.children,m),c.memoizedState=null,m)}return C?(y=Kg(a,c,y.children,y.fallback,m),C=c.child,M=a.child.memoizedState,C.memoizedState=M===null?vc(m):{baseLanes:M.baseLanes|m,cachePool:null},C.childLanes=a.childLanes&~m,c.memoizedState=gc,y):(m=Yg(a,c,y.children,m),c.memoizedState=null,m)}function Hf(a,c){return c=Nc({mode:"visible",children:c},a.mode,0,null),c.return=a,a.child=c}function Yg(a,c,m,y){var M=a.child;return a=M.sibling,m=Kr(M,{mode:"visible",children:m}),(c.mode&1)===0&&(m.lanes=y),m.return=c,m.sibling=null,a!==null&&(y=c.deletions,y===null?(c.deletions=[a],c.flags|=16):y.push(a)),c.child=m}function Kg(a,c,m,y,M){var C=c.mode;a=a.child;var k=a.sibling,j={mode:"hidden",children:m};return(C&1)===0&&c.child!==a?(m=c.child,m.childLanes=0,m.pendingProps=j,c.deletions=null):(m=Kr(a,j),m.subtreeFlags=a.subtreeFlags&14680064),k!==null?y=Kr(k,y):(y=Rs(y,C,M,null),y.flags|=2),y.return=c,m.return=c,m.sibling=y,c.child=m,y}function _c(a,c,m,y){return y!==null&&Ef(y),Mo(c,a.child,null,m),a=Hf(c,c.pendingProps.children),a.flags|=2,c.memoizedState=null,a}function Zg(a,c,m){a.lanes|=c;var y=a.alternate;y!==null&&(y.lanes|=c),gf(a.return,c,m)}function Gf(a,c,m,y,M){var C=a.memoizedState;C===null?a.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:y,tail:m,tailMode:M}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=y,C.tail=m,C.tailMode=M)}function qg(a,c,m){var y=c.pendingProps,M=y.revealOrder,C=y.tail;if(ei(a,c,y.children,m),y=hn.current,(y&2)!==0)y=y&1|2,c.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=c.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Zg(a,m,c);else if(a.tag===19)Zg(a,m,c);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===c)break e;for(;a.sibling===null;){if(a.return===null||a.return===c)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}y&=1}if(Xe(hn,y),(c.mode&1)===0)c.memoizedState=null;else switch(M){case"forwards":for(m=c.child,M=null;m!==null;)a=m.alternate,a!==null&&oc(a)===null&&(M=m),m=m.sibling;m=M,m===null?(M=c.child,c.child=null):(M=m.sibling,m.sibling=null),Gf(c,!1,M,m,C);break;case"backwards":for(m=null,M=c.child,c.child=null;M!==null;){if(a=M.alternate,a!==null&&oc(a)===null){c.child=M;break}a=M.sibling,M.sibling=m,m=M,M=a}Gf(c,!0,m,null,C);break;case"together":Gf(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Er(a,c,m){if(a!==null&&(c.dependencies=a.dependencies),To|=c.lanes,(m&c.childLanes)===0)return null;if(a!==null&&c.child!==a.child)throw Error(o(153));if(c.child!==null){for(a=c.child,m=Kr(a,a.pendingProps),c.child=m,m.return=c;a.sibling!==null;)a=a.sibling,m=m.sibling=Kr(a,a.pendingProps),m.return=c;m.sibling=null}return c.child}function FA(a,c,m){switch(c.tag){case 3:Wg(c),Ao();break;case 5:fg(c);break;case 1:Ot(c.type)&&wt(c);break;case 4:wf(c,c.stateNode.containerInfo);break;case 10:Qm(c,c.type._context,c.memoizedProps.value);break;case 13:var y=c.memoizedState;if(y!==null)return y.dehydrated!==null?(Xe(hn,hn.current&1),c.flags|=128,null):(m&c.child.childLanes)!==0?Jg(a,c,m):(Xe(hn,hn.current&1),a=Er(a,c,m),a!==null?a.sibling:null);Xe(hn,hn.current&1);break;case 19:if(y=(m&c.childLanes)!==0,(a.flags&128)!==0){if(y)return qg(a,c,m);c.flags|=128}var M=c.memoizedState;if(M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),Xe(hn,hn.current),y)break;return null;case 22:case 23:return c.lanes=0,kg(a,c,m)}return Er(a,c,m)}function UA(a,c){switch(Af(c),c.tag){case 1:return Ot(c.type)&&yt(),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return Eo(),De(st),De(_t),bf(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 5:return Cf(c),null;case 13:if(De(hn),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(o(340));Ao()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return De(hn),null;case 4:return Eo(),null;case 10:return mf(c.type._context),null;case 22:case 23:return rd(),null;case 24:return null;default:return null}}var yc=!1,Es=!1,NA=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function xc(a,c){var m=a.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(y){hi(a,c,y)}else m.current=null}function kf(a,c,m){try{m()}catch(y){hi(a,c,y)}}var Qg=!1;function OA(a,c){for(te(a.containerInfo),Ze=c;Ze!==null;)if(a=Ze,c=a.child,(a.subtreeFlags&1028)!==0&&c!==null)c.return=a,Ze=c;else for(;Ze!==null;){a=Ze;try{var m=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,M=m.memoizedState,C=a.stateNode,k=C.getSnapshotBeforeUpdate(a.elementType===a.type?y:Wi(a.type,y),M);C.__reactInternalSnapshotBeforeUpdate=k}break;case 3:xt&&Ce(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(j){hi(a,a.return,j)}if(c=a.sibling,c!==null){c.return=a.return,Ze=c;break}Ze=a.return}return m=Qg,Qg=!1,m}function ws(a,c,m){var y=c.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var M=y=y.next;do{if((M.tag&a)===a){var C=M.destroy;M.destroy=void 0,C!==void 0&&kf(c,m,C)}M=M.next}while(M!==y)}}function La(a,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&a)===a){var y=m.create;m.destroy=y()}m=m.next}while(m!==c)}}function zf(a){var c=a.ref;if(c!==null){var m=a.stateNode;switch(a.tag){case 5:a=ee(m);break;default:a=m}typeof c=="function"?c(a):c.current=a}}function jg(a,c,m){if(ir&&typeof ir.onCommitFiberUnmount=="function")try{ir.onCommitFiberUnmount(Zl,c)}catch{}switch(c.tag){case 0:case 11:case 14:case 15:if(a=c.updateQueue,a!==null&&(a=a.lastEffect,a!==null)){var y=a=a.next;do{var M=y,C=M.destroy;M=M.tag,C!==void 0&&((M&2)!==0||(M&4)!==0)&&kf(c,m,C),y=y.next}while(y!==a)}break;case 1:if(xc(c,m),a=c.stateNode,typeof a.componentWillUnmount=="function")try{a.props=c.memoizedProps,a.state=c.memoizedState,a.componentWillUnmount()}catch(k){hi(c,m,k)}break;case 5:xc(c,m);break;case 4:xt?rv(a,c,m):kt&&kt&&(c=c.stateNode.containerInfo,m=We(c),_n(c,m))}}function $g(a,c,m){for(var y=c;;)if(jg(a,y,m),y.child===null||xt&&y.tag===4){if(y===c)break;for(;y.sibling===null;){if(y.return===null||y.return===c)return;y=y.return}y.sibling.return=y.return,y=y.sibling}else y.child.return=y,y=y.child}function ev(a){var c=a.alternate;c!==null&&(a.alternate=null,ev(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&Ie(c)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function tv(a){return a.tag===5||a.tag===3||a.tag===4}function nv(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||tv(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function iv(a){if(xt){e:{for(var c=a.return;c!==null;){if(tv(c))break e;c=c.return}throw Error(o(160))}var m=c;switch(m.tag){case 5:c=m.stateNode,m.flags&32&&(dt(c),m.flags&=-33),m=nv(a),Wf(a,m,c);break;case 3:case 4:c=m.stateNode.containerInfo,m=nv(a),Vf(a,m,c);break;default:throw Error(o(161))}}}function Vf(a,c,m){var y=a.tag;if(y===5||y===6)a=a.stateNode,c?it(m,a,c):Ke(m,a);else if(y!==4&&(a=a.child,a!==null))for(Vf(a,c,m),a=a.sibling;a!==null;)Vf(a,c,m),a=a.sibling}function Wf(a,c,m){var y=a.tag;if(y===5||y===6)a=a.stateNode,c?ut(m,a,c):Oe(m,a);else if(y!==4&&(a=a.child,a!==null))for(Wf(a,c,m),a=a.sibling;a!==null;)Wf(a,c,m),a=a.sibling}function rv(a,c,m){for(var y=c,M=!1,C,k;;){if(!M){M=y.return;e:for(;;){if(M===null)throw Error(o(160));switch(C=M.stateNode,M.tag){case 5:k=!1;break e;case 3:C=C.containerInfo,k=!0;break e;case 4:C=C.containerInfo,k=!0;break e}M=M.return}M=!0}if(y.tag===5||y.tag===6)$g(a,y,m),k?Et(C,y.stateNode):je(C,y.stateNode);else if(y.tag===18)k?Pe(C,y.stateNode):Ue(C,y.stateNode);else if(y.tag===4){if(y.child!==null){C=y.stateNode.containerInfo,k=!0,y.child.return=y,y=y.child;continue}}else if(jg(a,y,m),y.child!==null){y.child.return=y,y=y.child;continue}if(y===c)break;for(;y.sibling===null;){if(y.return===null||y.return===c)return;y=y.return,y.tag===4&&(M=!1)}y.sibling.return=y.return,y=y.sibling}}function Xf(a,c){if(xt){switch(c.tag){case 0:case 11:case 14:case 15:ws(3,c,c.return),La(3,c),ws(5,c,c.return);return;case 1:return;case 5:var m=c.stateNode;if(m!=null){var y=c.memoizedProps;a=a!==null?a.memoizedProps:y;var M=c.type,C=c.updateQueue;c.updateQueue=null,C!==null&&$e(m,C,M,a,y,c)}return;case 6:if(c.stateNode===null)throw Error(o(162));m=c.memoizedProps,Lt(c.stateNode,a!==null?a.memoizedProps:m,m);return;case 3:pt&&a!==null&&a.memoizedState.isDehydrated&&pe(c.stateNode.containerInfo);return;case 12:return;case 13:Ac(c);return;case 19:Ac(c);return;case 17:return}throw Error(o(163))}switch(c.tag){case 0:case 11:case 14:case 15:ws(3,c,c.return),La(3,c),ws(5,c,c.return);return;case 12:return;case 13:Ac(c);return;case 19:Ac(c);return;case 3:pt&&a!==null&&a.memoizedState.isDehydrated&&pe(c.stateNode.containerInfo);break;case 22:case 23:return}e:if(kt){switch(c.tag){case 1:case 5:case 6:break e;case 3:case 4:c=c.stateNode,_n(c.containerInfo,c.pendingChildren);break e}throw Error(o(163))}}function Ac(a){var c=a.updateQueue;if(c!==null){a.updateQueue=null;var m=a.stateNode;m===null&&(m=a.stateNode=new NA),c.forEach(function(y){var M=KA.bind(null,a,y);m.has(y)||(m.add(y),y.then(M,M))})}}function HA(a,c){for(Ze=c;Ze!==null;){c=Ze;var m=c.deletions;if(m!==null)for(var y=0;y<m.length;y++){var M=m[y];try{var C=a;xt?rv(C,M,c):$g(C,M,c);var k=M.alternate;k!==null&&(k.return=null),M.return=null}catch(ct){hi(M,c,ct)}}if(m=c.child,(c.subtreeFlags&12854)!==0&&m!==null)m.return=c,Ze=m;else for(;Ze!==null;){c=Ze;try{var j=c.flags;if(j&32&&xt&&dt(c.stateNode),j&512){var _e=c.alternate;if(_e!==null){var Ne=_e.ref;Ne!==null&&(typeof Ne=="function"?Ne(null):Ne.current=null)}}if(j&8192)switch(c.tag){case 13:if(c.memoizedState!==null){var rt=c.alternate;(rt===null||rt.memoizedState===null)&&(jf=Pn())}break;case 22:var Ct=c.memoizedState!==null,mt=c.alternate,nn=mt!==null&&mt.memoizedState!==null;if(m=c,xt){e:if(y=m,M=Ct,C=null,xt)for(var ht=y;;){if(ht.tag===5){if(C===null){C=ht;var Jn=ht.stateNode;M?Mt(Jn):ue(ht.stateNode,ht.memoizedProps)}}else if(ht.tag===6){if(C===null){var Fi=ht.stateNode;M?$(Fi):de(Fi,ht.memoizedProps)}}else if((ht.tag!==22&&ht.tag!==23||ht.memoizedState===null||ht===y)&&ht.child!==null){ht.child.return=ht,ht=ht.child;continue}if(ht===y)break;for(;ht.sibling===null;){if(ht.return===null||ht.return===y)break e;C===ht&&(C=null),ht=ht.return}C===ht&&(C=null),ht.sibling.return=ht.return,ht=ht.sibling}}if(Ct&&!nn&&(m.mode&1)!==0){Ze=m;for(var se=m.child;se!==null;){for(m=Ze=se;Ze!==null;){y=Ze;var ie=y.child;switch(y.tag){case 0:case 11:case 14:case 15:ws(4,y,y.return);break;case 1:xc(y,y.return);var fe=y.stateNode;if(typeof fe.componentWillUnmount=="function"){var Qe=y.return;try{fe.props=y.memoizedProps,fe.state=y.memoizedState,fe.componentWillUnmount()}catch(ct){hi(y,Qe,ct)}}break;case 5:xc(y,y.return);break;case 22:if(y.memoizedState!==null){av(m);continue}}ie!==null?(ie.return=y,Ze=ie):av(m)}se=se.sibling}}}switch(j&4102){case 2:iv(c),c.flags&=-3;break;case 6:iv(c),c.flags&=-3,Xf(c.alternate,c);break;case 4096:c.flags&=-4097;break;case 4100:c.flags&=-4097,Xf(c.alternate,c);break;case 4:Xf(c.alternate,c)}}catch(ct){hi(c,c.return,ct)}if(m=c.sibling,m!==null){m.return=c.return,Ze=m;break}Ze=c.return}}}function GA(a,c,m){Ze=a,sv(a)}function sv(a,c,m){for(var y=(a.mode&1)!==0;Ze!==null;){var M=Ze,C=M.child;if(M.tag===22&&y){var k=M.memoizedState!==null||yc;if(!k){var j=M.alternate,_e=j!==null&&j.memoizedState!==null||Es;j=yc;var Ne=Es;if(yc=k,(Es=_e)&&!Ne)for(Ze=M;Ze!==null;)k=Ze,_e=k.child,k.tag===22&&k.memoizedState!==null?lv(M):_e!==null?(_e.return=k,Ze=_e):lv(M);for(;C!==null;)Ze=C,sv(C),C=C.sibling;Ze=M,yc=j,Es=Ne}ov(a)}else(M.subtreeFlags&8772)!==0&&C!==null?(C.return=M,Ze=C):ov(a)}}function ov(a){for(;Ze!==null;){var c=Ze;if((c.flags&8772)!==0){var m=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Es||La(5,c);break;case 1:var y=c.stateNode;if(c.flags&4&&!Es)if(m===null)y.componentDidMount();else{var M=c.elementType===c.type?m.memoizedProps:Wi(c.type,m.memoizedProps);y.componentDidUpdate(M,m.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var C=c.updateQueue;C!==null&&eg(c,C,y);break;case 3:var k=c.updateQueue;if(k!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=ee(c.child.stateNode);break;case 1:m=c.child.stateNode}eg(c,k,m)}break;case 5:var j=c.stateNode;m===null&&c.flags&4&&Fe(j,c.type,c.memoizedProps,c);break;case 6:break;case 4:break;case 12:break;case 13:if(pt&&c.memoizedState===null){var _e=c.alternate;if(_e!==null){var Ne=_e.memoizedState;if(Ne!==null){var rt=Ne.dehydrated;rt!==null&&me(rt)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}Es||c.flags&512&&zf(c)}catch(Ct){hi(c,c.return,Ct)}}if(c===a){Ze=null;break}if(m=c.sibling,m!==null){m.return=c.return,Ze=m;break}Ze=c.return}}function av(a){for(;Ze!==null;){var c=Ze;if(c===a){Ze=null;break}var m=c.sibling;if(m!==null){m.return=c.return,Ze=m;break}Ze=c.return}}function lv(a){for(;Ze!==null;){var c=Ze;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{La(4,c)}catch(_e){hi(c,m,_e)}break;case 1:var y=c.stateNode;if(typeof y.componentDidMount=="function"){var M=c.return;try{y.componentDidMount()}catch(_e){hi(c,M,_e)}}var C=c.return;try{zf(c)}catch(_e){hi(c,C,_e)}break;case 5:var k=c.return;try{zf(c)}catch(_e){hi(c,k,_e)}}}catch(_e){hi(c,c.return,_e)}if(c===a){Ze=null;break}var j=c.sibling;if(j!==null){j.return=c.return,Ze=j;break}Ze=c.return}}var Mc=0,Sc=1,Ec=2,wc=3,Cc=4;if(typeof Symbol=="function"&&Symbol.for){var Fa=Symbol.for;Mc=Fa("selector.component"),Sc=Fa("selector.has_pseudo_class"),Ec=Fa("selector.role"),wc=Fa("selector.test_id"),Cc=Fa("selector.text")}function Jf(a){var c=X(a);if(c!=null){if(typeof c.memoizedProps["data-testname"]!="string")throw Error(o(364));return c}if(a=O(a),a===null)throw Error(o(362));return a.stateNode.current}function Yf(a,c){switch(c.$$typeof){case Mc:if(a.type===c.value)return!0;break;case Sc:e:{c=c.value,a=[a,0];for(var m=0;m<a.length;){var y=a[m++],M=a[m++],C=c[M];if(y.tag!==5||!he(y)){for(;C!=null&&Yf(y,C);)M++,C=c[M];if(M===c.length){c=!0;break e}else for(y=y.child;y!==null;)a.push(y,M),y=y.sibling}}c=!1}return c;case Ec:if(a.tag===5&&xe(a.stateNode,c.value))return!0;break;case Cc:if((a.tag===5||a.tag===6)&&(a=ne(a),a!==null&&0<=a.indexOf(c.value)))return!0;break;case wc:if(a.tag===5&&(a=a.memoizedProps["data-testname"],typeof a=="str
3857ing"&&a.toLowerCase()===c.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Kf(a){switch(a.$$typeof){case Mc:return"<"+(F(a.value)||"Unknown")+">";case Sc:return":has("+(Kf(a)||"")+")";case Ec:return'[role="'+a.value+'"]';case Cc:return'"'+a.value+'"';case wc:return'[data-testname="'+a.value+'"]';default:throw Error(o(365))}}function cv(a,c){var m=[];a=[a,0];for(var y=0;y<a.length;){var M=a[y++],C=a[y++],k=c[C];if(M.tag!==5||!he(M)){for(;k!=null&&Yf(M,k);)C++,k=c[C];if(C===c.length)m.push(M);else for(M=M.child;M!==null;)a.push(M,C),M=M.sibling}}return m}function Zf(a,c){if(!ye)throw Error(o(363));a=Jf(a),a=cv(a,c),c=[],a=Array.from(a);for(var m=0;m<a.length;){var y=a[m++];if(y.tag===5)he(y)||c.push(y.stateNode);else for(y=y.child;y!==null;)a.push(y),y=y.sibling}return c}var kA=Math.ceil,Tc=l.ReactCurrentDispatcher,qf=l.ReactCurrentOwner,yn=l.ReactCurrentBatchConfig,Nt=0,Sn=null,En=null,On=0,Si=0,Co=ke(0),Tn=0,Ua=null,To=0,bc=0,Qf=0,Na=null,ci=null,jf=0,$f=1/0;function bo(){$f=Pn()+500}var Rc=!1,ed=null,Wr=null,Ic=!1,Xr=null,Bc=0,Oa=0,td=null,Pc=-1,Dc=0;function ti(){return(Nt&6)!==0?Pn():Pc!==-1?Pc:Pc=Pn()}function Jr(a){return(a.mode&1)===0?1:(Nt&2)!==0&&On!==0?On&-On:SA.transition!==null?(Dc===0&&(a=Cn,Cn<<=1,(Cn&4194240)===0&&(Cn=64),Dc=a),Dc):(a=Kt,a!==0?a:Ee())}function Di(a,c,m){if(50<Oa)throw Oa=0,td=null,Error(o(185));var y=Lc(a,c);return y===null?null:(Aa(y,c,m),((Nt&2)===0||y!==Sn)&&(y===Sn&&((Nt&2)===0&&(bc|=c),Tn===4&&Yr(y,On)),ui(y,m),c===1&&Nt===0&&(a.mode&1)===0&&(bo(),ql&&sr())),y)}function Lc(a,c){a.lanes|=c;var m=a.alternate;for(m!==null&&(m.lanes|=c),m=a,a=a.return;a!==null;)a.childLanes|=c,m=a.alternate,m!==null&&(m.childLanes|=c),m=a,a=a.return;return m.tag===3?m.stateNode:null}function ui(a,c){var m=a.callbackNode;pA(a,c);var y=Kl(a,a===Sn?On:0);if(y===0)m!==null&&Zm(m),a.callbackNode=null,a.callbackPriority=0;else if(c=y&-y,a.callbackPriority!==c){if(m!=null&&Zm(m),c===1)a.tag===0?MA(hv.bind(null,a)):qm(hv.bind(null,a)),Ae?ze(function(){Nt===0&&sr()}):cf(uf,sr),m=null;else{switch(Km(y)){case 1:m=uf;break;case 4:m=_A;break;case 16:m=hf;break;case 536870912:m=yA;break;default:m=hf}m=xv(m,uv.bind(null,a))}a.callbackPriority=c,a.callbackNode=m}}function uv(a,c){if(Pc=-1,Dc=0,(Nt&6)!==0)throw Error(o(327));var m=a.callbackNode;if(bs()&&a.callbackNode!==m)return null;var y=Kl(a,a===Sn?On:0);if(y===0)return null;if((y&30)!==0||(y&a.expiredLanes)!==0||c)c=Fc(a,y);else{c=y;var M=Nt;Nt|=2;var C=pv();(Sn!==a||On!==c)&&(bo(),Cs(a,c));do try{WA();break}catch(j){dv(a,j)}while(!0);pf(),Tc.current=C,Nt=M,En!==null?c=0:(Sn=null,On=0,c=Tn)}if(c!==0){if(c===2&&(M=of(a),M!==0&&(y=M,c=nd(a,M))),c===1)throw m=Ua,Cs(a,0),Yr(a,y),ui(a,Pn()),m;if(c===6)Yr(a,y);else{if(M=a.current.alternate,(y&30)===0&&!zA(M)&&(c=Fc(a,y),c===2&&(C=of(a),C!==0&&(y=C,c=nd(a,C))),c===1))throw m=Ua,Cs(a,0),Yr(a,y),ui(a,Pn()),m;switch(a.finishedWork=M,a.finishedLanes=y,c){case 0:case 1:throw Error(o(345));case 2:Ts(a,ci);break;case 3:if(Yr(a,y),(y&130023424)===y&&(c=jf+500-Pn(),10<c)){if(Kl(a,0)!==0)break;if(M=a.suspendedLanes,(M&y)!==y){ti(),a.pingedLanes|=a.suspendedLanes&M;break}a.timeoutHandle=Le(Ts.bind(null,a,ci),c);break}Ts(a,ci);break;case 4:if(Yr(a,y),(y&4194240)===y)break;for(c=a.eventTimes,M=-1;0<y;){var k=31-vt(y);C=1<<k,k=c[k],k>M&&(M=k),y&=~C}if(y=M,y=Pn()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*kA(y/1960))-y,10<y){a.timeoutHandle=Le(Ts.bind(null,a,ci),y);break}Ts(a,ci);break;case 5:Ts(a,ci);break;default:throw Error(o(329))}}}return ui(a,Pn()),a.callbackNode===m?uv.bind(null,a):null}function nd(a,c){var m=Na;return a.current.memoizedState.isDehydrated&&(Cs(a,c).flags|=256),a=Fc(a,c),a!==2&&(c=ci,ci=m,c!==null&&id(c)),a}function id(a){ci===null?ci=a:ci.push.apply(ci,a)}function zA(a){for(var c=a;;){if(c.flags&16384){var m=c.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var y=0;y<m.length;y++){var M=m[y],C=M.getSnapshot;M=M.value;try{if(!rr(C(),M))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Yr(a,c){for(c&=~Qf,c&=~bc,a.suspendedLanes|=c,a.pingedLanes&=~c,a=a.expirationTimes;0<c;){var m=31-vt(c),y=1<<m;
vendor: 5,307 bytes, line 3857
3857a[m]=-1,c&=~y}}function hv(a){if((Nt&6)!==0)throw Error(o(327));bs();var c=Kl(a,0);if((c&1)===0)return ui(a,Pn()),null;var m=Fc(a,c);if(a.tag!==0&&m===2){var y=of(a);y!==0&&(c=y,m=nd(a,y))}if(m===1)throw m=Ua,Cs(a,0),Yr(a,c),ui(a,Pn()),m;if(m===6)throw Error(o(345));return a.finishedWork=a.current.alternate,a.finishedLanes=c,Ts(a,ci),ui(a,Pn()),null}function fv(a){Xr!==null&&Xr.tag===0&&(Nt&6)===0&&bs();var c=Nt;Nt|=1;var m=yn.transition,y=Kt;try{if(yn.transition=null,Kt=1,a)return a()}finally{Kt=y,yn.transition=m,Nt=c,(Nt&6)===0&&sr()}}function rd(){Si=Co.current,De(Co)}function Cs(a,c){a.finishedWork=null,a.finishedLanes=0;var m=a.timeoutHandle;if(m!==Ut&&(a.timeoutHandle=Ut,ot(m)),En!==null)for(m=En.return;m!==null;){var y=m;switch(Af(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&yt();break;case 3:Eo(),De(st),De(_t),bf();break;case 5:Cf(y);break;case 4:Eo();break;case 13:De(hn);break;case 19:De(hn);break;case 10:mf(y.type._context);break;case 22:case 23:rd()}m=m.return}if(Sn=a,En=a=Kr(a.current,null),On=Si=c,Tn=0,Ua=null,Qf=bc=To=0,ci=Na=null,or!==null){for(c=0;c<or.length;c++)if(m=or[c],y=m.interleaved,y!==null){m.interleaved=null;var M=y.next,C=m.pending;if(C!==null){var k=C.next;C.next=M,y.next=k}m.pending=y}or=null}return a}function dv(a,c){do{var m=En;try{if(pf(),ac.current=dc,lc){for(var y=mn.memoizedState;y!==null;){var M=y.queue;M!==null&&(M.pending=null),y=y.next}lc=!1}if(wo=0,Dn=Vn=mn=null,Ta=!1,ba=0,qf.current=null,m===null||m.return===null){Tn=1,Ua=c,En=null;break}e:{var C=a,k=m.return,j=m,_e=c;if(c=On,j.flags|=32768,_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var Ne=_e,rt=j,Ct=rt.tag;if((rt.mode&1)===0&&(Ct===0||Ct===11||Ct===15)){var mt=rt.alternate;mt?(rt.updateQueue=mt.updateQueue,rt.memoizedState=mt.memoizedState,rt.lanes=mt.lanes):(rt.updateQueue=null,rt.memoizedState=null)}var nn=Lg(k);if(nn!==null){nn.flags&=-257,Fg(nn,k,j,C,c),nn.mode&1&&Dg(C,Ne,c),c=nn,_e=Ne;var ht=c.updateQueue;if(ht===null){var Jn=new Set;Jn.add(_e),c.updateQueue=Jn}else ht.add(_e);break e}else{if((c&1)===0){Dg(C,Ne,c),sd();break e}_e=Error(o(426))}}else if(cn&&j.mode&1){var Fi=Lg(k);if(Fi!==null){(Fi.flags&65536)===0&&(Fi.flags|=256),Fg(Fi,k,j,C,c),Ef(_e);break e}}C=_e,Tn!==4&&(Tn=2),Na===null?Na=[C]:Na.push(C),_e=Ff(_e,j),j=k;do{switch(j.tag){case 3:j.flags|=65536,c&=-c,j.lanes|=c;var se=Bg(j,_e,c);$m(j,se);break e;case 1:C=_e;var ie=j.type,fe=j.stateNode;if((j.flags&128)===0&&(typeof ie.getDerivedStateFromError=="function"||fe!==null&&typeof fe.componentDidCatch=="function"&&(Wr===null||!Wr.has(fe)))){j.flags|=65536,c&=-c,j.lanes|=c;var Qe=Pg(j,C,c);$m(j,Qe);break e}}j=j.return}while(j!==null)}gv(m)}catch(ct){c=ct,En===m&&m!==null&&(En=m=m.return);continue}break}while(!0)}function pv(){var a=Tc.current;return Tc.current=dc,a===null?dc:a}function sd(){(Tn===0||Tn===3||Tn===2)&&(Tn=4),Sn===null||(To&268435455)===0&&(bc&268435455)===0||Yr(Sn,On)}function Fc(a,c){var m=Nt;Nt|=2;var y=pv();Sn===a&&On===c||Cs(a,c);do try{VA();break}catch(M){dv(a,M)}while(!0);if(pf(),Nt=m,Tc.current=y,En!==null)throw Error(o(261));return Sn=null,On=0,Tn}function VA(){for(;En!==null;)mv(En)}function WA(){for(;En!==null&&!gA();)mv(En)}function mv(a){var c=yv(a.alternate,a,Si);a.memoizedProps=a.pendingProps,c===null?gv(a):En=c,qf.current=null}function gv(a){var c=a;do{var m=c.alternate;if(a=c.return,(c.flags&32768)===0){if(m=DA(m,c,Si),m!==null){En=m;return}}else{if(m=UA(m,c),m!==null){m.flags&=32767,En=m;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{Tn=6,En=null;return}}if(c=c.sibling,c!==null){En=c;return}En=c=a}while(c!==null);Tn===0&&(Tn=5)}function Ts(a,c){var m=Kt,y=yn.transition;try{yn.transition=null,Kt=1,XA(a,c,m)}finally{yn.transition=y,Kt=m}return null}function XA(a,c,m){do bs();while(Xr!==null);if((Nt&6)!==0)throw Error(o(327));var y=a.finishedWork,M=a.finishedLanes;if(y===null)return null;if(a.finishedWork=null,a.finishedLanes=0,y===a.current)throw Error(o(177));a.callbackNode=null,a.callbackPriority=0;var C=y.lanes|y.childLanes;if(mA(a,C),a===Sn&&(En=Sn=null,On=0),(y.subtreeFlags&2064)===0&&(y.flags&2064)===0||Ic||(Ic=!0,xv(hf,function(){return bs(),null})),C=(y.flags&15990)!==0,(y.subtreeFlags&15990)!==0||C){C=yn.transition,yn.transition=null;var k=Kt;Kt=1;var j=Nt;Nt|=4,qf.current=null,OA(a,y),HA(a,y),q(a.containerInfo),a.current=y,GA(y),vA(),Nt=j,Kt=k,yn.transition=C}else a.current=y;if(Ic&&(Ic=!1,Xr=a,Bc=M),C=a.pendingLanes,C===0&&(Wr=null),xA(y.stateNode),ui(a,Pn()),c!==null)for(m=a.onRecoverableError,y=0;y<c.length;y++)m(c[y]);if(Rc)throw Rc=!1,a=ed,ed=null,a;return(Bc&1)!==0&&a.tag!==0&&bs(),C=a.pendingLanes,(C&1)!==0?a===td?Oa++:(Oa=0,td=a):Oa=0,sr(),null}function bs(){if(Xr!==null){var a=Km(Bc),c=yn.transition,m=Kt;try{if(yn.transition=null,Kt=16>a?16:a,Xr===null)var y=!1;else{if(a=Xr,Xr=null,Bc=0,(Nt&6)!==0)throw Error(o(331));var M=Nt;for(Nt|=4,Ze=a.current;Ze!==null;){var C=Ze,k=C.child;if((Ze.flags&16)!==0){var j=C.deletions;if(j!==null){for(var _e=0;_e<j.length;_e++){var Ne=j[_e];for(Ze=Ne;Ze!==null;){var rt=Ze;switch(rt.tag){case 0:case 11:case 15:ws(8,rt,C)}var Ct=rt.child;if(Ct!==null)Ct.return=rt,Ze=Ct;else for(;Ze!==null;){rt=Ze;var mt=rt.sibling,nn=rt.return;if(ev(rt),rt===Ne){Ze=null;break}if(mt!==null){mt.return=nn,Ze=mt;break}Ze=nn}}}var ht=C.alternate;
vendor: 4,333 bytes, line 3857
3857if(ht!==null){var Jn=ht.child;if(Jn!==null){ht.child=null;do{var Fi=Jn.sibling;Jn.sibling=null,Jn=Fi}while(Jn!==null)}}Ze=C}}if((C.subtreeFlags&2064)!==0&&k!==null)k.return=C,Ze=k;else e:for(;Ze!==null;){if(C=Ze,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:ws(9,C,C.return)}var se=C.sibling;if(se!==null){se.return=C.return,Ze=se;break e}Ze=C.return}}var ie=a.current;for(Ze=ie;Ze!==null;){k=Ze;var fe=k.child;if((k.subtreeFlags&2064)!==0&&fe!==null)fe.return=k,Ze=fe;else e:for(k=ie;Ze!==null;){if(j=Ze,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:La(9,j)}}catch(ct){hi(j,j.return,ct)}if(j===k){Ze=null;break e}var Qe=j.sibling;if(Qe!==null){Qe.return=j.return,Ze=Qe;break e}Ze=j.return}}if(Nt=M,sr(),ir&&typeof ir.onPostCommitFiberRoot=="function")try{ir.onPostCommitFiberRoot(Zl,a)}catch{}y=!0}return y}finally{Kt=m,yn.transition=c}}return!1}function vv(a,c,m){c=Ff(m,c),c=Bg(a,c,1),Vr(a,c),c=ti(),a=Lc(a,1),a!==null&&(Aa(a,1,c),ui(a,c))}function hi(a,c,m){if(a.tag===3)vv(a,a,m);else for(;c!==null;){if(c.tag===3){vv(c,a,m);break}else if(c.tag===1){var y=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Wr===null||!Wr.has(y))){a=Ff(m,a),a=Pg(c,a,1),Vr(c,a),a=ti(),c=Lc(c,1),c!==null&&(Aa(c,1,a),ui(c,a));break}}c=c.return}}function JA(a,c,m){var y=a.pingCache;y!==null&&y.delete(c),c=ti(),a.pingedLanes|=a.suspendedLanes&m,Sn===a&&(On&m)===m&&(Tn===4||Tn===3&&(On&130023424)===On&&500>Pn()-jf?Cs(a,0):Qf|=m),ui(a,c)}function _v(a,c){c===0&&((a.mode&1)===0?c=1:(c=kr,kr<<=1,(kr&130023424)===0&&(kr=4194304)));var m=ti();a=Lc(a,c),a!==null&&(Aa(a,c,m),ui(a,m))}function YA(a){var c=a.memoizedState,m=0;c!==null&&(m=c.retryLane),_v(a,m)}function KA(a,c){var m=0;switch(a.tag){case 13:var y=a.stateNode,M=a.memoizedState;M!==null&&(m=M.retryLane);break;case 19:y=a.stateNode;break;default:throw Error(o(314))}y!==null&&y.delete(c),_v(a,m)}var yv;yv=function(a,c,m){if(a!==null)if(a.memoizedProps!==c.pendingProps||st.current)Mi=!0;else{if((a.lanes&m)===0&&(c.flags&128)===0)return Mi=!1,FA(a,c,m);Mi=(a.flags&131072)!==0}else Mi=!1,cn&&(c.flags&1048576)!==0&&sg(c,rc,c.index);switch(c.lanes=0,c.tag){case 2:var y=c.type;a!==null&&(a.alternate=null,c.alternate=null,c.flags|=2),a=c.pendingProps;var M=et(c,_t.current);_o(c,m),M=If(null,c,y,a,M,m);var C=Bf();return c.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Ot(y)?(C=!0,wt(c)):C=!1,c.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,vf(c),M.updater=nc,c.stateNode=M,M._reactInternals=c,yf(c,y,a,m),c=Of(null,c,y,!0,C,m)):(c.tag=0,cn&&C&&xf(c),ei(null,c,M,m),c=c.child),c;case 16:y=c.elementType;e:{switch(a!==null&&(a.alternate=null,c.alternate=null,c.flags|=2),a=c.pendingProps,M=y._init,y=M(y._payload),c.type=y,M=c.tag=qA(y),a=Wi(y,a),M){case 0:c=Nf(null,c,y,a,m);break e;case 1:c=Vg(null,c,y,a,m);break e;case 11:c=Og(null,c,y,a,m);break e;case 14:c=Hg(null,c,y,Wi(y.type,a),m);break e}throw Error(o(306,y,""))}return c;case 0:return y=c.type,M=c.pendingProps,M=c.elementType===y?M:Wi(y,M),Nf(a,c,y,M,m);case 1:return y=c.type,M=c.pendingProps,M=c.elementType===y?M:Wi(y,M),Vg(a,c,y,M,m);case 3:e:{if(Wg(c),a===null)throw Error(o(387));y=c.pendingProps,C=c.memoizedState,M=C.element,jm(a,c),tc(c,y,null,m);var k=c.memoizedState;if(y=k.element,pt&&C.isDehydrated)if(C={element:y,isDehydrated:!1,cache:k.cache,transitions:k.transitions},c.updateQueue.baseState=C,c.memoizedState=C,c.flags&256){M=Error(o(423)),c=Xg(a,c,y,m,M);break e}else if(y!==M){M=Error(o(424)),c=Xg(a,c,y,m,M);break e}else for(pt&&(Ai=xs(c.stateNode.containerInfo),xi=c,cn=!0,Xi=null,Ma=!1),m=hg(c,null,y,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Ao(),y===M){c=Er(a,c,m);break e}ei(a,c,y,m)}c=c.child}return c;case 5:return fg(c),a===null&&Sf(c),y=c.type,M=c.pendingProps,C=a!==null?a.memoizedProps:null,k=M.children,Re(y,M)?k=null:C!==null&&Re(y,C)&&(c.flags|=32),zg(a,c),ei(a,c,k,m),c.child;case 6:return a===null&&Sf(c),null;case 13:return Jg(a,c,m);case 4:return wf(c,c.stateNode.containerInfo),y=c.pendingProps,a===null?c.child=Mo(c,null,y,m):ei(a,c,y,m),c.child;case 11:return y=c.type,M=c.pendingProps,M=c.elementType===y?M:Wi(y,M),Og(a,c,y,M,m);case 7:return ei(a,c,c.pendingProps,m),c.child;
vendor: 31,058 bytes, lines 3857-3869
3857case 8:return ei(a,c,c.pendingProps.children,m),c.child;case 12:return ei(a,c,c.pendingProps.children,m),c.child;case 10:e:{if(y=c.type._context,M=c.pendingProps,C=c.memoizedProps,k=M.value,Qm(c,y,k),C!==null)if(rr(C.value,k)){if(C.children===M.children&&!st.current){c=Er(a,c,m);break e}}else for(C=c.child,C!==null&&(C.return=c);C!==null;){var j=C.dependencies;if(j!==null){k=C.child;for(var _e=j.firstContext;_e!==null;){if(_e.context===y){if(C.tag===1){_e=xr(-1,m&-m),_e.tag=2;var Ne=C.updateQueue;if(Ne!==null){Ne=Ne.shared;var rt=Ne.pending;rt===null?_e.next=_e:(_e.next=rt.next,rt.next=_e),Ne.pending=_e}}C.lanes|=m,_e=C.alternate,_e!==null&&(_e.lanes|=m),gf(C.return,m,c),j.lanes|=m;break}_e=_e.next}}else if(C.tag===10)k=C.type===c.type?null:C.child;else if(C.tag===18){if(k=C.return,k===null)throw Error(o(341));k.lanes|=m,j=k.alternate,j!==null&&(j.lanes|=m),gf(k,m,c),k=C.sibling}else k=C.child;if(k!==null)k.return=C;else for(k=C;k!==null;){if(k===c){k=null;break}if(C=k.sibling,C!==null){C.return=k.return,k=C;break}k=k.return}C=k}ei(a,c,M.children,m),c=c.child}return c;case 9:return M=c.type,y=c.pendingProps.children,_o(c,m),M=bi(M),y=y(M),c.flags|=1,ei(a,c,y,m),c.child;case 14:return y=c.type,M=Wi(y,c.pendingProps),M=Wi(y.type,M),Hg(a,c,y,M,m);case 15:return Gg(a,c,c.type,c.pendingProps,m);case 17:return y=c.type,M=c.pendingProps,M=c.elementType===y?M:Wi(y,M),a!==null&&(a.alternate=null,c.alternate=null,c.flags|=2),c.tag=1,Ot(y)?(a=!0,wt(c)):a=!1,_o(c,m),ig(c,y,M),yf(c,y,M,m),Of(null,c,y,!0,a,m);case 19:return qg(a,c,m);case 22:return kg(a,c,m)}throw Error(o(156,c.tag))};function xv(a,c){return cf(a,c)}function ZA(a,c,m,y){this.tag=a,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=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Li(a,c,m,y){return new ZA(a,c,m,y)}function od(a){return a=a.prototype,!(!a||!a.isReactComponent)}function qA(a){if(typeof a=="function")return od(a)?1:0;if(a!=null){if(a=a.$$typeof,a===A)return 11;if(a===S)return 14}return 2}function Kr(a,c){var m=a.alternate;return m===null?(m=Li(a.tag,c,a.key,a.mode),m.elementType=a.elementType,m.type=a.type,m.stateNode=a.stateNode,m.alternate=a,a.alternate=m):(m.pendingProps=c,m.type=a.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=a.flags&14680064,m.childLanes=a.childLanes,m.lanes=a.lanes,m.child=a.child,m.memoizedProps=a.memoizedProps,m.memoizedState=a.memoizedState,m.updateQueue=a.updateQueue,c=a.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=a.sibling,m.index=a.index,m.ref=a.ref,m}function Uc(a,c,m,y,M,C){var k=2;if(y=a,typeof a=="function")od(a)&&(k=1);else if(typeof a=="string")k=5;else e:switch(a){case f:return Rs(m.children,M,C,c);case d:k=8,M|=8;break;case p:return a=Li(12,m,c,M|2),a.elementType=p,a.lanes=C,a;case x:return a=Li(13,m,c,M),a.elementType=x,a.lanes=C,a;case _:return a=Li(19,m,c,M),a.elementType=_,a.lanes=C,a;case w:return Nc(m,M,C,c);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case g:k=10;break e;case v:k=9;break e;case A:k=11;break e;case S:k=14;break e;case E:k=16,y=null;break e}throw Error(o(130,a==null?a:typeof a,""))}return c=Li(k,m,c,M),c.elementType=a,c.type=y,c.lanes=C,c}function Rs(a,c,m,y){return a=Li(7,a,y,c),a.lanes=m,a}function Nc(a,c,m,y){return a=Li(22,a,y,c),a.elementType=w,a.lanes=m,a.stateNode={},a}function ad(a,c,m){return a=Li(6,a,null,c),a.lanes=m,a}function ld(a,c,m){return c=Li(4,a.children!==null?a.children:[],a.key,c),c.lanes=m,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}function QA(a,c,m,y,M){this.tag=c,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ut,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=af(0),this.expirationTimes=af(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=af(0),this.identifierPrefix=y,this.onRecoverableError=M,pt&&(this.mutableSourceEagerHydrationData=null)}function Av(a,c,m,y,M,C,k,j,_e){return a=new QA(a,c,m,j,_e),c===1?(c=1,C===!0&&(c|=8)):c=0,C=Li(3,null,null,c),a.current=C,C.stateNode=a,C.memoizedState={element:y,isDehydrated:m,cache:null,transitions:null},vf(C),a}function Mv(a){if(!a)return nt;a=a._reactInternals;e:{if(T(a)!==a||a.tag!==1)throw Error(o(170));var c=a;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(o(171))}if(a.tag===1){var m=a.type;if(Ot(m))return sn(a,m,c)}return c}function Sv(a){var c=a._reactInternals;if(c===void 0)throw typeof a.render=="function"?Error(o(188)):(a=Object.keys(a).join(","),Error(o(268,a)));return a=Y(c),a===null?null:a.stateNode}function Ev(a,c){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var m=a.retryLane;a.retryLane=m!==0&&m<c?m:c}}function cd(a,c){Ev(a,c),(a=a.alternate)&&Ev(a,c)}function jA(a){return a=Y(a),a===null?null:a.stateNode}function $A(){return null}return t.attemptContinuousHydration=function(a){if(a.tag===13){var c=ti();Di(a,134217728,c),cd(a,134217728)}},t.attemptHydrationAtCurrentPriority=function(a){if(a.tag===13){var c=ti(),m=Jr(a);Di(a,m,c),cd(a,m)}},t.attemptSynchronousHydration=function(a){switch(a.tag){case 3:var c=a.stateNode;if(c.current.memoizedState.isDehydrated){var m=yi(c.pendingLanes);m!==0&&(lf(c,m|1),ui(c,Pn()),(Nt&6)===0&&(bo(),sr()))}break;case 13:var y=ti();fv(function(){return Di(a,1,y)}),cd(a,1)}},t.batchedUpdates=function(a,c){var m=Nt;Nt|=1;try{return a(c)}finally{Nt=m,Nt===0&&(bo(),ql&&sr())}},t.createComponentSelector=function(a){return{$$typeof:Mc,value:a}},t.createContainer=function(a,c,m,y,M,C,k){return Av(a,c,!1,null,m,y,M,C,k)},t.createHasPseudoClassSelector=function(a){return{$$typeof:Sc,value:a}},t.createHydrationContainer=function(a,c,m,y,M,C,k,j,_e){return a=Av(m,y,!0,a,M,C,k,j,_e),a.context=Mv(null),m=a.current,y=ti(),M=Jr(m),C=xr(y,M),C.callback=c??null,Vr(m,C),a.current.lanes=M,Aa(a,M,y),ui(a,y),a},t.createPortal=function(a,c,m){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:y==null?null:""+y,children:a,containerInfo:c,implementation:m}},t.createRoleSelector=function(a){return{$$typeof:Ec,value:a}},t.createTestNameSelector=function(a){return{$$typeof:wc,value:a}},t.createTextSelector=function(a){return{$$typeof:Cc,value:a}},t.deferredUpdates=function(a){var c=Kt,m=yn.transition;try{return yn.transition=null,Kt=16,a()}finally{Kt=c,yn.transition=m}},t.discreteUpdates=function(a,c,m,y,M){var C=Kt,k=yn.transition;try{return yn.transition=null,Kt=1,a(c,m,y,M)}finally{Kt=C,yn.transition=k,Nt===0&&bo()}},t.findAllNodes=Zf,t.findBoundingRects=function(a,c){if(!ye)throw Error(o(363));c=Zf(a,c),a=[];for(var m=0;m<c.length;m++)a.push(P(c[m]));for(c=a.length-1;0<c;c--){m=a[c];for(var y=m.x,M=y+m.width,C=m.y,k=C+m.height,j=c-1;0<=j;j--)if(c!==j){var _e=a[j],Ne=_e.x,rt=Ne+_e.width,Ct=_e.y,mt=Ct+_e.height;if(y>=Ne&&C>=Ct&&M<=rt&&k<=mt){a.splice(c,1);break}else if(y!==Ne||m.width!==_e.width||mt<C||Ct>k){if(!(C!==Ct||m.height!==_e.height||rt<y||Ne>M)){Ne>y&&(_e.width+=Ne-y,_e.x=y),rt<M&&(_e.width=M-Ne),a.splice(c,1);break}}else{Ct>C&&(_e.height+=Ct-C,_e.y=C),mt<k&&(_e.height=k-Ct),a.splice(c,1);break}}}return a},t.findHostInstance=Sv,t.findHostInstanceWithNoPortals=function(a){return a=N(a),a=a!==null?Q(a):null,a===null?null:a.stateNode},t.findHostInstanceWithWarning=function(a){return Sv(a)},t.flushControlled=function(a){var c=Nt;Nt|=1;var m=yn.transition,y=Kt;try{yn.transition=null,Kt=1,a()}finally{Kt=y,yn.transition=m,Nt=c,Nt===0&&(bo(),sr())}},t.flushPassiveEffects=bs,t.flushSync=fv,t.focusWithin=function(a,c){if(!ye)throw Error(o(363));for(a=Jf(a),c=cv(a,c),c=Array.from(c),a=0;a<c.length;){var m=c[a++];if(!he(m)){if(m.tag===5&&ve(m.stateNode))return!0;for(m=m.child;m!==null;)c.push(m),m=m.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Kt},t.getFindAllNodesFailureDescription=function(a,c){if(!ye)throw Error(o(363));var m=0,y=[];a=[Jf(a),0];for(var M=0;M<a.length;){var C=a[M++],k=a[M++],j=c[k];if((C.tag!==5||!he(C))&&(Yf(C,j)&&(y.push(Kf(j)),k++,k>m&&(m=k)),k<c.length))for(C=C.child;C!==null;)a.push(C,k),C=C.sibling}if(m<c.length){for(a=[];m<c.length;m++)a.push(Kf(c[m]));return`findAllNodes was able to match part of the selector: 3858 `+(y.join(" > ")+` 3859 3860No matching component was found for: 3861 `)+a.join(" > ")}return null},t.getPublicRootInstance=function(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return ee(a.child.stateNode);default:return a.child.stateNode}},t.injectIntoDevTools=function(a){if(a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:jA,findFiberByHostInstance:a.findFiberByHostInstance||$A,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)a=!0;else{try{Zl=c.inject(a),ir=c}catch{}a=!!c.checkDCE}}return a},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(a,c,m,y){if(!ye)throw Error(o(363));a=Zf(a,c);var M=tt(a,m,y).disconnect;return{disconnect:function(){M()}}},t.registerMutableSourceForHydration=function(a,c){var m=c._getVersion;m=m(c._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[c,m]:a.mutableSourceEagerHydrationData.push(c,m)},t.runWithPriority=function(a,c){var m=Kt;try{return Kt=a,c()}finally{Kt=m}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(a,c,m,y){var M=c.current,C=ti(),k=Jr(M);return m=Mv(m),c.context===null?c.context=m:c.pendingContext=m,c=xr(C,k),c.payload={element:a},y=y===void 0?null:y,y!==null&&(c.callback=y),Vr(M,c),a=Di(M,k,C),a!==null&&ec(a,M,k),k},t}),tp}var u_;function CR(){return u_||(u_=1,jd.exports=wR()),jd.exports}var TR=CR();const bR=sM(TR);var np={exports:{}},ip={};/** 3862 * @license React 3863 * scheduler.production.min.js 3864 * 3865 * Copyright (c) Facebook, Inc. and its affiliates. 3866 * 3867 * This source code is licensed under the MIT license found in the 3868 * LICENSE file in the root directory of this source tree. 3869 */var h_;function RR(){return h_||(h_=1,(function(r){function e(G,te){var q=G.length;G.push(te);e:for(;0<q;){var ce=q-1>>>1,Se=G[ce];if(0<i(Se,te))G[ce]=te,G[q]=Se,q=ce;else break e}}function t(G){return G.length===0?null:G[0]}function n(G){if(G.length===0)return null;var te=G[0],q=G.pop();if(q!==te){G[0]=q;e:for(var ce=0,Se=G.length,Ge=Se>>>1;ce<Ge;){var le=2*(ce+1)-1,Re=G[le],we=le+1,Le=G[we];if(0>i(Re,q))we<Se&&0>i(Le,Re)?(G[ce]=Le,G[we]=q,ce=we):(G[ce]=Re,G[le]=q,ce=le);else if(we<Se&&0>i(Le,q))G[ce]=Le,G[we]=q,ce=we;else break e}}return te}function i(G,te){var q=G.sortIndex-te.sortIndex;return q!==0?q:G.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();r.unstable_now=function(){return o.now()-l}}var u=[],h=[],f=1,d=null,p=3,g=!1,v=!1,A=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=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(G){for(var te=t(h);te!==null;){if(te.callback===null)n(h);else if(te.startTime<=G)n(h),te.sortIndex=te.expirationTime,e(u,te);else break;te=t(h)}}function w(G){if(A=!1,E(G),!v)if(t(u)!==null)v=!0,ee(L);else{var te=t(h);te!==null&&Me(w,te.startTime-G)}}function L(G,te){v=!1,A&&(A=!1,_(D),D=-1),g=!0;var q=p;try{for(E(te),d=t(u);d!==null&&(!(d.expirationTime>te)||G&&!N());){var ce=d.callback;if(typeof ce=="function"){d.callback=null,p=d.priorityLevel;var Se=ce(d.expirationTime<=te);te=r.unstable_now(),typeof Se=="function"?d.callback=Se:d===t(u)&&n(u),E(te)}else n(u);d=t(u)}if(d!==null)var Ge=!0;else{var le=t(h);le!==null&&Me(w,le.startTime-te),Ge=!1}return Ge}finally{d=null,p=q,g=!1}}var B=!1,F=null,D=-1,T=5,b=-1;function N(){return!(r.unstable_now()-b<T)}function Y(){if(F!==null){var G=r.unstable_now();b=G;var te=!0;try{te=F(!0,G)}finally{te?K():(B=!1,F=null)}}else B=!1}var K;if(typeof S=="function")K=function(){S(Y)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,oe=Q.port2;Q.port1.onmessage=Y,K=function(){oe.postMessage(null)}}else K=function(){x(Y,0)};function ee(G){F=G,B||(B=!0,K())}function Me(G,te){D=x(function(){G(r.unstable_now())},te)}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(G){G.callback=null},r.unstable_continueExecution=function(){v||g||(v=!0,ee(L))},r.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<G?Math.floor(1e3/G):5},r.unstable_getCurrentPriorityLevel=function(){return p},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(G){switch(p){case 1:case 2:case 3:var te=3;break;default:te=p}var q=p;p=te;try{return G()}finally{p=q}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(G,te){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var q=p;p=G;try{return te()}finally{p=q}},r.unstable_scheduleCallback=function(G,te,q){var ce=r.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?ce+q:ce):q=ce,G){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=q+Se,G={id:f++,callback:te,priorityLevel:G,startTime:q,expirationTime:Se,sortIndex:-1},q>ce?(G.sortIndex=q,e(h,G),t(u)===null&&G===t(h)&&(A?(_(D),D=-1):A=!0,Me(w,q-ce))):(G.sortIndex=Se,e(u,G),v||g||(v=!0,ee(L))),G},r.unstable_shouldYield=N,r.unstable_wrapCallback=function(G){var te=p;return function(){var q=p;p=te;try{return G.apply(this,arguments)}finally{p=q}}}})(ip)),ip}var f_;function IR(){return f_||(f_=1,np.exports=RR()),np.exports}var d_=IR();const Lm={},Lx=r=>void Object.assign(Lm,r);function BR(r,e){function t(f,{args:d=[],attach:p,...g},v){let A=`${f[0].toUpperCase()}${f.slice(1)}`,x;if(f==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=g.object;x=Ko(_,{type:f,root:v,attach:p,primitive:!0})}else{const _=Lm[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!");x=Ko(new _(...d),{type:f,root:v,attach:p,memoizedProps:{args:d}})}return x.__r3f.attach===void 0&&(x.isBufferGeometry?x.__r3f.attach="geometry":x.isMaterial&&(x.__r3f.attach="material")),A!=="inject"&&op(x,g),x}function n(f,d){let p=!1;if(d){var g,v;(g=d.__r3f)!=null&&g.attach?sp(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||Ko(d,{}),d.__r3f.parent=f,Up(d),Zo(d)}}function i(f,d,p){let g=!1;if(d){var v,A;if((v=d.__r3f)!=null&&v.attach)sp(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 x=f.children.filter(S=>S!==d),_=x.indexOf(p);f.children=[...x.slice(0,_),d,...x.slice(_)],g=!0}g||(A=f.__r3f)==null||A.objects.push(d),d.__r3f||Ko(d,{}),d.__r3f.parent=f,Up(d),Zo(d)}}function s(f,d,p=!1){f&&[...f].forEach(g=>o(d,g,p))}function o(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)__(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){var x;f.remove(d),(x=d.__r3f)!=null&&x.root&&OR(Gu(d),d)}const S=(A=d.__r3f)==null?void 0:A.primitive,E=!S&&(p===void 0?d.dispose!==null:p);if(!S){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"?d_.unstable_scheduleCallback(d_.unstable_IdlePriority,w):w()}Zo(f)}}function l(f,d,p,g){var v;const A=(v=f.__r3f)==null?void 0:v.parent;if(!A)return;const x=t(d,p,f.__r3f.root);if(f.children){for(const _ of f.children)_.__r3f&&n(x,_);f.children=f.children.filter(_=>!_.__r3f)}f.__r3f.objects.forEach(_=>n(x,_)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||o(A,f),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),n(A,x),x.raycast&&x.__r3f.eventCount&&Gu(x).getState().internal.interaction.push(x),[g,g.alternate].forEach(_=>{_!==null&&(_.stateNode=x,_.ref&&(typeof _.ref=="function"?_.ref(x):_.ref.current=x))})}const u=()=>{};return{reconciler:bR({createInstance:t,removeChild:o,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&&o(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==null?void 0:f.__r3f)!=null?d:{}).handlers},prepareUpdate(f,d,p,g){var v;if(((v=f==null?void 0:f.__r3f)!=null?v:{}).primitive&&g.object&&g.object!==f)return[!0];{const{args:x=[],children:_,...S}=g,{args:E=[],children:w,...L}=p;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((F,D)=>F!==E[D]))return[!0];const B=kx(f,S,L,!0);return B.changes.length?[!1,B]:null}},commitUpdate(f,[d,p],g,v,A,x){d?l(f,g,A,x):op(f,p)},commitMount(f,d,p,g){var v;const A=(v=f.__r3f)!=null?v:{};f.raycast&&A.handlers&&A.eventCount&&Gu(f).getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>Ko(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var d;const{attach:p,parent:g}=(d=f.__r3f)!=null?d:{};p&&g&&__(g,f,p),f.isObject3D&&(f.visible=!1),Zo(f)},unhideInstance(f,d){var p;const{attach:g,parent:v}=(p=f.__r3f)!=null?p:{};g&&v&&sp(v,f,g),(f.isObject3D&&d.visible==null||d.visible)&&(f.visible=!0),Zo(f)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():jo.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&an.fun(performance.now)?performance.now:an.fun(Date.now)?Date.now:()=>0,scheduleTimeout:an.fun(setTimeout)?setTimeout:void 0,cancelTimeout:an.fun(clearTimeout)?clearTimeout:void 0}),applyProps:op}}var p_,m_;const rp=r=>"colorSpace"in r||"outputColorSpace"in r,Fx=()=>{var r;return(r=Lm.ColorManagement)!=null?r:null},Ux=r=>r&&r.isOrthographicCamera,PR=r=>r&&r.hasOwnProperty("current"),Jl=typeof window<"u"&&((p_=window.document)!=null&&p_.createElement||((m_=window.navigator)==null?void 0:m_.product)==="ReactNative")?He.useLayoutEffect:He.useEffect;function Nx(r){const e=He.useRef(r);return Jl(()=>void(e.current=r),[r]),e}function DR({set:r}){return Jl(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class Ox extends He.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}Ox.getDerivedStateFromError=()=>({error:!0});const Hx="__default",g_=new Map,LR=r=>r&&!!r.memoized&&!!r.changes;function Gx(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 Qa=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function Gu(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const an={obj:r=>r===Object(r)&&!an.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(an.str(r)||an.num(r)||an.boo(r))return r===e;const s=an.obj(r);if(s&&n==="reference")return r===e;const o=an.arr(r);if(o&&t==="reference")return r===e;if((o||s)&&r===e)return!0;let l;for(l in r)if(!(l in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(l in i?e:r)if(!an.equ(r[l],e[l],{strict:i,objects:"reference"}))return!1}else for(l in i?e:r)if(r[l]!==e[l])return!1;if(an.und(l)){if(o&&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 FR(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 UR(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function Ko(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function Fp(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,o)=>s[o],r),{target:t,key:i}}else return{target:t,key:e}}const v_=/-\d+$/;function sp(r,e,t){if(an.str(t)){if(v_.test(t)){const s=t.replace(v_,""),{target:o,key:l}=Fp(r,s);Array.isArray(o[l])||(o[l]=[])}const{target:n,key:i}=Fp(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function __(r,e,t){var n,i;if(an.str(t)){const{target:s,key:o}=Fp(r,t),l=e.__r3f.previousAttach;l===void 0?delete s[o]:s[o]=l}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function kx(r,{children:e,key:t,ref:n,...i},{children:s,key:o,ref:l,...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],Hx+"remove"])}d.forEach(([v,A])=>{var x;if((x=r.__r3f)!=null&&x.primitive&&v==="object"||an.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 S in i){const E=i[S];S.startsWith(`${v}-`)&&p.push([S,E,!1,S.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 op(r,e){var t;const n=r.__r3f,i=n==null?void 0:n.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:l}=LR(e)?e:kx(r,e),u=n==null?void 0:n.eventCount;r.__r3f&&(r.__r3f.memoizedProps=o);for(let p=0;p<l.length;p++){let[g,v,A,x]=l[p];if(rp(r)){const w="srgb",L="srgb-linear";g==="encoding"?(g="colorSpace",v=v===3001?w:L):g==="outputEncoding"&&(g="outputColorSpace",v=v===3001?w:L)}let _=r,S=_[g];if(x.length&&(S=x.reduce((E,w)=>E[w],r),!(S&&S.set))){const[E,...w]=x.reverse();_=w.reverse().reduce((L,B)=>L[B],r),g=E}if(v===Hx+"remove")if(_.constructor){let E=g_.get(_.constructor);E||(E=new _.constructor,g_.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(S&&S.set&&(S.copy||S instanceof no)){if(Array.isArray(v))S.fromArray?S.fromArray(v):S.set(...v);else if(S.copy&&v&&v.constructor&&S.constructor===v.constructor)S.copy(v);else if(v!==void 0){var h;const E=(h=S)==null?void 0:h.isColor;!E&&S.setScalar?S.setScalar(v):S instanceof no&&v instanceof no?S.mask=v.mask:S.set(v),!Fx()&&s&&!s.linear&&E&&S.convertSRGBToLinear()}}else{var f;if(_[g]=v,(f=_[g])!=null&&f.isTexture&&_[g].format===Mn&&_[g].type===gi&&s){const E=_[g];rp(E)&&rp(s.gl)?E.colorSpace=s.gl.outputColorSpace:E.encoding=s.gl.outputEncoding}}Zo(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const p=Gu(r).getState().internal,g=p.interaction.indexOf(r);g>-1&&p.interaction.splice(g,1),n.eventCount&&p.interaction.push(r)}return!(l.length===1&&l[0][0]==="onUpdate")&&l.length&&(t=r.__r3f)!=null&&t.parent&&Up(r),r}function Zo(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 Up(r){r.onUpdate==null||r.onUpdate(r)}function zx(r,e){r.manual||(Ux(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 Iu(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function NR(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return jo.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return jo.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return jo.ContinuousEventPriority;default:return jo.DefaultEventPriority}}function Vx(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function OR(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)=>{Vx(t.capturedMap,e,n,i)})}function HR(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 S=Qa(g[_]);S&&(S.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(u,f);function v(_){const S=Qa(_);if(!S||!S.events.enabled||S.raycaster.camera===null)return[];if(S.raycaster.camera===void 0){var E;S.events.compute==null||S.events.compute(u,S,(E=S.previousRoot)==null?void 0:E.getState()),S.raycaster.camera===void 0&&(S.raycaster.camera=null)}return S.raycaster.camera?S.raycaster.intersectObject(_,!0):[]}let A=g.flatMap(v).sort((_,S)=>{const E=Qa(_.object),w=Qa(S.object);return!E||!w?_.distance-S.distance:w.events.priority-E.events.priority||_.distance-S.distance}).filter(_=>{const S=Iu(_);return d.has(S)?!1:(d.add(S),!0)});f.events.filter&&(A=f.events.filter(A,f));for(const _ of A){let S=_.object;for(;S;){var x;(x=S.__r3f)!=null&&x.eventCount&&p.push({..._,eventObject:S}),S=S.parent}}if("pointerId"in u&&f.internal.capturedMap.has(u.pointerId))for(let _ of f.internal.capturedMap.get(u.pointerId).values())d.has(Iu(_.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=Qa(v.object)||p,{raycaster:x,pointer:_,camera:S,internal:E}=A,w=new H(_.x,_.y,0).unproject(S),L=b=>{var N,Y;return(N=(Y=E.capturedMap.get(b))==null?void 0:Y.has(v.eventObject))!=null?N:!1},B=b=>{const N={intersection:v,target:h.target};E.capturedMap.has(b)?E.capturedMap.get(b).set(v.eventObject,N):E.capturedMap.set(b,new Map([[v.eventObject,N]])),h.target.setPointerCapture(b)},F=b=>{const N=E.capturedMap.get(b);N&&Vx(E.capturedMap,v.eventObject,N,b)};let D={};for(let b in h){let N=h[b];typeof N!="function"&&(D[b]=N)}let T={...v,...D,pointer:_,intersections:u,stopped:g.stopped,delta:f,unprojectedPoint:w,ray:x.ray,camera:S,stopPropagation(){const b="pointerId"in h&&E.capturedMap.get(h.pointerId);if((!b||b.has(v.eventObject))&&(T.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(N=>N.eventObject===v.eventObject))){const N=u.slice(0,u.indexOf(v));s([...N,v])}},target:{hasPointerCapture:L,setPointerCapture:B,releasePointerCapture:F},currentTarget:{hasPointerCapture:L,setPointerCapture:B,releasePointerCapture:F},nativeEvent:h};if(d(T),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==null?void 0:p.handlers;if(h.hovered.delete(Iu(f)),p!=null&&p.eventCount){const v={...f,intersections:u};g.onPointerOut==null||g.onPointerOut(v),g.onPointerLeave==null||g.onPointerLeave(v)}}}function o(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 l(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",x=n(f,g?t:void 0),_=v?e(f):0;u==="onPointerDown"&&(p.initialClick=[f.offsetX,f.offsetY],p.initialHits=x.map(E=>E.eventObject)),v&&!x.length&&_<=2&&(o(f,p.interaction),d&&d(f)),g&&s(x);function S(E){const w=E.eventObject,L=w.__r3f,B=L==null?void 0:L.handlers;if(L!=null&&L.eventCount)if(g){if(B.onPointerOver||B.onPointerEnter||B.onPointerOut||B.onPointerLeave){const F=Iu(E),D=p.hovered.get(F);D?D.stopped&&E.stopPropagation():(p.hovered.set(F,E),B.onPointerOver==null||B.onPointerOver(E),B.onPointerEnter==null||B.onPointerEnter(E))}B.onPointerMove==null||B.onPointerMove(E)}else{const F=B[u];F?(!v||p.initialHits.includes(w))&&(o(f,p.interaction.filter(D=>!p.initialHits.includes(D))),F(E)):v&&p.initialHits.includes(w)&&o(f,p.interaction.filter(D=>!p.initialHits.includes(D)))}}i(x,f,_,S)}}return{handlePointer:l}}const GR=["set","get","setSize","setFrameloop","setDpr","events","invali
3869date","advance","size","viewport"],Wx=r=>!!(r!=null&&r.render),Fm=He.createContext(null),kR=(r,e)=>{const t=Bx((l,u)=>{const h=new H,f=new H,d=new H;function p(_=u().camera,S=f,E=u().size){const{width:w,height:L,top:B,left:F}=E,D=w/L;S.isVector3?d.copy(S):d.set(...S);const T=_.getWorldPosition(h).distanceTo(d);if(Ux(_))return{width:w/_.zoom,height:L/_.zoom,top:B,left:F,factor:1,distance:T,aspect:D};{const b=_.fov*Math.PI/180,N=2*Math.tan(b/2)*T,Y=N*(w/L);return{width:Y,height:N,top:B,left:F,factor:w/Y,distance:T,aspect:D}}}let g;const v=_=>l(S=>({performance:{...S.performance,current:_}})),A=new be;return{set:l,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>r(u(),_),advance:(_,S)=>e(_,S,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Cm,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:_=>l(S=>({...S,events:{...S.events,..._}})),setSize:(_,S,E,w,L)=>{const B=u().camera,F={width:_,height:S,top:w||0,left:L||0,updateStyle:E};l(D=>({size:F,viewport:{...D.viewport,...p(B,f,F)}}))},setDpr:_=>l(S=>{const E=Gx(_);return{viewport:{...S.viewport,dpr:E,initialDpr:S.viewport.initialDpr||E}}}),setFrameloop:(_="always")=>{const S=u().clock;S.stop(),S.elapsedTime=0,_!=="never"&&(S.start(),S.elapsedTime=0),l(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:He.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,S,E)=>{const w=u().internal;return w.priority=w.priority+(S>0?1:0),w.subscribers.push({ref:_,priority:S,store:E}),w.subscribers=w.subscribers.sort((L,B)=>L.priority-B.priority),()=>{const L=u().internal;L!=null&&L.subscribers&&(L.priority=L.priority-(S>0?1:0),L.subscribers=L.subscribers.filter(B=>B.ref!==_))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:l,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,zx(l,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)}l!==o&&(o=l,d(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(l)}})))}),t.subscribe(l=>r(l)),t};let Bu,zR=new Set,VR=new Set,WR=new Set;function ap(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function ja(r,e){switch(r){case"before":return ap(zR,e);case"after":return ap(VR,e);case"tail":return ap(WR,e)}}let lp,cp;function up(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),lp=e.internal.subscribers,Bu=0;Bu<lp.length;Bu++)cp=lp[Bu],cp.ref.current(cp.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 XR(r){let e=!1,t=!1,n,i,s;function o(h){i=requestAnimationFrame(o),e=!0,n=0,ja("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+=up(h,s))}if(t=!1,ja("after",h),n===0)return ja("tail",h),e=!1,cancelAnimationFrame(i)}function l(h,f=1){var d;if(!h)return r.forEach(p=>l(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(o)))}function u(h,f=!0,d,p){if(f&&ja("before",h),d)up(h,d,p);else for(const g of r.values())up(h,g.store.getState());f&&ja("after",h)}return{loop:o,invalidate:l,advance:u}}function Um(){const r=He.useContext(Fm);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Cl(r=t=>t,e){return Um()(r,e)}function JR(r,e=0){const t=Um(),n=t.getState().internal.subscribe,i=Nx(r);return Jl(()=>n(i,e,t),[e,n,t]),null}const y_=new WeakMap;function Xx(r,e){return function(t,...n){let i=y_.get(t);
vendor: 33,628 bytes, lines 3869-3950
3869return i||(i=new t,y_.set(t,i)),r&&r(i),Promise.all(n.map(s=>new Promise((o,l)=>i.load(s,u=>{u.scene&&Object.assign(u,FR(u.scene)),o(u)},e,u=>l(new Error(`Could not load ${s}: ${u==null?void 0:u.message}`))))))}}function Hr(r,e,t,n){const i=Array.isArray(e)?e:[e],s=xR(Xx(t,n),[r,...i],{equal:an.equ});return Array.isArray(e)?s:s[0]}Hr.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return AR(Xx(t),[r,...n])};Hr.clear=function(r,e){const t=Array.isArray(e)?e:[e];return MR([r,...t])};const ma=new Map,{invalidate:x_,advance:A_}=XR(ma),{reconciler:Tl,applyProps:as}=BR(ma,NR),Yo={objects:"shallow",strict:!1},YR=(r,e)=>{const t=typeof r=="function"?r(e):r;return Wx(t)?t:new Dm({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function KR(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:o,updateStyle:l=t}=e;return{width:n,height:i,top:s,left:o,updateStyle:l}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:o}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:o,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 ZR(r){const e=ma.get(r),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||kR(x_,A_),o=t||Tl.createContainer(s,jo.ConcurrentRoot,null,!1,null,"",i,null);e||ma.set(r,{fiber:o,store:s});let l,u=!1,h;return{configure(f={}){let{gl:d,size:p,scene:g,events:v,onCreated:A,shadows:x=!1,linear:_=!1,flat:S=!1,legacy:E=!1,orthographic:w=!1,frameloop:L="always",dpr:B=[1,2],performance:F,raycaster:D,camera:T,onPointerMissed:b}=f,N=s.getState(),Y=N.gl;N.gl||N.set({gl:Y=YR(d,r)});let K=N.raycaster;K||N.set({raycaster:K=new Im});const{params:Q,...oe}=D||{};if(an.equ(oe,K,Yo)||as(K,{...oe}),an.equ(Q,K.params,Yo)||as(K,{params:{...K.params,...Q}}),!N.camera||N.camera===h&&!an.equ(h,T,Yo)){h=T;const q=T instanceof Fl,ce=q?T:w?new po(0,0,0,0,.1,1e3):new bn(75,0,.1,1e3);q||(ce.position.z=5,T&&(as(ce,T),("aspect"in T||"left"in T||"right"in T||"bottom"in T||"top"in T)&&(ce.manual=!0,ce.updateProjectionMatrix())),!N.camera&&!(T!=null&&T.rotation)&&ce.lookAt(0,0,0)),N.set({camera:ce}),K.camera=ce}if(!N.scene){let q;g!=null&&g.isScene?q=g:(q=new Nl,g&&as(q,g)),N.set({scene:Ko(q)})}if(!N.xr){var ee;const q=(Ge,le)=>{const Re=s.getState();Re.frameloop!=="never"&&A_(Ge,!0,Re,le)},ce=()=>{const Ge=s.getState();Ge.gl.xr.enabled=Ge.gl.xr.isPresenting,Ge.gl.xr.setAnimationLoop(Ge.gl.xr.isPresenting?q:null),Ge.gl.xr.isPresenting||x_(Ge)},Se={connect(){const Ge=s.getState().gl;Ge.xr.addEventListener("sessionstart",ce),Ge.xr.addEventListener("sessionend",ce)},disconnect(){const Ge=s.getState().gl;Ge.xr.removeEventListener("sessionstart",ce),Ge.xr.removeEventListener("sessionend",ce)}};typeof((ee=Y.xr)==null?void 0:ee.addEventListener)=="function"&&Se.connect(),N.set({xr:Se})}if(Y.shadowMap){const q=Y.shadowMap.enabled,ce=Y.shadowMap.type;if(Y.shadowMap.enabled=!!x,an.boo(x))Y.shadowMap.type=sl;else if(an.str(x)){var Me;const Se={basic:O_,percentage:Th,soft:sl,variance:qi};Y.shadowMap.type=(Me=Se[x])!=null?Me:sl}else an.obj(x)&&Object.assign(Y.shadowMap,x);(q!==Y.shadowMap.enabled||ce!==Y.shadowMap.type)&&(Y.shadowMap.needsUpdate=!0)}const G=Fx();G&&("enabled"in G?G.enabled=!E:"legacyMode"in G&&(G.legacyMode=E)),u||as(Y,{outputEncoding:_?3e3:3001,toneMapping:S?hr:zp}),N.legacy!==E&&N.set(()=>({legacy:E})),N.linear!==_&&N.set(()=>({linear:_})),N.flat!==S&&N.set(()=>({flat:S})),d&&!an.fun(d)&&!Wx(d)&&!an.equ(d,Y,Yo)&&as(Y,d),v&&!N.events.handlers&&N.set({events:v(s)});const te=KR(r,p);return an.equ(te,N.size,Yo)||N.setSize(te.width,te.height,te.updateStyle,te.top,te.left),B&&N.viewport.dpr!==Gx(B)&&N.setDpr(B),N.frameloop!==L&&N.setFrameloop(L),N.onPointerMissed||N.set({onPointerMissed:b}),F&&!an.equ(F,N.performance,Yo)&&N.set(q=>({performance:{...q.performance,...F}})),l=A,u=!0,this},render(f){return u||this.configure(),Tl.updateContainer(ri.jsx(qR,{store:s,children:f,onCreated:l,rootElement:r}),o,null,()=>{}),s},unmount(){Jx(r)}}}function qR({store:r,children:e,onCreated:t,rootElement:n}){return Jl(()=>{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)},[]),ri.jsx(Fm.Provider,{value:r,children:e})}function Jx(r,e){const t=ma.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Tl.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,o,l,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(l=i.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),UR(i),ma.delete(r)}catch{}},500)})}}function QR(r,e,t){return ri.jsx(jR,{children:r,container:e,state:t},e.uuid)}function jR({state:r={},children:e,container:t}){const{events:n,size:i,...s}=r,o=Um(),[l]=He.useState(()=>new Im),[u]=He.useState(()=>new be),h=He.useCallback((d,p)=>{const g={...d};Object.keys(d).forEach(A=>{(GR.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 H,i),A!==d.camera&&zx(A,i)}return{...g,scene:t,raycaster:l,pointer:u,mouse:u,previousRoot:o,events:{...d.events,...p==null?void 0:p.events,...n},size:{...d.size,...i},viewport:{...d.viewport,...v},...s}},[r]),[f]=He.useState(()=>{const d=o.getState();return Bx((g,v)=>({...d,scene:t,raycaster:l,pointer:u,mouse:u,previousRoot:o,events:{...d.events,...n},size:{...d.size,...i},...s,set:g,get:v,setEvents:A=>g(x=>({...x,events:{...x.events,...A}}))}))});return He.useEffect(()=>{const d=o.subscribe(p=>f.setState(g=>h(p,g)));return()=>{d()}},[h]),He.useEffect(()=>{f.setState(d=>h(o.getState(),d))},[h]),He.useEffect(()=>()=>{f.destroy()},[]),ri.jsx(ri.Fragment,{children:Tl.createPortal(ri.jsx(Fm.Provider,{value:f,children:e}),f,null)})}Tl.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:He.version});const hp={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 $R(r){const{handlePointer:e}=HR(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(hp).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(o=>({events:{...o.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([o,l])=>{const[u,h]=hp[o];t.addEventListener(u,l,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,o])=>{if(n&&n.connected instanceof HTMLElement){const[l]=hp[s];n.connected.removeEventListener(l,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function M_(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function eI({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,o]=He.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=He.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=He.useRef(!1);He.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[d,p,g]=He.useMemo(()=>{const _=()=>{if(!l.current.element)return;const{left:S,top:E,width:w,height:L,bottom:B,right:F,x:D,y:T}=l.current.element.getBoundingClientRect(),b={left:S,top:E,width:w,height:L,bottom:B,right:F,x:D,y:T};l.current.element instanceof HTMLElement&&n&&(b.height=l.current.element.offsetHeight,b.width=l.current.element.offsetWidth),Object.freeze(b),f.current&&!rI(l.current.lastBounds,b)&&o(l.current.lastBounds=b)};return[_,h?M_(_,h):_,u?M_(_,u):_]},[o,n,u,h]);function v(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null),l.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",l.current.orientationHandler))}function A(){l.current.element&&(l.current.resizeObserver=new i(g),l.current.resizeObserver.observe(l.current.element),e&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})),l.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",l.current.orientationHandler))}const x=_=>{!_||_===l.current.element||(v(),l.current.element=_,l.current.scrollContainers=Yx(_),A())};return nI(g,!!e),tI(p),He.useEffect(()=>{v(),A()},[e,g,p]),He.useEffect(()=>v,[]),[x,s,d]}function tI(r){He.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function nI(r,e){He.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function Yx(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,...Yx(r.parentElement)]}const iI=["x","y","top","bottom","left","right","width","height"],rI=(r,e)=>iI.every(t=>r[t]===e[t]);var sI=Object.defineProperty,oI=Object.defineProperties,aI=Object.getOwnPropertyDescriptors,S_=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,cI=Object.prototype.propertyIsEnumerable,E_=(r,e,t)=>e in r?sI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w_=(r,e)=>{for(var t in e||(e={}))lI.call(e,t)&&E_(r,t,e[t]);if(S_)for(var t of S_(e))cI.call(e,t)&&E_(r,t,e[t]);return r},uI=(r,e)=>oI(r,aI(e)),C_,T_;typeof window<"u"&&((C_=window.document)!=null&&C_.createElement||((T_=window.navigator)==null?void 0:T_.product)==="ReactNative")?He.useLayoutEffect:He.useEffect;function Kx(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=Kx(n,e,t);if(i)return i;n=n.sibling}}function Zx(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const b_=console.error;console.error=function(){const r=[...arguments].join("");if(r!=null&&r.startsWith("Warning:")&&r.includes("useContext")){console.error=b_;return}return b_.apply(this,arguments)};const Nm=Zx(He.createContext(null));class qx extends He.Component{render(){return He.createElement(Nm.Provider,{value:this._reactInternals},this.props.children)}}function hI(){const r=He.useContext(Nm);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=He.useId();return He.useMemo(()=>{for(const n of[r,r==null?void 0:r.alternate]){if(!n)continue;const i=Kx(n,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[r,e])}function fI(){const r=hI(),[e]=He.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!==Nm&&!e.has(i)&&e.set(i,He.useContext(Zx(i)))}t=t.return}return e}function dI(){const r=fI();return He.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>He.createElement(e,null,He.createElement(t.Provider,uI(w_({},n),{value:r.get(t)}))),e=>He.createElement(qx,w_({},e))),[r])}const pI=He.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:o=$R,eventSource:l,eventPrefix:u,shadows:h,linear:f,flat:d,legacy:p,orthographic:g,frameloop:v,dpr:A,performance:x,raycaster:_,camera:S,scene:E,onPointerMissed:w,onCreated:L,...B},F){He.useMemo(()=>Lx(pR),[]);const D=dI(),[T,b]=eI({scroll:!0,debounce:{scroll:50,resize:0},...n}),N=He.useRef(null),Y=He.useRef(null);He.useImperativeHandle(F,()=>N.current);const K=Nx(w),[Q,oe]=He.useState(!1),[ee,Me]=He.useState(!1);if(Q)throw Q;if(ee)throw ee;const G=He.useRef(null);Jl(()=>{const q=N.current;b.width>0&&b.height>0&&q&&(G.current||(G.current=ZR(q)),G.current.configure({gl:s,events:o,shadows:h,linear:f,flat:d,legacy:p,orthographic:g,frameloop:v,dpr:A,performance:x,raycaster:_,camera:S,scene:E,size:b,onPointerMissed:(...ce)=>K.current==null?void 0:K.current(...ce),onCreated:ce=>{ce.events.connect==null||ce.events.connect(l?PR(l)?l.current:l:Y.current),u&&ce.setEvents({compute:(Se,Ge)=>{const le=Se[u+"X"],Re=Se[u+"Y"];Ge.pointer.set(le/Ge.size.width*2-1,-(Re/Ge.size.height)*2+1),Ge.raycaster.setFromCamera(Ge.pointer,Ge.camera)}}),L==null||L(ce)}}),G.current.render(ri.jsx(D,{children:ri.jsx(Ox,{set:Me,children:ri.jsx(He.Suspense,{fallback:ri.jsx(DR,{set:oe}),children:e??null})})})))}),He.useEffect(()=>{const q=N.current;if(q)return()=>Jx(q)},[]);const te=l?"none":"auto";return ri.jsx("div",{ref:Y,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:te,...i},...B,children:ri.jsx("div",{ref:T,style:{width:"100%",height:"100%"},children:ri.jsx("canvas",{ref:N,style:{display:"block"},children:t})})})}),OB=He.forwardRef(function(e,t){return ri.jsx(qx,{children:ri.jsx(pI,{...e,ref:t})})});function Np(){return Np=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Np.apply(null,arguments)}const Om=parseInt(Rl.replace(/\D+/g,""));function R_(r,e){if(e===my)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Mh||e===Qp){let t=r.getIndex();if(t===null){const o=[],l=r.getAttribute("position");if(l!==void 0){for(let u=0;u<l.count;u++)o.push(u);r.setIndex(o),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===Mh)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));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 Hi=Uint8Array,us=Uint16Array,Op=Uint32Array,Qx=new Hi([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]),jx=new Hi([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]),mI=new Hi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$x=function(r,e){for(var t=new us(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new Op(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]},eA=$x(Qx,2),tA=eA[0],gI=eA[1];tA[28]=258,gI[258]=28;var vI=$x(jx,0),_I=vI[0],Hp=new us(32768);for(var ln=0;ln<32768;++ln){var rs=(ln&43690)>>>1|(ln&21845)<<1;rs=(rs&52428)>>>2|(rs&13107)<<2,rs=(rs&61680)>>>4|(rs&3855)<<4,Hp[ln]=((rs&65280)>>>8|(rs&255)<<8)>>>1}var pl=(function(r,e,t){for(var n=r.length,i=0,s=new us(e);i<n;++i)++s[r[i]-1];var o=new us(e);for(i=0;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;var l;if(t){l=new us(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=o[r[i]-1]++<<f,p=d|(1<<f)-1;d<=p;++d)l[Hp[d]>>>u]=h}else for(l=new us(n),i=0;i<n;++i)r[i]&&(l[i]=Hp[o[r[i]-1]++]>>>15-r[i]);return l}),Yl=new Hi(288);for(var ln=0;ln<144;++ln)Yl[ln]=8;for(var ln=144;ln<256;++ln)Yl[ln]=9;for(var ln=256;ln<280;++ln)Yl[ln]=7;for(var ln=280;ln<288;++ln)Yl[ln]=8;var nA=new Hi(32);for(var ln=0;ln<32;++ln)nA[ln]=5;var yI=pl(Yl,9,1),xI=pl(nA,5,1),fp=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},Zi=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},dp=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},AI=function(r){return(r/8|0)+(r&7&&1)},MI=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof us?us:r instanceof Op?Op:Hi)(t-e);return n.set(r.subarray(e,t)),n},SI=function(r,e,t){var n=r.length;if(!n||t&&!t.l&&n<5)return e||new Hi(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Hi(n*3));var o=function(we){var Le=e.length;if(we>Le){var ot=new Hi(Math.max(Le*2,we));ot.set(e),e=ot}},l=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=l=Zi(r,u,1);var A=Zi(r,u+1,3);if(u+=3,A)if(A==1)f=yI,d=xI,p=9,g=5;else if(A==2){var E=Zi(r,u,31)+257,w=Zi(r,u+10,15)+4,L=E+Zi(r,u+5,31)+1;u+=14;for(var B=new Hi(L),F=new Hi(19),D=0;D<w;++D)F[mI[D]]=Zi(r,u+D*3,7);u+=w*3;for(var T=fp(F),b=(1<<T)-1,N=pl(F,T,1),D=0;D<L;){var Y=N[Zi(r,u,b)];u+=Y&15;var x=Y>>>4;if(x<16)B[D++]=x;else{var K=0,Q=0;for(x==16?(Q=3+Zi(r,u,3),u+=2,K=B[D-1]):x==17?(Q=3+Zi(r,u,7),u+=3):x==18&&(Q=11+Zi(r,u,127),u+=7);Q--;)B[D++]=K}}var oe=B.subarray(0,E),ee=B.subarray(E);p=fp(oe),g=fp(ee),f=pl(oe,p,1),d=pl(ee,g,1)}else throw"invalid block type";else{var x=AI(u)+4,_=r[x-4]|r[x-3]<<8,S=x+_;if(S>n){if(s)throw"unexpected EOF";break}i&&o(h+_),e.set(r.subarray(x,S),h),t.b=h+=_,t.p=u=S*8;continue}if(u>v){if(s)throw"unexpected EOF";break}}i&&o(h+131072);for(var Me=(1<<p)-1,G=(1<<g)-1,te=u;;te=u){var K=f[dp(r,u)&Me],q=K>>>4;if(u+=K&15,u>v){if(s)throw"unexpected EOF";break}if(!K)throw"invalid length/literal";if(q<256)e[h++]=q;else if(q==256){te=u,f=null;break}else{var ce=q-254;if(q>264){var D=q-257,Se=Qx[D];ce=Zi(r,u,(1<<Se)-1)+tA[D],u+=Se}var Ge=d[dp(r,u)&G],le=Ge>>>4;if(!Ge)throw"invalid distance";u+=Ge&15;var ee=_I[le];if(le>3){var Se=jx[le];ee+=dp(r,u)&(1<<Se)-1,u+=Se}if(u>v){if(s)throw"unexpected EOF";break}i&&o(h+131072);for(var Re=h+ce;h<Re;h+=4)e[h]=e[h-ee],e[h+1]=e[h+1-ee],e[h+2]=e[h+2-ee],e[h+3]=e[h+3-ee];h=Re}}t.l=f,t.p=te,t.b=h,f&&(l=1,t.m=p,t.d=d,t.n=g)}while(!l);return h==e.length?e:MI(e,0,h)},EI=new Hi(0),wI=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 Pu(r,e){return SI((wI(r),r.subarray(2,-4)),e)}var CI=typeof TextDecoder<"u"&&new TextDecoder,TI=0;try{CI.decode(EI,{stream:!0}),TI=1}catch{}const bI=r=>r&&r.isCubeTexture;class RI extends un{constructor(e,t){var n,i;const s=bI(e),l=((i=s?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?i:1024)/4,u=Math.floor(Math.log2(l)),h=Math.pow(2,u),f=3*Math.max(h,112),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=` 3870 varying vec3 vWorldPosition; 3871 void main() 3872 { 3873 vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); 3874 vWorldPosition = worldPosition.xyz; 3875 3876 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3877 } 3878 `,v=p.join(` 3879`)+` 3880 #define ENVMAP_TYPE_CUBE_UV 3881 varying vec3 vWorldPosition; 3882 uniform float radius; 3883 uniform float height; 3884 uniform float angle; 3885 #ifdef ENVMAP_TYPE_CUBE 3886 uniform samplerCube map; 3887 #else 3888 uniform sampler2D map; 3889 #endif 3890 // From: https://www.shadertoy.com/view/4tsBD7 3891 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 3892 { 3893 float d = dot ( rd, n ); 3894 3895 if( d > 0.0 ) { return 1e6; } 3896 3897 vec3 o = ro - c; 3898 float t = - dot( n, o ) / d; 3899 vec3 q = o + rd * t; 3900 3901 return ( dot( q, q ) < r * r ) ? t : 1e6; 3902 } 3903 // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm 3904 float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 3905 { 3906 vec3 oc = ro - ce; 3907 float b = dot( oc, rd ); 3908 float c = dot( oc, oc ) - ra * ra; 3909 float h = b * b - c; 3910 3911 if( h < 0.0 ) { return -1.0; } 3912 3913 h = sqrt( h ); 3914 3915 return - b + h; 3916 } 3917 vec3 project() 3918 { 3919 vec3 p = normalize( vWorldPosition ); 3920 vec3 camPos = cameraPosition; 3921 camPos.y -= height; 3922 float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); 3923 if( intersection > 0.0 ) { 3924 3925 vec3 h = vec3( 0.0, - height, 0.0 ); 3926 float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); 3927 p = ( camPos + min( intersection, intersection2 ) * p ) / radius; 3928 } else { 3929 p = vec3( 0.0, 1.0, 0.0 ); 3930 } 3931 return p; 3932 } 3933 #include <common> 3934 #include <cube_uv_reflection_fragment> 3935 void main() 3936 { 3937 vec3 projectedWorldPosition = project(); 3938 3939 #ifdef ENVMAP_TYPE_CUBE 3940 vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; 3941 #else 3942 vec3 direction = normalize( projectedWorldPosition ); 3943 vec2 uv = equirectUv( direction ); 3944 vec3 outcolor = texture2D( map, uv ).rgb; 3945 #endif 3946 gl_FragColor = vec4( outcolor, 1.0 ); 3947 #include <tonemapping_fragment> 3948 #include <${Om>=154?"colorspace_fragment":"encodings_fragment"}> 3949 } 3950 `,A={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},x=new zl(1,16),_=new vi({uniforms:A,fragmentShader:v,vertexShader:g,side:Oi});super(x,_)}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}}function Ch(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 $s="srgb",Nr="srgb-linear",I_=3001,II=3e3;class Hm extends kn{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new FI(t)}),this.register(function(t){return new UI(t)}),this.register(function(t){return new XI(t)}),this.register(function(t){return new JI(t)}),this.register(function(t){return new YI(t)}),this.register(function(t){return new OI(t)}),this.register(function(t){return new HI(t)}),this.register(function(t){return new GI(t)}),this.register(function(t){return new kI(t)}),this.register(function(t){return new LI(t)}),this.register(function(t){return new zI(t)}),this.register(function(t){return new NI(t)}),this.register(function(t){return new WI(t)}),this.register(function(t){return new VI(t)}),this.register(function(t){return new PI(t)}),this.register(function(t){return new KI(t)}),this.register(function(t){return new ZI(t)})}load(e,t,n,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const h=hs.extractUrlBase(e);o=hs.resolveURL(h,this.path)}else o=hs.extractUrlBase(e);this.manager.itemStart(e);const l=function(h){i?i(h):console.error(h),s.manager.itemError(e),s.manager.itemEnd(e)},u=new Gn(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,o,function(f){t(f),s.manager.itemEnd(e)},l)}catch(f){l(f)}},n,l)}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 o={},l={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Ch(new Uint8Array(e.slice(0,4)))===iA){try{o[Gt.KHR_BINARY_GLTF]=new qI(e)}catch(f){i&&i(f);return}s=JSON.parse(o[Gt.KHR_BINARY_GLTF].content)}else s=JSON.parse(Ch(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 cB(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"),l[f.name]=f,o[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 Gt.KHR_MATERIALS_UNLIT:o[f]=new DI;break;case Gt.KHR_DRACO_MESH_COMPRESSION:o[f]=new QI(s,this.dracoLoader);break;case Gt.KHR_TEXTURE_TRANSFORM:o[f]=new jI;break;case Gt.KHR_MESH_QUANTIZATION:o[f]=new $I;break;default:d.indexOf(f)>=0&&l[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(o),u.setPlugins(l),u.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function BI(){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 Gt={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 PI{constructor(e){this.parser=e,this.name=Gt.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 Ye(16777215);u.color!==void 0&&f.setRGB(u.color[0],u.color[1],u.color[2],Nr);const d=u.range!==void 0?u.range:0;switch(u.type){case"directional":h=new Em(f),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new Sm(f),h.distance=d;break;case"spot":h=new Mm(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,Br(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],l=(s.extensions&&s.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(u){return n._getNodeRef(t.cache,l,u)})}}class DI{constructor(){this.name=Gt.KHR_MATERIALS_UNLIT}getMaterialType(){return mi}extendParams(e,t,n){const i=[];e.color=new Ye(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Nr),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,$s))}return Promise.all(i)}}class LI{constructor(e){this.parser=e,this.name=Gt.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 FI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const l=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new be(l,l)}return Promise.all(s)}}class UI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}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 NI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class OI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}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 Ye(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const l=o.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],Nr)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,$s)),o.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRough
3950nessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class HI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class GI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const l=o.attenuationColor||[1,1,1];return t.attenuationColor=new Ye().setRGB(l[0],l[1],l[2],Nr),Promise.all(s)}}class kI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}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 zI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));const l=o.specularColorFactor||[1,1,1];return t.specularColor=new Ye().setRGB(l[0],l[1],l[2],Nr),o.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",o.specularColorTexture,$s)),Promise.all(s)}}class VI{constructor(e){this.parser=e,this.name=Gt.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class WI{constructor(e){this.parser=e,this.name=Gt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:zi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class XI{constructor(e){this.parser=e,this.name=Gt.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],o=t.options.ktx2Loader;if(!o){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,o)}}class JI{constructor(e){this.parser=e,this.name=Gt.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 o=s.extensions[t],l=i.images[o.source];let u=n.textureLoader;if(l.uri){const h=n.options.manager.getHandler(l.uri);h!==null&&(u=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,o.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 YI{constructor(e){this.parser=e,this.name=Gt.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 o=s.extensions[t],l=i.images[o.source];let u=n.textureLoader;if(l.uri){const h=n.options.manager.getHandler(l.uri);h!==null&&(u=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,o.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,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
3950FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class KI{constructor(e){this.name=Gt.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),o=this.parser.options.meshoptDecoder;if(!o||!o.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(l){const u=i.byteOffset||0,h=i.byteLength||0,f=i.count,d=i.byteStride,p=new Uint8Array(l,u,h);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(f,d,p,i.mode,i.filter).then(function(g){return g.buffer}):o.ready.then(function(){const g=new ArrayBuffer(f*d);return o.decodeGltfBuffer(new Uint8Array(g),f,d,p,i.mode,i.filter),g})})}else return null}}class ZI{constructor(e){this.name=Gt.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!==Ni.TRIANGLES&&h.mode!==Ni.TRIANGLE_STRIP&&h.mode!==Ni.TRIANGLE_FAN&&h.mode!==void 0)return null;const o=n.extensions[this.name].attributes,l=[],u={};for(const h in o)l.push(this.parser.getDependency("accessor",o[h]).then(f=>(u[h]=f,u[h])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).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 gt,x=new H,_=new qn,S=new H(1,1,1),E=new sm(v.geometry,v.material,p);for(let w=0;w<p;w++)u.TRANSLATION&&x.fromBufferAttribute(u.TRANSLATION,w),u.ROTATION&&_.fromBufferAttribute(u.ROTATION,w),u.SCALE&&S.fromBufferAttribute(u.SCALE,w),E.setMatrixAt(w,A.compose(x,_,S));for(const w in u)if(w==="_COLOR_0"){const L=u[w];E.instanceColor=new so(L.array,L.itemSize,L.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&v.geometry.setAttribute(w,u[w]);zt.prototype.copy.call(E,v),this.parser.assignFinalMaterial(E),g.push(E)}return f.isGroup?(f.clear(),f.add(...g),f):g[0]}))}}const iA="glTF",$a=12,B_={JSON:1313821514,BIN:5130562};class qI{constructor(e){this.name=Gt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,$a);if(this.header={magic:Ch(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==iA)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-$a,i=new DataView(e,$a);let s=0;for(;s<n;){const o=i.getUint32(s,!0);s+=4;const l=i.getUint32(s,!0);if(s+=4,l===B_.JSON){const u=new Uint8Array(e,$a+s,o);this.content=Ch(u)}else if(l===B_.BIN){const u=$a+s;this.body=e.slice(u,u+o)}s+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class QI{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Gt.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,o=e.extensions[this.name].attributes,l={},u={},h={};for(const f in o){const d=Gp[f]||f.toLowerCase();l[d]=o[f]}for(const f in e.attributes){const d=Gp[f]||f.toLowerCase();if(o[f]!==void 0){const p=n.accessors[e.attributes[f]],g=ta[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],x=u[v];x!==void 0&&(A.normalized=x)}d(g)},l,h,Nr,p)})})}}class jI{constructor(){this.name=Gt.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}}class $I{constructor(){this.name=Gt.KHR_MESH_QUANTIZATION}}class rA extends ya{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 o=0;o!==i;o++)t[o]=n[s+o];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=l*2,h=l*3,f=i-t,d=(n-t)/f,p=d*d,g=p*d,v=e*h,A=v-h,x=-2*g+3*p,_=g-p,S=1-x,E=_-p+d;for(let w=0;w!==l;w++){const L=o[A+w+l],B=o[A+w+u]*f,F=o[v+w+l],D=o[v+w]*f;s[w]=S*L+E*B+x*F+_*D}return s}}const eB=new qn;class tB extends rA{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return eB.fromArray(s).normalize().toArray(s),s}}const Ni={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ta={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},P_={9728:Nn,9729:Qt,9984:bh,9985:$o,9986:Ys,9987:Gi},D_={33071:An,33648:ra,10497:ps},pp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Gp={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Om>=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"},ss={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},nB={CUBICSPLINE:void 0,LINEAR:ua,STEP:ca},mp={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function iB(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new Xl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:dr})),r.DefaultMaterial}function Vs(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 Br(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 rB(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 o=[],l=[],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;o.push(p)}if(i){const p=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):r.attributes.normal;l.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(o),Promise.all(l),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 sB(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[Gt.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+gp(t.attributes):e=r.indices+":"+gp(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+gp(r.targets[n]);return e}function gp(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 kp(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 aB(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 lB=new gt;class cB{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new BI,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 hx(this.options.manager):this.textureLoader=new yx(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Gn(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(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()}
vendor: 15,311 bytes, line 3950
3950)).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const l={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};return Vs(s,l,i),Br(l,i),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(l)})).then(function(){for(const u of l.scenes)u.updateMatrixWorld();e(l)})}).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 o=t[i].joints;for(let l=0,u=o.length;l<u;l++)e[o[l]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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=(o,l)=>{const u=this.associations.get(o);u!=null&&this.associations.set(l,u);for(const[h,f]of o.children.entries())s(f,l.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,o){return n.getDependency(e,o)})),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[Gt.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,o){n.load(hs.resolveURL(t.uri,i.path),s,void 0,function(){o(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 o=pp[i.type],l=ta[i.componentType],u=i.normalized===!0,h=new l(i.count*o);return Promise.resolve(new Yt(h,o,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(o){const l=o[0],u=pp[i.type],h=ta[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,x;if(g&&g!==d){const _=Math.floor(p/g),S="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+_+":"+i.count;let E=t.cache.get(S);E||(A=new h(l,_*g,i.count*g/f),E=new Ol(A,g/f),t.cache.add(S,E)),x=new ms(E,u,p%g/f,v)}else l===null?A=new h(i.count*u):A=new h(l,p,i.count*u),x=new Yt(A,u,v);if(i.sparse!==void 0){const _=pp.SCALAR,S=ta[i.sparse.indices.componentType],E=i.sparse.indices.byteOffset||0,w=i.sparse.values.byteOffset||0,L=new S(o[1],E,i.sparse.count*_),B=new h(o[2],w,i.sparse.count*u);l!==null&&(x=new Yt(x.array.slice(),x.itemSize,x.normalized));for(let F=0,D=L.length;F<D;F++){const T=L[F];if(x.setX(T,B[F*u]),u>=2&&x.setY(T,B[F*u+1]),u>=3&&x.setZ(T,B[F*u+2]),u>=4&&x.setW(T,B[F*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const u=n.manager.getHandler(o.uri);u!==null&&(l=u)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,n){const i=this,s=this.json,o=s.textures[e],l=s.images[t],u=(l.uri||l.bufferView)+":"+o.sampler;if(this.textureCache[u])return this.textureCache[u];const h=this.loadImageSource(t,n).then(function(f){f.flipY=!1,f.name=o.name||l.name||"",f.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(f.name=l.uri);const p=(s.samplers||{})[o.sampler]||{};return f.magFilter=P_[p.magFilter]||Qt,f.minFilter=P_[p.minFilter]||Gi,f.wrapS=D_[p.wrapS]||ps,f.wrapT=D_[p.wrapT]||ps,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 o=i.images[e],l=self.URL||self.webkitURL;let u=o.uri||"",h=!1;if(o.bufferView!==void 0)u=n.getDependency("bufferView",o.bufferView).then(function(d){h=!0;const p=new Blob([d],{type:o.mimeType});return u=l.createObjectURL(p),u});else if(o.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 x=new jt(A);x.needsUpdate=!0,p(x)}),t.load(hs.resolveURL(d,s.path),v,void 0,g)})}).then(function(d){return h===!0&&l.revokeObjectURL(u),Br(d,o),d.userData.mimeType=o.mimeType||aB(o.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(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[Gt.KHR_TEXTURE_TRANSFORM]){const l=n.extensions!==void 0?n.extensions[Gt.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const u=s.associations.get(o);o=s.extensions[Gt.KHR_TEXTURE_TRANSFORM].extendTexture(o,l),s.associations.set(o,u)}}return i!==void 0&&(typeof i=="number"&&(i=i===I_?$s:Nr),"colorSpace"in o?o.colorSpace=i:o.encoding=i===$s?I_:II),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+n.uuid;let u=this.cache.get(l);u||(u=new kh,Rn.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(l,u)),n=u}else if(e.isLine){const l="LineBasicMaterial:"+n.uuid;let u=this.cache.get(l);u||(u=new jn,Rn.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(l,u)),n=u}if(i||s||o){let l="ClonedMaterial:"+n.uuid+":";i&&(l+="derivative-tangents:"),s&&(l+="vertex-colors:"),o&&(l+="flat-shading:");let u=this.cache.get(l);u||(u=n.clone(),s&&(u.vertexColors=!0),o&&(u.flatShading=!0),i&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(l,u),this.associations.set(u,this.associations.get(n))),n=u}e.material=n}getMaterialType(){return Xl}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let o;const l={},u=s.extensions||{},h=[];if(u[Gt.KHR_MATERIALS_UNLIT]){const d=i[Gt.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),h.push(d.extendParams(l,s,t))}else{const d=s.pbrMetallicRoughness||{};if(l.color=new Ye(1,1,1),l.opacity=1,Array.isArray(d.baseColorFactor)){const p=d.baseColorFactor;l.color.setRGB(p[0],p[1],p[2],Nr),l.opacity=p[3]}d.baseColorTexture!==void 0&&h.push(t.assignTexture(l,"map",d.baseColorTexture,$s)),l.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,l.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(l,"metalnessMap",d.metallicRoughnessTexture)),h.push(t.assignTexture(l,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,l)})))}s.doubleSided===!0&&(l.side=Oi);const f=s.alphaMode||mp.OPAQUE;if(f===mp.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,f===mp.MASK&&(l.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==mi&&(h.push(t.assignTexture(l,"normalMap",s.normalTexture)),l.normalScale=new be(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;l.normalScale.set(d,d)}if(s.occlusionTexture!==void 0&&o!==mi&&(h.push(t.assignTexture(l,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==mi){const d=s.emissiveFactor;l.emissive=new Ye().setRGB(d[0],d[1],d[2],Nr)}return s.emissiveTexture!==void 0&&o!==mi&&h.push(t.assignTexture(l,"emissiveMap",s.emissiveTexture,$s)),Promise.all(h).then(function(){const d=new o(l);return s.name&&(d.name=s.name),Br(d,s),t.associations.set(d,{materials:e}),s.extensions&&Vs(i,d,s),d})}createUniqueName(e){const t=Wt.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(l){return n[Gt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(u){return L_(u,l,t)})}const o=[];for(let l=0,u=e.length;l<u;l++){const h=e[l],f=oB(h),d=i[f];if(d)o.push(d.promise);else{let p;h.extensions&&h.extensions[Gt.KHR_DRACO_MESH_COMPRESSION]?p=s(h):p=L_(new Rt,h,t),i[f]={primitive:h,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],o=s.primitives,l=[];for(let u=0,h=o.length;u<h;u++){const f=o[u].material===void 0?iB(this.cache):this.getDependency("material",o[u].material);l.push(f)}return l.push(t.loadGeometries(o)),Promise.all(l).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],x=o[g];let _;const S=h[g];if(x.mode===Ni.TRIANGLES||x.mode===Ni.TRIANGLE_STRIP||x.mode===Ni.TRIANGLE_FAN||x.mode===void 0)_=s.isSkinnedMesh===!0?new rm(A,S):new un(A,S),_.isSkinnedMesh===!0&&_.normalizeSkinWeights(),x.mode===Ni.TRIANGLE_STRIP?_.geometry=R_(_.geometry,Qp):x.mode===Ni.TRIANGLE_FAN&&(_.geometry=R_(_.geometry,Mh));else if(x.mode===Ni.LINES)_=new er(A,S);else if(x.mode===Ni.LINE_STRIP)_=new Or(A,S);else if(x.mode===Ni.LINE_LOOP)_=new om(A,S);else if(x.mode===Ni.POINTS)_=new am(A,S);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(_.geometry.morphAttributes).length>0&&sB(_,s),_.name=t.createUniqueName(s.name||"mesh_"+e),Br(_,s),x.extensions&&Vs(i,_,x),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&&Vs(i,d[0],s),d[0];const p=new Lr;s.extensions&&Vs(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 bn(Cy.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new po(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Br(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(),o=i,l=[],u=[];for(let h=0,f=o.length;h<f;h++){const d=o[h];if(d){l.push(d);const p=new gt;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 Hl(l,u)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,o=[],l=[],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,x=A.node,_=i.parameters!==void 0?i.parameters[v.input]:v.input,S=i.parameters!==void 0?i.parameters[v.output]:v.output;A.node!==void 0&&(o.push(this.getDependency("node",x)),l.push(this.getDependency("accessor",_)),u.push(this.getDependency("accessor",S)),h.push(v),f.push(A))}return Promise.all([Promise.all(o),Promise.all(l),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],x=d[4],_=[];for(let S=0,E=p.length;S<E;S++){const w=p[S],L=g[S],B=v[S],F=A[S],D=x[S];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const T=n._createAnimationTracks(w,L,B,F,D);if(T)for(let b=0;b<T.length;b++)_.push(T[b])}return new pa(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 o=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(l){if(l.isMesh)for(let u=0,h=i.weights.length;u<h;u++)l.morphTargetInfluences[u]=i.weights[u]}),o})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),o=[],l=i.children||[];for(let h=0,f=l.length;h<f;h++)o.push(n.getDependency("node",l[h]));const u=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),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,lB)});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],o=s.name?i.createUniqueName(s.name):"",l=[],u=i._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return u&&l.push(u),s.camera!==void 0&&l.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){l.push(h)}),this.nodeCache[e]=Promise.all(l).then(function(h){let f;if(s.isBone===!0?f=new Gh:h.length>1?f=new Lr:h.length===1?f=h[0]:f=new zt,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=o),Br(f,s),s.extensions&&Vs(n,f,s),s.matrix!==void 0){const d=new gt;
vendor: 4,201 bytes, lines 3950-3951
3950d.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 Lr;n.name&&(s.name=i.createUniqueName(n.name)),Br(s,n),n.extensions&&Vs(t,s,n);const o=n.nodes||[],l=[];for(let u=0,h=o.length;u<h;u++)l.push(i.getDependency("node",o[u]));return Promise.all(l).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 Rn||p instanceof jt)&&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 o=[],l=e.name?e.name:e.uuid,u=[];ss[s.path]===ss.weights?e.traverse(function(p){p.morphTargetInfluences&&u.push(p.name?p.name:p.uuid)}):u.push(l);let h;switch(ss[s.path]){case ss.weights:h=ao;break;case ss.rotation:h=lo;break;case ss.position:case ss.scale:h=co;break;default:switch(n.itemSize){case 1:h=ao;break;case 2:case 3:default:h=co;break}break}const f=i.interpolation!==void 0?nB[i.interpolation]:ua,d=this._getArrayFromAccessor(n);for(let p=0,g=u.length;p<g;p++){const v=new h(u[p]+"."+ss[s.path],t.array,d,f);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(v),o.push(v)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=kp(t.constructor),i=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof lo?tB:rA;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function uB(r,e,t){const n=e.attributes,i=new Qn;if(n.POSITION!==void 0){const l=t.json.accessors[n.POSITION],u=l.min,h=l.max;if(u!==void 0&&h!==void 0){if(i.set(new H(u[0],u[1],u[2]),new H(h[0],h[1],h[2])),l.normalized){const f=kp(ta[l.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 l=new H,u=new H;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=kp(ta[p.componentType]);u.multiplyScalar(A)}l.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(l)}r.boundingBox=i;const o=new Hn;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=o}function L_(r,e,t){const n=e.attributes,i=[];function s(o,l){return t.getDependency("accessor",o).then(function(u){r.setAttribute(l,u)})}for(const o in n){const l=Gp[o]||o.toLowerCase();l in r.attributes||i.push(s(n[o],l))}if(e.indices!==void 0&&!r.index){const o=t.getDependency("accessor",e.indices).then(function(l){r.setIndex(l)});i.push(o)}return Br(r,e),uB(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?rB(r,e.targets,t):r})}class hB extends xm{constructor(e){super(e),this.type=Un}parse(e){const o=function(D,T){switch(D){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(T||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(T||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(T||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(T||""))}},d=function(D,T,b){T=T||1024;let Y=D.pos,K=-1,Q=0,oe="",ee=String.fromCharCode.apply(null,new Uint16Array(D.subarray(Y,Y+128)));for(;0>(K=ee.indexOf(` 3951`))&&Q<T&&Y<D.byteLength;)oe+=ee,Q+=ee.length,Y+=128,ee+=String.fromCharCode.apply(null,new Uint16Array(D.subarray(Y,Y+128)));return-1<K?(D.pos+=Q+K+1,oe+ee.slice(0,K)):!1},p=function(D){const T=/^#\?(\S+)/,b=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,N=/^\s*EXPOSURE\s*=\s
vendor: 28,467 bytes, lines 3951-3955
3951*(\d+(\.\d+)?)\s*$/,Y=/^\s*FORMAT=(\S+)\s*$/,K=/^\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,ee;for((D.pos>=D.byteLength||!(oe=d(D)))&&o(1,"no header found"),(ee=oe.match(T))||o(3,"bad initial token"),Q.valid|=1,Q.programtype=ee[1],Q.string+=oe+` 3952`;oe=d(D),oe!==!1;){if(Q.string+=oe+` 3953`,oe.charAt(0)==="#"){Q.comments+=oe+` 3954`;continue}if((ee=oe.match(b))&&(Q.gamma=parseFloat(ee[1])),(ee=oe.match(N))&&(Q.exposure=parseFloat(ee[1])),(ee=oe.match(Y))&&(Q.valid|=2,Q.format=ee[1]),(ee=oe.match(K))&&(Q.valid|=4,Q.height=parseInt(ee[1],10),Q.width=parseInt(ee[2],10)),Q.valid&2&&Q.valid&4)break}return Q.valid&2||o(3,"missing format specifier"),Q.valid&4||o(3,"missing image size specifier"),Q},g=function(D,T,b){const N=T;if(N<8||N>32767||D[0]!==2||D[1]!==2||D[2]&128)return new Uint8Array(D);N!==(D[2]<<8|D[3])&&o(3,"wrong scanline width");const Y=new Uint8Array(4*T*b);Y.length||o(4,"unable to allocate buffer space");let K=0,Q=0;const oe=4*N,ee=new Uint8Array(4),Me=new Uint8Array(oe);let G=b;for(;G>0&&Q<D.byteLength;){Q+4>D.byteLength&&o(1),ee[0]=D[Q++],ee[1]=D[Q++],ee[2]=D[Q++],ee[3]=D[Q++],(ee[0]!=2||ee[1]!=2||(ee[2]<<8|ee[3])!=N)&&o(3,"bad rgbe scanline format");let te=0,q;for(;te<oe&&Q<D.byteLength;){q=D[Q++];const Se=q>128;if(Se&&(q-=128),(q===0||te+q>oe)&&o(3,"bad scanline data"),Se){const Ge=D[Q++];for(let le=0;le<q;le++)Me[te++]=Ge}else Me.set(D.subarray(Q,Q+q),te),te+=q,Q+=q}const ce=N;for(let Se=0;Se<ce;Se++){let Ge=0;Y[K]=Me[Se+Ge],Ge+=N,Y[K+1]=Me[Se+Ge],Ge+=N,Y[K+2]=Me[Se+Ge],Ge+=N,Y[K+3]=Me[Se+Ge],K+=4}G--}return Y},v=function(D,T,b,N){const Y=D[T+3],K=Math.pow(2,Y-128)/255;b[N+0]=D[T+0]*K,b[N+1]=D[T+1]*K,b[N+2]=D[T+2]*K,b[N+3]=1},A=function(D,T,b,N){const Y=D[T+3],K=Math.pow(2,Y-128)/255;b[N+0]=qs.toHalfFloat(Math.min(D[T+0]*K,65504)),b[N+1]=qs.toHalfFloat(Math.min(D[T+1]*K,65504)),b[N+2]=qs.toHalfFloat(Math.min(D[T+2]*K,65504)),b[N+3]=qs.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const _=p(x),S=_.width,E=_.height,w=g(x.subarray(x.pos),S,E);let L,B,F;switch(this.type){case dn:F=w.length/4;const D=new Float32Array(F*4);for(let b=0;b<F;b++)v(w,b*4,D,b*4);L=D,B=dn;break;case Un:F=w.length/4;const T=new Uint16Array(F*4);for(let b=0;b<F;b++)A(w,b*4,T,b*4);L=T,B=Un;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:S,height:E,data:L,header:_.string,gamma:_.gamma,exposure:_.exposure,type:B}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(o,l){switch(o.type){case dn:case Un:"colorSpace"in o?o.colorSpace="srgb-linear":o.encoding=3e3,o.minFilter=Qt,o.magFilter=Qt,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,l)}return super.load(e,s,n,i)}}const el=Om>=152;class fB extends xm{constructor(e){super(e),this.type=Un}parse(e){const T=Math.pow(2.7182818,2.2);function b(R,U){for(var J=0,ae=0;ae<65536;++ae)(ae==0||R[ae>>3]&1<<(ae&7))&&(U[J++]=ae);for(var pe=J-1;J<65536;)U[J++]=0;return pe}function N(R){for(var U=0;U<16384;U++)R[U]={},R[U].len=0,R[U].lit=0,R[U].p=null}const Y={l:0,c:0,lc:0};function K(R,U,J,ae,pe){for(;J<R;)U=U<<8|je(ae,pe),J+=8;J-=R,Y.l=U>>J&(1<<R)-1,Y.c=U,Y.lc=J}const Q=new Array(59);function oe(R){for(var U=0;U<=58;++U)Q[U]=0;for(var U=0;U<65537;++U)Q[R[U]]+=1;for(var J=0,U=58;U>0;--U){var ae=J+Q[U]>>1;Q[U]=J,J=ae}for(var U=0;U<65537;++U){var pe=R[U];pe>0&&(R[U]=pe|Q[pe]++<<6)}}function ee(R,U,J,ae,pe,me,Ue){for(var Pe=J,I=0,z=0;pe<=me;pe++){if(Pe.value-J.value>ae)return!1;K(6,I,z,R,Pe);var W=Y.l;if(I=Y.c,z=Y.lc,Ue[pe]=W,W==63){if(Pe.value-J.value>ae)throw"Something wrong with hufUnpackEncTable";K(8,I,z,R,Pe);var V=Y.l+6;if(I=Y.c,z=Y.lc,pe+V>me+1)throw"Something wrong with hufUnpackEncTable";for(;V--;)Ue[pe++]=0;pe--}else if(W>=59){var V=W-59+2;if(pe+V>me+1)throw"Something wrong with hufUnpackEncTable";for(;V--;)Ue[pe++]=0;pe--}}oe(Ue)}function Me(R){return R&63}function G(R){return R>>6}function te(R,U,J,ae){for(;U<=J;U++){var pe=G(R[U]),me=Me(R[U]);if(pe>>me)throw"Invalid table entry";if(me>14){var Ue=ae[pe>>me-14];if(Ue.len)throw"Invalid table entry";if(Ue.lit++,Ue.p){var Pe=Ue.p;Ue.p=new Array(Ue.lit);for(var I=0;I<Ue.lit-1;++I)Ue.p[I]=Pe[I]}else Ue.p=new Array(1);Ue.p[Ue.lit-1]=U}else if(me)for(var z=0,I=1<<14-me;I>0;I--){var Ue=ae[(pe<<14-me)+z];if(Ue.len||Ue.p)throw"Invalid table entry";Ue.len=me,Ue.lit=U,z++}}return!0}const q={c:0,lc:0};function ce(R,U,J,ae){R=R<<8|je(J,ae),U+=8,q.c=R,q.lc=U}const Se={c:0,lc:0};function Ge(R,U,J,ae,pe,me,Ue,Pe,I,z){if(R==U){ae<8&&(ce(J,ae,pe,Ue),J=q.c,ae=q.lc),ae-=8;var W=J>>ae,W=new Uint8Array([W])[0];if(I.value+W>z)return!1;for(var V=Pe[I.value-1];W-- >0;)Pe[I.value++]=V}else if(I.value<z)Pe[I.value++]=R;else return!1;Se.c=J,Se.lc=ae}function le(R){return R&65535}function Re(R){var U=le(R);return U>32767?U-65536:U}const we={a:0,b:0};function Le(R,U){var J=Re(R),ae=Re(U),pe=ae,me=J+(pe&1)+(pe>>1),Ue=me,Pe=me-pe;we.a=Ue,we.b=Pe}function ot(R,U){var J=le(R),ae=le(U),pe=J-(ae>>1)&65535,me=ae+pe-32768&65535;we.a=me,we.b=pe}function Ut(R,U,J,ae,pe,me,Ue){for(var Pe=Ue<16384,I=J>pe?pe:J,z=1,W;z<=I;)z<<=1;for(z>>=1,W=z,z>>=1;z>=1;){for(var V=0,Z=V+me*(pe-W),re=me*z,ge=me*W,Te=ae*z,Be=ae*W,Ve,ke,De,Xe;V<=Z;V+=ge){for(var nt=V,_t=V+ae*(J-W);nt<=_t;nt+=Be){var st=nt+Te,lt=nt+re,et=lt+Te;Pe?(Le(R[nt+U],R[lt+U]),Ve=we.a,De=we.b,Le(R[st+U],R[et+U]),ke=we.a,Xe=we.b,Le(Ve,ke),R[nt+U]=we.a,R[st+U]=we.b,Le(De,Xe),R[lt+U]=we.a,R[et+U]=we.b):(ot(R[nt+U],R[lt+U]),Ve=we.a,De=we.b,ot(R[st+U],R[et+U]),ke=we.a,Xe=we.b,ot(Ve,ke),R[nt+U]=we.a,R[st+U]=we.b,ot(De,Xe),R[lt+U]=we.a,R[et+U]=we.b)}if(J&z){var lt=nt+re;Pe?Le(R[nt+U],R[lt+U]):ot(R[nt+U],R[lt+U]),Ve=we.a,R[lt+U]=we.b,R[nt+U]=Ve}}if(pe&z)for(var nt=V,_t=V+ae*(J-W);nt<=_t;nt+=Be){var st=nt+Te;Pe?Le(R[nt+U],R[st+U]):ot(R[nt+U],R[st+U]),Ve=we.a,R[st+U]=we.b,R[nt+U]=Ve}W=z,z>>=1}return V}function ft(R,U,J,ae,pe,me,Ue,Pe,I,z){for(var W=0,V=0,Z=Pe,re=Math.trunc(pe.value+(me+7)/8);pe.value<re;)for(ce(W,V,J,pe),W=q.c,V=q.lc;V>=14;){var ge=W>>V-14&16383,Te=U[ge];if(Te.len)V-=Te.len,Ge(Te.lit,Ue,W,V,J,ae,pe,I,z,Z),W=Se.c,V=Se.lc;else{if(!Te.p)throw"hufDecode issues";var Be;for(Be=0;Be<Te.lit;Be++){for(var Ve=Me(R[Te.p[Be]]);V<Ve&&pe.value<re;)ce(W,V,J,pe),W=q.c,V=q.lc;if(V>=Ve&&G(R[Te.p[Be]])==(W>>V-Ve&(1<<Ve)-1)){V-=Ve,Ge(Te.p[Be],Ue,W,V,J,ae,pe,I,z,Z),W=Se.c,V=Se.lc;break}}if(Be==Te.lit)throw"hufDecode issues"}}var ke=8-me&7;for(W>>=ke,V-=ke;V>0;){var Te=U[W<<14-V&16383];if(Te.len)V-=Te.len,Ge(Te.lit,Ue,W,V,J,ae,pe,I,z,Z),W=Se.c,V=Se.lc;else throw"hufDecode issues"}return!0}function xt(R,U,J,ae,pe,me){var Ue={value:0},Pe=J.value,I=it(U,J),z=it(U,J);J.value+=4;var W=it(U,J);if(J.value+=4,I<0||I>=65537||z<0||z>=65537)throw"Something wrong with HUF_ENCSIZE";var V=new Array(65537),Z=new Array(16384);N(Z);var re=ae-(J.value-Pe);if(ee(R,U,J,re,I,z,V),W>8*(ae-(J.value-Pe)))throw"Something wrong with hufUncompress";te(V,I,z,Z),ft(V,Z,R,U,J,W,z,me,pe,Ue)}function kt(R,U,J){for(var ae=0;ae<J;++ae)U[ae]=R[U[ae]]}function pt(R){for(var U=1;U<R.length;U++){var J=R[U-1]+R[U]-128;R[U]=J}}function X(R,U){for(var J=0,ae=Math.floor((R.length+1)/2),pe=0,me=R.length-1;!(pe>me||(U[pe++]=R[J++],pe>me));)U[pe++]=R[ae++]}function tn(R){for(var U=R.byteLength,J=new Array,ae=0,pe=new DataView(R);U>0;){var me=pe.getInt8(ae++);if(me<0){var Ue=-me;U-=Ue+1;for(var Pe=0;Pe<Ue;Pe++)J.push(pe.getUint8(ae++))}else{var Ue=me;U-=2;for(var I=pe.getUint8(ae++),Pe=0;Pe<Ue+1;Pe++)J.push(I)}}return J}function Ee(R,U,J,ae,pe,me){var st=new DataView(me.buffer),Ue=J[R.idx[0]].width,Pe=J[R.idx[0]].height,I=3,z=Math.floor(Ue/8),W=Math.ceil(Ue/8),V=Math.ceil(Pe/8),Z=Ue-(W-1)*8,re=Pe-(V-1)*8,ge={value:0},Te=new Array(I),Be=new Array(I),Ve=new Array(I),ke=new Array(I),De=new Array(I);for(let Bt=0;Bt<I;++Bt)De[Bt]=U[R.idx[Bt]],Te[Bt]=Bt<1?0:Te[Bt-1]+W*V,Be[Bt]=new Float32Array(64),Ve[Bt]=new Uint16Array(64),ke[Bt]=new Uint16Array(W*64);for(let Bt=0;Bt<V;++Bt){var Xe=8;Bt==V-1&&(Xe=re);var nt=8;for(let wt=0;wt<W;++wt){wt==W-1&&(nt=Z);for(let Ht=0;Ht<I;++Ht)Ve[Ht].fill(0),Ve[Ht][0]=pe[Te[Ht]++],Ie(ge,ae,Ve[Ht]),Ae(Ve[Ht],Be[Ht]),ze(Be[Ht]);ye(Be);for(let Ht=0;Ht<I;++Ht)O(Be[Ht],ke[Ht],wt*64)}let sn=0;for(let wt=0;wt<I;++wt){const Ht=J[R.idx[wt]].type;for(let vt=8*Bt;vt<8*Bt+Xe;++vt){sn=De[wt][vt];for(let pn=0;pn<z;++pn){const en=pn*64+(vt&7)*8;st.setUint16(sn+0*Ht,ke[wt][en+0],!0),st.setUint16(sn+2*Ht,ke[wt][en+1],!0),st.setUint16(sn+4*Ht,ke[wt][en+2],!0),st.setUint16(sn+6*Ht,ke[wt][en+3],!0),st.setUint16(sn+8*Ht,ke[wt][en+4],!0),st.setUint16(sn+10*Ht,ke[wt][en+5],!0),st.setUint16(sn+12*Ht,ke[wt][en+6],!0),st.setUint16(sn+14*Ht,ke[wt][en+7],!0),sn+=16*Ht}}if(z!=W)for(let vt=8*Bt;vt<8*Bt+Xe;++vt){const pn=De[wt][vt]+8*z*2*Ht,en=z*64+(vt&7)*8;for(let on=0;on<nt;++on)st.setUint16(pn+on*2*Ht,ke[wt][en+on],!0)}}}for(var _t=new Uint16Array(Ue),st=new DataView(me.buffer),lt=0;lt<I;++lt){J[R.idx[lt]].decoded=!0;var et=J[R.idx[lt]].type;if(J[lt].type==2)for(var Ot=0;Ot<Pe;++Ot){const Bt=De[lt][Ot];for(var yt=0;yt<Ue;++yt)_t[yt]=st.getUint16(Bt+yt*2*et,!0);for(var yt=0;yt<Ue;++yt)st.setFloat32(Bt+yt*2*et,ue(_t[yt]),!0)}}}function Ie(R,U,J){for(var ae,pe=1;pe<64;)ae=U[R.value],ae==65280?pe=64:ae>>8==255?pe+=ae&255:(J[pe]=ae,pe++),R.value++}function Ae(R,U){U[0]=ue(R[0]),U[1]=ue(R[1]),U[2]=ue(R[5]),U[3]=ue(R[6]),U[4]=ue(R[14]),U[5]=ue(R[15]),U[6]=ue(R[27]),U[7]=ue(R[28]),U[8]=ue(R[2]),U[9]=ue(R[4]),U[10]=ue(R[7]),U[11]=ue(R[13]),U[12]=ue(R[16]),U[13]=ue(R[26]),U[14]=ue(R[29]),U[15]=ue(R[42]),U[16]=ue(R[3]),U[17]=ue(R[8]),U[18]=ue(R[12]),U[19]=ue(R[17]),U[20]=ue(R[25]),U[21]=ue(R[30]),U[22]=ue(R[41]),U[23]=ue(R[43]),U[24]=ue(R[9]),U[25]=ue(R[11]),U[26]=ue(R[18]),U[27]=ue(R[24]),U[28]=ue(R[31]),U[29]=ue(R[40]),U[30]=ue(R[44]),U[31]=ue(R[53]),U[32]=ue(R[10]),U[33]=ue(R[19]),U[34]=ue(R[23]),U[35]=ue(R[32]),U[36]=ue(R[39]),U[37]=ue(R[45]),U[38]=ue(R[52]),U[39]=ue(R[54]),U[40]=ue(R[20]),U[41]=ue(R[22]),U[42]=ue(R[33]),U[43]=ue(R[38]),U[44]=ue(R[46]),U[45]=ue(R[51]),U[46]=ue(R[55]),U[47]=ue(R[60]),U[48]=ue(R[21]),U[49]=ue(R[34]),U[50]=ue(R[37]),U[51]=ue(R[47]),U[52]=ue(R[50]),U[53]=ue(R[56]),U[54]=ue(R[59]),U[55]=ue(R[61]),U[56]=ue(R[35]),U[57]=ue(R[36]),U[58]=ue(R[48]),U[59]=ue(R[49]),U[60]=ue(R[57]),U[61]=ue(R[58]),U[62]=ue(R[62]),U[63]=ue(R[63])}function ze(R){const U=.5*Math.cos(.7853975),J=.5*Math.cos(3.14159/16),ae=.5*Math.cos(3.14159/8),pe=.5*Math.cos(3*3.14159/16),me=.5*Math.cos(5*3.14159/16),Ue=.5*Math.cos(3*3.14159/8),Pe=.5*Math.cos(7*3.14159/16);for(var I=new Array(4),z=new Array(4),W=new Array(4),V=new Array(4),Z=0;Z<8;++Z){var re=Z*8;I[0]=ae*R[re+2],I[1]=Ue*R[re+2],I[2]=ae*R[re+6],I[3]=Ue*R[re+6],z[0]=J*R[re+1]+pe*R[re+3]+me*R[re+5]+Pe*R[re+7],z[1]=pe*R[re+1]-Pe*R[re+3]-J*R[re+5]-me*R[re+7],z[2]=me*R[re+1]-J*R[re+3]+Pe*R[re+5]+pe*R[re+7],z[3]=Pe*R[re+1]-me*R[re+3]+pe*R[re+5]-J*R[re+7],W[0]=U*(R[re+0]+R[re+4]),W[3]=U*(R[re+0]-R[re+4]),W[1]=I[0]+I[3],W[2]=I[1]-I[2],V[0]=W[0]+W[1],V[1]=W[3]+W[2],V[2]=W[3]-W[2],V[3]=W[0]-W[1],R[re+0]=V[0]+z[0],R[re+1]=V[1]+z[1],R[re+2]=V[2]+z[2],R[re+3]=V[3]+z[3],R[re+4]=V[3]-z[3],R[re+5]=V[2]-z[2],R[re+6]=V[1]-z[1],R[re+7]=V[0]-z[0]}for(var ge=0;ge<8;++ge)I[0]=ae*R[16+ge],I[1]=Ue*R[16+ge],I[2]=ae*R[48+ge],I[3]=Ue*R[48+ge],z[0]=J*R[8+ge]+pe*R[24+ge]+me*R[40+ge]+Pe*R[56+ge],z[1]=pe*R[8+ge]-Pe*R[24+ge]-J*R[40+ge]-me*R[56+ge],z[2]=me*R[8+ge]-J*R[24+ge]+Pe*R[40+ge]+pe*R[56+ge],z[3]=Pe*R[8+ge]-me*R[24+ge]+pe*R[40+ge]-J*R[56+ge],W[0]=U*(R[ge]+R[32+ge]),W[3]=U*(R[ge]-R[32+ge]),W[1]=I[0]+I[3],W[2]=I[1]-I[2],V[0]=W[0]+W[1],V[1]=W[3]+W[2],V[2]=W[3]-W[2],V[3]=W[0]-W[1],R[0+ge]=V[0]+z[0],R[8+ge]=V[1]+z[1],R[16+ge]=V[2]+z[2],R[24+ge]=V[3]+z[3],R[32+ge]=V[3]-z[3],R[40+ge]=V[2]-z[2],R[48+ge]=V[1]-z[1],R[56+ge]=V[0]-z[0]}function ye(R){for(var U=0;U<64;++U){var J=R[0][U],ae=R[1][U],pe=R[2][U];R[0][U]=J+1.5747*pe,R[1][U]=J-.1873*ae-.4682*pe,R[2][U]=J+1.8556*ae}}function O(R,U,J){for(var ae=0;ae<64;++ae)U[J+ae]=qs.toHalfFloat(P(R[ae]))}function P(R){return R<=1?Math.sign(R)*Math.pow(Math.abs(R),2.2):Math.sign(R)*Math.pow(T,Math.abs(R)-1)}function ne(R){return new DataView(R.array.buffer,R.offset.value,R.size)}function he(R){var U=R.viewer.buffer.slice(R.offset.value,R.offset.value+R.size),J=new Uint8Array(tn(U)),ae=new Uint8Array(J.length);return pt(J),X(J,ae),new DataView(ae.buffer)}function xe(R){var U=R.array.slice(R.offset.value,R.offset.value+R.size),J=Pu(U),ae=new Uint8Array(J.length);return pt(J),X(J,ae),new DataView(ae.buffer)}function ve(R){for(var U=R.viewer,J={value:R.offset.value},ae=new Uint16Array(R.width*R.scanlineBlockSize*(R.channels*R.type)),pe=new Uint8Array(8192),me=0,Ue=new Array(R.channels),Pe=0;Pe<R.channels;Pe++)Ue[Pe]={},Ue[Pe].start=me,Ue[Pe].end=Ue[Pe].start,Ue[Pe].nx=R.width,Ue[Pe].ny=R.lines,Ue[Pe].size=R.type,me+=Ue[Pe].nx*Ue[Pe].ny*Ue[Pe].size;var I=de(U,J),z=de(U,J);if(z>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(I<=z)for(var Pe=0;Pe<z-I+1;Pe++)pe[Pe+I]=Et(U,J);var W=new Uint16Array(65536),V=b(pe,W),Z=it(U,J);xt(R.array,U,J,Z,ae,me);for(var Pe=0;Pe<R.channels;++Pe)for(var re=Ue[Pe],ge=0;ge<Ue[Pe].size;++ge)Ut(ae,re.start+ge,re.nx,re.size,re.ny,re.nx*re.size,V);kt(W,ae,me);for(var Te=0,Be=new Uint8Array(ae.buffer.byteLength),Ve=0;Ve<R.lines;Ve++)for(var ke=0;ke<R.channels;ke++){var re=Ue[ke],De=re.nx*re.size,Xe=new Uint8Array(ae.buffer,re.end*2,De*2);Be.set(Xe,Te),Te+=De*2,re.end+=De}return new DataView(Be.buffer)}function tt(R){var U=R.array.slice(R.offset.value,R.offset.value+R.size),J=Pu(U);const ae=R.lines*R.channels*R.width,pe=R.type==1?new Uint16Array(ae):new Uint32Array(ae);let me=0,Ue=0;const Pe=new Array(4);for(let I=0;I<R.lines;I++)for(let z=0;z<R.channels;z++){let W=0;switch(R.type){case 1:Pe[0]=me,Pe[1]=Pe[0]+R.width,me=Pe[1]+R.width;for(let V=0;V<R.width;++V){const Z=J[Pe[0]++]<<8|J[Pe[1]++];W+=Z,pe[Ue]=W,Ue++}break;case 2:Pe[0]=me,Pe[1]=Pe[0]+R.width,Pe[2]=Pe[1]+R.width,me=Pe[2]+R.width;for(let V=0;V<R.width;++V){const Z=J[Pe[0]++]<<24|J[Pe[1]++]<<16|J[Pe[2]++]<<8;W+=Z,pe[Ue]=W,Ue++}break}}return new DataView(pe.buffer)}function Oe(R){var U=R.viewer,J={value:R.offset.value},ae=new Uint8Array(R.width*R.lines*(R.channels*R.type*2)),pe={version:dt(U,J),unknownUncompressedSize:dt(U,J),unknownCompressedSize:dt(U,J),acCompressedSize:dt(U,J),dcCompressedSize:dt(U,J),rleCompressedSize:dt(U,J),rleUncompressedSize:dt(U,J),rleRawSize:dt(U,J),totalAcUncompressedCount:dt(U,J),totalDcUncompressedCount:dt(U,J),acCompression:dt(U,J)};if(pe.version<2)throw"EXRLoader.parse: "+li.compression+" version "+pe.version+" is unsupported";for(var me=new Array,Ue=de(U,J)-2;Ue>0;){var Pe=Ke(U.buffer,J),I=Et(U,J),z=I>>2&3,W=(I>>4)-1,V=new Int8Array([W])[0],Z=Et(U,J);me.push({name:Pe,index:V,type:Z,compression:z}),Ue-=Pe.length+3}for(var re=li.channels,ge=new Array(R.channels),Te=0;Te<R.channels;++Te){var Be=ge[Te]={},Ve=re[Te];Be.name=Ve.name,Be.compression=0,Be.decoded=!1,Be.type=Ve.pixelType,Be.pLinear=Ve.pLinear,Be.width=R.width,Be.height=R.lines}for(var ke={idx:new Array(3)},De=0;De<R.channels;++De)for(var Be=ge[De],Te=0;Te<me.length;++Te){var Xe=me[Te];Be.name==Xe.name&&(Be.compression=Xe.compression,Xe.index>=0&&(ke.idx[Xe.index]=De),Be.offset=De)}if(pe.acCompressedSize>0)switch(pe.acCompression){case 0:var st=new Uint16Array(pe.totalAcUncompressedCount);xt(R.array,U,J,pe.acCompressedSize,st,pe.totalAcUncompressedCount);break;case 1:var nt=R.array.slice(J.value,J.value+pe.totalAcUncompressedCount),_t=Pu(nt),st=new Uint16Array(_t.buffer);J.value+=pe.totalAcUncompressedCount;break}if(pe.dcCompressedSize>0){var lt={array:R.array,offset:J,size:pe.dcCompressedSize},et=new Uint16Array(xe(lt).buffer);J.value+=pe.dcCompressedSize}if(pe.rleRawSize>0){var nt=R.array.slice(J.value,J.value+pe.rleCompressedSize),_t=Pu(nt),Ot=tn(_t.buffer);J.value+=pe.rleCompressedSize}for(var yt=0,Bt=new Array(ge.length),Te=0;Te<Bt.length;++Te)Bt[Te]=new Array;for(var sn=0;sn<R.lines;++sn)for(var wt=0;wt<ge.length;++wt)Bt[wt].push(yt),yt+=ge[wt].width*R.type*2;Ee(ke,Bt,ge,st,et,ae);for(var Te=0;Te<ge.length;++Te){var Be=ge[Te];if(!Be.decoded)switch(Be.compression){case 2:for(var Ht=0,vt=0,sn=0;sn<R.lines;++sn){for(var pn=Bt[Te][Ht],en=0;en<Be.width;++en){for(var on=0;on<2*Be.type;++on)ae[pn++]=Ot[vt+on*Be.width*Be.height];vt++}Ht++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(ae.buffer)}function Ke(R,U){for(var J=new Uint8Array(R),ae=0;J[U.value+ae]!=0;)ae+=1;var pe=new TextDecoder().decode(J.slice(U.value,U.value+ae));return U.value=U.value+ae+1,pe}function Lt(R,U,J){var ae=new TextDecoder().decode(new Uint8Array(R).slice(U.value,U.value+J));return U.value=U.value+J,ae}function Fe(R,U){var J=ut(R,U),ae=it(R,U);return[J,ae]}function $e(R,U){var J=it(R,U),ae=it(R,U);return[J,ae]}function ut(R,U){var J=R.getInt32(U.value,!0);return U.value=U.value+4,J}function it(R,U){var J=R.getUint32(U.value,!0);return U.value=U.value+4,J}function je(R,U){var J=R[U.value];return U.value=U.value+1,J}function Et(R,U){var J=R.getUint8(U.value);return U.value=U.value+1,J}const dt=function(R,U){let J;return"getBigInt64"in DataView.prototype?J=Number(R.getBigInt64(U.value,!0)):J=R.getUint32(U.value+4,!0)+Number(R.getUint32(U.value,!0)<<32),U.value+=8,J};function Mt(R,U){var J=R.getFloat32(U.value,!0);return U.value+=4,J}function $(R,U){return qs.toHalfFloat(Mt(R,U))}function ue(R){var U=(R&31744)>>10,J=R&1023;return(R>>15?-1:1)*(U?U===31?J?NaN:1/0:Math.pow(2,U-15)*(1+J/1024):6103515625e-14*(J/1024))}function de(R,U){var J=R.getUint16(U.value,!0);return U.value+=2,J}function Ce(R,U){return ue(de(R,U))}function qe(R,U,J,ae){for(var pe=J.value,me=[];J.value<pe+ae-1;){var Ue=Ke(U,J),Pe=ut(R,J),I=Et(R,J);J.value+=3;var z=ut(R,J),W=ut(R,J);me.push({name:Ue,pixelType:Pe,pLinear:I,xSampling:z,ySampling:W})}return J.value+=1,me}function We(R,U){var J=Mt(R,U),ae=Mt(R,U),pe=Mt(R,U),me=Mt(R,U),Ue=Mt(R,U),Pe=Mt(R,U),I=Mt(R,U),z=Mt(R,U);return{redX:J,redY:ae,greenX:pe,greenY:me,blueX:Ue,blueY:Pe,whiteX:I,whiteY:z}}function At(R,U){var J=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],ae=Et(R,U);return J[ae]}function rn(R,U){var J=it(R,U),ae=it(R,U),pe=it(R,U),me=it(R,U);return{xMin:J,yMin:ae,xMax:pe,yMax:me}}function _n(R,U){var J=["INCREASING_Y"],ae=Et(R,U);return J[ae]}function Vt(R,U){var J=Mt(R,U),ae=Mt(R,U);return[J,ae]}function zn(R,U){var J=Mt(R,U),ae=Mt(R,U),pe=Mt(R,U);return[J,ae,pe]}function _i(R,U,J,ae,pe){if(ae==="string"||ae==="stringvector"||ae==="iccProfile")return Lt(U,J,pe);if(ae==="chlist")return qe(R,U,J,pe);if(ae==="chromaticities")return We(R,J);if(ae==="compression")return At(R,J);if(ae==="box2i")return rn(R,J);if(ae==="lineOrder")return _n(R,J);if(ae==="float")return Mt(R,J);if(ae==="v2f")return Vt(R,J);if(ae==="v3f")return zn(R,J);if(ae==="int")return ut(R,J);if(ae==="rational")return Fe(R,J);if(ae==="timecode")return $e(R,J);if(ae==="preview")return J.value+=pe,"skipped";J.value+=pe}function mo(R,U,J){const ae={};if(R.getUint32(0,!0)!=20000630)throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";ae.version=R.getUint8(4);const pe=R.getUint8(5);ae.spec={singleTile:!!(pe&2),longName:!!(pe&4),deepFormat:!!(pe&8),multiPart:!!(pe&16)},J.value=8;for(var me=!0;me;){var Ue=Ke(U,J);if(Ue==0)me=!1;else{var Pe=Ke(U,J),I=it(R,J),z=_i(R,U,J,Pe,I);z===void 0?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${Pe}'.`):ae[Ue]=z}}if((pe&-5)!=0)throw console.error("EXRHeader:",ae),"THREE.EXRLoader: provided file is currently unsupported.";return ae}function go(R,U,J,ae,pe){const me={size:0,viewer:U,array:J,offset:ae,width:R.dataWindow.xMax-R.dataWindow.xMin+1,height:R.dataWindow.yMax-R.dataWindow.yMin+1,channels:R.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:R.channels[0].pixelType,uncompress:null,getter:null,format:null,[el?"colorSpace":"encoding"]:null};switch(R.compression){case"NO_COMPRESSION":me.lines=1,me.uncompress=ne;break;case"RLE_COMPRESSION":me.lines=1,me.uncompress=he;break;case"ZIPS_COMPRESSION":me.lines=1,me.uncompress=xe;break;case"ZIP_COMPRESSION":me.lines=16,me.uncompress=xe;break;case"PIZ_COMPRESSION":me.lines=32,me.uncompress=ve;break;case"PXR24_COMPRESSION":me.lines=16,me.uncompress=tt;break;case"DWAA_COMPRESSION":me.lines=32,me.uncompress=Oe;break;case"DWAB_COMPRESSION":me.lines=256,me.uncompress=Oe;break;default:throw"EXRLoader.parse: "+R.compression+" is unsupported"}if(me.scanlineBlockSize=me.lines,me.type==1)switch(pe){case dn:me.getter=Ce,me.inputSize=2;break;case Un:me.getter=de,me.inputSize=2;break}else if(me.type==2)switch(pe){case dn:me.getter=Mt,me.inputSize=4;break;case Un:me.getter=$,me.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+me.type+" for "+R.compression+".";me.blockCount=(R.dataWindow.yMax+1)/me.scanlineBlockSize;for(var Ue=0;Ue<me.blockCount;Ue++)dt(U,ae);me.outputChannels=me.channels==3?4:me.channels;const Pe=me.width*me.height*me.outputChannels;switch(pe){case dn:me.byteArray=new Float32Array(Pe),me.channels<me.outputChannels&&me.byteArray.fill(1,0,Pe);break;case Un:me.byteArray=new Uint16Array(Pe),me.channels<me.outputChannels&&me.byteArray.fill(15360,0,Pe);break;default:console.error("THREE.EXRLoader: unsupported type: ",pe);break}return me.bytesPerLine=me.width*me.inputSize*me.channels,me.outputChannels==4?me.format=Mn:me.format=Pl,el?me.colorSpace="srgb-linear":me.encoding=3e3,me}const $n=new DataView(e),_r=new Uint8Array(e),nr={value:0},li=mo($n,e,nr),It=go(li,$n,_r,nr,this.type),xs={value:0},Gr={R:0,G:1,B:2,A:3,Y:0};for(let R=0;R<It.height/It.scanlineBlockSize;R++){const U=it($n,nr);It.size=it($n,nr),It.lines=U+It.scanlineBlockSize>It.height?It.height-U:It.scanlineBlockSize;const ae=It.size<It.lines*It.bytesPerLine?It.uncompress(It):ne(It);nr.value+=It.size;for(let pe=0;pe<It.scanlineBlockSize;pe++){const me=pe+R*It.scanlineBlockSize;if(me>=It.height)break;for(let Ue=0;Ue<It.channels;Ue++){const Pe=Gr[li.channels[Ue].name];for(let I=0;I<It.width;I++){xs.value=(pe*(It.channels*It.width)+Ue*It.width+I)*It.inputSize;const z=(It.height-1-me)*(It.width*It.outputChannels)+I*It.outputChannels+Pe;It.byteArray[z]=It.getter(ae,xs)}}}}return{header:li,width:It.width,height:It.height,data:It.byteArray,format:It.format,[el?"colorSpace":"encoding"]:It[el?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(o,l){el?o.colorSpace=l.colorSpace:o.encoding=l.encoding,o.minFilter=Qt,o.magFilter=Qt,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,l)}return super.load(e,s,n,i)}}const vp=new WeakMap;class dB extends kn{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 Gn(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{const l={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,l).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(vp.has(e)){const u=vp.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++,o=e.byteLength,l=this._getWorker(s,o).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 l.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),vp.set(e,{key:n,promise:l}),l}_createGeometry(e){const t=new Rt;e.index&&t.setIndex(new Yt(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],s=i.name,o=i.array,l=i.itemSize;t.setAttribute(s,new Yt(o,l))}return t}_loadLibrary(e,t){const n=new Gn(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=pB.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` 3955`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),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 o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.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 pB(){let r,e;onmessage=function(o){const l=o.data;switch(l.type){case"init":r=l.decoderConfig,e=new Promise(function(f){r.onModuleLoaded=function(d){f({draco:d})},DracoDecoderModule(r)});break;case"decode":const u=l.buffer,h=l.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(x=>x.array.buffer);v.index&&A.push(v.index.array.buffer),self.postMessage({type:"decode",id:l.id,geometry:v},A)}catch(v){console.error(v),self.postMessage({type:"error",id:l.id,error:v.message})}finally{d.destroy(g),d.destroy(p)}});break}};function t(o,l,u,h){const f=h.attributeIDs,d=h.attributeTypes;let p,g;const v=l.GetEncodedGeometryType(u);if(v===o.TRIANGULAR_MESH)p=new o.Mesh,g=l.DecodeBufferToMesh(u,p);else if(v===o.POINT_CLOUD)p=new o.PointCloud,g=l.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 x in f){const _=self[d[x]];let S,E;if(h.useUniqueIDs)E=f[x],S=l.GetAttributeByUniqueId(p,E);else{if(E=l.GetAttributeId(p,o[f[x]]),E===-1)continue;S=l.GetAttribute(p,E)}A.attributes.push(i(o,l,p,x,_,S))}return v===o.TRIANGULAR_MESH&&(A.index=n(o,l,p)),o.destroy(p),A}function n(o,l,u){const f=u.num_faces()*3,d=f*4,p=o._malloc(d);l.GetTrianglesUInt32Array(u,d,p);const g=new Uint32Array(o.HEAPF32.buffer,p,f).slice();return o._free(p),{array:g,itemSize:1}}function i(o,l,u,h,f,d){const p=d.num_components(),v=u.num_points()*p,A=v*f.BYTES_PER_ELEMENT,x=s(o,f),_=o._malloc(A);l.GetAttributeDataArrayForAllPoints(u,d,x,A,_);const S=new f(o.HEAPF32.buffer,_,v).slice();return o._free(_),{name:h,array:S,itemSize:p}}function s(o,l){switch(l){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let Du;const _p=()=>
3955{if(Du)return Du;const r="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
3955LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/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
3955XAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/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 o=WebAssembly.instantiate(l(i),{}).then(d=>{s=d.instance,s.exports.__wasm_call_ctors()});function l(d){const p=new Uint8Array(d.length);for(let v=0;v<d.length;
3955++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,x){const _=s.exports.sbrk,S=g+3&-4,E=_(S*v),w=_(A.length),L=new Uint8Array(s.exports.memory.buffer);L.set(A,w);const B=d(E,g,v,w,A.length);if(B===0&&x&&x(E,S,v),p.set(L.subarray(E,E+g*v)),_(E-_(0)),B!==0)throw new Error(`Malformed buffer data: ${B}`)}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 Du={ready:o,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,x){u(s.exports[f[A]],d,p,g,v,s.exports[h[x]])}},Du};let Lu=null,sA="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function oA(r=!0,e=!0,t){return n=>{t&&t(n),r&&(Lu||(Lu=new dB),Lu.setDecoderPath(typeof r=="string"?r:sA),n.setDRACOLoader(Lu)),e&&n.setMeshoptDecoder(typeof _p=="function"?_p():_p)}}const Gm=(r,e,t,n)=>Hr(Hm,r,oA(e,t,n));Gm.preload=(r,e,t,n)=>Hr.preload(Hm,r,oA(e,t,n));Gm.clear=r=>Hr.clear(Hm,r);Gm.setDecoderPath=r=>{sA=r};const mB=3e3,gB=3001,aA=(r,e,t)=>{let n;switch(r){case gi:n=new Uint8ClampedArray(e*t*4);break;case Un:n=new Uint16Array(e*t*4);break;case mr:n=new Uint32Array(e*t*4);break;case Rh:n=new Int8Array(e*t*4);break;case Ih:n=new Int16Array(e*t*4);break;case Bl:n=new Int32Array(e*t*4);break;case dn:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let Fu;const vB=(r,e,t,n)=>{if(Fu!==void 0)return Fu;const i=new ki(1,1,n);e.setRenderTarget(i);const s=new un(new _s,new mi({color:16777215}));e.render(s,t),e.setRenderTarget(null);const o=aA(r,i.width,i.height);return e.readRenderTargetPixels(i,0,0,i.width,i.height,o),i.dispose(),s.geometry.dispose(),s.material.dispose(),Fu=o[0]!==0,Fu};class km{constructor(e){gn(this,"_renderer");gn(this,"_rendererIsDisposable",!1);gn(this,"_material");gn(this,"_scene");gn(this,"_camera");gn(this,"_quad");gn(this,"_renderTarget");gn(this,"_width");gn(this,"_height");gn(this,"_type");gn(this,"_colorSpace");gn(this,"_supportsReadPixels",!0);gn(this,"render",()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)});var n,i,s,o,l,u,h,f,d,p,g,v,A,x,_,S;this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace
vendor: 5,081 bytes, line 3955
3955=e.colorSpace;const t={format:Mn,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((n=e.renderTargetOptions)==null?void 0:n.anisotropy)!==void 0?(i=e.renderTargetOptions)==null?void 0:i.anisotropy:1,generateMipmaps:((s=e.renderTargetOptions)==null?void 0:s.generateMipmaps)!==void 0?(o=e.renderTargetOptions)==null?void 0:o.generateMipmaps:!1,magFilter:((l=e.renderTargetOptions)==null?void 0:l.magFilter)!==void 0?(u=e.renderTargetOptions)==null?void 0:u.magFilter:Qt,minFilter:((h=e.renderTargetOptions)==null?void 0:h.minFilter)!==void 0?(f=e.renderTargetOptions)==null?void 0:f.minFilter:Qt,samples:((d=e.renderTargetOptions)==null?void 0:d.samples)!==void 0?(p=e.renderTargetOptions)==null?void 0:p.samples:void 0,wrapS:((g=e.renderTargetOptions)==null?void 0:g.wrapS)!==void 0?(v=e.renderTargetOptions)==null?void 0:v.wrapS:An,wrapT:((A=e.renderTargetOptions)==null?void 0:A.wrapT)!==void 0?(x=e.renderTargetOptions)==null?void 0:x.wrapT:An};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=km.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Nl,this._camera=new po,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!vB(this._type,this._renderer,this._camera,t)){let E;switch(this._type){case Un:E=this._renderer.extensions.has("EXT_color_buffer_float")?dn:void 0;break}E!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${dn}`),this._type=E):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new un(new _s,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new ki(this.width,this.height,t),this._renderTarget.texture.mapping=((_=e.renderTargetOptions)==null?void 0:_.mapping)!==void 0?(S=e.renderTargetOptions)==null?void 0:S.mapping:fs}static instantiateRenderer(){const e=new Dm;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=aA(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new $i(this.toArray(),this.width,this.height,Mn,this._type,(e==null?void 0:e.mapping)||fs,(e==null?void 0:e.wrapS)||An,(e==null?void 0:e.wrapT)||An,(e==null?void 0:e.magFilter)||Qt,(e==null?void 0:e.minFilter)||Qt,(e==null?void 0:e.anisotropy)||1,gr);return t.generateMipmaps=(e==null?void 0:e.generateMipmaps)!==void 0?e==null?void 0:e.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof vi&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof jt&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof jt&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class lA extends Error{}class cA extends Error{}const tl=(r,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(r);if(n)return n[1];const i=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(r);if(i){const s=i[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(o=>o.replace(/<\/?rdf:li>/g,"")):i[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},_B=r=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(r):e=r.toString();let t=e.indexOf("<x:xmpmeta");for(;t!==-1;){const n=e.indexOf("x:xmpmeta>",t),i=e.slice(t,n+10);try{const s=tl(i,"hdrgm:GainMapMin","0"),o=tl(i,"hdrgm:GainMapMax"),l=tl(i,"hdrgm:Gamma","1"),u=tl(i,"hdrgm:OffsetSDR","0.015625"),h=tl(i,"hdrgm:OffsetHDR","0.015625"),f=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),d=f?f[1]:"0",p=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!p)throw new Error("Incomplete gainmap metadata");const g=p[1];return{gainMapMin:Array.isArray(s)?s.map(v=>parseFloat(v)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map(v=>parseFloat(v)):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(l)?l.map(v=>parseFloat(v)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(u)?u.map(v=>parseFloat(v)):[parseFloat(u),parseFloat(u),parseFloat(u)],offsetHdr:Array.isArray(h)?h.map(v
vendor: 4,655 bytes, lines 3955-3960
3955=>parseFloat(v)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(d),hdrCapacityMax:parseFloat(g)}}catch{}t=e.indexOf("<x:xmpmeta",n)}};class yB{constructor(e){gn(this,"options");this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,n)=>{const i=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const o=s.byteLength;let l=2,u=0,h;for(;l<o;){if(++u>250){n(new Error(`Found no marker after ${u} loops ðµ`));return}if(s.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${s.getUint8(l).toString(16)}`));return}if(h=s.getUint8(l+1),i&&console.log(`Marker: ${h.toString(16)}`),h===226){i&&console.log("Found APP2 marker (0xffe2)");const f=l+4;if(s.getUint32(f)===1297106432){const d=f+4;let p;if(s.getUint16(d)===18761)p=!1;else if(s.getUint16(d)===19789)p=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(d+2,!p)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const g=s.getUint32(d+4,!p);if(g<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const v=d+g,A=s.getUint16(v,!p),x=v+2;let _=0;for(let L=x;L<x+12*A;L+=12)s.getUint16(L,!p)===45057&&(_=s.getUint32(L+8,!p));const E=v+2+A*12+4,w=[];for(let L=E;L<E+_*16;L+=16){const B={MPType:s.getUint32(L,!p),size:s.getUint32(L+4,!p),dataOffset:s.getUint32(L+8,!p),dependantImages:s.getUint32(L+12,!p),start:-1,end:-1,isFII:!1};B.dataOffset?(B.start=d+B.dataOffset,B.isFII=!1):(B.start=0,B.isFII=!0),B.end=B.start+B.size,w.push(B)}if(this.options.extractNonFII&&w.length){const L=new Blob([s]),B=[];for(const F of w){if(F.isFII&&!this.options.extractFII)continue;const D=L.slice(F.start,F.end+1,"image/jpeg");B.push(D)}t(B)}}}l+=2+s.getUint16(l+2)}})}}const xB=async r=>{const e=_B(r);if(!e)throw new cA("Gain map XMP metadata not found");const n=await new yB({extractFII:!0,extractNonFII:!0}).extract(r);if(n.length!==2)throw new lA("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},F_=r=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{t(i)},n.src=URL.createObjectURL(r)});class AB extends kn{constructor(t,n){super(n);gn(this,"_renderer");gn(this,"_renderTargetOptions");gn(this,"_internalLoadingManager");gn(this,"_config");this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new tf}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new jt,sdr:new jt});return this._config.createQuadRenderer({width:16,height:16,type:Un,colorSpace:gr,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,n,i){const s=n?new Blob([n],{type:"image/jpeg"}):void 0,o=new Blob([t],{type:"image/jpeg"});let l,u,h=!1;if(typeof createImageBitmap>"u"){const f=await Promise.all([s?F_(s):Promise.resolve(void 0),F_(o)]);u=f[0],l=f[1],h=i==="flipY"}else{const f=await Promise.all([s?createImageBitmap(s,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:i||"flipY"})]);u=f[0],l=f[1]}return{sdrImage:l,gainMapImage:u,needsFlip:h}}createTextures(t,n,i){const s=new jt(n||new ImageData(2,2),fs,An,An,Qt,Ep,Mn,gi,1,gr);s.flipY=i,s.needsUpdate=!0;const o=new jt(t,fs,An,An,Qt,Ep,Mn,gi,1,si);return o.flipY=i,o.needsUpdate=!0,{gainMap:s,sdr:o}}updateQuadRenderer(t,n,i,s,o){t.width=n.width,t.height=n.height,t.material.gainMap=i,t.material.sdr=s,t.material.gainMapMin=o.gainMapMin,t.material.gainMapMax=o.gainMapMax,t.material.offsetHdr=o.offsetHdr,t.material.offsetSdr=o.offsetSdr,t.material.gamma=o.gamma,t.material.hdrCapacityMin=o.hdrCapacityMin,t.material.hdrCapacityMax=o.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),t.material.needsUpdate=!0}}const MB=` 3956varying vec2 vUv; 3957 3958void main() { 3959 vUv = uv; 3960 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
3960); 3961} 3962`,SB=` 3963// min half float value 3964#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) 3965// max half float value 3966#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) 3967 3968uniform sampler2D sdr; 3969uniform sampler2D gainMap; 3970uniform vec3 gamma; 3971uniform vec3 offsetHdr; 3972uniform vec3 offsetSdr; 3973uniform vec3 gainMapMin; 3974uniform vec3 gainMapMax; 3975uniform float weightFactor; 3976 3977varying vec2 vUv; 3978 3979void main() { 3980 vec3 rgb = texture2D( sdr, vUv ).rgb; 3981 vec3 recovery = texture2D( gainMap, vUv ).rgb; 3982 vec3 logRecovery = pow( recovery, gamma ); 3983 vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; 3984 vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; 3985 vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); 3986 gl_FragColor = vec4( clampedHdrColor , 1.0 ); 3987} 3988`;class EB extends vi{constructor({gamma:t,offsetHdr:n,offsetSdr:i,gainMapMin:s,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:u,hdrCapacityMax:h,sdr:f,gainMap:d}){super({name:"GainMapDecoderMaterial",vertexShader:MB,fragmentShader:SB,uniforms:{sdr:{value:f},gainMap:{value:d},gamma:{value:new H(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new H().fromArray(n)},offsetSdr:{value:new H().fromArray(i)},gainMapMin:{value:new H().fromArray(s)},gainMapMax:{value:new H().fromArray(o)},weightFactor:{value:(Math.log2(l)-u)/(h-u)}},blending:ur,depthTest:!1,depthWrite:!1});gn(this,"_maxDisplayBoost");gn(this,"_hdrCapacityMin");gn(this,"_hdrCapacityMax");this._maxDisplayBoost=l,this._hdrCapacityMin=u,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const n=this.uniforms.gamma.value;n.x=1/t[0],n.y=1/t[1],n.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class uA extends AB{constructor(e,t){super({renderer:e,createMaterial:n=>new EB(n),createQuadRenderer:n=>new km(n)},t)}async render(e,t,n,i){const{sdrImage:s,gainMapImage:o,needsFlip:l}=await this.processImages(n,i,"flipY"),{gainMap:u,sdr:h}=this.createTextures(s,o,l);this.updateQuadRenderer(e,s,u,h,t),e.render()}}class wB extends uA{load([e,t,n],i,s,o){const l=this.prepareQuadRenderer();let u,h,f;const d=async()=>{if(u&&h&&f){try{await this.render(l,f,u,h)}catch(T){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof o=="function"&&o(T),l.disposeOnDemandRenderer();return}typeof i=="function"&&i(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let p=!0,g=0,v=0,A=!0,x=0,_=0,S=!0,E=0,w=0;const L=()=>
3988{if(typeof s=="function"){const T=g+x+E,b=v+_+w,N=p&&A&&S;s(new ProgressEvent("progress",{lengthComputable:N,loaded:b,total:T}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const B=new Gn(this._internalLoadingManager);B.setResponseType("arraybuffer"),B.setRequestHeader(this.requestHeader),B.setPath(this.path),B.setWithCredentials(this.withCredentials),B.load(e,async T=>{if(typeof T=="string")throw new Error("Invalid sdr buffer");u=T,await d()},T=>{p=T.lengthComputable,v=T.loaded,g=T.total,L()},T=>{this.manager.itemError(e),typeof o=="function"&&o(T)});const F=new Gn(this._internalLoadingManager);F.setResponseType("arraybuffer"),F.setRequestHeader(this.requestHeader),F.setPath(this.path),F.setWithCredentials(this.withCredentials),F.load(t,async T=>{if(typeof T=="string")throw new Error("Invalid gainmap buffer");h=T,await d()},T=>{A=T.lengthComputable,_=T.loaded,x=T.total,L()},T=>{this.manager.itemError(t),typeof o=="function"&&o(T)});const D=new Gn(this._internalLoadingManager);return D.setRequestHeader(this.requestHeader),D.setPath(this.path),D.setWithCredentials(this.withCredentials),D.load(n,async T=>{if(typeof T!="string")throw new Error("Invalid metadata string");f=JSON.parse(T),await d()},T=>{S=T.lengthComputable,w=T.loaded,E=T.total,L()},T=>{this.manager.itemError(n),typeof o=="function"&&o(T)}),l}}class CB extends uA{load(e,t,n,i){const s=this.prepareQuadRenderer(),o=new Gn(this._internalLoadingManager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(this.withCredentials),this.manager.itemStart(e),o.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const u=new Uint8Array(l);let h,f,d;try{const p=await xB(u);h=p.sdr,f=p.gainMap,d=p.metadata}catch(p){if(p instanceof cA||p instanceof lA)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=u;else throw p}try{await this.render(s,d,h.buffer,f==null?void 0:f.buffer)}catch(p){this.manager.itemError(e),typeof i=="function"&&i(p),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof i=="function"&&i(l)}),s}}const bl={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},hA="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",na=r=>Array.isArray(r),zm=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function sf({files:r=zm,path:e="",preset:t=void 0,encoding:n=void 0,extensions:i}={}){let s=null,o=!1;t&&(Vm(t),r=bl[t],e=hA),o=na(r);const{extension:l,isCubemap:u}=Wm(r);if(s=Xm(l),!s)throw new Error("useEnvironment: Unrecognized file extension: "+r);const h=Cl(g=>g.gl);He.useLayoutEffect(()=>{if(l!=="webp"&&l!=="jpg"&&l!=="jpeg")return;function g(){Hr.clear(s,o?[r]:r)}h.domElement.addEventListener("webglcontextlost",g,{once:!0})},[r,h.domElement]);const f=Hr(s,o?[r]:r,g=>{(l==="webp"||l==="jpg"||l==="jpeg")&&g.setRenderer(h),g.setPath==null||g.setPath(e),i&&i(g)});let d=o?f[0]:f;if(l==="jpg"||l==="jpeg"||l==="webp"){var p;d=(p=d.renderTarget)==null?void 0:p.texture}return d.mapping=u?pr:ia,"colorSpace"in d?d.colorSpace=n??u?"srgb":"srgb-linear":d.encoding=n??u?gB:mB,d}const TB={files:zm,path:"",preset:void 0,extensions:void 0};sf.preload=r=>{const e={...TB,...r};let{files:t,path:n=""}=e;
3988const{preset:i,extensions:s}=e;i&&(Vm(i),t=bl[i],n=hA);const{extension:o}=Wm(t);if(o==="webp"||o==="jpg"||o==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=Xm(o);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);Hr.preload(l,na(t)?[t]:t,u=>{u.setPath==null||u.setPath(n),s&&s(u)})};const bB={files:zm,preset:void 0};sf.clear=r=>{const e={...bB,...r};let{files:t}=e;const{preset:n}=e;n&&(Vm(n),t=bl[n]);const{extension:i}=Wm(t),s=Xm(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+t);Hr.clear(s,na(t)?[t]:t)};function Vm(r){if(!(r in bl))throw new Error("Preset must be one of: "+Object.keys(bl).join(", "))}function Wm(r){var e;const t=na(r)&&r.length===6,n=na(r)&&r.length===3&&r.some(o=>o.endsWith("json")),i=na(r)?r[0]:r;return{extension:t?"cube":n?"webp":i.startsWith("data:application/exr")?"exr":i.startsWith("data:application/hdr")?"hdr":i.startsWith("data:image/jpeg")?"jpg":(e=i.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function Xm(r){return r==="cube"?ux:r==="hdr"?hB:r==="exr"?fB:r==="jpg"||r==="jpeg"?CB:r==="webp"?wB:null}const RB=r=>r.current&&r.current.isScene,IB=r=>RB(r)?r.current:r;function Jm(r,e,t,n,i={}){var s,o,l,u;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};const h=IB(e||t),f=h.background,d=h.environment,p={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(s=(o=h.backgroundRotation)==null||o.clone==null?void 0:o.clone())!==null&&s!==void 0?s:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(u=h.environmentRotation)==null||u.clone==null?void 0:u.clone())!==null&&l!==void 0?l:[0,0,0]};return r!=="only"&&(h.environment=n),r&&(h.background=n),as(h,i),()=>{r!=="only"&&(h.environment=d),r&&(h.background=f),as(h,p)}}function Ym({scene:r,background:e=!1,map:t,...n}){const i=Cl(s=>s.scene);return He.useLayoutEffect(()=>{if(t)return Jm(e,r,i,t,n)}),null}function fA({background:r=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:i,backgroundRotation:s,environmentIntensity:o,environmentRotation:l,...u}){const h=sf(u),f=Cl(d=>d.scene);return He.useLayoutEffect(()=>Jm(r,e,f,h,{backgroundBlurriness:t??n,backgroundIntensity:i,backgroundRotation:s,environmentIntensity:o,environmentRotation:l})),He.useEffect(()=>()=>{h.dispose()},[h]),null}function BB({children:r,near:e=.1,far:t=1e3,resolution:n=256,frames:i=1,map:s,background:o=!1,blur:l,backgroundBlurriness:u,backgroundIntensity:h,backgroundRotation:f,environmentIntensity:d,environmentRotation:p,scene:g,files:v,path:A,preset:x=void 0,extensions:_}){const S=Cl(D=>D.gl),E=Cl(D=>D.scene),w=He.useRef(null),[L]=He.useState(()=>new Nl),B=He.useMemo(()=>{const D=new nm(n);return D.texture.type=Un,D},[n]);He.useEffect(()=>()=>{B.dispose()},[B]),He.useLayoutEffect(()=>{if(i===1){const D=S.autoClear;S.autoClear=!0,w.current.update(S,L),S.autoClear=D}return Jm(o,g,E,B.texture,{backgroundBlurriness:l??u,backgroundIntensity:h,backgroundRotation:f,environmentIntensity:d,environmentRotation:p})},[r,L,B.texture,g,E,o,i,S]);let F=1;return JR(()=>{if(i===1/0||F<i){const D=S.autoClear;S.autoClear=!0,w.current.update(S,L),S.autoClear=D,F++}}),He.createElement(He.Fragment,null,QR(He.createElement(He.Fragment,null,r,He.createElement("cubeCamera",{ref:w,args:[e,t,B]}),v||x?He.createElement(fA,{background:!0,files:v,preset:x,path:A,extensions:_}):s?He.createElement(Ym,{background:!0,map:s,extensions:_}):null),L))}function PB(r){var e,t,n,i;const s=sf(r),o=r.map||s;He.useMemo(()=>Lx({GroundProjectedEnvImpl:RI}),[]),He.useEffect(()=>()=>{s.dispose()},[s]);const l=He.useMemo(()=>[o],[o]),u=(e=r.ground)==null?void 0:e.height,h=(t=r.ground)==null?void 0:t.radius,f=(n=(i=r.ground)==null?void 0:i.scale)!==null&&n!==void 0?n:1e3;return He.createElement(He.Fragment,null,He.createElement(Ym,Np({},r,{map:o})),He.createElement("groundProjectedEnvImpl",{args:l,scale:f,height:u,radius:h}))}function HB(r){return r.ground?He.createElement(PB,r):r.map?He.createElement(Ym,r):r.children?He.createElement(BB,r):He.createElement(fA,r)}export{zp as A,Qn as B,OB as C,Oi as D,HB as E,gt as M,qn as Q,H as V,NB as _,JR as a,Cy as b,uo as c,UB as d,Gy as e,Cl as f,Gm as u};
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.