From 83b147658192b249f927fa0a22cac7220e18f9f1 Mon Sep 17 00:00:00 2001 From: ValerioSpagnoli Date: Mon, 9 Sep 2024 23:17:02 +0200 Subject: [PATCH] Updates --- .../{index-CEJLM3rC.js => index-CJLolbtS.js} | 54 +++++++++--------- index.html | 2 +- models/monster/{attack_1.fbx => attack.fbx} | Bin models/monster/attack_2.fbx | Bin 226848 -> 0 bytes 4 files changed, 28 insertions(+), 28 deletions(-) rename assets/{index-CEJLM3rC.js => index-CJLolbtS.js} (80%) rename models/monster/{attack_1.fbx => attack.fbx} (100%) delete mode 100644 models/monster/attack_2.fbx diff --git a/assets/index-CEJLM3rC.js b/assets/index-CJLolbtS.js similarity index 80% rename from assets/index-CEJLM3rC.js rename to assets/index-CJLolbtS.js index e31dc42..216157b 100644 --- a/assets/index-CEJLM3rC.js +++ b/assets/index-CJLolbtS.js @@ -2,11 +2,11 @@ * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const mo="167",Sh=0,qo=1,bh=2,xl=1,vl=2,Tn=3,Pn=0,Bt=1,fn=2,Wn=0,Fi=1,Yo=2,Ko=3,Zo=4,wh=5,ii=100,Th=101,Eh=102,Ah=103,Rh=104,Ch=200,Ph=201,Lh=202,Ih=203,Ca=204,Pa=205,Dh=206,Uh=207,Nh=208,Fh=209,Oh=210,Bh=211,kh=212,zh=213,Hh=214,Vh=0,Gh=1,Wh=2,pr=3,Xh=4,jh=5,qh=6,Yh=7,Ar=0,Kh=1,Zh=2,Xn=0,$h=1,Jh=2,Qh=3,eu=4,tu=5,nu=6,iu=7,$o="attached",su="detached",yl=300,Vi=301,Gi=302,mr=303,La=304,Rr=306,Jt=1e3,mn=1001,_r=1002,Ot=1003,Ml=1004,hs=1005,jt=1006,or=1007,An=1008,Ln=1009,Sl=1010,bl=1011,ms=1012,_o=1013,ri=1014,hn=1015,bs=1016,go=1017,xo=1018,Wi=1020,wl=35902,Tl=1021,El=1022,Qt=1023,Al=1024,Rl=1025,Oi=1026,Xi=1027,vo=1028,yo=1029,Cl=1030,Mo=1031,So=1033,cr=33776,lr=33777,hr=33778,ur=33779,Ia=35840,Da=35841,Ua=35842,Na=35843,Fa=36196,Oa=37492,Ba=37496,ka=37808,za=37809,Ha=37810,Va=37811,Ga=37812,Wa=37813,Xa=37814,ja=37815,qa=37816,Ya=37817,Ka=37818,Za=37819,$a=37820,Ja=37821,dr=36492,Qa=36494,eo=36495,Pl=36283,to=36284,no=36285,io=36286,ru=2200,au=2201,ou=2202,_s=2300,gs=2301,Wr=2302,Li=2400,Ii=2401,gr=2402,bo=2500,cu=2501,lu=0,Ll=1,so=2,hu=3200,uu=3201,Cr=0,du=1,Vn="",Mt="srgb",Ct="srgb-linear",wo="display-p3",Pr="display-p3-linear",xr="linear",at="srgb",vr="rec709",yr="p3",di=7680,Jo=519,fu=512,pu=513,mu=514,Il=515,_u=516,gu=517,xu=518,vu=519,ro=35044,Qo="300 es",Rn=2e3,Mr=2001;class hi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s>8&255]+Pt[r>>16&255]+Pt[r>>24&255]+"-"+Pt[e&255]+Pt[e>>8&255]+"-"+Pt[e>>16&15|64]+Pt[e>>24&255]+"-"+Pt[t&63|128]+Pt[t>>8&255]+"-"+Pt[t>>16&255]+Pt[t>>24&255]+Pt[n&255]+Pt[n>>8&255]+Pt[n>>16&255]+Pt[n>>24&255]).toLowerCase()}function At(r,e,t){return Math.max(e,Math.min(t,r))}function To(r,e){return(r%e+e)%e}function yu(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Mu(r,e,t){return r!==e?(t-r)/(e-r):0}function fs(r,e,t){return(1-t)*r+t*e}function Su(r,e,t,n){return fs(r,e,1-Math.exp(-t*n))}function bu(r,e=1){return e-Math.abs(To(r,e*2)-e)}function wu(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Tu(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Eu(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Au(r,e){return r+Math.random()*(e-r)}function Ru(r){return r*(.5-Math.random())}function Cu(r){r!==void 0&&(ec=r);let e=ec+=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 Pu(r){return r*ds}function Lu(r){return r*ji}function Iu(r){return(r&r-1)===0&&r!==0}function Du(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Uu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Nu(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),c=a(t/2),l=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),_=a((n-e)/2);switch(i){case"XYX":r.set(o*u,c*h,c*d,o*l);break;case"YZY":r.set(c*d,o*u,c*h,o*l);break;case"ZXZ":r.set(c*h,c*d,o*u,o*l);break;case"XZX":r.set(o*u,c*_,c*f,o*l);break;case"YXY":r.set(c*f,o*u,c*_,o*l);break;case"ZYZ":r.set(c*_,c*f,o*u,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ln(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 tt(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 It={DEG2RAD:ds,RAD2DEG:ji,generateUUID:un,clamp:At,euclideanModulo:To,mapLinear:yu,inverseLerp:Mu,lerp:fs,damp:Su,pingpong:bu,smoothstep:wu,smootherstep:Tu,randInt:Eu,randFloat:Au,randFloatSpread:Ru,seededRandom:Cu,degToRad:Pu,radToDeg:Lu,isPowerOfTwo:Iu,ceilPowerOfTwo:Du,floorPowerOfTwo:Uu,setQuaternionFromProperEuler:Nu,normalize:tt,denormalize:ln};class Ne{constructor(e=0,t=0){Ne.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(At(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Fe{constructor(e,t,n,i,s,a,o,c,l){Fe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,c,l)}set(e,t,n,i,s,a,o,c,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],u=n[4],h=n[7],d=n[2],f=n[5],_=n[8],g=i[0],m=i[3],p=i[6],b=i[1],x=i[4],M=i[7],L=i[2],E=i[5],A=i[8];return s[0]=a*g+o*b+c*L,s[3]=a*m+o*x+c*E,s[6]=a*p+o*M+c*A,s[1]=l*g+u*b+h*L,s[4]=l*m+u*x+h*E,s[7]=l*p+u*M+h*A,s[2]=d*g+f*b+_*L,s[5]=d*m+f*x+_*E,s[8]=d*p+f*M+_*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*s*u+n*o*c+i*s*l-i*a*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8],h=u*a-o*l,d=o*c-u*s,f=l*s-a*c,_=t*h+n*d+i*f;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=h*g,e[1]=(i*l-u*n)*g,e[2]=(o*n-i*a)*g,e[3]=d*g,e[4]=(u*t-i*c)*g,e[5]=(i*s-o*t)*g,e[6]=f*g,e[7]=(n*c-l*t)*g,e[8]=(a*t-n*s)*g,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Xr.makeScale(e,t)),this}rotate(e){return this.premultiply(Xr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xr.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 Xr=new Fe;function Dl(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function xs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Fu(){const r=xs("canvas");return r.style.display="block",r}const tc={};function Bi(r){r in tc||(tc[r]=!0,console.warn(r))}function Ou(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)})}const nc=new Fe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ic=new Fe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),es={[Ct]:{transfer:xr,primaries:vr,luminanceCoefficients:[.2126,.7152,.0722],toReference:r=>r,fromReference:r=>r},[Mt]:{transfer:at,primaries:vr,luminanceCoefficients:[.2126,.7152,.0722],toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Pr]:{transfer:xr,primaries:yr,luminanceCoefficients:[.2289,.6917,.0793],toReference:r=>r.applyMatrix3(ic),fromReference:r=>r.applyMatrix3(nc)},[wo]:{transfer:at,primaries:yr,luminanceCoefficients:[.2289,.6917,.0793],toReference:r=>r.convertSRGBToLinear().applyMatrix3(ic),fromReference:r=>r.applyMatrix3(nc).convertLinearToSRGB()}},Bu=new Set([Ct,Pr]),Ke={enabled:!0,_workingColorSpace:Ct,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!Bu.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=es[e].toReference,i=es[t].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return es[r].primaries},getTransfer:function(r){return r===Vn?xr:es[r].transfer},getLuminanceCoefficients:function(r,e=this._workingColorSpace){return r.fromArray(es[e].luminanceCoefficients)}};function ki(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function jr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let fi;class ku{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{fi===void 0&&(fi=xs("canvas")),fi.width=e.width,fi.height=e.height;const n=fi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=fi}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=xs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==yl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jt:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case _r: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 Jt:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case _r: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++}}St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=yl;St.DEFAULT_ANISOTROPY=1;class Ze{constructor(e=0,t=0,n=0,i=1){Ze.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}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 c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],f=c[5],_=c[9],g=c[2],m=c[6],p=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+g)<.1&&Math.abs(_+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(l+1)/2,M=(f+1)/2,L=(p+1)/2,E=(u+d)/4,A=(h+g)/4,D=(_+m)/4;return x>M&&x>L?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=E/n,s=A/n):M>L?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=E/i,s=D/i):L<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(L),n=A/s,i=D/s),this.set(n,i,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(h-g)*(h-g)+(d-u)*(d-u));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(h-g)/b,this.z=(d-u)/b,this.w=Math.acos((l+f+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&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 Vu extends hi{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ze(0,0,e,t),this.scissorTest=!1,this.viewport=new Ze(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new St(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 a=n.count;for(let o=0;o=0?1:-1,x=1-p*p;if(x>Number.EPSILON){const L=Math.sqrt(x),E=Math.atan2(L,p*b);m=Math.sin(m*E)/L,o=Math.sin(o*E)/L}const M=o*b;if(c=c*m+d*M,l=l*m+f*M,u=u*m+_*M,h=h*m+g*M,m===1-o){const L=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=L,l*=L,u*=L,h*=L}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=s[a],d=s[a+1],f=s[a+2],_=s[a+3];return e[t]=o*_+u*h+c*f-l*d,e[t+1]=c*_+u*d+l*h-o*f,e[t+2]=l*_+u*f+o*d-c*h,e[t+3]=u*_-o*h-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),u=o(i/2),h=o(s/2),d=c(n/2),f=c(i/2),_=c(s/2);switch(a){case"XYZ":this._x=d*u*h+l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h-d*f*_;break;case"YXZ":this._x=d*u*h+l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h+d*f*_;break;case"ZXY":this._x=d*u*h-l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h-d*f*_;break;case"ZYX":this._x=d*u*h-l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h+d*f*_;break;case"YZX":this._x=d*u*h+l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h-d*f*_;break;case"XZY":this._x=d*u*h-l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h+d*f*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],c=t[9],l=t[2],u=t[6],h=t[10],d=n+o+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-c)*f,this._y=(s-l)*f,this._z=(a-i)*f}else if(n>o&&n>h){const f=2*Math.sqrt(1+n-o-h);this._w=(u-c)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+l)/f}else if(o>h){const f=2*Math.sqrt(1+o-n-h);this._w=(s-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+h-n-o);this._w=(a-i)/f,this._x=(s+l)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.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(At(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+i*l-s*c,this._y=i*u+a*c+s*o-n*l,this._z=s*u+a*l+n*c-i*o,this._w=a*u-n*o-i*c-s*l,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,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const c=1-o*o;if(c<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const l=Math.sqrt(c),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+this._z*d,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()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class T{constructor(e=0,t=0,n=0){T.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(sc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(sc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+c*l+a*h-o*u,this.y=n+c*u+o*l-s*h,this.z=i+c*h+s*u-a*l,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-s*o,this.y=s*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Yr.copy(this).projectOnVector(e),this.sub(Yr)}reflect(e){return this.sub(Yr.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(At(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 Yr=new T,sc=new pt;class bt{constructor(e=new T(1/0,1/0,1/0),t=new T(-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=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,sn),sn.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(ts),Ls.subVectors(this.max,ts),pi.subVectors(e.a,ts),mi.subVectors(e.b,ts),_i.subVectors(e.c,ts),Un.subVectors(mi,pi),Nn.subVectors(_i,mi),Yn.subVectors(pi,_i);let t=[0,-Un.z,Un.y,0,-Nn.z,Nn.y,0,-Yn.z,Yn.y,Un.z,0,-Un.x,Nn.z,0,-Nn.x,Yn.z,0,-Yn.x,-Un.y,Un.x,0,-Nn.y,Nn.x,0,-Yn.y,Yn.x,0];return!Kr(t,pi,mi,_i,Ls)||(t=[1,0,0,0,1,0,0,0,1],!Kr(t,pi,mi,_i,Ls))?!1:(Is.crossVectors(Un,Nn),t=[Is.x,Is.y,Is.z],Kr(t,pi,mi,_i,Ls))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(sn).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:(vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vn),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 vn=[new T,new T,new T,new T,new T,new T,new T,new T],sn=new T,Ps=new bt,pi=new T,mi=new T,_i=new T,Un=new T,Nn=new T,Yn=new T,ts=new T,Ls=new T,Is=new T,Kn=new T;function Kr(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Kn.fromArray(r,s);const o=i.x*Math.abs(Kn.x)+i.y*Math.abs(Kn.y)+i.z*Math.abs(Kn.z),c=e.dot(Kn),l=t.dot(Kn),u=n.dot(Kn);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>o)return!1}return!0}const Wu=new bt,ns=new T,Zr=new T;class _n{constructor(e=new T,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):Wu.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ns.subVectors(e,this.center);const t=ns.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ns,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):(Zr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ns.copy(e.center).add(Zr)),this.expandByPoint(ns.copy(e.center).sub(Zr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const yn=new T,$r=new T,Ds=new T,Fn=new T,Jr=new T,Us=new T,Qr=new T;class Lr{constructor(e=new T,t=new T(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,yn)),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=yn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yn.copy(this.origin).addScaledVector(this.direction,t),yn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){$r.copy(e).add(t).multiplyScalar(.5),Ds.copy(t).sub(e).normalize(),Fn.copy(this.origin).sub($r);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ds),o=Fn.dot(this.direction),c=-Fn.dot(Ds),l=Fn.lengthSq(),u=Math.abs(1-a*a);let h,d,f,_;if(u>0)if(h=a*c-o,d=a*o-c,_=s*u,h>=0)if(d>=-_)if(d<=_){const g=1/u;h*=g,d*=g,f=h*(h+a*d+2*o)+d*(a*h+d+2*c)+l}else d=s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*c)+l;else d=-s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*c)+l;else d<=-_?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-c),s),f=-h*h+d*(d+2*c)+l):d<=_?(h=0,d=Math.min(Math.max(-s,-c),s),f=d*(d+2*c)+l):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-c),s),f=-h*h+d*(d+2*c)+l);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy($r).addScaledVector(Ds,d),f}intersectSphere(e,t){yn.subVectors(e.center,this.origin);const n=yn.dot(this.direction),i=yn.dot(yn)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,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,a,o,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a=0?(o=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),n>c||o>i)||((o>n||n!==n)&&(n=o),(c=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,yn)!==null}intersectTriangle(e,t,n,i,s){Jr.subVectors(t,e),Us.subVectors(n,e),Qr.crossVectors(Jr,Us);let a=this.direction.dot(Qr),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Fn.subVectors(this.origin,e);const c=o*this.direction.dot(Us.crossVectors(Fn,Us));if(c<0)return null;const l=o*this.direction.dot(Jr.cross(Fn));if(l<0||c+l>a)return null;const u=-o*Fn.dot(Qr);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class fe{constructor(e,t,n,i,s,a,o,c,l,u,h,d,f,_,g,m){fe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,c,l,u,h,d,f,_,g,m)}set(e,t,n,i,s,a,o,c,l,u,h,d,f,_,g,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=c,p[2]=l,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=_,p[11]=g,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new fe().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/gi.setFromMatrixColumn(e,0).length(),s=1/gi.setFromMatrixColumn(e,1).length(),a=1/gi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,f=a*h,_=o*u,g=o*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=f+_*l,t[5]=d-g*l,t[9]=-o*c,t[2]=g-d*l,t[6]=_+f*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*u,f=c*h,_=l*u,g=l*h;t[0]=d+g*o,t[4]=_*o-f,t[8]=a*l,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=f*o-_,t[6]=g+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*u,f=c*h,_=l*u,g=l*h;t[0]=d-g*o,t[4]=-a*h,t[8]=_+f*o,t[1]=f+_*o,t[5]=a*u,t[9]=g-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*u,f=a*h,_=o*u,g=o*h;t[0]=c*u,t[4]=_*l-f,t[8]=d*l+g,t[1]=c*h,t[5]=g*l+d,t[9]=f*l-_,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,f=a*l,_=o*c,g=o*l;t[0]=c*u,t[4]=g-d*h,t[8]=_*h+f,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=f*h+_,t[10]=d-g*h}else if(e.order==="XZY"){const d=a*c,f=a*l,_=o*c,g=o*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=d*h+g,t[5]=a*u,t[9]=f*h-_,t[2]=_*h-f,t[6]=o*u,t[10]=g*h+d}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(Xu,e,ju)}lookAt(e,t,n){const i=this.elements;return Wt.subVectors(e,t),Wt.lengthSq()===0&&(Wt.z=1),Wt.normalize(),On.crossVectors(n,Wt),On.lengthSq()===0&&(Math.abs(n.z)===1?Wt.x+=1e-4:Wt.z+=1e-4,Wt.normalize(),On.crossVectors(n,Wt)),On.normalize(),Ns.crossVectors(Wt,On),i[0]=On.x,i[4]=Ns.x,i[8]=Wt.x,i[1]=On.y,i[5]=Ns.y,i[9]=Wt.y,i[2]=On.z,i[6]=Ns.z,i[10]=Wt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],u=n[1],h=n[5],d=n[9],f=n[13],_=n[2],g=n[6],m=n[10],p=n[14],b=n[3],x=n[7],M=n[11],L=n[15],E=i[0],A=i[4],D=i[8],w=i[12],y=i[1],P=i[5],z=i[9],O=i[13],G=i[2],X=i[6],H=i[10],q=i[14],V=i[3],ie=i[7],oe=i[11],pe=i[15];return s[0]=a*E+o*y+c*G+l*V,s[4]=a*A+o*P+c*X+l*ie,s[8]=a*D+o*z+c*H+l*oe,s[12]=a*w+o*O+c*q+l*pe,s[1]=u*E+h*y+d*G+f*V,s[5]=u*A+h*P+d*X+f*ie,s[9]=u*D+h*z+d*H+f*oe,s[13]=u*w+h*O+d*q+f*pe,s[2]=_*E+g*y+m*G+p*V,s[6]=_*A+g*P+m*X+p*ie,s[10]=_*D+g*z+m*H+p*oe,s[14]=_*w+g*O+m*q+p*pe,s[3]=b*E+x*y+M*G+L*V,s[7]=b*A+x*P+M*X+L*ie,s[11]=b*D+x*z+M*H+L*oe,s[15]=b*w+x*O+M*q+L*pe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],f=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+s*c*h-i*l*h-s*o*d+n*l*d+i*o*f-n*c*f)+g*(+t*c*f-t*l*d+s*a*d-i*a*f+i*l*u-s*c*u)+m*(+t*l*h-t*o*f-s*a*h+n*a*f+s*o*u-n*l*u)+p*(-i*o*u-t*c*h+t*o*d+i*a*h-n*a*d+n*c*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],_=e[12],g=e[13],m=e[14],p=e[15],b=h*m*l-g*d*l+g*c*f-o*m*f-h*c*p+o*d*p,x=_*d*l-u*m*l-_*c*f+a*m*f+u*c*p-a*d*p,M=u*g*l-_*h*l+_*o*f-a*g*f-u*o*p+a*h*p,L=_*h*c-u*g*c-_*o*d+a*g*d+u*o*m-a*h*m,E=t*b+n*x+i*M+s*L;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/E;return e[0]=b*A,e[1]=(g*d*s-h*m*s-g*i*f+n*m*f+h*i*p-n*d*p)*A,e[2]=(o*m*s-g*c*s+g*i*l-n*m*l-o*i*p+n*c*p)*A,e[3]=(h*c*s-o*d*s-h*i*l+n*d*l+o*i*f-n*c*f)*A,e[4]=x*A,e[5]=(u*m*s-_*d*s+_*i*f-t*m*f-u*i*p+t*d*p)*A,e[6]=(_*c*s-a*m*s-_*i*l+t*m*l+a*i*p-t*c*p)*A,e[7]=(a*d*s-u*c*s+u*i*l-t*d*l-a*i*f+t*c*f)*A,e[8]=M*A,e[9]=(_*h*s-u*g*s-_*n*f+t*g*f+u*n*p-t*h*p)*A,e[10]=(a*g*s-_*o*s+_*n*l-t*g*l-a*n*p+t*o*p)*A,e[11]=(u*o*s-a*h*s-u*n*l+t*h*l+a*n*f-t*o*f)*A,e[12]=L*A,e[13]=(u*g*i-_*h*i+_*n*d-t*g*d-u*n*m+t*h*m)*A,e[14]=(_*o*i-a*g*i-_*n*c+t*g*c+a*n*m-t*o*m)*A,e[15]=(a*h*i-u*o*i+u*n*c-t*h*c-a*n*d+t*o*d)*A,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,c=e.z,l=s*a,u=s*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,u*o+n,u*c-i*a,0,l*c-i*o,u*c+i*a,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,c=t._w,l=s+s,u=a+a,h=o+o,d=s*l,f=s*u,_=s*h,g=a*u,m=a*h,p=o*h,b=c*l,x=c*u,M=c*h,L=n.x,E=n.y,A=n.z;return i[0]=(1-(g+p))*L,i[1]=(f+M)*L,i[2]=(_-x)*L,i[3]=0,i[4]=(f-M)*E,i[5]=(1-(d+p))*E,i[6]=(m+b)*E,i[7]=0,i[8]=(_+x)*A,i[9]=(m-b)*A,i[10]=(1-(d+g))*A,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=gi.set(i[0],i[1],i[2]).length();const a=gi.set(i[4],i[5],i[6]).length(),o=gi.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],rn.copy(this);const l=1/s,u=1/a,h=1/o;return rn.elements[0]*=l,rn.elements[1]*=l,rn.elements[2]*=l,rn.elements[4]*=u,rn.elements[5]*=u,rn.elements[6]*=u,rn.elements[8]*=h,rn.elements[9]*=h,rn.elements[10]*=h,t.setFromRotationMatrix(rn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=Rn){const c=this.elements,l=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let f,_;if(o===Rn)f=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Mr)f=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Rn){const c=this.elements,l=1/(t-e),u=1/(n-i),h=1/(a-s),d=(t+e)*l,f=(n+i)*u;let _,g;if(o===Rn)_=(a+s)*h,g=-2*h;else if(o===Mr)_=s*h,g=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-f,c[2]=0,c[6]=0,c[10]=g,c[14]=-_,c[3]=0,c[7]=0,c[11]=0,c[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 gi=new T,rn=new fe,Xu=new T(0,0,0),ju=new T(1,1,1),On=new T,Ns=new T,Wt=new T,rc=new fe,ac=new pt;class mt{constructor(e=0,t=0,n=0,i=mt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(At(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-At(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(At(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-At(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(At(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-At(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),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 rc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rc,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ac.setFromEuler(this),this.setFromQuaternion(ac,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}}mt.DEFAULT_ORDER="XYZ";class Fl{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(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(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),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(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),_.length>0&&(n.nodes=_)}return n.object=i,n;function a(o){const c=[];for(const l in o){const u=o[l];delete u.metadata,c.push(u)}return c}}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;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){an.subVectors(i,t),Sn.subVectors(n,t),ta.subVectors(e,t);const a=an.dot(an),o=an.dot(Sn),c=an.dot(ta),l=Sn.dot(Sn),u=Sn.dot(ta),h=a*l-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,f=(l*c-o*u)*d,_=(a*u-o*c)*d;return s.set(1-f-_,_,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,bn)===null?!1:bn.x>=0&&bn.y>=0&&bn.x+bn.y<=1}static getInterpolation(e,t,n,i,s,a,o,c){return this.getBarycoord(e,t,n,i,bn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,bn.x),c.addScaledVector(a,bn.y),c.addScaledVector(o,bn.z),c)}static isFrontFacing(e,t,n,i){return an.subVectors(n,t),Sn.subVectors(e,t),an.cross(Sn).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 an.subVectors(this.c,this.b),Sn.subVectors(this.a,this.b),an.cross(Sn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return pn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return pn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return pn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return pn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;yi.subVectors(i,n),Mi.subVectors(s,n),na.subVectors(e,n);const c=yi.dot(na),l=Mi.dot(na);if(c<=0&&l<=0)return t.copy(n);ia.subVectors(e,i);const u=yi.dot(ia),h=Mi.dot(ia);if(u>=0&&h<=u)return t.copy(i);const d=c*h-u*l;if(d<=0&&c>=0&&u<=0)return a=c/(c-u),t.copy(n).addScaledVector(yi,a);sa.subVectors(e,s);const f=yi.dot(sa),_=Mi.dot(sa);if(_>=0&&f<=_)return t.copy(s);const g=f*l-c*_;if(g<=0&&l>=0&&_<=0)return o=l/(l-_),t.copy(n).addScaledVector(Mi,o);const m=u*_-f*h;if(m<=0&&h-u>=0&&f-_>=0)return dc.subVectors(s,i),o=(h-u)/(h-u+(f-_)),t.copy(i).addScaledVector(dc,o);const p=1/(m+g+d);return a=g*p,o=d*p,t.copy(n).addScaledVector(yi,a).addScaledVector(Mi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ol={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},Bn={h:0,s:0,l:0},Os={h:0,s:0,l:0};function ra(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 ge{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=Mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ke.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ke.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ke.workingColorSpace){if(e=To(e,1),t=At(t,0,1),n=At(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=ra(a,s,e+1/3),this.g=ra(a,s,e),this.b=ra(a,s,e-1/3)}return Ke.toWorkingColorSpace(this,i),this}setStyle(e,t=Mt){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 a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Mt){const n=Ol[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=ki(e.r),this.g=ki(e.g),this.b=ki(e.b),this}copyLinearToSRGB(e){return this.r=jr(e.r),this.g=jr(e.g),this.b=jr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Mt){return Ke.fromWorkingColorSpace(Lt.copy(this),e),Math.round(At(Lt.r*255,0,255))*65536+Math.round(At(Lt.g*255,0,255))*256+Math.round(At(Lt.b*255,0,255))}getHexString(e=Mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ke.workingColorSpace){Ke.fromWorkingColorSpace(Lt.copy(this),t);const n=Lt.r,i=Lt.g,s=Lt.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let c,l;const u=(o+a)/2;if(o===a)c=0,l=0;else{const h=a-o;switch(l=u<=.5?h/(a+o):h/(2-a-o),a){case n:c=(i-s)/h+(i0!=e>0&&this.version++,this._alphaTest=e}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"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(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!==Fi&&(n.blending=this.blending),this.side!==Pn&&(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!==Ca&&(n.blendSrc=this.blendSrc),this.blendDst!==Pa&&(n.blendDst=this.blendDst),this.blendEquation!==ii&&(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!==pr&&(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!==Jo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==di&&(n.stencilFail=this.stencilFail),this.stencilZFail!==di&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==di&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Le extends en{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ge(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 mt,this.combine=Ar,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 vt=new T,Bs=new Ne;class kt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ro,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=hn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Bi("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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;i0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h0&&(i[c]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const l in i){const u=i[l];this.setAttribute(l,u.clone(t))}const s=e.morphAttributes;for(const l in s){const u=[],h=s[l];for(let d=0,f=h.length;d0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s(e.far-e.near)**2))&&(fc.copy(s).invert(),Zn.copy(e.ray).applyMatrix4(fc),!(n.boundingBox!==null&&Zn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Zn)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,g=d.length;_t.far?null:{distance:l,point:Xs.clone(),object:r}}function js(r,e,t,n,i,s,a,o,c,l){r.getVertexPosition(o,bi),r.getVertexPosition(c,wi),r.getVertexPosition(l,Ti);const u=Qu(r,e,t,n,bi,wi,Ti,Ws);if(u){i&&(Hs.fromBufferAttribute(i,o),Vs.fromBufferAttribute(i,c),Gs.fromBufferAttribute(i,l),u.uv=pn.getInterpolation(Ws,bi,wi,Ti,Hs,Vs,Gs,new Ne)),s&&(Hs.fromBufferAttribute(s,o),Vs.fromBufferAttribute(s,c),Gs.fromBufferAttribute(s,l),u.uv1=pn.getInterpolation(Ws,bi,wi,Ti,Hs,Vs,Gs,new Ne)),a&&(mc.fromBufferAttribute(a,o),_c.fromBufferAttribute(a,c),gc.fromBufferAttribute(a,l),u.normal=pn.getInterpolation(Ws,bi,wi,Ti,mc,_c,gc,new T),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:c,c:l,normal:new T,materialIndex:0};pn.getNormal(bi,wi,Ti,h.normal),u.face=h}return u}class ze extends zt{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],u=[],h=[];let d=0,f=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,i,a,2),_("x","z","y",1,-1,e,n,-t,i,a,3),_("x","y","z",1,-1,e,t,n,i,s,4),_("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new gt(l,3)),this.setAttribute("normal",new gt(u,3)),this.setAttribute("uv",new gt(h,2));function _(g,m,p,b,x,M,L,E,A,D,w){const y=M/A,P=L/D,z=M/2,O=L/2,G=E/2,X=A+1,H=D+1;let q=0,V=0;const ie=new T;for(let oe=0;oe0?1:-1,u.push(ie.x,ie.y,ie.z),h.push(Oe/A),h.push(1-oe/D),q+=1}}for(let oe=0;oe>8&255]+Pt[r>>16&255]+Pt[r>>24&255]+"-"+Pt[e&255]+Pt[e>>8&255]+"-"+Pt[e>>16&15|64]+Pt[e>>24&255]+"-"+Pt[t&63|128]+Pt[t>>8&255]+"-"+Pt[t>>16&255]+Pt[t>>24&255]+Pt[n&255]+Pt[n>>8&255]+Pt[n>>16&255]+Pt[n>>24&255]).toLowerCase()}function At(r,e,t){return Math.max(e,Math.min(t,r))}function To(r,e){return(r%e+e)%e}function yu(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Mu(r,e,t){return r!==e?(t-r)/(e-r):0}function ds(r,e,t){return(1-t)*r+t*e}function Su(r,e,t,n){return ds(r,e,1-Math.exp(-t*n))}function bu(r,e=1){return e-Math.abs(To(r,e*2)-e)}function wu(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Tu(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Eu(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Au(r,e){return r+Math.random()*(e-r)}function Ru(r){return r*(.5-Math.random())}function Cu(r){r!==void 0&&(el=r);let e=el+=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 Pu(r){return r*us}function Lu(r){return r*ji}function Iu(r){return(r&r-1)===0&&r!==0}function Du(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Uu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Nu(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),_=a((n-e)/2);switch(i){case"XYX":r.set(o*u,l*h,l*d,o*c);break;case"YZY":r.set(l*d,o*u,l*h,o*c);break;case"ZXZ":r.set(l*h,l*d,o*u,o*c);break;case"XZX":r.set(o*u,l*_,l*f,o*c);break;case"YXY":r.set(l*f,o*u,l*_,o*c);break;case"ZYZ":r.set(l*_,l*f,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function cn(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 tt(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 It={DEG2RAD:us,RAD2DEG:ji,generateUUID:un,clamp:At,euclideanModulo:To,mapLinear:yu,inverseLerp:Mu,lerp:ds,damp:Su,pingpong:bu,smoothstep:wu,smootherstep:Tu,randInt:Eu,randFloat:Au,randFloatSpread:Ru,seededRandom:Cu,degToRad:Pu,radToDeg:Lu,isPowerOfTwo:Iu,ceilPowerOfTwo:Du,floorPowerOfTwo:Uu,setQuaternionFromProperEuler:Nu,normalize:tt,denormalize:cn};class Ne{constructor(e=0,t=0){Ne.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(At(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Fe{constructor(e,t,n,i,s,a,o,l,c){Fe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],f=n[5],_=n[8],g=i[0],m=i[3],p=i[6],b=i[1],x=i[4],M=i[7],L=i[2],E=i[5],A=i[8];return s[0]=a*g+o*b+l*L,s[3]=a*m+o*x+l*E,s[6]=a*p+o*M+l*A,s[1]=c*g+u*b+h*L,s[4]=c*m+u*x+h*E,s[7]=c*p+u*M+h*A,s[2]=d*g+f*b+_*L,s[5]=d*m+f*x+_*E,s[8]=d*p+f*M+_*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,d=o*l-u*s,f=c*s-a*l,_=t*h+n*d+i*f;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=h*g,e[1]=(i*c-u*n)*g,e[2]=(o*n-i*a)*g,e[3]=d*g,e[4]=(u*t-i*l)*g,e[5]=(i*s-o*t)*g,e[6]=f*g,e[7]=(n*l-c*t)*g,e[8]=(a*t-n*s)*g,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Xr.makeScale(e,t)),this}rotate(e){return this.premultiply(Xr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xr.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 Xr=new Fe;function Dc(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function gs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Fu(){const r=gs("canvas");return r.style.display="block",r}const tl={};function Bi(r){r in tl||(tl[r]=!0,console.warn(r))}function Ou(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)})}const nl=new Fe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),il=new Fe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Qi={[Ct]:{transfer:xr,primaries:vr,luminanceCoefficients:[.2126,.7152,.0722],toReference:r=>r,fromReference:r=>r},[Mt]:{transfer:at,primaries:vr,luminanceCoefficients:[.2126,.7152,.0722],toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Pr]:{transfer:xr,primaries:yr,luminanceCoefficients:[.2289,.6917,.0793],toReference:r=>r.applyMatrix3(il),fromReference:r=>r.applyMatrix3(nl)},[wo]:{transfer:at,primaries:yr,luminanceCoefficients:[.2289,.6917,.0793],toReference:r=>r.convertSRGBToLinear().applyMatrix3(il),fromReference:r=>r.applyMatrix3(nl).convertLinearToSRGB()}},Bu=new Set([Ct,Pr]),Ke={enabled:!0,_workingColorSpace:Ct,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!Bu.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=Qi[e].toReference,i=Qi[t].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return Qi[r].primaries},getTransfer:function(r){return r===Vn?xr:Qi[r].transfer},getLuminanceCoefficients:function(r,e=this._workingColorSpace){return r.fromArray(Qi[e].luminanceCoefficients)}};function ki(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function jr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let fi;class ku{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{fi===void 0&&(fi=gs("canvas")),fi.width=e.width,fi.height=e.height;const n=fi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=fi}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=gs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==yc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jt:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case _r: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 Jt:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case _r: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++}}St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=yc;St.DEFAULT_ANISOTROPY=1;class Ze{constructor(e=0,t=0,n=0,i=1){Ze.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}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 l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],f=l[5],_=l[9],g=l[2],m=l[6],p=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+g)<.1&&Math.abs(_+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,M=(f+1)/2,L=(p+1)/2,E=(u+d)/4,A=(h+g)/4,D=(_+m)/4;return x>M&&x>L?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=E/n,s=A/n):M>L?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=E/i,s=D/i):L<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(L),n=A/s,i=D/s),this.set(n,i,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(h-g)*(h-g)+(d-u)*(d-u));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(h-g)/b,this.z=(d-u)/b,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&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 Vu extends hi{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ze(0,0,e,t),this.scissorTest=!1,this.viewport=new Ze(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new St(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 a=n.count;for(let o=0;o=0?1:-1,x=1-p*p;if(x>Number.EPSILON){const L=Math.sqrt(x),E=Math.atan2(L,p*b);m=Math.sin(m*E)/L,o=Math.sin(o*E)/L}const M=o*b;if(l=l*m+d*M,c=c*m+f*M,u=u*m+_*M,h=h*m+g*M,m===1-o){const L=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=L,c*=L,u*=L,h*=L}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[a],d=s[a+1],f=s[a+2],_=s[a+3];return e[t]=o*_+u*h+l*f-c*d,e[t+1]=l*_+u*d+c*h-o*f,e[t+2]=c*_+u*f+o*d-l*h,e[t+3]=u*_-o*h-l*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(i/2),h=o(s/2),d=l(n/2),f=l(i/2),_=l(s/2);switch(a){case"XYZ":this._x=d*u*h+c*f*_,this._y=c*f*h-d*u*_,this._z=c*u*_+d*f*h,this._w=c*u*h-d*f*_;break;case"YXZ":this._x=d*u*h+c*f*_,this._y=c*f*h-d*u*_,this._z=c*u*_-d*f*h,this._w=c*u*h+d*f*_;break;case"ZXY":this._x=d*u*h-c*f*_,this._y=c*f*h+d*u*_,this._z=c*u*_+d*f*h,this._w=c*u*h-d*f*_;break;case"ZYX":this._x=d*u*h-c*f*_,this._y=c*f*h+d*u*_,this._z=c*u*_-d*f*h,this._w=c*u*h+d*f*_;break;case"YZX":this._x=d*u*h+c*f*_,this._y=c*f*h+d*u*_,this._z=c*u*_-d*f*h,this._w=c*u*h-d*f*_;break;case"XZY":this._x=d*u*h-c*f*_,this._y=c*f*h-d*u*_,this._z=c*u*_+d*f*h,this._w=c*u*h+d*f*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=n+o+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>h){const f=2*Math.sqrt(1+n-o-h);this._w=(u-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>h){const f=2*Math.sqrt(1+o-n-h);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+h-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.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(At(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-i*o,this._w=a*u-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+this._z*d,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()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class T{constructor(e=0,t=0,n=0){T.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(sl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(sl.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=i+l*h+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Yr.copy(this).projectOnVector(e),this.sub(Yr)}reflect(e){return this.sub(Yr.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(At(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 Yr=new T,sl=new pt;class bt{constructor(e=new T(1/0,1/0,1/0),t=new T(-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=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,sn),sn.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(es),Ls.subVectors(this.max,es),pi.subVectors(e.a,es),mi.subVectors(e.b,es),_i.subVectors(e.c,es),Un.subVectors(mi,pi),Nn.subVectors(_i,mi),Yn.subVectors(pi,_i);let t=[0,-Un.z,Un.y,0,-Nn.z,Nn.y,0,-Yn.z,Yn.y,Un.z,0,-Un.x,Nn.z,0,-Nn.x,Yn.z,0,-Yn.x,-Un.y,Un.x,0,-Nn.y,Nn.x,0,-Yn.y,Yn.x,0];return!Kr(t,pi,mi,_i,Ls)||(t=[1,0,0,0,1,0,0,0,1],!Kr(t,pi,mi,_i,Ls))?!1:(Is.crossVectors(Un,Nn),t=[Is.x,Is.y,Is.z],Kr(t,pi,mi,_i,Ls))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(sn).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:(vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vn),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 vn=[new T,new T,new T,new T,new T,new T,new T,new T],sn=new T,Ps=new bt,pi=new T,mi=new T,_i=new T,Un=new T,Nn=new T,Yn=new T,es=new T,Ls=new T,Is=new T,Kn=new T;function Kr(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Kn.fromArray(r,s);const o=i.x*Math.abs(Kn.x)+i.y*Math.abs(Kn.y)+i.z*Math.abs(Kn.z),l=e.dot(Kn),c=t.dot(Kn),u=n.dot(Kn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Wu=new bt,ts=new T,Zr=new T;class _n{constructor(e=new T,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):Wu.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ts.subVectors(e,this.center);const t=ts.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ts,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):(Zr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ts.copy(e.center).add(Zr)),this.expandByPoint(ts.copy(e.center).sub(Zr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const yn=new T,$r=new T,Ds=new T,Fn=new T,Jr=new T,Us=new T,Qr=new T;class Lr{constructor(e=new T,t=new T(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,yn)),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=yn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yn.copy(this.origin).addScaledVector(this.direction,t),yn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){$r.copy(e).add(t).multiplyScalar(.5),Ds.copy(t).sub(e).normalize(),Fn.copy(this.origin).sub($r);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ds),o=Fn.dot(this.direction),l=-Fn.dot(Ds),c=Fn.lengthSq(),u=Math.abs(1-a*a);let h,d,f,_;if(u>0)if(h=a*l-o,d=a*o-l,_=s*u,h>=0)if(d>=-_)if(d<=_){const g=1/u;h*=g,d*=g,f=h*(h+a*d+2*o)+d*(a*h+d+2*l)+c}else d=s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;else d<=-_?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c):d<=_?(h=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy($r).addScaledVector(Ds,d),f}intersectSphere(e,t){yn.subVectors(e.center,this.origin);const n=yn.dot(this.direction),i=yn.dot(yn)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,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,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a=0?(o=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),n>l||o>i)||((o>n||n!==n)&&(n=o),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,yn)!==null}intersectTriangle(e,t,n,i,s){Jr.subVectors(t,e),Us.subVectors(n,e),Qr.crossVectors(Jr,Us);let a=this.direction.dot(Qr),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Fn.subVectors(this.origin,e);const l=o*this.direction.dot(Us.crossVectors(Fn,Us));if(l<0)return null;const c=o*this.direction.dot(Jr.cross(Fn));if(c<0||l+c>a)return null;const u=-o*Fn.dot(Qr);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class fe{constructor(e,t,n,i,s,a,o,l,c,u,h,d,f,_,g,m){fe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,u,h,d,f,_,g,m)}set(e,t,n,i,s,a,o,l,c,u,h,d,f,_,g,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=_,p[11]=g,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new fe().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/gi.setFromMatrixColumn(e,0).length(),s=1/gi.setFromMatrixColumn(e,1).length(),a=1/gi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,f=a*h,_=o*u,g=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=f+_*c,t[5]=d-g*c,t[9]=-o*l,t[2]=g-d*c,t[6]=_+f*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*u,f=l*h,_=c*u,g=c*h;t[0]=d+g*o,t[4]=_*o-f,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=f*o-_,t[6]=g+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*u,f=l*h,_=c*u,g=c*h;t[0]=d-g*o,t[4]=-a*h,t[8]=_+f*o,t[1]=f+_*o,t[5]=a*u,t[9]=g-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*u,f=a*h,_=o*u,g=o*h;t[0]=l*u,t[4]=_*c-f,t[8]=d*c+g,t[1]=l*h,t[5]=g*c+d,t[9]=f*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,f=a*c,_=o*l,g=o*c;t[0]=l*u,t[4]=g-d*h,t[8]=_*h+f,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*h+_,t[10]=d-g*h}else if(e.order==="XZY"){const d=a*l,f=a*c,_=o*l,g=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+g,t[5]=a*u,t[9]=f*h-_,t[2]=_*h-f,t[6]=o*u,t[10]=g*h+d}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(Xu,e,ju)}lookAt(e,t,n){const i=this.elements;return Wt.subVectors(e,t),Wt.lengthSq()===0&&(Wt.z=1),Wt.normalize(),On.crossVectors(n,Wt),On.lengthSq()===0&&(Math.abs(n.z)===1?Wt.x+=1e-4:Wt.z+=1e-4,Wt.normalize(),On.crossVectors(n,Wt)),On.normalize(),Ns.crossVectors(Wt,On),i[0]=On.x,i[4]=Ns.x,i[8]=Wt.x,i[1]=On.y,i[5]=Ns.y,i[9]=Wt.y,i[2]=On.z,i[6]=Ns.z,i[10]=Wt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],f=n[13],_=n[2],g=n[6],m=n[10],p=n[14],b=n[3],x=n[7],M=n[11],L=n[15],E=i[0],A=i[4],D=i[8],w=i[12],y=i[1],P=i[5],z=i[9],O=i[13],G=i[2],X=i[6],H=i[10],q=i[14],V=i[3],ie=i[7],oe=i[11],pe=i[15];return s[0]=a*E+o*y+l*G+c*V,s[4]=a*A+o*P+l*X+c*ie,s[8]=a*D+o*z+l*H+c*oe,s[12]=a*w+o*O+l*q+c*pe,s[1]=u*E+h*y+d*G+f*V,s[5]=u*A+h*P+d*X+f*ie,s[9]=u*D+h*z+d*H+f*oe,s[13]=u*w+h*O+d*q+f*pe,s[2]=_*E+g*y+m*G+p*V,s[6]=_*A+g*P+m*X+p*ie,s[10]=_*D+g*z+m*H+p*oe,s[14]=_*w+g*O+m*q+p*pe,s[3]=b*E+x*y+M*G+L*V,s[7]=b*A+x*P+M*X+L*ie,s[11]=b*D+x*z+M*H+L*oe,s[15]=b*w+x*O+M*q+L*pe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],f=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+s*l*h-i*c*h-s*o*d+n*c*d+i*o*f-n*l*f)+g*(+t*l*f-t*c*d+s*a*d-i*a*f+i*c*u-s*l*u)+m*(+t*c*h-t*o*f-s*a*h+n*a*f+s*o*u-n*c*u)+p*(-i*o*u-t*l*h+t*o*d+i*a*h-n*a*d+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const 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[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e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+n,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,d=s*c,f=s*u,_=s*h,g=a*u,m=a*h,p=o*h,b=l*c,x=l*u,M=l*h,L=n.x,E=n.y,A=n.z;return i[0]=(1-(g+p))*L,i[1]=(f+M)*L,i[2]=(_-x)*L,i[3]=0,i[4]=(f-M)*E,i[5]=(1-(d+p))*E,i[6]=(m+b)*E,i[7]=0,i[8]=(_+x)*A,i[9]=(m-b)*A,i[10]=(1-(d+g))*A,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=gi.set(i[0],i[1],i[2]).length();const a=gi.set(i[4],i[5],i[6]).length(),o=gi.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],rn.copy(this);const c=1/s,u=1/a,h=1/o;return rn.elements[0]*=c,rn.elements[1]*=c,rn.elements[2]*=c,rn.elements[4]*=u,rn.elements[5]*=u,rn.elements[6]*=u,rn.elements[8]*=h,rn.elements[9]*=h,rn.elements[10]*=h,t.setFromRotationMatrix(rn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=Rn){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let f,_;if(o===Rn)f=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Mr)f=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Rn){const l=this.elements,c=1/(t-e),u=1/(n-i),h=1/(a-s),d=(t+e)*c,f=(n+i)*u;let _,g;if(o===Rn)_=(a+s)*h,g=-2*h;else if(o===Mr)_=s*h,g=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=g,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[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 gi=new T,rn=new fe,Xu=new T(0,0,0),ju=new T(1,1,1),On=new T,Ns=new T,Wt=new T,rl=new fe,al=new pt;class mt{constructor(e=0,t=0,n=0,i=mt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(At(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-At(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(At(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-At(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(At(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-At(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),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 rl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rl,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return al.setFromEuler(this),this.setFromQuaternion(al,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}}mt.DEFAULT_ORDER="XYZ";class Fc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(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(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),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(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),_.length>0&&(n.nodes=_)}return n.object=i,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){an.subVectors(i,t),Sn.subVectors(n,t),ta.subVectors(e,t);const a=an.dot(an),o=an.dot(Sn),l=an.dot(ta),c=Sn.dot(Sn),u=Sn.dot(ta),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,f=(c*l-o*u)*d,_=(a*u-o*l)*d;return s.set(1-f-_,_,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,bn)===null?!1:bn.x>=0&&bn.y>=0&&bn.x+bn.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,bn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,bn.x),l.addScaledVector(a,bn.y),l.addScaledVector(o,bn.z),l)}static isFrontFacing(e,t,n,i){return an.subVectors(n,t),Sn.subVectors(e,t),an.cross(Sn).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 an.subVectors(this.c,this.b),Sn.subVectors(this.a,this.b),an.cross(Sn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return pn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return pn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return pn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return pn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;yi.subVectors(i,n),Mi.subVectors(s,n),na.subVectors(e,n);const l=yi.dot(na),c=Mi.dot(na);if(l<=0&&c<=0)return t.copy(n);ia.subVectors(e,i);const u=yi.dot(ia),h=Mi.dot(ia);if(u>=0&&h<=u)return t.copy(i);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(yi,a);sa.subVectors(e,s);const f=yi.dot(sa),_=Mi.dot(sa);if(_>=0&&f<=_)return t.copy(s);const g=f*c-l*_;if(g<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(Mi,o);const m=u*_-f*h;if(m<=0&&h-u>=0&&f-_>=0)return dl.subVectors(s,i),o=(h-u)/(h-u+(f-_)),t.copy(i).addScaledVector(dl,o);const p=1/(m+g+d);return a=g*p,o=d*p,t.copy(n).addScaledVector(yi,a).addScaledVector(Mi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Oc={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},Bn={h:0,s:0,l:0},Os={h:0,s:0,l:0};function ra(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 ge{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=Mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ke.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ke.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ke.workingColorSpace){if(e=To(e,1),t=At(t,0,1),n=At(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=ra(a,s,e+1/3),this.g=ra(a,s,e),this.b=ra(a,s,e-1/3)}return Ke.toWorkingColorSpace(this,i),this}setStyle(e,t=Mt){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 a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Mt){const n=Oc[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=ki(e.r),this.g=ki(e.g),this.b=ki(e.b),this}copyLinearToSRGB(e){return this.r=jr(e.r),this.g=jr(e.g),this.b=jr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Mt){return Ke.fromWorkingColorSpace(Lt.copy(this),e),Math.round(At(Lt.r*255,0,255))*65536+Math.round(At(Lt.g*255,0,255))*256+Math.round(At(Lt.b*255,0,255))}getHexString(e=Mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ke.workingColorSpace){Ke.fromWorkingColorSpace(Lt.copy(this),t);const n=Lt.r,i=Lt.g,s=Lt.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(i-s)/h+(i0!=e>0&&this.version++,this._alphaTest=e}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"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(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!==Fi&&(n.blending=this.blending),this.side!==Pn&&(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!==Ca&&(n.blendSrc=this.blendSrc),this.blendDst!==Pa&&(n.blendDst=this.blendDst),this.blendEquation!==ii&&(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!==pr&&(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!==Jo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==di&&(n.stencilFail=this.stencilFail),this.stencilZFail!==di&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==di&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Le extends en{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ge(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 mt,this.combine=Ar,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 vt=new T,Bs=new Ne;class kt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ro,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=hn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Bi("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s(e.far-e.near)**2))&&(fl.copy(s).invert(),Zn.copy(e.ray).applyMatrix4(fl),!(n.boundingBox!==null&&Zn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Zn)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,g=d.length;_t.far?null:{distance:c,point:Xs.clone(),object:r}}function js(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,bi),r.getVertexPosition(l,wi),r.getVertexPosition(c,Ti);const u=Qu(r,e,t,n,bi,wi,Ti,Ws);if(u){i&&(Hs.fromBufferAttribute(i,o),Vs.fromBufferAttribute(i,l),Gs.fromBufferAttribute(i,c),u.uv=pn.getInterpolation(Ws,bi,wi,Ti,Hs,Vs,Gs,new Ne)),s&&(Hs.fromBufferAttribute(s,o),Vs.fromBufferAttribute(s,l),Gs.fromBufferAttribute(s,c),u.uv1=pn.getInterpolation(Ws,bi,wi,Ti,Hs,Vs,Gs,new Ne)),a&&(ml.fromBufferAttribute(a,o),_l.fromBufferAttribute(a,l),gl.fromBufferAttribute(a,c),u.normal=pn.getInterpolation(Ws,bi,wi,Ti,ml,_l,gl,new T),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new T,materialIndex:0};pn.getNormal(bi,wi,Ti,h.normal),u.face=h}return u}class ze extends zt{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let d=0,f=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,i,a,2),_("x","z","y",1,-1,e,n,-t,i,a,3),_("x","y","z",1,-1,e,t,n,i,s,4),_("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new gt(c,3)),this.setAttribute("normal",new gt(u,3)),this.setAttribute("uv",new gt(h,2));function _(g,m,p,b,x,M,L,E,A,D,w){const y=M/A,P=L/D,z=M/2,O=L/2,G=E/2,X=A+1,H=D+1;let q=0,V=0;const ie=new T;for(let oe=0;oe0?1:-1,u.push(ie.x,ie.y,ie.z),h.push(Oe/A),h.push(1-oe/D),q+=1}}for(let oe=0;oe0&&(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 zl extends it{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new fe,this.projectionMatrix=new fe,this.projectionMatrixInverse=new fe,this.coordinateSystem=Rn}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 kn=new T,xc=new Ne,vc=new Ne;class Dt extends zl{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=ji*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ds*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ji*2*Math.atan(Math.tan(ds*.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){kn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(kn.x,kn.y).multiplyScalar(-e/kn.z),kn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(kn.x,kn.y).multiplyScalar(-e/kn.z)}getViewSize(e,t){return this.getViewBounds(e,xc,vc),t.subVectors(vc,xc)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ds*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.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 Ei=-90,Ai=1;class sd extends it{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Dt(Ei,Ai,e,t);i.layers=this.layers,this.add(i);const s=new Dt(Ei,Ai,e,t);s.layers=this.layers,this.add(s);const a=new Dt(Ei,Ai,e,t);a.layers=this.layers,this.add(a);const o=new Dt(Ei,Ai,e,t);o.layers=this.layers,this.add(o);const c=new Dt(Ei,Ai,e,t);c.layers=this.layers,this.add(c);const l=new Dt(Ei,Ai,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===Rn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Mr)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,c),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(h,d,f),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Hl extends St{constructor(e,t,n,i,s,a,o,c,l,u){e=e!==void 0?e:[],t=t!==void 0?t:Vi,super(e,t,n,i,s,a,o,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class rd extends ai{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Hl(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:jt}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:` +}`;class jn extends en{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=nd,this.fragmentShader=id,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=qi(e.uniforms),this.uniformsGroups=ed(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 a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class zc extends it{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new fe,this.projectionMatrix=new fe,this.projectionMatrixInverse=new fe,this.coordinateSystem=Rn}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 kn=new T,xl=new Ne,vl=new Ne;class Dt extends zc{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=ji*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(us*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ji*2*Math.atan(Math.tan(us*.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){kn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(kn.x,kn.y).multiplyScalar(-e/kn.z),kn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(kn.x,kn.y).multiplyScalar(-e/kn.z)}getViewSize(e,t){return this.getViewBounds(e,xl,vl),t.subVectors(vl,xl)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(us*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.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 Ei=-90,Ai=1;class sd extends it{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Dt(Ei,Ai,e,t);i.layers=this.layers,this.add(i);const s=new Dt(Ei,Ai,e,t);s.layers=this.layers,this.add(s);const a=new Dt(Ei,Ai,e,t);a.layers=this.layers,this.add(a);const o=new Dt(Ei,Ai,e,t);o.layers=this.layers,this.add(o);const l=new Dt(Ei,Ai,e,t);l.layers=this.layers,this.add(l);const c=new Dt(Ei,Ai,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Rn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Mr)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(h,d,f),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Hc extends St{constructor(e,t,n,i,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Vi,super(e,t,n,i,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class rd extends ai{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Hc(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:jt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -41,7 +41,7 @@ gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new ze(5,5,5),s=new jn({name:"CubemapFromEquirect",uniforms:qi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Bt,blending:Wn});s.uniforms.tEquirect.value=t;const a=new ye(i,s),o=t.minFilter;return t.minFilter===An&&(t.minFilter=jt),new sd(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}const ca=new T,ad=new T,od=new Fe;class ti{constructor(e=new T(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=ca.subVectors(n,t).cross(ad.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(ca),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||od.getNormalMatrix(e),i=this.coplanarPoint(ca).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 $n=new _n,qs=new T;class Ao{constructor(e=new ti,t=new ti,n=new ti,i=new ti,s=new ti,a=new ti){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Rn){const n=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],c=i[3],l=i[4],u=i[5],h=i[6],d=i[7],f=i[8],_=i[9],g=i[10],m=i[11],p=i[12],b=i[13],x=i[14],M=i[15];if(n[0].setComponents(c-s,d-l,m-f,M-p).normalize(),n[1].setComponents(c+s,d+l,m+f,M+p).normalize(),n[2].setComponents(c+a,d+u,m+_,M+b).normalize(),n[3].setComponents(c-a,d-u,m-_,M-b).normalize(),n[4].setComponents(c-o,d-h,m-g,M-x).normalize(),t===Rn)n[5].setComponents(c+o,d+h,m+g,M+x).normalize();else if(t===Mr)n[5].setComponents(o,h,g,x).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(),$n.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),$n.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($n)}intersectsSprite(e){return $n.center.set(0,0,0),$n.radius=.7071067811865476,$n.applyMatrix4(e.matrixWorld),this.intersectsSphere($n)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,qs.y=i.normal.y>0?e.max.y:e.min.y,qs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(qs)<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 Vl(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function cd(r){const e=new WeakMap;function t(o,c){const l=o.array,u=o.usage,h=l.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,l,u),o.onUploadCallback();let f;if(l instanceof Float32Array)f=r.FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=r.SHORT;else if(l instanceof Uint32Array)f=r.UNSIGNED_INT;else if(l instanceof Int32Array)f=r.INT;else if(l instanceof Int8Array)f=r.BYTE;else if(l instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,c,l){const u=c.array,h=c._updateRange,d=c.updateRanges;if(r.bindBuffer(l,o),h.count===-1&&d.length===0&&r.bufferSubData(l,0,u),d.length!==0){for(let f=0,_=d.length;f<_;f++){const g=d[f];r.bufferSubData(l,g.start*u.BYTES_PER_ELEMENT,u,g.start,g.count)}c.clearUpdateRanges()}h.count!==-1&&(r.bufferSubData(l,h.offset*u.BYTES_PER_ELEMENT,u,h.offset,h.count),h.count=-1),c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(r.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version1?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||od.getNormalMatrix(e),i=this.coplanarPoint(la).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 $n=new _n,qs=new T;class Ao{constructor(e=new ti,t=new ti,n=new ti,i=new ti,s=new ti,a=new ti){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Rn){const n=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],u=i[5],h=i[6],d=i[7],f=i[8],_=i[9],g=i[10],m=i[11],p=i[12],b=i[13],x=i[14],M=i[15];if(n[0].setComponents(l-s,d-c,m-f,M-p).normalize(),n[1].setComponents(l+s,d+c,m+f,M+p).normalize(),n[2].setComponents(l+a,d+u,m+_,M+b).normalize(),n[3].setComponents(l-a,d-u,m-_,M-b).normalize(),n[4].setComponents(l-o,d-h,m-g,M-x).normalize(),t===Rn)n[5].setComponents(l+o,d+h,m+g,M+x).normalize();else if(t===Mr)n[5].setComponents(o,h,g,x).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(),$n.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),$n.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($n)}intersectsSprite(e){return $n.center.set(0,0,0),$n.radius=.7071067811865476,$n.applyMatrix4(e.matrixWorld),this.intersectsSphere($n)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,qs.y=i.normal.y>0?e.max.y:e.min.y,qs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(qs)<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 Vc(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function ld(r){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,h=c.byteLength,d=r.createBuffer();r.bindBuffer(l,d),r.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,l,c){const u=l.array,h=l._updateRange,d=l.updateRanges;if(r.bindBuffer(c,o),h.count===-1&&d.length===0&&r.bufferSubData(c,0,u),d.length!==0){for(let f=0,_=d.length;f<_;f++){const g=d[f];r.bufferSubData(c,g.start*u.BYTES_PER_ELEMENT,u,g.start,g.count)}l.clearUpdateRanges()}h.count!==-1&&(r.bufferSubData(c,h.offset*u.BYTES_PER_ELEMENT,u,h.offset,h.count),h.count=-1),l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(r.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version 0 +#endif`,lp=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2532,7 +2532,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ip=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const lp=`varying vec2 vUv; +#endif`;const cp=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; @@ -3586,7 +3586,7 @@ void main() { #include #include #include -}`,ke={alphahash_fragment:ld,alphahash_pars_fragment:hd,alphamap_fragment:ud,alphamap_pars_fragment:dd,alphatest_fragment:fd,alphatest_pars_fragment:pd,aomap_fragment:md,aomap_pars_fragment:_d,batching_pars_vertex:gd,batching_vertex:xd,begin_vertex:vd,beginnormal_vertex:yd,bsdfs:Md,iridescence_fragment:Sd,bumpmap_pars_fragment:bd,clipping_planes_fragment:wd,clipping_planes_pars_fragment:Td,clipping_planes_pars_vertex:Ed,clipping_planes_vertex:Ad,color_fragment:Rd,color_pars_fragment:Cd,color_pars_vertex:Pd,color_vertex:Ld,common:Id,cube_uv_reflection_fragment:Dd,defaultnormal_vertex:Ud,displacementmap_pars_vertex:Nd,displacementmap_vertex:Fd,emissivemap_fragment:Od,emissivemap_pars_fragment:Bd,colorspace_fragment:kd,colorspace_pars_fragment:zd,envmap_fragment:Hd,envmap_common_pars_fragment:Vd,envmap_pars_fragment:Gd,envmap_pars_vertex:Wd,envmap_physical_pars_fragment:tf,envmap_vertex:Xd,fog_vertex:jd,fog_pars_vertex:qd,fog_fragment:Yd,fog_pars_fragment:Kd,gradientmap_pars_fragment:Zd,lightmap_pars_fragment:$d,lights_lambert_fragment:Jd,lights_lambert_pars_fragment:Qd,lights_pars_begin:ef,lights_toon_fragment:nf,lights_toon_pars_fragment:sf,lights_phong_fragment:rf,lights_phong_pars_fragment:af,lights_physical_fragment:of,lights_physical_pars_fragment:cf,lights_fragment_begin:lf,lights_fragment_maps:hf,lights_fragment_end:uf,logdepthbuf_fragment:df,logdepthbuf_pars_fragment:ff,logdepthbuf_pars_vertex:pf,logdepthbuf_vertex:mf,map_fragment:_f,map_pars_fragment:gf,map_particle_fragment:xf,map_particle_pars_fragment:vf,metalnessmap_fragment:yf,metalnessmap_pars_fragment:Mf,morphinstance_vertex:Sf,morphcolor_vertex:bf,morphnormal_vertex:wf,morphtarget_pars_vertex:Tf,morphtarget_vertex:Ef,normal_fragment_begin:Af,normal_fragment_maps:Rf,normal_pars_fragment:Cf,normal_pars_vertex:Pf,normal_vertex:Lf,normalmap_pars_fragment:If,clearcoat_normal_fragment_begin:Df,clearcoat_normal_fragment_maps:Uf,clearcoat_pars_fragment:Nf,iridescence_pars_fragment:Ff,opaque_fragment:Of,packing:Bf,premultiplied_alpha_fragment:kf,project_vertex:zf,dithering_fragment:Hf,dithering_pars_fragment:Vf,roughnessmap_fragment:Gf,roughnessmap_pars_fragment:Wf,shadowmap_pars_fragment:Xf,shadowmap_pars_vertex:jf,shadowmap_vertex:qf,shadowmask_pars_fragment:Yf,skinbase_vertex:Kf,skinning_pars_vertex:Zf,skinning_vertex:$f,skinnormal_vertex:Jf,specularmap_fragment:Qf,specularmap_pars_fragment:ep,tonemapping_fragment:tp,tonemapping_pars_fragment:np,transmission_fragment:ip,transmission_pars_fragment:sp,uv_pars_fragment:rp,uv_pars_vertex:ap,uv_vertex:op,worldpos_vertex:cp,background_vert:lp,background_frag:hp,backgroundCube_vert:up,backgroundCube_frag:dp,cube_vert:fp,cube_frag:pp,depth_vert:mp,depth_frag:_p,distanceRGBA_vert:gp,distanceRGBA_frag:xp,equirect_vert:vp,equirect_frag:yp,linedashed_vert:Mp,linedashed_frag:Sp,meshbasic_vert:bp,meshbasic_frag:wp,meshlambert_vert:Tp,meshlambert_frag:Ep,meshmatcap_vert:Ap,meshmatcap_frag:Rp,meshnormal_vert:Cp,meshnormal_frag:Pp,meshphong_vert:Lp,meshphong_frag:Ip,meshphysical_vert:Dp,meshphysical_frag:Up,meshtoon_vert:Np,meshtoon_frag:Fp,points_vert:Op,points_frag:Bp,shadow_vert:kp,shadow_frag:zp,sprite_vert:Hp,sprite_frag:Vp},re={common:{diffuse:{value:new ge(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Fe}},envmap:{envMap:{value:null},envMapRotation:{value:new Fe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Fe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Fe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Fe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Fe},normalScale:{value:new Ne(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Fe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Fe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Fe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Fe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ge(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 ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0},uvTransform:{value:new Fe}},sprite:{diffuse:{value:new ge(16777215)},opacity:{value:1},center:{value:new Ne(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}}},dn={basic:{uniforms:Nt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:Nt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new ge(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:Nt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new ge(0)},specular:{value:new ge(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:Nt([re.common,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.roughnessmap,re.metalnessmap,re.fog,re.lights,{emissive:{value:new ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:Nt([re.common,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.gradientmap,re.fog,re.lights,{emissive:{value:new ge(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:Nt([re.common,re.bumpmap,re.normalmap,re.displacementmap,re.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:Nt([re.points,re.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:Nt([re.common,re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:Nt([re.common,re.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:Nt([re.common,re.bumpmap,re.normalmap,re.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:Nt([re.sprite,re.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new Fe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Fe}},vertexShader:ke.backgroundCube_vert,fragmentShader:ke.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:Nt([re.common,re.displacementmap,{referencePosition:{value:new T},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:Nt([re.lights,re.fog,{color:{value:new ge(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};dn.physical={uniforms:Nt([dn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Fe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Fe},clearcoatNormalScale:{value:new Ne(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Fe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Fe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Fe},sheen:{value:0},sheenColor:{value:new ge(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Fe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Fe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Fe},transmissionSamplerSize:{value:new Ne},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Fe},attenuationDistance:{value:0},attenuationColor:{value:new ge(0)},specularColor:{value:new ge(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Fe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Fe},anisotropyVector:{value:new Ne},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Fe}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};const Ys={r:0,b:0,g:0},Jn=new mt,Gp=new fe;function Wp(r,e,t,n,i,s,a){const o=new ge(0);let c=s===!0?0:1,l,u,h=null,d=0,f=null;function _(b){let x=b.isScene===!0?b.background:null;return x&&x.isTexture&&(x=(b.backgroundBlurriness>0?t:e).get(x)),x}function g(b){let x=!1;const M=_(b);M===null?p(o,c):M&&M.isColor&&(p(M,1),x=!0);const L=r.xr.getEnvironmentBlendMode();L==="additive"?n.buffers.color.setClear(0,0,0,1,a):L==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function m(b,x){const M=_(x);M&&(M.isCubeTexture||M.mapping===Rr)?(u===void 0&&(u=new ye(new ze(1,1,1),new jn({name:"BackgroundCubeMaterial",uniforms:qi(dn.backgroundCube.uniforms),vertexShader:dn.backgroundCube.vertexShader,fragmentShader:dn.backgroundCube.fragmentShader,side:Bt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(L,E,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Jn.copy(x.backgroundRotation),Jn.x*=-1,Jn.y*=-1,Jn.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(Jn.y*=-1,Jn.z*=-1),u.material.uniforms.envMap.value=M,u.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Gp.makeRotationFromEuler(Jn)),u.material.toneMapped=Ke.getTransfer(M.colorSpace)!==at,(h!==M||d!==M.version||f!==r.toneMapping)&&(u.material.needsUpdate=!0,h=M,d=M.version,f=r.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new ye(new ws(2,2),new jn({name:"BackgroundMaterial",uniforms:qi(dn.background.uniforms),vertexShader:dn.background.vertexShader,fragmentShader:dn.background.fragmentShader,side:Pn,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,l.material.toneMapped=Ke.getTransfer(M.colorSpace)!==at,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||f!==r.toneMapping)&&(l.material.needsUpdate=!0,h=M,d=M.version,f=r.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null))}function p(b,x){b.getRGB(Ys,kl(r)),n.buffers.color.setClear(Ys.r,Ys.g,Ys.b,x,a)}return{getClearColor:function(){return o},setClearColor:function(b,x=1){o.set(b),c=x,p(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(b){c=b,p(o,c)},render:g,addToRenderList:m}}function Xp(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(y,P,z,O,G){let X=!1;const H=h(O,z,P);s!==H&&(s=H,l(s.object)),X=f(y,O,z,G),X&&_(y,O,z,G),G!==null&&e.update(G,r.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,M(y,P,z,O),G!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function c(){return r.createVertexArray()}function l(y){return r.bindVertexArray(y)}function u(y){return r.deleteVertexArray(y)}function h(y,P,z){const O=z.wireframe===!0;let G=n[y.id];G===void 0&&(G={},n[y.id]=G);let X=G[P.id];X===void 0&&(X={},G[P.id]=X);let H=X[O];return H===void 0&&(H=d(c()),X[O]=H),H}function d(y){const P=[],z=[],O=[];for(let G=0;G=0){const oe=G[V];let pe=X[V];if(pe===void 0&&(V==="instanceMatrix"&&y.instanceMatrix&&(pe=y.instanceMatrix),V==="instanceColor"&&y.instanceColor&&(pe=y.instanceColor)),oe===void 0||oe.attribute!==pe||pe&&oe.data!==pe.data)return!0;H++}return s.attributesNum!==H||s.index!==O}function _(y,P,z,O){const G={},X=P.attributes;let H=0;const q=z.getAttributes();for(const V in q)if(q[V].location>=0){let oe=X[V];oe===void 0&&(V==="instanceMatrix"&&y.instanceMatrix&&(oe=y.instanceMatrix),V==="instanceColor"&&y.instanceColor&&(oe=y.instanceColor));const pe={};pe.attribute=oe,oe&&oe.data&&(pe.data=oe.data),G[V]=pe,H++}s.attributes=G,s.attributesNum=H,s.index=O}function g(){const y=s.newAttributes;for(let P=0,z=y.length;P=0){let ie=G[q];if(ie===void 0&&(q==="instanceMatrix"&&y.instanceMatrix&&(ie=y.instanceMatrix),q==="instanceColor"&&y.instanceColor&&(ie=y.instanceColor)),ie!==void 0){const oe=ie.normalized,pe=ie.itemSize,Oe=e.get(ie);if(Oe===void 0)continue;const He=Oe.buffer,W=Oe.type,J=Oe.bytesPerElement,ce=W===r.INT||W===r.UNSIGNED_INT||ie.gpuType===_o;if(ie.isInterleavedBufferAttribute){const ae=ie.data,Ae=ae.stride,Ce=ie.offset;if(ae.isInstancedInterleavedBuffer){for(let Be=0;Be0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";E="mediump"}return E==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const u=c(l);u!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const h=t.logarithmicDepthBuffer===!0,d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),p=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),b=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),M=f>0,L=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:f,maxTextureSize:_,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:p,maxVaryings:b,maxFragmentUniforms:x,vertexTextures:M,maxSamples:L}}function Yp(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new ti,o=new Fe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||n!==0||i;return i=d,n=h.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const _=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,p=r.get(h);if(!i||_===null||_.length===0||s&&!m)s?u(null):l();else{const b=s?0:n,x=b*4;let M=p.clippingState||null;c.value=M,M=u(_,d,x,f);for(let L=0;L!==x;++L)M[L]=t[L];p.clippingState=M,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=b}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,_){const g=h!==null?h.length:0;let m=null;if(g!==0){if(m=c.value,_!==!0||m===null){const p=f+g*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length0){const l=new rd(c.height);return l.fromEquirectangularTexture(r,a),e.set(a,l),a.addEventListener("dispose",i),t(l.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ir extends zl{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,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}}const Di=4,yc=[.125,.215,.35,.446,.526,.582],si=20,la=new Ir,Mc=new ge;let ha=null,ua=0,da=0,fa=!1;const ni=(1+Math.sqrt(5))/2,Ri=1/ni,Sc=[new T(-ni,Ri,0),new T(ni,Ri,0),new T(-Ri,0,ni),new T(Ri,0,ni),new T(0,ni,-Ri),new T(0,ni,Ri),new T(-1,1,-1),new T(1,1,-1),new T(-1,1,1),new T(1,1,1)];class bc{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){ha=this._renderer.getRenderTarget(),ua=this._renderer.getActiveCubeFace(),da=this._renderer.getActiveMipmapLevel(),fa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ec(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Tc(),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;e2?x:0,x,x),u.setRenderTarget(i),g&&u.render(_,o),u.render(e,o)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Vi||e.mapping===Gi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ec()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Tc());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new ye(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;Ks(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,la)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;ssi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${si}`);const p=[];let b=0;for(let A=0;Ax-Di?i-x+Di:0),E=4*(this._cubeSize-M);Ks(t,L,E,3*M,2*M),c.setRenderTarget(t),c.render(h,la)}}function Zp(r){const e=[],t=[],n=[];let i=r;const s=r-Di+1+yc.length;for(let a=0;ar-Di?c=yc[a-r+Di-1]:a===0&&(c=0),n.push(c);const l=1/(o-2),u=-l,h=1+l,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,_=6,g=3,m=2,p=1,b=new Float32Array(g*_*f),x=new Float32Array(m*_*f),M=new Float32Array(p*_*f);for(let E=0;E2?0:-1,w=[A,D,0,A+2/3,D,0,A+2/3,D+1,0,A,D,0,A+2/3,D+1,0,A,D+1,0];b.set(w,g*_*E),x.set(d,m*_*E);const y=[E,E,E,E,E,E];M.set(y,p*_*E)}const L=new zt;L.setAttribute("position",new kt(b,g)),L.setAttribute("uv",new kt(x,m)),L.setAttribute("faceIndex",new kt(M,p)),e.push(L),i>Di&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function wc(r,e,t){const n=new ai(r,e,t);return n.texture.mapping=Rr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ks(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function $p(r,e,t){const n=new Float32Array(si),i=new T(0,1,0);return new jn({name:"SphericalGaussianBlur",defines:{n:si,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:Ro(),fragmentShader:` +}`,ke={alphahash_fragment:cd,alphahash_pars_fragment:hd,alphamap_fragment:ud,alphamap_pars_fragment:dd,alphatest_fragment:fd,alphatest_pars_fragment:pd,aomap_fragment:md,aomap_pars_fragment:_d,batching_pars_vertex:gd,batching_vertex:xd,begin_vertex:vd,beginnormal_vertex:yd,bsdfs:Md,iridescence_fragment:Sd,bumpmap_pars_fragment:bd,clipping_planes_fragment:wd,clipping_planes_pars_fragment:Td,clipping_planes_pars_vertex:Ed,clipping_planes_vertex:Ad,color_fragment:Rd,color_pars_fragment:Cd,color_pars_vertex:Pd,color_vertex:Ld,common:Id,cube_uv_reflection_fragment:Dd,defaultnormal_vertex:Ud,displacementmap_pars_vertex:Nd,displacementmap_vertex:Fd,emissivemap_fragment:Od,emissivemap_pars_fragment:Bd,colorspace_fragment:kd,colorspace_pars_fragment:zd,envmap_fragment:Hd,envmap_common_pars_fragment:Vd,envmap_pars_fragment:Gd,envmap_pars_vertex:Wd,envmap_physical_pars_fragment:tf,envmap_vertex:Xd,fog_vertex:jd,fog_pars_vertex:qd,fog_fragment:Yd,fog_pars_fragment:Kd,gradientmap_pars_fragment:Zd,lightmap_pars_fragment:$d,lights_lambert_fragment:Jd,lights_lambert_pars_fragment:Qd,lights_pars_begin:ef,lights_toon_fragment:nf,lights_toon_pars_fragment:sf,lights_phong_fragment:rf,lights_phong_pars_fragment:af,lights_physical_fragment:of,lights_physical_pars_fragment:lf,lights_fragment_begin:cf,lights_fragment_maps:hf,lights_fragment_end:uf,logdepthbuf_fragment:df,logdepthbuf_pars_fragment:ff,logdepthbuf_pars_vertex:pf,logdepthbuf_vertex:mf,map_fragment:_f,map_pars_fragment:gf,map_particle_fragment:xf,map_particle_pars_fragment:vf,metalnessmap_fragment:yf,metalnessmap_pars_fragment:Mf,morphinstance_vertex:Sf,morphcolor_vertex:bf,morphnormal_vertex:wf,morphtarget_pars_vertex:Tf,morphtarget_vertex:Ef,normal_fragment_begin:Af,normal_fragment_maps:Rf,normal_pars_fragment:Cf,normal_pars_vertex:Pf,normal_vertex:Lf,normalmap_pars_fragment:If,clearcoat_normal_fragment_begin:Df,clearcoat_normal_fragment_maps:Uf,clearcoat_pars_fragment:Nf,iridescence_pars_fragment:Ff,opaque_fragment:Of,packing:Bf,premultiplied_alpha_fragment:kf,project_vertex:zf,dithering_fragment:Hf,dithering_pars_fragment:Vf,roughnessmap_fragment:Gf,roughnessmap_pars_fragment:Wf,shadowmap_pars_fragment:Xf,shadowmap_pars_vertex:jf,shadowmap_vertex:qf,shadowmask_pars_fragment:Yf,skinbase_vertex:Kf,skinning_pars_vertex:Zf,skinning_vertex:$f,skinnormal_vertex:Jf,specularmap_fragment:Qf,specularmap_pars_fragment:ep,tonemapping_fragment:tp,tonemapping_pars_fragment:np,transmission_fragment:ip,transmission_pars_fragment:sp,uv_pars_fragment:rp,uv_pars_vertex:ap,uv_vertex:op,worldpos_vertex:lp,background_vert:cp,background_frag:hp,backgroundCube_vert:up,backgroundCube_frag:dp,cube_vert:fp,cube_frag:pp,depth_vert:mp,depth_frag:_p,distanceRGBA_vert:gp,distanceRGBA_frag:xp,equirect_vert:vp,equirect_frag:yp,linedashed_vert:Mp,linedashed_frag:Sp,meshbasic_vert:bp,meshbasic_frag:wp,meshlambert_vert:Tp,meshlambert_frag:Ep,meshmatcap_vert:Ap,meshmatcap_frag:Rp,meshnormal_vert:Cp,meshnormal_frag:Pp,meshphong_vert:Lp,meshphong_frag:Ip,meshphysical_vert:Dp,meshphysical_frag:Up,meshtoon_vert:Np,meshtoon_frag:Fp,points_vert:Op,points_frag:Bp,shadow_vert:kp,shadow_frag:zp,sprite_vert:Hp,sprite_frag:Vp},re={common:{diffuse:{value:new ge(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Fe}},envmap:{envMap:{value:null},envMapRotation:{value:new Fe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Fe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Fe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Fe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Fe},normalScale:{value:new Ne(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Fe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Fe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Fe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Fe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ge(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 ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0},uvTransform:{value:new Fe}},sprite:{diffuse:{value:new ge(16777215)},opacity:{value:1},center:{value:new Ne(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Fe},alphaMap:{value:null},alphaMapTransform:{value:new Fe},alphaTest:{value:0}}},dn={basic:{uniforms:Nt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:Nt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new ge(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:Nt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new ge(0)},specular:{value:new ge(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:Nt([re.common,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.roughnessmap,re.metalnessmap,re.fog,re.lights,{emissive:{value:new ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:Nt([re.common,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.gradientmap,re.fog,re.lights,{emissive:{value:new ge(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:Nt([re.common,re.bumpmap,re.normalmap,re.displacementmap,re.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:Nt([re.points,re.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:Nt([re.common,re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:Nt([re.common,re.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:Nt([re.common,re.bumpmap,re.normalmap,re.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:Nt([re.sprite,re.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new Fe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Fe}},vertexShader:ke.backgroundCube_vert,fragmentShader:ke.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:Nt([re.common,re.displacementmap,{referencePosition:{value:new T},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:Nt([re.lights,re.fog,{color:{value:new ge(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};dn.physical={uniforms:Nt([dn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Fe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Fe},clearcoatNormalScale:{value:new Ne(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Fe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Fe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Fe},sheen:{value:0},sheenColor:{value:new ge(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Fe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Fe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Fe},transmissionSamplerSize:{value:new Ne},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Fe},attenuationDistance:{value:0},attenuationColor:{value:new ge(0)},specularColor:{value:new ge(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Fe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Fe},anisotropyVector:{value:new Ne},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Fe}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};const Ys={r:0,b:0,g:0},Jn=new mt,Gp=new fe;function Wp(r,e,t,n,i,s,a){const o=new ge(0);let l=s===!0?0:1,c,u,h=null,d=0,f=null;function _(b){let x=b.isScene===!0?b.background:null;return x&&x.isTexture&&(x=(b.backgroundBlurriness>0?t:e).get(x)),x}function g(b){let x=!1;const M=_(b);M===null?p(o,l):M&&M.isColor&&(p(M,1),x=!0);const L=r.xr.getEnvironmentBlendMode();L==="additive"?n.buffers.color.setClear(0,0,0,1,a):L==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function m(b,x){const M=_(x);M&&(M.isCubeTexture||M.mapping===Rr)?(u===void 0&&(u=new ye(new ze(1,1,1),new jn({name:"BackgroundCubeMaterial",uniforms:qi(dn.backgroundCube.uniforms),vertexShader:dn.backgroundCube.vertexShader,fragmentShader:dn.backgroundCube.fragmentShader,side:Bt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(L,E,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Jn.copy(x.backgroundRotation),Jn.x*=-1,Jn.y*=-1,Jn.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(Jn.y*=-1,Jn.z*=-1),u.material.uniforms.envMap.value=M,u.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Gp.makeRotationFromEuler(Jn)),u.material.toneMapped=Ke.getTransfer(M.colorSpace)!==at,(h!==M||d!==M.version||f!==r.toneMapping)&&(u.material.needsUpdate=!0,h=M,d=M.version,f=r.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new ye(new bs(2,2),new jn({name:"BackgroundMaterial",uniforms:qi(dn.background.uniforms),vertexShader:dn.background.vertexShader,fragmentShader:dn.background.fragmentShader,side:Pn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=Ke.getTransfer(M.colorSpace)!==at,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,h=M,d=M.version,f=r.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function p(b,x){b.getRGB(Ys,kc(r)),n.buffers.color.setClear(Ys.r,Ys.g,Ys.b,x,a)}return{getClearColor:function(){return o},setClearColor:function(b,x=1){o.set(b),l=x,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,p(o,l)},render:g,addToRenderList:m}}function Xp(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(y,P,z,O,G){let X=!1;const H=h(O,z,P);s!==H&&(s=H,c(s.object)),X=f(y,O,z,G),X&&_(y,O,z,G),G!==null&&e.update(G,r.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,M(y,P,z,O),G!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return r.createVertexArray()}function c(y){return r.bindVertexArray(y)}function u(y){return r.deleteVertexArray(y)}function h(y,P,z){const O=z.wireframe===!0;let G=n[y.id];G===void 0&&(G={},n[y.id]=G);let X=G[P.id];X===void 0&&(X={},G[P.id]=X);let H=X[O];return H===void 0&&(H=d(l()),X[O]=H),H}function d(y){const P=[],z=[],O=[];for(let G=0;G=0){const oe=G[V];let pe=X[V];if(pe===void 0&&(V==="instanceMatrix"&&y.instanceMatrix&&(pe=y.instanceMatrix),V==="instanceColor"&&y.instanceColor&&(pe=y.instanceColor)),oe===void 0||oe.attribute!==pe||pe&&oe.data!==pe.data)return!0;H++}return s.attributesNum!==H||s.index!==O}function _(y,P,z,O){const G={},X=P.attributes;let H=0;const q=z.getAttributes();for(const V in q)if(q[V].location>=0){let oe=X[V];oe===void 0&&(V==="instanceMatrix"&&y.instanceMatrix&&(oe=y.instanceMatrix),V==="instanceColor"&&y.instanceColor&&(oe=y.instanceColor));const pe={};pe.attribute=oe,oe&&oe.data&&(pe.data=oe.data),G[V]=pe,H++}s.attributes=G,s.attributesNum=H,s.index=O}function g(){const y=s.newAttributes;for(let P=0,z=y.length;P=0){let ie=G[q];if(ie===void 0&&(q==="instanceMatrix"&&y.instanceMatrix&&(ie=y.instanceMatrix),q==="instanceColor"&&y.instanceColor&&(ie=y.instanceColor)),ie!==void 0){const oe=ie.normalized,pe=ie.itemSize,Oe=e.get(ie);if(Oe===void 0)continue;const He=Oe.buffer,W=Oe.type,J=Oe.bytesPerElement,le=W===r.INT||W===r.UNSIGNED_INT||ie.gpuType===_o;if(ie.isInterleavedBufferAttribute){const ae=ie.data,Ae=ae.stride,Ce=ie.offset;if(ae.isInstancedInterleavedBuffer){for(let Be=0;Be0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";E="mediump"}return E==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),p=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),b=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),M=f>0,L=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:f,maxTextureSize:_,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:p,maxVaryings:b,maxFragmentUniforms:x,vertexTextures:M,maxSamples:L}}function Yp(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new ti,o=new Fe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||n!==0||i;return i=d,n=h.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const _=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,p=r.get(h);if(!i||_===null||_.length===0||s&&!m)s?u(null):c();else{const b=s?0:n,x=b*4;let M=p.clippingState||null;l.value=M,M=u(_,d,x,f);for(let L=0;L!==x;++L)M[L]=t[L];p.clippingState=M,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,_){const g=h!==null?h.length:0;let m=null;if(g!==0){if(m=l.value,_!==!0||m===null){const p=f+g*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length0){const c=new rd(l.height);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ir extends zc{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Di=4,yl=[.125,.215,.35,.446,.526,.582],si=20,ca=new Ir,Ml=new ge;let ha=null,ua=0,da=0,fa=!1;const ni=(1+Math.sqrt(5))/2,Ri=1/ni,Sl=[new T(-ni,Ri,0),new T(ni,Ri,0),new T(-Ri,0,ni),new T(Ri,0,ni),new T(0,ni,-Ri),new T(0,ni,Ri),new T(-1,1,-1),new T(1,1,-1),new T(-1,1,1),new T(1,1,1)];class bl{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){ha=this._renderer.getRenderTarget(),ua=this._renderer.getActiveCubeFace(),da=this._renderer.getActiveMipmapLevel(),fa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=El(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Tl(),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;e2?x:0,x,x),u.setRenderTarget(i),g&&u.render(_,o),u.render(e,o)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Vi||e.mapping===Gi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=El()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Tl());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new ye(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Ks(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,ca)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;ssi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${si}`);const p=[];let b=0;for(let A=0;Ax-Di?i-x+Di:0),E=4*(this._cubeSize-M);Ks(t,L,E,3*M,2*M),l.setRenderTarget(t),l.render(h,ca)}}function Zp(r){const e=[],t=[],n=[];let i=r;const s=r-Di+1+yl.length;for(let a=0;ar-Di?l=yl[a-r+Di-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,_=6,g=3,m=2,p=1,b=new Float32Array(g*_*f),x=new Float32Array(m*_*f),M=new Float32Array(p*_*f);for(let E=0;E2?0:-1,w=[A,D,0,A+2/3,D,0,A+2/3,D+1,0,A,D,0,A+2/3,D+1,0,A,D+1,0];b.set(w,g*_*E),x.set(d,m*_*E);const y=[E,E,E,E,E,E];M.set(y,p*_*E)}const L=new zt;L.setAttribute("position",new kt(b,g)),L.setAttribute("uv",new kt(x,m)),L.setAttribute("faceIndex",new kt(M,p)),e.push(L),i>Di&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function wl(r,e,t){const n=new ai(r,e,t);return n.texture.mapping=Rr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ks(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function $p(r,e,t){const n=new Float32Array(si),i=new T(0,1,0);return new jn({name:"SphericalGaussianBlur",defines:{n:si,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:Ro(),fragmentShader:` precision mediump float; precision mediump int; @@ -3646,7 +3646,7 @@ void main() { } } - `,blending:Wn,depthTest:!1,depthWrite:!1})}function Tc(){return new jn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ro(),fragmentShader:` + `,blending:Wn,depthTest:!1,depthWrite:!1})}function Tl(){return new jn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ro(),fragmentShader:` precision mediump float; precision mediump int; @@ -3665,7 +3665,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:Wn,depthTest:!1,depthWrite:!1})}function Ec(){return new jn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ro(),fragmentShader:` + `,blending:Wn,depthTest:!1,depthWrite:!1})}function El(){return new jn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ro(),fragmentShader:` precision mediump float; precision mediump int; @@ -3736,16 +3736,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function Jp(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===mr||c===La,u=c===Vi||c===Gi;if(l||u){let h=e.get(o);const d=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new bc(r)),h=l?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const f=o.image;return l&&f&&f.height>0||u&&f&&i(f)?(t===null&&(t=new bc(r)),h=l?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function i(o){let c=0;const l=6;for(let u=0;ue.maxTextureSize&&(E=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const A=new Float32Array(L*E*4*h),D=new Nl(A,L,E,h);D.type=hn,D.needsUpdate=!0;const w=M*4;for(let P=0;P0)return r;const i=e*t;let s=Rc[i];if(s===void 0&&(s=new Float32Array(i),Rc[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function wt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0||u&&f&&i(f)?(t===null&&(t=new bl(r)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function i(o){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(E=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const A=new Float32Array(L*E*4*h),D=new Nc(A,L,E,h);D.type=hn,D.needsUpdate=!0;const w=M*4;for(let P=0;P0)return r;const i=e*t;let s=Rl[i];if(s===void 0&&(s=new Float32Array(i),Rl[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function wt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${o}: ${t[a]}`)}return n.join(` -`)}function Jm(r){const e=Ke.getPrimaries(Ke.workingColorSpace),t=Ke.getPrimaries(r);let n;switch(e===t?n="":e===yr&&t===vr?n="LinearDisplayP3ToLinearSRGB":e===vr&&t===yr&&(n="LinearSRGBToLinearDisplayP3"),r){case Ct:case Pr:return[n,"LinearTransferOETF"];case Mt:case wo:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function Nc(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 a=parseInt(s[1]);return t.toUpperCase()+` +`)}function Jm(r){const e=Ke.getPrimaries(Ke.workingColorSpace),t=Ke.getPrimaries(r);let n;switch(e===t?n="":e===yr&&t===vr?n="LinearDisplayP3ToLinearSRGB":e===vr&&t===yr&&(n="LinearSRGBToLinearDisplayP3"),r){case Ct:case Pr:return[n,"LinearTransferOETF"];case Mt:case wo:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function Nl(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 a=parseInt(s[1]);return t.toUpperCase()+` `+i+` `+$m(r.getShaderSource(e),a)}else return i}function Qm(r,e){const t=Jm(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function e_(r,e){let t;switch(e){case $h:t="Linear";break;case Jh:t="Reinhard";break;case Qh:t="OptimizedCineon";break;case eu:t="ACESFilmic";break;case nu:t="AgX";break;case iu:t="Neutral";break;case tu:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Zs=new T;function t_(){Ke.getLuminanceCoefficients(Zs);const r=Zs.x.toFixed(4),e=Zs.y.toFixed(4),t=Zs.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function n_(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(us).join(` +`)}function n_(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(hs).join(` `)}function i_(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function s_(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function ao(r){return r.replace(r_,o_)}const a_=new Map;function o_(r,e){let t=ke[e];if(t===void 0){const n=a_.get(e);if(n!==void 0)t=ke[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 ao(t)}const c_=/#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 Bc(r){return r.replace(c_,l_)}function l_(r,e,t,n){let i="";for(let s=parseInt(e);s/gm;function ao(r){return r.replace(r_,o_)}const a_=new Map;function o_(r,e){let t=ke[e];if(t===void 0){const n=a_.get(e);if(n!==void 0)t=ke[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 ao(t)}const l_=/#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 Bl(r){return r.replace(l_,c_)}function c_(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(m+=` -`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(us).join(` +`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(hs).join(` `),p.length>0&&(p+=` -`)):(m=[kc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(us).join(` -`),p=[kc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Xn?"#define TONE_MAPPING":"",t.toneMapping!==Xn?ke.tonemapping_pars_fragment:"",t.toneMapping!==Xn?e_("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.colorspace_pars_fragment,Qm("linearToOutputTexel",t.outputColorSpace),t_(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(us).join(` -`)),a=ao(a),a=Fc(a,t),a=Oc(a,t),o=ao(o),o=Fc(o,t),o=Oc(o,t),a=Bc(a),o=Bc(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es +`)):(m=[kl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&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 "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(hs).join(` +`),p=[kl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Xn?"#define TONE_MAPPING":"",t.toneMapping!==Xn?ke.tonemapping_pars_fragment:"",t.toneMapping!==Xn?e_("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.colorspace_pars_fragment,Qm("linearToOutputTexel",t.outputColorSpace),t_(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(hs).join(` +`)),a=ao(a),a=Fl(a,t),a=Ol(a,t),o=ao(o),o=Fl(o,t),o=Ol(o,t),a=Bl(a),o=Bl(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es `,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+m,p=["#define varying in",t.glslVersion===Qo?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Qo?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+p);const x=b+m+a,M=b+p+o,L=Uc(i,i.VERTEX_SHADER,x),E=Uc(i,i.FRAGMENT_SHADER,M);i.attachShader(g,L),i.attachShader(g,E),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function A(P){if(r.debug.checkShaderErrors){const z=i.getProgramInfoLog(g).trim(),O=i.getShaderInfoLog(L).trim(),G=i.getShaderInfoLog(E).trim();let X=!0,H=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(X=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,L,E);else{const q=Nc(i,L,"vertex"),V=Nc(i,E,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+` +`+p);const x=b+m+a,M=b+p+o,L=Ul(i,i.VERTEX_SHADER,x),E=Ul(i,i.FRAGMENT_SHADER,M);i.attachShader(g,L),i.attachShader(g,E),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function A(P){if(r.debug.checkShaderErrors){const z=i.getProgramInfoLog(g).trim(),O=i.getShaderInfoLog(L).trim(),G=i.getShaderInfoLog(E).trim();let X=!0,H=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(X=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,L,E);else{const q=Nl(i,L,"vertex"),V=Nl(i,E,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+` Material Name: `+P.name+` Material Type: `+P.type+` Program Info Log: `+z+` `+q+` -`+V)}else z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",z):(O===""||G==="")&&(H=!1);H&&(P.diagnostics={runnable:X,programLog:z,vertexShader:{log:O,prefix:m},fragmentShader:{log:G,prefix:p}})}i.deleteShader(L),i.deleteShader(E),D=new fr(i,g),w=s_(i,g)}let D;this.getUniforms=function(){return D===void 0&&A(this),D};let w;this.getAttributes=function(){return w===void 0&&A(this),w};let y=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return y===!1&&(y=i.getProgramParameter(g,Km)),y},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Zm++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=L,this.fragmentShader=E,this}let __=0;class g_{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new x_(e),t.set(e,n)),n}}class x_{constructor(e){this.id=__++,this.code=e,this.usedTimes=0}}function v_(r,e,t,n,i,s,a){const o=new Fl,c=new g_,l=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const _={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 g(w){return l.add(w),w===0?"uv":`uv${w}`}function m(w,y,P,z,O){const G=z.fog,X=O.geometry,H=w.isMeshStandardMaterial?z.environment:null,q=(w.isMeshStandardMaterial?t:e).get(w.envMap||H),V=q&&q.mapping===Rr?q.image.height:null,ie=_[w.type];w.precision!==null&&(f=i.getMaxPrecision(w.precision),f!==w.precision&&console.warn("THREE.WebGLProgram.getParameters:",w.precision,"not supported, using",f,"instead."));const oe=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,pe=oe!==void 0?oe.length:0;let Oe=0;X.morphAttributes.position!==void 0&&(Oe=1),X.morphAttributes.normal!==void 0&&(Oe=2),X.morphAttributes.color!==void 0&&(Oe=3);let He,W,J,ce;if(ie){const Ye=dn[ie];He=Ye.vertexShader,W=Ye.fragmentShader}else He=w.vertexShader,W=w.fragmentShader,c.update(w),J=c.getVertexShaderID(w),ce=c.getFragmentShaderID(w);const ae=r.getRenderTarget(),Ae=O.isInstancedMesh===!0,Ce=O.isBatchedMesh===!0,Be=!!w.map,nt=!!w.matcap,C=!!q,st=!!w.aoMap,$e=!!w.lightMap,qe=!!w.bumpMap,xe=!!w.normalMap,ut=!!w.displacementMap,Te=!!w.emissiveMap,Ie=!!w.metalnessMap,R=!!w.roughnessMap,v=w.anisotropy>0,k=w.clearcoat>0,Z=w.dispersion>0,$=w.iridescence>0,K=w.sheen>0,Me=w.transmission>0,se=v&&!!w.anisotropyMap,ue=k&&!!w.clearcoatMap,De=k&&!!w.clearcoatNormalMap,Q=k&&!!w.clearcoatRoughnessMap,he=$&&!!w.iridescenceMap,We=$&&!!w.iridescenceThicknessMap,be=K&&!!w.sheenColorMap,de=K&&!!w.sheenRoughnessMap,Pe=!!w.specularMap,Ue=!!w.specularColorMap,rt=!!w.specularIntensityMap,I=Me&&!!w.transmissionMap,ee=Me&&!!w.thicknessMap,j=!!w.gradientMap,Y=!!w.alphaMap,te=w.alphaTest>0,we=!!w.alphaHash,Xe=!!w.extensions;let ct=Xn;w.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(ct=r.toneMapping);const yt={shaderID:ie,shaderType:w.type,shaderName:w.name,vertexShader:He,fragmentShader:W,defines:w.defines,customVertexShaderID:J,customFragmentShaderID:ce,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:f,batching:Ce,batchingColor:Ce&&O._colorsTexture!==null,instancing:Ae,instancingColor:Ae&&O.instanceColor!==null,instancingMorph:Ae&&O.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ae===null?r.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:Ct,alphaToCoverage:!!w.alphaToCoverage,map:Be,matcap:nt,envMap:C,envMapMode:C&&q.mapping,envMapCubeUVHeight:V,aoMap:st,lightMap:$e,bumpMap:qe,normalMap:xe,displacementMap:d&&ut,emissiveMap:Te,normalMapObjectSpace:xe&&w.normalMapType===du,normalMapTangentSpace:xe&&w.normalMapType===Cr,metalnessMap:Ie,roughnessMap:R,anisotropy:v,anisotropyMap:se,clearcoat:k,clearcoatMap:ue,clearcoatNormalMap:De,clearcoatRoughnessMap:Q,dispersion:Z,iridescence:$,iridescenceMap:he,iridescenceThicknessMap:We,sheen:K,sheenColorMap:be,sheenRoughnessMap:de,specularMap:Pe,specularColorMap:Ue,specularIntensityMap:rt,transmission:Me,transmissionMap:I,thicknessMap:ee,gradientMap:j,opaque:w.transparent===!1&&w.blending===Fi&&w.alphaToCoverage===!1,alphaMap:Y,alphaTest:te,alphaHash:we,combine:w.combine,mapUv:Be&&g(w.map.channel),aoMapUv:st&&g(w.aoMap.channel),lightMapUv:$e&&g(w.lightMap.channel),bumpMapUv:qe&&g(w.bumpMap.channel),normalMapUv:xe&&g(w.normalMap.channel),displacementMapUv:ut&&g(w.displacementMap.channel),emissiveMapUv:Te&&g(w.emissiveMap.channel),metalnessMapUv:Ie&&g(w.metalnessMap.channel),roughnessMapUv:R&&g(w.roughnessMap.channel),anisotropyMapUv:se&&g(w.anisotropyMap.channel),clearcoatMapUv:ue&&g(w.clearcoatMap.channel),clearcoatNormalMapUv:De&&g(w.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&g(w.clearcoatRoughnessMap.channel),iridescenceMapUv:he&&g(w.iridescenceMap.channel),iridescenceThicknessMapUv:We&&g(w.iridescenceThicknessMap.channel),sheenColorMapUv:be&&g(w.sheenColorMap.channel),sheenRoughnessMapUv:de&&g(w.sheenRoughnessMap.channel),specularMapUv:Pe&&g(w.specularMap.channel),specularColorMapUv:Ue&&g(w.specularColorMap.channel),specularIntensityMapUv:rt&&g(w.specularIntensityMap.channel),transmissionMapUv:I&&g(w.transmissionMap.channel),thicknessMapUv:ee&&g(w.thicknessMap.channel),alphaMapUv:Y&&g(w.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(xe||v),vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!X.attributes.uv&&(Be||Y),fog:!!G,useFog:w.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:w.flatShading===!0,sizeAttenuation:w.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:O.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:pe,morphTextureStride:Oe,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numSpotLightMaps:y.spotLightMap.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numSpotLightShadowsWithMaps:y.numSpotLightShadowsWithMaps,numLightProbes:y.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:w.dithering,shadowMapEnabled:r.shadowMap.enabled&&P.length>0,shadowMapType:r.shadowMap.type,toneMapping:ct,decodeVideoTexture:Be&&w.map.isVideoTexture===!0&&Ke.getTransfer(w.map.colorSpace)===at,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===fn,flipSided:w.side===Bt,useDepthPacking:w.depthPacking>=0,depthPacking:w.depthPacking||0,index0AttributeName:w.index0AttributeName,extensionClipCullDistance:Xe&&w.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Xe&&w.extensions.multiDraw===!0||Ce)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:w.customProgramCacheKey()};return yt.vertexUv1s=l.has(1),yt.vertexUv2s=l.has(2),yt.vertexUv3s=l.has(3),l.clear(),yt}function p(w){const y=[];if(w.shaderID?y.push(w.shaderID):(y.push(w.customVertexShaderID),y.push(w.customFragmentShaderID)),w.defines!==void 0)for(const P in w.defines)y.push(P),y.push(w.defines[P]);return w.isRawShaderMaterial===!1&&(b(y,w),x(y,w),y.push(r.outputColorSpace)),y.push(w.customProgramCacheKey),y.join()}function b(w,y){w.push(y.precision),w.push(y.outputColorSpace),w.push(y.envMapMode),w.push(y.envMapCubeUVHeight),w.push(y.mapUv),w.push(y.alphaMapUv),w.push(y.lightMapUv),w.push(y.aoMapUv),w.push(y.bumpMapUv),w.push(y.normalMapUv),w.push(y.displacementMapUv),w.push(y.emissiveMapUv),w.push(y.metalnessMapUv),w.push(y.roughnessMapUv),w.push(y.anisotropyMapUv),w.push(y.clearcoatMapUv),w.push(y.clearcoatNormalMapUv),w.push(y.clearcoatRoughnessMapUv),w.push(y.iridescenceMapUv),w.push(y.iridescenceThicknessMapUv),w.push(y.sheenColorMapUv),w.push(y.sheenRoughnessMapUv),w.push(y.specularMapUv),w.push(y.specularColorMapUv),w.push(y.specularIntensityMapUv),w.push(y.transmissionMapUv),w.push(y.thicknessMapUv),w.push(y.combine),w.push(y.fogExp2),w.push(y.sizeAttenuation),w.push(y.morphTargetsCount),w.push(y.morphAttributeCount),w.push(y.numDirLights),w.push(y.numPointLights),w.push(y.numSpotLights),w.push(y.numSpotLightMaps),w.push(y.numHemiLights),w.push(y.numRectAreaLights),w.push(y.numDirLightShadows),w.push(y.numPointLightShadows),w.push(y.numSpotLightShadows),w.push(y.numSpotLightShadowsWithMaps),w.push(y.numLightProbes),w.push(y.shadowMapType),w.push(y.toneMapping),w.push(y.numClippingPlanes),w.push(y.numClipIntersection),w.push(y.depthPacking)}function x(w,y){o.disableAll(),y.supportsVertexTextures&&o.enable(0),y.instancing&&o.enable(1),y.instancingColor&&o.enable(2),y.instancingMorph&&o.enable(3),y.matcap&&o.enable(4),y.envMap&&o.enable(5),y.normalMapObjectSpace&&o.enable(6),y.normalMapTangentSpace&&o.enable(7),y.clearcoat&&o.enable(8),y.iridescence&&o.enable(9),y.alphaTest&&o.enable(10),y.vertexColors&&o.enable(11),y.vertexAlphas&&o.enable(12),y.vertexUv1s&&o.enable(13),y.vertexUv2s&&o.enable(14),y.vertexUv3s&&o.enable(15),y.vertexTangents&&o.enable(16),y.anisotropy&&o.enable(17),y.alphaHash&&o.enable(18),y.batching&&o.enable(19),y.dispersion&&o.enable(20),y.batchingColor&&o.enable(21),w.push(o.mask),o.disableAll(),y.fog&&o.enable(0),y.useFog&&o.enable(1),y.flatShading&&o.enable(2),y.logarithmicDepthBuffer&&o.enable(3),y.skinning&&o.enable(4),y.morphTargets&&o.enable(5),y.morphNormals&&o.enable(6),y.morphColors&&o.enable(7),y.premultipliedAlpha&&o.enable(8),y.shadowMapEnabled&&o.enable(9),y.doubleSided&&o.enable(10),y.flipSided&&o.enable(11),y.useDepthPacking&&o.enable(12),y.dithering&&o.enable(13),y.transmission&&o.enable(14),y.sheen&&o.enable(15),y.opaque&&o.enable(16),y.pointsUvs&&o.enable(17),y.decodeVideoTexture&&o.enable(18),y.alphaToCoverage&&o.enable(19),w.push(o.mask)}function M(w){const y=_[w.type];let P;if(y){const z=dn[y];P=td.clone(z.uniforms)}else P=w.uniforms;return P}function L(w,y){let P;for(let z=0,O=u.length;z0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function c(h,d,f,_,g,m){const p=a(h,d,f,_,g,m);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function l(h,d){t.length>1&&t.sort(h||M_),n.length>1&&n.sort(d||zc),i.length>1&&i.sort(d||zc)}function u(){for(let h=e,d=r.length;h=s.length?(a=new Hc,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function b_(){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 T,color:new ge};break;case"SpotLight":t={position:new T,direction:new T,color:new ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new T,color:new ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new T,skyColor:new ge,groundColor:new ge};break;case"RectAreaLight":t={color:new ge,position:new T,halfWidth:new T,halfHeight:new T};break}return r[e.id]=t,t}}}function w_(){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 Ne};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ne};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ne,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let T_=0;function E_(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function A_(r){const e=new b_,t=w_(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new T);const i=new T,s=new fe,a=new fe;function o(l){let u=0,h=0,d=0;for(let w=0;w<9;w++)n.probe[w].set(0,0,0);let f=0,_=0,g=0,m=0,p=0,b=0,x=0,M=0,L=0,E=0,A=0;l.sort(E_);for(let w=0,y=l.length;w0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=re.LTC_FLOAT_1,n.rectAreaLTC2=re.LTC_FLOAT_2):(n.rectAreaLTC1=re.LTC_HALF_1,n.rectAreaLTC2=re.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const D=n.hash;(D.directionalLength!==f||D.pointLength!==_||D.spotLength!==g||D.rectAreaLength!==m||D.hemiLength!==p||D.numDirectionalShadows!==b||D.numPointShadows!==x||D.numSpotShadows!==M||D.numSpotMaps!==L||D.numLightProbes!==A)&&(n.directional.length=f,n.spot.length=g,n.rectArea.length=m,n.point.length=_,n.hemi.length=p,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=M+L-E,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=A,D.directionalLength=f,D.pointLength=_,D.spotLength=g,D.rectAreaLength=m,D.hemiLength=p,D.numDirectionalShadows=b,D.numPointShadows=x,D.numSpotShadows=M,D.numSpotMaps=L,D.numLightProbes=A,n.version=T_++)}function c(l,u){let h=0,d=0,f=0,_=0,g=0;const m=u.matrixWorldInverse;for(let p=0,b=l.length;p=a.length?(o=new Vc(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class C_ extends en{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=hu,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 P_ extends en{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}}const L_=`void main() { +`+V)}else z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",z):(O===""||G==="")&&(H=!1);H&&(P.diagnostics={runnable:X,programLog:z,vertexShader:{log:O,prefix:m},fragmentShader:{log:G,prefix:p}})}i.deleteShader(L),i.deleteShader(E),D=new fr(i,g),w=s_(i,g)}let D;this.getUniforms=function(){return D===void 0&&A(this),D};let w;this.getAttributes=function(){return w===void 0&&A(this),w};let y=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return y===!1&&(y=i.getProgramParameter(g,Km)),y},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Zm++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=L,this.fragmentShader=E,this}let __=0;class g_{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new x_(e),t.set(e,n)),n}}class x_{constructor(e){this.id=__++,this.code=e,this.usedTimes=0}}function v_(r,e,t,n,i,s,a){const o=new Fc,l=new g_,c=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const _={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 g(w){return c.add(w),w===0?"uv":`uv${w}`}function m(w,y,P,z,O){const G=z.fog,X=O.geometry,H=w.isMeshStandardMaterial?z.environment:null,q=(w.isMeshStandardMaterial?t:e).get(w.envMap||H),V=q&&q.mapping===Rr?q.image.height:null,ie=_[w.type];w.precision!==null&&(f=i.getMaxPrecision(w.precision),f!==w.precision&&console.warn("THREE.WebGLProgram.getParameters:",w.precision,"not supported, using",f,"instead."));const oe=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,pe=oe!==void 0?oe.length:0;let Oe=0;X.morphAttributes.position!==void 0&&(Oe=1),X.morphAttributes.normal!==void 0&&(Oe=2),X.morphAttributes.color!==void 0&&(Oe=3);let He,W,J,le;if(ie){const Ye=dn[ie];He=Ye.vertexShader,W=Ye.fragmentShader}else He=w.vertexShader,W=w.fragmentShader,l.update(w),J=l.getVertexShaderID(w),le=l.getFragmentShaderID(w);const ae=r.getRenderTarget(),Ae=O.isInstancedMesh===!0,Ce=O.isBatchedMesh===!0,Be=!!w.map,nt=!!w.matcap,C=!!q,st=!!w.aoMap,$e=!!w.lightMap,qe=!!w.bumpMap,xe=!!w.normalMap,ut=!!w.displacementMap,Te=!!w.emissiveMap,Ie=!!w.metalnessMap,R=!!w.roughnessMap,v=w.anisotropy>0,k=w.clearcoat>0,Z=w.dispersion>0,$=w.iridescence>0,K=w.sheen>0,Me=w.transmission>0,se=v&&!!w.anisotropyMap,ue=k&&!!w.clearcoatMap,De=k&&!!w.clearcoatNormalMap,Q=k&&!!w.clearcoatRoughnessMap,he=$&&!!w.iridescenceMap,We=$&&!!w.iridescenceThicknessMap,be=K&&!!w.sheenColorMap,de=K&&!!w.sheenRoughnessMap,Pe=!!w.specularMap,Ue=!!w.specularColorMap,rt=!!w.specularIntensityMap,I=Me&&!!w.transmissionMap,ee=Me&&!!w.thicknessMap,j=!!w.gradientMap,Y=!!w.alphaMap,te=w.alphaTest>0,we=!!w.alphaHash,Xe=!!w.extensions;let lt=Xn;w.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(lt=r.toneMapping);const yt={shaderID:ie,shaderType:w.type,shaderName:w.name,vertexShader:He,fragmentShader:W,defines:w.defines,customVertexShaderID:J,customFragmentShaderID:le,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:f,batching:Ce,batchingColor:Ce&&O._colorsTexture!==null,instancing:Ae,instancingColor:Ae&&O.instanceColor!==null,instancingMorph:Ae&&O.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ae===null?r.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:Ct,alphaToCoverage:!!w.alphaToCoverage,map:Be,matcap:nt,envMap:C,envMapMode:C&&q.mapping,envMapCubeUVHeight:V,aoMap:st,lightMap:$e,bumpMap:qe,normalMap:xe,displacementMap:d&&ut,emissiveMap:Te,normalMapObjectSpace:xe&&w.normalMapType===du,normalMapTangentSpace:xe&&w.normalMapType===Cr,metalnessMap:Ie,roughnessMap:R,anisotropy:v,anisotropyMap:se,clearcoat:k,clearcoatMap:ue,clearcoatNormalMap:De,clearcoatRoughnessMap:Q,dispersion:Z,iridescence:$,iridescenceMap:he,iridescenceThicknessMap:We,sheen:K,sheenColorMap:be,sheenRoughnessMap:de,specularMap:Pe,specularColorMap:Ue,specularIntensityMap:rt,transmission:Me,transmissionMap:I,thicknessMap:ee,gradientMap:j,opaque:w.transparent===!1&&w.blending===Fi&&w.alphaToCoverage===!1,alphaMap:Y,alphaTest:te,alphaHash:we,combine:w.combine,mapUv:Be&&g(w.map.channel),aoMapUv:st&&g(w.aoMap.channel),lightMapUv:$e&&g(w.lightMap.channel),bumpMapUv:qe&&g(w.bumpMap.channel),normalMapUv:xe&&g(w.normalMap.channel),displacementMapUv:ut&&g(w.displacementMap.channel),emissiveMapUv:Te&&g(w.emissiveMap.channel),metalnessMapUv:Ie&&g(w.metalnessMap.channel),roughnessMapUv:R&&g(w.roughnessMap.channel),anisotropyMapUv:se&&g(w.anisotropyMap.channel),clearcoatMapUv:ue&&g(w.clearcoatMap.channel),clearcoatNormalMapUv:De&&g(w.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&g(w.clearcoatRoughnessMap.channel),iridescenceMapUv:he&&g(w.iridescenceMap.channel),iridescenceThicknessMapUv:We&&g(w.iridescenceThicknessMap.channel),sheenColorMapUv:be&&g(w.sheenColorMap.channel),sheenRoughnessMapUv:de&&g(w.sheenRoughnessMap.channel),specularMapUv:Pe&&g(w.specularMap.channel),specularColorMapUv:Ue&&g(w.specularColorMap.channel),specularIntensityMapUv:rt&&g(w.specularIntensityMap.channel),transmissionMapUv:I&&g(w.transmissionMap.channel),thicknessMapUv:ee&&g(w.thicknessMap.channel),alphaMapUv:Y&&g(w.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(xe||v),vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!X.attributes.uv&&(Be||Y),fog:!!G,useFog:w.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:w.flatShading===!0,sizeAttenuation:w.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:O.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:pe,morphTextureStride:Oe,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numSpotLightMaps:y.spotLightMap.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numSpotLightShadowsWithMaps:y.numSpotLightShadowsWithMaps,numLightProbes:y.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:w.dithering,shadowMapEnabled:r.shadowMap.enabled&&P.length>0,shadowMapType:r.shadowMap.type,toneMapping:lt,decodeVideoTexture:Be&&w.map.isVideoTexture===!0&&Ke.getTransfer(w.map.colorSpace)===at,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===fn,flipSided:w.side===Bt,useDepthPacking:w.depthPacking>=0,depthPacking:w.depthPacking||0,index0AttributeName:w.index0AttributeName,extensionClipCullDistance:Xe&&w.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Xe&&w.extensions.multiDraw===!0||Ce)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:w.customProgramCacheKey()};return yt.vertexUv1s=c.has(1),yt.vertexUv2s=c.has(2),yt.vertexUv3s=c.has(3),c.clear(),yt}function p(w){const y=[];if(w.shaderID?y.push(w.shaderID):(y.push(w.customVertexShaderID),y.push(w.customFragmentShaderID)),w.defines!==void 0)for(const P in w.defines)y.push(P),y.push(w.defines[P]);return w.isRawShaderMaterial===!1&&(b(y,w),x(y,w),y.push(r.outputColorSpace)),y.push(w.customProgramCacheKey),y.join()}function b(w,y){w.push(y.precision),w.push(y.outputColorSpace),w.push(y.envMapMode),w.push(y.envMapCubeUVHeight),w.push(y.mapUv),w.push(y.alphaMapUv),w.push(y.lightMapUv),w.push(y.aoMapUv),w.push(y.bumpMapUv),w.push(y.normalMapUv),w.push(y.displacementMapUv),w.push(y.emissiveMapUv),w.push(y.metalnessMapUv),w.push(y.roughnessMapUv),w.push(y.anisotropyMapUv),w.push(y.clearcoatMapUv),w.push(y.clearcoatNormalMapUv),w.push(y.clearcoatRoughnessMapUv),w.push(y.iridescenceMapUv),w.push(y.iridescenceThicknessMapUv),w.push(y.sheenColorMapUv),w.push(y.sheenRoughnessMapUv),w.push(y.specularMapUv),w.push(y.specularColorMapUv),w.push(y.specularIntensityMapUv),w.push(y.transmissionMapUv),w.push(y.thicknessMapUv),w.push(y.combine),w.push(y.fogExp2),w.push(y.sizeAttenuation),w.push(y.morphTargetsCount),w.push(y.morphAttributeCount),w.push(y.numDirLights),w.push(y.numPointLights),w.push(y.numSpotLights),w.push(y.numSpotLightMaps),w.push(y.numHemiLights),w.push(y.numRectAreaLights),w.push(y.numDirLightShadows),w.push(y.numPointLightShadows),w.push(y.numSpotLightShadows),w.push(y.numSpotLightShadowsWithMaps),w.push(y.numLightProbes),w.push(y.shadowMapType),w.push(y.toneMapping),w.push(y.numClippingPlanes),w.push(y.numClipIntersection),w.push(y.depthPacking)}function x(w,y){o.disableAll(),y.supportsVertexTextures&&o.enable(0),y.instancing&&o.enable(1),y.instancingColor&&o.enable(2),y.instancingMorph&&o.enable(3),y.matcap&&o.enable(4),y.envMap&&o.enable(5),y.normalMapObjectSpace&&o.enable(6),y.normalMapTangentSpace&&o.enable(7),y.clearcoat&&o.enable(8),y.iridescence&&o.enable(9),y.alphaTest&&o.enable(10),y.vertexColors&&o.enable(11),y.vertexAlphas&&o.enable(12),y.vertexUv1s&&o.enable(13),y.vertexUv2s&&o.enable(14),y.vertexUv3s&&o.enable(15),y.vertexTangents&&o.enable(16),y.anisotropy&&o.enable(17),y.alphaHash&&o.enable(18),y.batching&&o.enable(19),y.dispersion&&o.enable(20),y.batchingColor&&o.enable(21),w.push(o.mask),o.disableAll(),y.fog&&o.enable(0),y.useFog&&o.enable(1),y.flatShading&&o.enable(2),y.logarithmicDepthBuffer&&o.enable(3),y.skinning&&o.enable(4),y.morphTargets&&o.enable(5),y.morphNormals&&o.enable(6),y.morphColors&&o.enable(7),y.premultipliedAlpha&&o.enable(8),y.shadowMapEnabled&&o.enable(9),y.doubleSided&&o.enable(10),y.flipSided&&o.enable(11),y.useDepthPacking&&o.enable(12),y.dithering&&o.enable(13),y.transmission&&o.enable(14),y.sheen&&o.enable(15),y.opaque&&o.enable(16),y.pointsUvs&&o.enable(17),y.decodeVideoTexture&&o.enable(18),y.alphaToCoverage&&o.enable(19),w.push(o.mask)}function M(w){const y=_[w.type];let P;if(y){const z=dn[y];P=td.clone(z.uniforms)}else P=w.uniforms;return P}function L(w,y){let P;for(let z=0,O=u.length;z0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function l(h,d,f,_,g,m){const p=a(h,d,f,_,g,m);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function c(h,d){t.length>1&&t.sort(h||M_),n.length>1&&n.sort(d||zl),i.length>1&&i.sort(d||zl)}function u(){for(let h=e,d=r.length;h=s.length?(a=new Hl,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function b_(){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 T,color:new ge};break;case"SpotLight":t={position:new T,direction:new T,color:new ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new T,color:new ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new T,skyColor:new ge,groundColor:new ge};break;case"RectAreaLight":t={color:new ge,position:new T,halfWidth:new T,halfHeight:new T};break}return r[e.id]=t,t}}}function w_(){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 Ne};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ne};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ne,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let T_=0;function E_(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function A_(r){const e=new b_,t=w_(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new T);const i=new T,s=new fe,a=new fe;function o(c){let u=0,h=0,d=0;for(let w=0;w<9;w++)n.probe[w].set(0,0,0);let f=0,_=0,g=0,m=0,p=0,b=0,x=0,M=0,L=0,E=0,A=0;c.sort(E_);for(let w=0,y=c.length;w0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=re.LTC_FLOAT_1,n.rectAreaLTC2=re.LTC_FLOAT_2):(n.rectAreaLTC1=re.LTC_HALF_1,n.rectAreaLTC2=re.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const D=n.hash;(D.directionalLength!==f||D.pointLength!==_||D.spotLength!==g||D.rectAreaLength!==m||D.hemiLength!==p||D.numDirectionalShadows!==b||D.numPointShadows!==x||D.numSpotShadows!==M||D.numSpotMaps!==L||D.numLightProbes!==A)&&(n.directional.length=f,n.spot.length=g,n.rectArea.length=m,n.point.length=_,n.hemi.length=p,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=M+L-E,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=A,D.directionalLength=f,D.pointLength=_,D.spotLength=g,D.rectAreaLength=m,D.hemiLength=p,D.numDirectionalShadows=b,D.numPointShadows=x,D.numSpotShadows=M,D.numSpotMaps=L,D.numLightProbes=A,n.version=T_++)}function l(c,u){let h=0,d=0,f=0,_=0,g=0;const m=u.matrixWorldInverse;for(let p=0,b=c.length;p=a.length?(o=new Vl(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class C_ extends en{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=hu,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 P_ extends en{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}}const L_=`void main() { gl_Position = vec4( position, 1.0 ); }`,I_=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3814,7 +3814,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function D_(r,e,t){let n=new Ao;const i=new Ne,s=new Ne,a=new Ze,o=new C_({depthPacking:uu}),c=new P_,l={},u=t.maxTextureSize,h={[Pn]:Bt,[Bt]:Pn,[fn]:fn},d=new jn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ne},radius:{value:4}},vertexShader:L_,fragmentShader:I_}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const _=new zt;_.setAttribute("position",new kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new ye(_,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=xl;let p=this.type;this.render=function(E,A,D){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;const w=r.getRenderTarget(),y=r.getActiveCubeFace(),P=r.getActiveMipmapLevel(),z=r.state;z.setBlending(Wn),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const O=p!==Tn&&this.type===Tn,G=p===Tn&&this.type!==Tn;for(let X=0,H=E.length;Xu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/ie.x),i.x=s.x*ie.x,V.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/ie.y),i.y=s.y*ie.y,V.mapSize.y=s.y)),V.map===null||O===!0||G===!0){const pe=this.type!==Tn?{minFilter:Ot,magFilter:Ot}:{};V.map!==null&&V.map.dispose(),V.map=new ai(i.x,i.y,pe),V.map.texture.name=q.name+".shadowMap",V.camera.updateProjectionMatrix()}r.setRenderTarget(V.map),r.clear();const oe=V.getViewportCount();for(let pe=0;pe0||A.map&&A.alphaTest>0){const z=y.uuid,O=A.uuid;let G=l[z];G===void 0&&(G={},l[z]=G);let X=G[O];X===void 0&&(X=y.clone(),G[O]=X,A.addEventListener("dispose",L)),y=X}if(y.visible=A.visible,y.wireframe=A.wireframe,w===Tn?y.side=A.shadowSide!==null?A.shadowSide:A.side:y.side=A.shadowSide!==null?A.shadowSide:h[A.side],y.alphaMap=A.alphaMap,y.alphaTest=A.alphaTest,y.map=A.map,y.clipShadows=A.clipShadows,y.clippingPlanes=A.clippingPlanes,y.clipIntersection=A.clipIntersection,y.displacementMap=A.displacementMap,y.displacementScale=A.displacementScale,y.displacementBias=A.displacementBias,y.wireframeLinewidth=A.wireframeLinewidth,y.linewidth=A.linewidth,D.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const z=r.properties.get(y);z.light=D}return y}function M(E,A,D,w,y){if(E.visible===!1)return;if(E.layers.test(A.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&y===Tn)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,E.matrixWorld);const O=e.update(E),G=E.material;if(Array.isArray(G)){const X=O.groups;for(let H=0,q=X.length;H=1):q.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),X=H>=2);let V=null,ie={};const oe=r.getParameter(r.SCISSOR_BOX),pe=r.getParameter(r.VIEWPORT),Oe=new Ze().fromArray(oe),He=new Ze().fromArray(pe);function W(I,ee,j,Y){const te=new Uint8Array(4),we=r.createTexture();r.bindTexture(I,we),r.texParameteri(I,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(I,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Xe=0;Xe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ne,u=new WeakMap;let h;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(R,v){return f?new OffscreenCanvas(R,v):xs("canvas")}function g(R,v,k){let Z=1;const $=Ie(R);if(($.width>k||$.height>k)&&(Z=k/Math.max($.width,$.height)),Z<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const K=Math.floor(Z*$.width),Me=Math.floor(Z*$.height);h===void 0&&(h=_(K,Me));const se=v?_(K,Me):h;return se.width=K,se.height=Me,se.getContext("2d").drawImage(R,0,0,K,Me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+K+"x"+Me+")."),se}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),R;return R}function m(R){return R.generateMipmaps&&R.minFilter!==Ot&&R.minFilter!==jt}function p(R){r.generateMipmap(R)}function b(R,v,k,Z,$=!1){if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let K=v;if(v===r.RED&&(k===r.FLOAT&&(K=r.R32F),k===r.HALF_FLOAT&&(K=r.R16F),k===r.UNSIGNED_BYTE&&(K=r.R8)),v===r.RED_INTEGER&&(k===r.UNSIGNED_BYTE&&(K=r.R8UI),k===r.UNSIGNED_SHORT&&(K=r.R16UI),k===r.UNSIGNED_INT&&(K=r.R32UI),k===r.BYTE&&(K=r.R8I),k===r.SHORT&&(K=r.R16I),k===r.INT&&(K=r.R32I)),v===r.RG&&(k===r.FLOAT&&(K=r.RG32F),k===r.HALF_FLOAT&&(K=r.RG16F),k===r.UNSIGNED_BYTE&&(K=r.RG8)),v===r.RG_INTEGER&&(k===r.UNSIGNED_BYTE&&(K=r.RG8UI),k===r.UNSIGNED_SHORT&&(K=r.RG16UI),k===r.UNSIGNED_INT&&(K=r.RG32UI),k===r.BYTE&&(K=r.RG8I),k===r.SHORT&&(K=r.RG16I),k===r.INT&&(K=r.RG32I)),v===r.RGB&&k===r.UNSIGNED_INT_5_9_9_9_REV&&(K=r.RGB9_E5),v===r.RGBA){const Me=$?xr:Ke.getTransfer(Z);k===r.FLOAT&&(K=r.RGBA32F),k===r.HALF_FLOAT&&(K=r.RGBA16F),k===r.UNSIGNED_BYTE&&(K=Me===at?r.SRGB8_ALPHA8:r.RGBA8),k===r.UNSIGNED_SHORT_4_4_4_4&&(K=r.RGBA4),k===r.UNSIGNED_SHORT_5_5_5_1&&(K=r.RGB5_A1)}return(K===r.R16F||K===r.R32F||K===r.RG16F||K===r.RG32F||K===r.RGBA16F||K===r.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function x(R,v){let k;return R?v===null||v===ri||v===Wi?k=r.DEPTH24_STENCIL8:v===hn?k=r.DEPTH32F_STENCIL8:v===ms&&(k=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===ri||v===Wi?k=r.DEPTH_COMPONENT24:v===hn?k=r.DEPTH_COMPONENT32F:v===ms&&(k=r.DEPTH_COMPONENT16),k}function M(R,v){return m(R)===!0||R.isFramebufferTexture&&R.minFilter!==Ot&&R.minFilter!==jt?Math.log2(Math.max(v.width,v.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?v.mipmaps.length:1}function L(R){const v=R.target;v.removeEventListener("dispose",L),A(v),v.isVideoTexture&&u.delete(v)}function E(R){const v=R.target;v.removeEventListener("dispose",E),w(v)}function A(R){const v=n.get(R);if(v.__webglInit===void 0)return;const k=R.source,Z=d.get(k);if(Z){const $=Z[v.__cacheKey];$.usedTimes--,$.usedTimes===0&&D(R),Object.keys(Z).length===0&&d.delete(k)}n.remove(R)}function D(R){const v=n.get(R);r.deleteTexture(v.__webglTexture);const k=R.source,Z=d.get(k);delete Z[v.__cacheKey],a.memory.textures--}function w(R){const v=n.get(R);if(R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(v.__webglFramebuffer[Z]))for(let $=0;$=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),y+=1,R}function O(R){const v=[];return v.push(R.wrapS),v.push(R.wrapT),v.push(R.wrapR||0),v.push(R.magFilter),v.push(R.minFilter),v.push(R.anisotropy),v.push(R.internalFormat),v.push(R.format),v.push(R.type),v.push(R.generateMipmaps),v.push(R.premultiplyAlpha),v.push(R.flipY),v.push(R.unpackAlignment),v.push(R.colorSpace),v.join()}function G(R,v){const k=n.get(R);if(R.isVideoTexture&&ut(R),R.isRenderTargetTexture===!1&&R.version>0&&k.__version!==R.version){const Z=R.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{He(k,R,v);return}}t.bindTexture(r.TEXTURE_2D,k.__webglTexture,r.TEXTURE0+v)}function X(R,v){const k=n.get(R);if(R.version>0&&k.__version!==R.version){He(k,R,v);return}t.bindTexture(r.TEXTURE_2D_ARRAY,k.__webglTexture,r.TEXTURE0+v)}function H(R,v){const k=n.get(R);if(R.version>0&&k.__version!==R.version){He(k,R,v);return}t.bindTexture(r.TEXTURE_3D,k.__webglTexture,r.TEXTURE0+v)}function q(R,v){const k=n.get(R);if(R.version>0&&k.__version!==R.version){W(k,R,v);return}t.bindTexture(r.TEXTURE_CUBE_MAP,k.__webglTexture,r.TEXTURE0+v)}const V={[Jt]:r.REPEAT,[mn]:r.CLAMP_TO_EDGE,[_r]:r.MIRRORED_REPEAT},ie={[Ot]:r.NEAREST,[Ml]:r.NEAREST_MIPMAP_NEAREST,[hs]:r.NEAREST_MIPMAP_LINEAR,[jt]:r.LINEAR,[or]:r.LINEAR_MIPMAP_NEAREST,[An]:r.LINEAR_MIPMAP_LINEAR},oe={[fu]:r.NEVER,[vu]:r.ALWAYS,[pu]:r.LESS,[Il]:r.LEQUAL,[mu]:r.EQUAL,[xu]:r.GEQUAL,[_u]:r.GREATER,[gu]:r.NOTEQUAL};function pe(R,v){if(v.type===hn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===jt||v.magFilter===or||v.magFilter===hs||v.magFilter===An||v.minFilter===jt||v.minFilter===or||v.minFilter===hs||v.minFilter===An)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(R,r.TEXTURE_WRAP_S,V[v.wrapS]),r.texParameteri(R,r.TEXTURE_WRAP_T,V[v.wrapT]),(R===r.TEXTURE_3D||R===r.TEXTURE_2D_ARRAY)&&r.texParameteri(R,r.TEXTURE_WRAP_R,V[v.wrapR]),r.texParameteri(R,r.TEXTURE_MAG_FILTER,ie[v.magFilter]),r.texParameteri(R,r.TEXTURE_MIN_FILTER,ie[v.minFilter]),v.compareFunction&&(r.texParameteri(R,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(R,r.TEXTURE_COMPARE_FUNC,oe[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Ot||v.minFilter!==hs&&v.minFilter!==An||v.type===hn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const k=e.get("EXT_texture_filter_anisotropic");r.texParameterf(R,k.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,i.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function Oe(R,v){let k=!1;R.__webglInit===void 0&&(R.__webglInit=!0,v.addEventListener("dispose",L));const Z=v.source;let $=d.get(Z);$===void 0&&($={},d.set(Z,$));const K=O(v);if(K!==R.__cacheKey){$[K]===void 0&&($[K]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,k=!0),$[K].usedTimes++;const Me=$[R.__cacheKey];Me!==void 0&&($[R.__cacheKey].usedTimes--,Me.usedTimes===0&&D(v)),R.__cacheKey=K,R.__webglTexture=$[K].texture}return k}function He(R,v,k){let Z=r.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Z=r.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Z=r.TEXTURE_3D);const $=Oe(R,v),K=v.source;t.bindTexture(Z,R.__webglTexture,r.TEXTURE0+k);const Me=n.get(K);if(K.version!==Me.__version||$===!0){t.activeTexture(r.TEXTURE0+k);const se=Ke.getPrimaries(Ke.workingColorSpace),ue=v.colorSpace===Vn?null:Ke.getPrimaries(v.colorSpace),De=v.colorSpace===Vn||se===ue?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,v.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,v.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,De);let Q=g(v.image,!1,i.maxTextureSize);Q=Te(v,Q);const he=s.convert(v.format,v.colorSpace),We=s.convert(v.type);let be=b(v.internalFormat,he,We,v.colorSpace,v.isVideoTexture);pe(Z,v);let de;const Pe=v.mipmaps,Ue=v.isVideoTexture!==!0,rt=Me.__version===void 0||$===!0,I=K.dataReady,ee=M(v,Q);if(v.isDepthTexture)be=x(v.format===Xi,v.type),rt&&(Ue?t.texStorage2D(r.TEXTURE_2D,1,be,Q.width,Q.height):t.texImage2D(r.TEXTURE_2D,0,be,Q.width,Q.height,0,he,We,null));else if(v.isDataTexture)if(Pe.length>0){Ue&&rt&&t.texStorage2D(r.TEXTURE_2D,ee,be,Pe[0].width,Pe[0].height);for(let j=0,Y=Pe.length;j0){const te=Gc(de.width,de.height,v.format,v.type);for(const we of v.layerUpdates){const Xe=de.data.subarray(we*te/de.data.BYTES_PER_ELEMENT,(we+1)*te/de.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,j,0,0,we,de.width,de.height,1,he,Xe,0,0)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,j,0,0,0,de.width,de.height,Q.depth,he,de.data,0,0)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,j,be,de.width,de.height,Q.depth,0,de.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?I&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,j,0,0,0,de.width,de.height,Q.depth,he,We,de.data):t.texImage3D(r.TEXTURE_2D_ARRAY,j,be,de.width,de.height,Q.depth,0,he,We,de.data)}else{Ue&&rt&&t.texStorage2D(r.TEXTURE_2D,ee,be,Pe[0].width,Pe[0].height);for(let j=0,Y=Pe.length;j0){const j=Gc(Q.width,Q.height,v.format,v.type);for(const Y of v.layerUpdates){const te=Q.data.subarray(Y*j/Q.data.BYTES_PER_ELEMENT,(Y+1)*j/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Y,Q.width,Q.height,1,he,We,te)}v.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,he,We,Q.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,be,Q.width,Q.height,Q.depth,0,he,We,Q.data);else if(v.isData3DTexture)Ue?(rt&&t.texStorage3D(r.TEXTURE_3D,ee,be,Q.width,Q.height,Q.depth),I&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,he,We,Q.data)):t.texImage3D(r.TEXTURE_3D,0,be,Q.width,Q.height,Q.depth,0,he,We,Q.data);else if(v.isFramebufferTexture){if(rt)if(Ue)t.texStorage2D(r.TEXTURE_2D,ee,be,Q.width,Q.height);else{let j=Q.width,Y=Q.height;for(let te=0;te>=1,Y>>=1}}else if(Pe.length>0){if(Ue&&rt){const j=Ie(Pe[0]);t.texStorage2D(r.TEXTURE_2D,ee,be,j.width,j.height)}for(let j=0,Y=Pe.length;j0&&ee++;const Y=Ie(he[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ee,Pe,Y.width,Y.height)}for(let Y=0;Y<6;Y++)if(Q){Ue?I&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,he[Y].width,he[Y].height,be,de,he[Y].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,Pe,he[Y].width,he[Y].height,0,be,de,he[Y].data);for(let te=0;te>K),he=Math.max(1,v.height>>K);$===r.TEXTURE_3D||$===r.TEXTURE_2D_ARRAY?t.texImage3D($,K,ue,Q,he,v.depth,0,Me,se,null):t.texImage2D($,K,ue,Q,he,0,Me,se,null)}t.bindFramebuffer(r.FRAMEBUFFER,R),xe(v)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Z,$,n.get(k).__webglTexture,0,qe(v)):($===r.TEXTURE_2D||$>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Z,$,n.get(k).__webglTexture,K),t.bindFramebuffer(r.FRAMEBUFFER,null)}function ce(R,v,k){if(r.bindRenderbuffer(r.RENDERBUFFER,R),v.depthBuffer){const Z=v.depthTexture,$=Z&&Z.isDepthTexture?Z.type:null,K=x(v.stencilBuffer,$),Me=v.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,se=qe(v);xe(v)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,se,K,v.width,v.height):k?r.renderbufferStorageMultisample(r.RENDERBUFFER,se,K,v.width,v.height):r.renderbufferStorage(r.RENDERBUFFER,K,v.width,v.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Me,r.RENDERBUFFER,R)}else{const Z=v.textures;for(let $=0;$1;if(Me||(Z.__webglTexture===void 0&&(Z.__webglTexture=r.createTexture()),Z.__version=v.version,a.memory.textures++),K){k.__webglFramebuffer=[];for(let se=0;se<6;se++)if(v.mipmaps&&v.mipmaps.length>0){k.__webglFramebuffer[se]=[];for(let ue=0;ue0){k.__webglFramebuffer=[];for(let se=0;se0&&xe(R)===!1){k.__webglMultisampledFramebuffer=r.createFramebuffer(),k.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,k.__webglMultisampledFramebuffer);for(let se=0;se<$.length;se++){const ue=$[se];k.__webglColorRenderbuffer[se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,k.__webglColorRenderbuffer[se]);const De=s.convert(ue.format,ue.colorSpace),Q=s.convert(ue.type),he=b(ue.internalFormat,De,Q,ue.colorSpace,R.isXRRenderTarget===!0),We=qe(R);r.renderbufferStorageMultisample(r.RENDERBUFFER,We,he,R.width,R.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+se,r.RENDERBUFFER,k.__webglColorRenderbuffer[se])}r.bindRenderbuffer(r.RENDERBUFFER,null),R.depthBuffer&&(k.__webglDepthRenderbuffer=r.createRenderbuffer(),ce(k.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(K){t.bindTexture(r.TEXTURE_CUBE_MAP,Z.__webglTexture),pe(r.TEXTURE_CUBE_MAP,v);for(let se=0;se<6;se++)if(v.mipmaps&&v.mipmaps.length>0)for(let ue=0;ue0)for(let ue=0;ue0){if(xe(R)===!1){const v=R.textures,k=R.width,Z=R.height;let $=r.COLOR_BUFFER_BIT;const K=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Me=n.get(R),se=v.length>1;if(se)for(let ue=0;ue0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function ut(R){const v=a.render.frame;u.get(R)!==v&&(u.set(R,v),R.update())}function Te(R,v){const k=R.colorSpace,Z=R.format,$=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||k!==Ct&&k!==Vn&&(Ke.getTransfer(k)===at?(Z!==Qt||$!==Ln)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",k)),v}function Ie(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(l.width=R.naturalWidth||R.width,l.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(l.width=R.displayWidth,l.height=R.displayHeight):(l.width=R.width,l.height=R.height),l}this.allocateTextureUnit=z,this.resetTextureUnits=P,this.setTexture2D=G,this.setTexture2DArray=X,this.setTexture3D=H,this.setTextureCube=q,this.rebindTextures=Ce,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=nt,this.updateMultisampleRenderTarget=$e,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=J,this.useMultisampledRTT=xe}function O_(r,e){function t(n,i=Vn){let s;const a=Ke.getTransfer(i);if(n===Ln)return r.UNSIGNED_BYTE;if(n===go)return r.UNSIGNED_SHORT_4_4_4_4;if(n===xo)return r.UNSIGNED_SHORT_5_5_5_1;if(n===wl)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Sl)return r.BYTE;if(n===bl)return r.SHORT;if(n===ms)return r.UNSIGNED_SHORT;if(n===_o)return r.INT;if(n===ri)return r.UNSIGNED_INT;if(n===hn)return r.FLOAT;if(n===bs)return r.HALF_FLOAT;if(n===Tl)return r.ALPHA;if(n===El)return r.RGB;if(n===Qt)return r.RGBA;if(n===Al)return r.LUMINANCE;if(n===Rl)return r.LUMINANCE_ALPHA;if(n===Oi)return r.DEPTH_COMPONENT;if(n===Xi)return r.DEPTH_STENCIL;if(n===vo)return r.RED;if(n===yo)return r.RED_INTEGER;if(n===Cl)return r.RG;if(n===Mo)return r.RG_INTEGER;if(n===So)return r.RGBA_INTEGER;if(n===cr||n===lr||n===hr||n===ur)if(a===at)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===cr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===lr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ur)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===cr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===lr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===hr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ia||n===Da||n===Ua||n===Na)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ia)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Da)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ua)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Na)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Fa||n===Oa||n===Ba)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Fa||n===Oa)return a===at?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ba)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ka||n===za||n===Ha||n===Va||n===Ga||n===Wa||n===Xa||n===ja||n===qa||n===Ya||n===Ka||n===Za||n===$a||n===Ja)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ka)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===za)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ha)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Va)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ga)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wa)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Xa)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ja)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===qa)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ya)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ka)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Za)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$a)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ja)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===dr||n===Qa||n===eo)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===dr)return a===at?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Qa)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===eo)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Pl||n===to||n===no||n===io)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===dr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===to)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===no)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===io)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Wi?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}class B_ extends Dt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Cn extends it{constructor(){super(),this.isGroup=!0,this.type="Group"}}const k_={type:"move"};class ma{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Cn,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 Cn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new T,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new T),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Cn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new T,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new T),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,n),p=this._getHandJoint(l,g);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,_=.005;l.inputState.pinching&&d>f+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(k_)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Cn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const z_=` +}`;function D_(r,e,t){let n=new Ao;const i=new Ne,s=new Ne,a=new Ze,o=new C_({depthPacking:uu}),l=new P_,c={},u=t.maxTextureSize,h={[Pn]:Bt,[Bt]:Pn,[fn]:fn},d=new jn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ne},radius:{value:4}},vertexShader:L_,fragmentShader:I_}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const _=new zt;_.setAttribute("position",new kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new ye(_,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=xc;let p=this.type;this.render=function(E,A,D){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;const w=r.getRenderTarget(),y=r.getActiveCubeFace(),P=r.getActiveMipmapLevel(),z=r.state;z.setBlending(Wn),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const O=p!==Tn&&this.type===Tn,G=p===Tn&&this.type!==Tn;for(let X=0,H=E.length;Xu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/ie.x),i.x=s.x*ie.x,V.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/ie.y),i.y=s.y*ie.y,V.mapSize.y=s.y)),V.map===null||O===!0||G===!0){const pe=this.type!==Tn?{minFilter:Ot,magFilter:Ot}:{};V.map!==null&&V.map.dispose(),V.map=new ai(i.x,i.y,pe),V.map.texture.name=q.name+".shadowMap",V.camera.updateProjectionMatrix()}r.setRenderTarget(V.map),r.clear();const oe=V.getViewportCount();for(let pe=0;pe0||A.map&&A.alphaTest>0){const z=y.uuid,O=A.uuid;let G=c[z];G===void 0&&(G={},c[z]=G);let X=G[O];X===void 0&&(X=y.clone(),G[O]=X,A.addEventListener("dispose",L)),y=X}if(y.visible=A.visible,y.wireframe=A.wireframe,w===Tn?y.side=A.shadowSide!==null?A.shadowSide:A.side:y.side=A.shadowSide!==null?A.shadowSide:h[A.side],y.alphaMap=A.alphaMap,y.alphaTest=A.alphaTest,y.map=A.map,y.clipShadows=A.clipShadows,y.clippingPlanes=A.clippingPlanes,y.clipIntersection=A.clipIntersection,y.displacementMap=A.displacementMap,y.displacementScale=A.displacementScale,y.displacementBias=A.displacementBias,y.wireframeLinewidth=A.wireframeLinewidth,y.linewidth=A.linewidth,D.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const z=r.properties.get(y);z.light=D}return y}function M(E,A,D,w,y){if(E.visible===!1)return;if(E.layers.test(A.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&y===Tn)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,E.matrixWorld);const O=e.update(E),G=E.material;if(Array.isArray(G)){const X=O.groups;for(let H=0,q=X.length;H=1):q.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),X=H>=2);let V=null,ie={};const oe=r.getParameter(r.SCISSOR_BOX),pe=r.getParameter(r.VIEWPORT),Oe=new Ze().fromArray(oe),He=new Ze().fromArray(pe);function W(I,ee,j,Y){const te=new Uint8Array(4),we=r.createTexture();r.bindTexture(I,we),r.texParameteri(I,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(I,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Xe=0;Xe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ne,u=new WeakMap;let h;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(R,v){return f?new OffscreenCanvas(R,v):gs("canvas")}function g(R,v,k){let Z=1;const $=Ie(R);if(($.width>k||$.height>k)&&(Z=k/Math.max($.width,$.height)),Z<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const K=Math.floor(Z*$.width),Me=Math.floor(Z*$.height);h===void 0&&(h=_(K,Me));const se=v?_(K,Me):h;return se.width=K,se.height=Me,se.getContext("2d").drawImage(R,0,0,K,Me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+K+"x"+Me+")."),se}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),R;return R}function m(R){return R.generateMipmaps&&R.minFilter!==Ot&&R.minFilter!==jt}function p(R){r.generateMipmap(R)}function b(R,v,k,Z,$=!1){if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let K=v;if(v===r.RED&&(k===r.FLOAT&&(K=r.R32F),k===r.HALF_FLOAT&&(K=r.R16F),k===r.UNSIGNED_BYTE&&(K=r.R8)),v===r.RED_INTEGER&&(k===r.UNSIGNED_BYTE&&(K=r.R8UI),k===r.UNSIGNED_SHORT&&(K=r.R16UI),k===r.UNSIGNED_INT&&(K=r.R32UI),k===r.BYTE&&(K=r.R8I),k===r.SHORT&&(K=r.R16I),k===r.INT&&(K=r.R32I)),v===r.RG&&(k===r.FLOAT&&(K=r.RG32F),k===r.HALF_FLOAT&&(K=r.RG16F),k===r.UNSIGNED_BYTE&&(K=r.RG8)),v===r.RG_INTEGER&&(k===r.UNSIGNED_BYTE&&(K=r.RG8UI),k===r.UNSIGNED_SHORT&&(K=r.RG16UI),k===r.UNSIGNED_INT&&(K=r.RG32UI),k===r.BYTE&&(K=r.RG8I),k===r.SHORT&&(K=r.RG16I),k===r.INT&&(K=r.RG32I)),v===r.RGB&&k===r.UNSIGNED_INT_5_9_9_9_REV&&(K=r.RGB9_E5),v===r.RGBA){const Me=$?xr:Ke.getTransfer(Z);k===r.FLOAT&&(K=r.RGBA32F),k===r.HALF_FLOAT&&(K=r.RGBA16F),k===r.UNSIGNED_BYTE&&(K=Me===at?r.SRGB8_ALPHA8:r.RGBA8),k===r.UNSIGNED_SHORT_4_4_4_4&&(K=r.RGBA4),k===r.UNSIGNED_SHORT_5_5_5_1&&(K=r.RGB5_A1)}return(K===r.R16F||K===r.R32F||K===r.RG16F||K===r.RG32F||K===r.RGBA16F||K===r.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function x(R,v){let k;return R?v===null||v===ri||v===Wi?k=r.DEPTH24_STENCIL8:v===hn?k=r.DEPTH32F_STENCIL8:v===ps&&(k=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===ri||v===Wi?k=r.DEPTH_COMPONENT24:v===hn?k=r.DEPTH_COMPONENT32F:v===ps&&(k=r.DEPTH_COMPONENT16),k}function M(R,v){return m(R)===!0||R.isFramebufferTexture&&R.minFilter!==Ot&&R.minFilter!==jt?Math.log2(Math.max(v.width,v.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?v.mipmaps.length:1}function L(R){const v=R.target;v.removeEventListener("dispose",L),A(v),v.isVideoTexture&&u.delete(v)}function E(R){const v=R.target;v.removeEventListener("dispose",E),w(v)}function A(R){const v=n.get(R);if(v.__webglInit===void 0)return;const k=R.source,Z=d.get(k);if(Z){const $=Z[v.__cacheKey];$.usedTimes--,$.usedTimes===0&&D(R),Object.keys(Z).length===0&&d.delete(k)}n.remove(R)}function D(R){const v=n.get(R);r.deleteTexture(v.__webglTexture);const k=R.source,Z=d.get(k);delete Z[v.__cacheKey],a.memory.textures--}function w(R){const v=n.get(R);if(R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(v.__webglFramebuffer[Z]))for(let $=0;$=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),y+=1,R}function O(R){const v=[];return v.push(R.wrapS),v.push(R.wrapT),v.push(R.wrapR||0),v.push(R.magFilter),v.push(R.minFilter),v.push(R.anisotropy),v.push(R.internalFormat),v.push(R.format),v.push(R.type),v.push(R.generateMipmaps),v.push(R.premultiplyAlpha),v.push(R.flipY),v.push(R.unpackAlignment),v.push(R.colorSpace),v.join()}function G(R,v){const k=n.get(R);if(R.isVideoTexture&&ut(R),R.isRenderTargetTexture===!1&&R.version>0&&k.__version!==R.version){const Z=R.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{He(k,R,v);return}}t.bindTexture(r.TEXTURE_2D,k.__webglTexture,r.TEXTURE0+v)}function X(R,v){const k=n.get(R);if(R.version>0&&k.__version!==R.version){He(k,R,v);return}t.bindTexture(r.TEXTURE_2D_ARRAY,k.__webglTexture,r.TEXTURE0+v)}function H(R,v){const k=n.get(R);if(R.version>0&&k.__version!==R.version){He(k,R,v);return}t.bindTexture(r.TEXTURE_3D,k.__webglTexture,r.TEXTURE0+v)}function q(R,v){const k=n.get(R);if(R.version>0&&k.__version!==R.version){W(k,R,v);return}t.bindTexture(r.TEXTURE_CUBE_MAP,k.__webglTexture,r.TEXTURE0+v)}const V={[Jt]:r.REPEAT,[mn]:r.CLAMP_TO_EDGE,[_r]:r.MIRRORED_REPEAT},ie={[Ot]:r.NEAREST,[Mc]:r.NEAREST_MIPMAP_NEAREST,[cs]:r.NEAREST_MIPMAP_LINEAR,[jt]:r.LINEAR,[or]:r.LINEAR_MIPMAP_NEAREST,[An]:r.LINEAR_MIPMAP_LINEAR},oe={[fu]:r.NEVER,[vu]:r.ALWAYS,[pu]:r.LESS,[Ic]:r.LEQUAL,[mu]:r.EQUAL,[xu]:r.GEQUAL,[_u]:r.GREATER,[gu]:r.NOTEQUAL};function pe(R,v){if(v.type===hn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===jt||v.magFilter===or||v.magFilter===cs||v.magFilter===An||v.minFilter===jt||v.minFilter===or||v.minFilter===cs||v.minFilter===An)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(R,r.TEXTURE_WRAP_S,V[v.wrapS]),r.texParameteri(R,r.TEXTURE_WRAP_T,V[v.wrapT]),(R===r.TEXTURE_3D||R===r.TEXTURE_2D_ARRAY)&&r.texParameteri(R,r.TEXTURE_WRAP_R,V[v.wrapR]),r.texParameteri(R,r.TEXTURE_MAG_FILTER,ie[v.magFilter]),r.texParameteri(R,r.TEXTURE_MIN_FILTER,ie[v.minFilter]),v.compareFunction&&(r.texParameteri(R,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(R,r.TEXTURE_COMPARE_FUNC,oe[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Ot||v.minFilter!==cs&&v.minFilter!==An||v.type===hn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const k=e.get("EXT_texture_filter_anisotropic");r.texParameterf(R,k.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,i.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function Oe(R,v){let k=!1;R.__webglInit===void 0&&(R.__webglInit=!0,v.addEventListener("dispose",L));const Z=v.source;let $=d.get(Z);$===void 0&&($={},d.set(Z,$));const K=O(v);if(K!==R.__cacheKey){$[K]===void 0&&($[K]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,k=!0),$[K].usedTimes++;const Me=$[R.__cacheKey];Me!==void 0&&($[R.__cacheKey].usedTimes--,Me.usedTimes===0&&D(v)),R.__cacheKey=K,R.__webglTexture=$[K].texture}return k}function He(R,v,k){let Z=r.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Z=r.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Z=r.TEXTURE_3D);const $=Oe(R,v),K=v.source;t.bindTexture(Z,R.__webglTexture,r.TEXTURE0+k);const Me=n.get(K);if(K.version!==Me.__version||$===!0){t.activeTexture(r.TEXTURE0+k);const se=Ke.getPrimaries(Ke.workingColorSpace),ue=v.colorSpace===Vn?null:Ke.getPrimaries(v.colorSpace),De=v.colorSpace===Vn||se===ue?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,v.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,v.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,De);let Q=g(v.image,!1,i.maxTextureSize);Q=Te(v,Q);const he=s.convert(v.format,v.colorSpace),We=s.convert(v.type);let be=b(v.internalFormat,he,We,v.colorSpace,v.isVideoTexture);pe(Z,v);let de;const Pe=v.mipmaps,Ue=v.isVideoTexture!==!0,rt=Me.__version===void 0||$===!0,I=K.dataReady,ee=M(v,Q);if(v.isDepthTexture)be=x(v.format===Xi,v.type),rt&&(Ue?t.texStorage2D(r.TEXTURE_2D,1,be,Q.width,Q.height):t.texImage2D(r.TEXTURE_2D,0,be,Q.width,Q.height,0,he,We,null));else if(v.isDataTexture)if(Pe.length>0){Ue&&rt&&t.texStorage2D(r.TEXTURE_2D,ee,be,Pe[0].width,Pe[0].height);for(let j=0,Y=Pe.length;j0){const te=Gl(de.width,de.height,v.format,v.type);for(const we of v.layerUpdates){const Xe=de.data.subarray(we*te/de.data.BYTES_PER_ELEMENT,(we+1)*te/de.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,j,0,0,we,de.width,de.height,1,he,Xe,0,0)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,j,0,0,0,de.width,de.height,Q.depth,he,de.data,0,0)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,j,be,de.width,de.height,Q.depth,0,de.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?I&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,j,0,0,0,de.width,de.height,Q.depth,he,We,de.data):t.texImage3D(r.TEXTURE_2D_ARRAY,j,be,de.width,de.height,Q.depth,0,he,We,de.data)}else{Ue&&rt&&t.texStorage2D(r.TEXTURE_2D,ee,be,Pe[0].width,Pe[0].height);for(let j=0,Y=Pe.length;j0){const j=Gl(Q.width,Q.height,v.format,v.type);for(const Y of v.layerUpdates){const te=Q.data.subarray(Y*j/Q.data.BYTES_PER_ELEMENT,(Y+1)*j/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Y,Q.width,Q.height,1,he,We,te)}v.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,he,We,Q.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,be,Q.width,Q.height,Q.depth,0,he,We,Q.data);else if(v.isData3DTexture)Ue?(rt&&t.texStorage3D(r.TEXTURE_3D,ee,be,Q.width,Q.height,Q.depth),I&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,he,We,Q.data)):t.texImage3D(r.TEXTURE_3D,0,be,Q.width,Q.height,Q.depth,0,he,We,Q.data);else if(v.isFramebufferTexture){if(rt)if(Ue)t.texStorage2D(r.TEXTURE_2D,ee,be,Q.width,Q.height);else{let j=Q.width,Y=Q.height;for(let te=0;te>=1,Y>>=1}}else if(Pe.length>0){if(Ue&&rt){const j=Ie(Pe[0]);t.texStorage2D(r.TEXTURE_2D,ee,be,j.width,j.height)}for(let j=0,Y=Pe.length;j0&&ee++;const Y=Ie(he[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ee,Pe,Y.width,Y.height)}for(let Y=0;Y<6;Y++)if(Q){Ue?I&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,he[Y].width,he[Y].height,be,de,he[Y].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,Pe,he[Y].width,he[Y].height,0,be,de,he[Y].data);for(let te=0;te>K),he=Math.max(1,v.height>>K);$===r.TEXTURE_3D||$===r.TEXTURE_2D_ARRAY?t.texImage3D($,K,ue,Q,he,v.depth,0,Me,se,null):t.texImage2D($,K,ue,Q,he,0,Me,se,null)}t.bindFramebuffer(r.FRAMEBUFFER,R),xe(v)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Z,$,n.get(k).__webglTexture,0,qe(v)):($===r.TEXTURE_2D||$>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Z,$,n.get(k).__webglTexture,K),t.bindFramebuffer(r.FRAMEBUFFER,null)}function le(R,v,k){if(r.bindRenderbuffer(r.RENDERBUFFER,R),v.depthBuffer){const Z=v.depthTexture,$=Z&&Z.isDepthTexture?Z.type:null,K=x(v.stencilBuffer,$),Me=v.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,se=qe(v);xe(v)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,se,K,v.width,v.height):k?r.renderbufferStorageMultisample(r.RENDERBUFFER,se,K,v.width,v.height):r.renderbufferStorage(r.RENDERBUFFER,K,v.width,v.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Me,r.RENDERBUFFER,R)}else{const Z=v.textures;for(let $=0;$1;if(Me||(Z.__webglTexture===void 0&&(Z.__webglTexture=r.createTexture()),Z.__version=v.version,a.memory.textures++),K){k.__webglFramebuffer=[];for(let se=0;se<6;se++)if(v.mipmaps&&v.mipmaps.length>0){k.__webglFramebuffer[se]=[];for(let ue=0;ue0){k.__webglFramebuffer=[];for(let se=0;se0&&xe(R)===!1){k.__webglMultisampledFramebuffer=r.createFramebuffer(),k.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,k.__webglMultisampledFramebuffer);for(let se=0;se<$.length;se++){const ue=$[se];k.__webglColorRenderbuffer[se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,k.__webglColorRenderbuffer[se]);const De=s.convert(ue.format,ue.colorSpace),Q=s.convert(ue.type),he=b(ue.internalFormat,De,Q,ue.colorSpace,R.isXRRenderTarget===!0),We=qe(R);r.renderbufferStorageMultisample(r.RENDERBUFFER,We,he,R.width,R.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+se,r.RENDERBUFFER,k.__webglColorRenderbuffer[se])}r.bindRenderbuffer(r.RENDERBUFFER,null),R.depthBuffer&&(k.__webglDepthRenderbuffer=r.createRenderbuffer(),le(k.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(K){t.bindTexture(r.TEXTURE_CUBE_MAP,Z.__webglTexture),pe(r.TEXTURE_CUBE_MAP,v);for(let se=0;se<6;se++)if(v.mipmaps&&v.mipmaps.length>0)for(let ue=0;ue0)for(let ue=0;ue0){if(xe(R)===!1){const v=R.textures,k=R.width,Z=R.height;let $=r.COLOR_BUFFER_BIT;const K=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Me=n.get(R),se=v.length>1;if(se)for(let ue=0;ue0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function ut(R){const v=a.render.frame;u.get(R)!==v&&(u.set(R,v),R.update())}function Te(R,v){const k=R.colorSpace,Z=R.format,$=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||k!==Ct&&k!==Vn&&(Ke.getTransfer(k)===at?(Z!==Qt||$!==Ln)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",k)),v}function Ie(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=P,this.setTexture2D=G,this.setTexture2DArray=X,this.setTexture3D=H,this.setTextureCube=q,this.rebindTextures=Ce,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=nt,this.updateMultisampleRenderTarget=$e,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=J,this.useMultisampledRTT=xe}function O_(r,e){function t(n,i=Vn){let s;const a=Ke.getTransfer(i);if(n===Ln)return r.UNSIGNED_BYTE;if(n===go)return r.UNSIGNED_SHORT_4_4_4_4;if(n===xo)return r.UNSIGNED_SHORT_5_5_5_1;if(n===wc)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Sc)return r.BYTE;if(n===bc)return r.SHORT;if(n===ps)return r.UNSIGNED_SHORT;if(n===_o)return r.INT;if(n===ri)return r.UNSIGNED_INT;if(n===hn)return r.FLOAT;if(n===Ss)return r.HALF_FLOAT;if(n===Tc)return r.ALPHA;if(n===Ec)return r.RGB;if(n===Qt)return r.RGBA;if(n===Ac)return r.LUMINANCE;if(n===Rc)return r.LUMINANCE_ALPHA;if(n===Oi)return r.DEPTH_COMPONENT;if(n===Xi)return r.DEPTH_STENCIL;if(n===vo)return r.RED;if(n===yo)return r.RED_INTEGER;if(n===Cc)return r.RG;if(n===Mo)return r.RG_INTEGER;if(n===So)return r.RGBA_INTEGER;if(n===lr||n===cr||n===hr||n===ur)if(a===at)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===lr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ur)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===lr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===cr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===hr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ia||n===Da||n===Ua||n===Na)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ia)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Da)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ua)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Na)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Fa||n===Oa||n===Ba)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Fa||n===Oa)return a===at?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ba)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ka||n===za||n===Ha||n===Va||n===Ga||n===Wa||n===Xa||n===ja||n===qa||n===Ya||n===Ka||n===Za||n===$a||n===Ja)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ka)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===za)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ha)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Va)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ga)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wa)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Xa)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ja)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===qa)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ya)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ka)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Za)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$a)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ja)return a===at?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===dr||n===Qa||n===eo)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===dr)return a===at?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Qa)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===eo)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Pc||n===to||n===no||n===io)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===dr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===to)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===no)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===io)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Wi?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}class B_ extends Dt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Cn extends it{constructor(){super(),this.isGroup=!0,this.type="Group"}}const k_={type:"move"};class ma{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Cn,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 Cn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new T,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new T),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Cn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new T,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new T),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,n),p=this._getHandJoint(c,g);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,_=.005;c.inputState.pinching&&d>f+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(k_)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Cn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const z_=` void main() { gl_Position = vec4( position, 1.0 ); @@ -3838,9 +3838,9 @@ void main() { } -}`;class V_{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new St,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 jn({vertexShader:z_,fragmentShader:H_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ye(new ws(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class G_ extends hi{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",c=1,l=null,u=null,h=null,d=null,f=null,_=null;const g=new V_,m=t.getContextAttributes();let p=null,b=null;const x=[],M=[],L=new Ne;let E=null;const A=new Dt;A.layers.enable(1),A.viewport=new Ze;const D=new Dt;D.layers.enable(2),D.viewport=new Ze;const w=[A,D],y=new B_;y.layers.enable(1),y.layers.enable(2);let P=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(W){let J=x[W];return J===void 0&&(J=new ma,x[W]=J),J.getTargetRaySpace()},this.getControllerGrip=function(W){let J=x[W];return J===void 0&&(J=new ma,x[W]=J),J.getGripSpace()},this.getHand=function(W){let J=x[W];return J===void 0&&(J=new ma,x[W]=J),J.getHandSpace()};function O(W){const J=M.indexOf(W.inputSource);if(J===-1)return;const ce=x[J];ce!==void 0&&(ce.update(W.inputSource,W.frame,l||a),ce.dispatchEvent({type:W.type,data:W.inputSource}))}function G(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",G),i.removeEventListener("inputsourceschange",X);for(let W=0;W=0&&(M[ae]=null,x[ae].disconnect(ce))}for(let J=0;J=M.length){M.push(ce),ae=Ce;break}else if(M[Ce]===null){M[Ce]=ce,ae=Ce;break}if(ae===-1)break}const Ae=x[ae];Ae&&Ae.connect(ce)}}const H=new T,q=new T;function V(W,J,ce){H.setFromMatrixPosition(J.matrixWorld),q.setFromMatrixPosition(ce.matrixWorld);const ae=H.distanceTo(q),Ae=J.projectionMatrix.elements,Ce=ce.projectionMatrix.elements,Be=Ae[14]/(Ae[10]-1),nt=Ae[14]/(Ae[10]+1),C=(Ae[9]+1)/Ae[5],st=(Ae[9]-1)/Ae[5],$e=(Ae[8]-1)/Ae[0],qe=(Ce[8]+1)/Ce[0],xe=Be*$e,ut=Be*qe,Te=ae/(-$e+qe),Ie=Te*-$e;J.matrixWorld.decompose(W.position,W.quaternion,W.scale),W.translateX(Ie),W.translateZ(Te),W.matrixWorld.compose(W.position,W.quaternion,W.scale),W.matrixWorldInverse.copy(W.matrixWorld).invert();const R=Be+Te,v=nt+Te,k=xe-Ie,Z=ut+(ae-Ie),$=C*nt/v*R,K=st*nt/v*R;W.projectionMatrix.makePerspective(k,Z,$,K,R,v),W.projectionMatrixInverse.copy(W.projectionMatrix).invert()}function ie(W,J){J===null?W.matrixWorld.copy(W.matrix):W.matrixWorld.multiplyMatrices(J.matrixWorld,W.matrix),W.matrixWorldInverse.copy(W.matrixWorld).invert()}this.updateCamera=function(W){if(i===null)return;g.texture!==null&&(W.near=g.depthNear,W.far=g.depthFar),y.near=D.near=A.near=W.near,y.far=D.far=A.far=W.far,(P!==y.near||z!==y.far)&&(i.updateRenderState({depthNear:y.near,depthFar:y.far}),P=y.near,z=y.far,A.near=P,A.far=z,D.near=P,D.far=z,A.updateProjectionMatrix(),D.updateProjectionMatrix(),W.updateProjectionMatrix());const J=W.parent,ce=y.cameras;ie(y,J);for(let ae=0;ae0&&(m.alphaTest.value=p.alphaTest);const b=e.get(p),x=b.envMap,M=b.envMapRotation;x&&(m.envMap.value=x,Qn.copy(M),Qn.x*=-1,Qn.y*=-1,Qn.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Qn.y*=-1,Qn.z*=-1),m.envMapRotation.value.setFromMatrix4(W_.makeRotationFromEuler(Qn)),m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,b,x){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*b,m.scale.value=x*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,b){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Bt&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function g(m,p){const b=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function j_(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(b,x){const M=x.program;n.uniformBlockBinding(b,M)}function l(b,x){let M=i[b.id];M===void 0&&(_(b),M=u(b),i[b.id]=M,b.addEventListener("dispose",m));const L=x.program;n.updateUBOMapping(b,L);const E=e.render.frame;s[b.id]!==E&&(d(b),s[b.id]=E)}function u(b){const x=h();b.__bindingPointIndex=x;const M=r.createBuffer(),L=b.__size,E=b.usage;return r.bindBuffer(r.UNIFORM_BUFFER,M),r.bufferData(r.UNIFORM_BUFFER,L,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,M),M}function h(){for(let b=0;b0&&(M+=L-E),b.__size=M,b.__cache={},this}function g(b){const x={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function m(b){const x=b.target;x.removeEventListener("dispose",m);const M=a.indexOf(x.__bindingPointIndex);a.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function p(){for(const b in i)r.deleteBuffer(i[b]);a=[],i={},s={}}return{bind:c,update:l,dispose:p}}class q_{constructor(e={}){const{canvas:t=Fu(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const f=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const p=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Mt,this.toneMapping=Xn,this.toneMappingExposure=1;const x=this;let M=!1,L=0,E=0,A=null,D=-1,w=null;const y=new Ze,P=new Ze;let z=null;const O=new ge(0);let G=0,X=t.width,H=t.height,q=1,V=null,ie=null;const oe=new Ze(0,0,X,H),pe=new Ze(0,0,X,H);let Oe=!1;const He=new Ao;let W=!1,J=!1;const ce=new fe,ae=new T,Ae=new Ze,Ce={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function nt(){return A===null?q:1}let C=n;function st(S,U){return t.getContext(S,U)}try{const S={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${mo}`),t.addEventListener("webglcontextlost",j,!1),t.addEventListener("webglcontextrestored",Y,!1),t.addEventListener("webglcontextcreationerror",te,!1),C===null){const U="webgl2";if(C=st(U,S),C===null)throw st(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let $e,qe,xe,ut,Te,Ie,R,v,k,Z,$,K,Me,se,ue,De,Q,he,We,be,de,Pe,Ue,rt;function I(){$e=new Qp(C),$e.init(),Pe=new O_(C,$e),qe=new qp(C,$e,e,Pe),xe=new U_(C),ut=new nm(C),Te=new y_,Ie=new F_(C,$e,xe,Te,qe,Pe,ut),R=new Kp(x),v=new Jp(x),k=new cd(C),Ue=new Xp(C,k),Z=new em(C,k,ut,Ue),$=new sm(C,Z,k,ut),We=new im(C,qe,Ie),De=new Yp(Te),K=new v_(x,R,v,$e,qe,Ue,De),Me=new X_(x,Te),se=new S_,ue=new R_($e),he=new Wp(x,R,v,xe,$,d,c),Q=new D_(x,$,qe),rt=new j_(C,ut,qe,xe),be=new jp(C,$e,ut),de=new tm(C,$e,ut),ut.programs=K.programs,x.capabilities=qe,x.extensions=$e,x.properties=Te,x.renderLists=se,x.shadowMap=Q,x.state=xe,x.info=ut}I();const ee=new G_(x,C);this.xr=ee,this.getContext=function(){return C},this.getContextAttributes=function(){return C.getContextAttributes()},this.forceContextLoss=function(){const S=$e.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=$e.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(S){S!==void 0&&(q=S,this.setSize(X,H,!1))},this.getSize=function(S){return S.set(X,H)},this.setSize=function(S,U,F=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=S,H=U,t.width=Math.floor(S*q),t.height=Math.floor(U*q),F===!0&&(t.style.width=S+"px",t.style.height=U+"px"),this.setViewport(0,0,S,U)},this.getDrawingBufferSize=function(S){return S.set(X*q,H*q).floor()},this.setDrawingBufferSize=function(S,U,F){X=S,H=U,q=F,t.width=Math.floor(S*F),t.height=Math.floor(U*F),this.setViewport(0,0,S,U)},this.getCurrentViewport=function(S){return S.copy(y)},this.getViewport=function(S){return S.copy(oe)},this.setViewport=function(S,U,F,B){S.isVector4?oe.set(S.x,S.y,S.z,S.w):oe.set(S,U,F,B),xe.viewport(y.copy(oe).multiplyScalar(q).round())},this.getScissor=function(S){return S.copy(pe)},this.setScissor=function(S,U,F,B){S.isVector4?pe.set(S.x,S.y,S.z,S.w):pe.set(S,U,F,B),xe.scissor(P.copy(pe).multiplyScalar(q).round())},this.getScissorTest=function(){return Oe},this.setScissorTest=function(S){xe.setScissorTest(Oe=S)},this.setOpaqueSort=function(S){V=S},this.setTransparentSort=function(S){ie=S},this.getClearColor=function(S){return S.copy(he.getClearColor())},this.setClearColor=function(){he.setClearColor.apply(he,arguments)},this.getClearAlpha=function(){return he.getClearAlpha()},this.setClearAlpha=function(){he.setClearAlpha.apply(he,arguments)},this.clear=function(S=!0,U=!0,F=!0){let B=0;if(S){let N=!1;if(A!==null){const ne=A.texture.format;N=ne===So||ne===Mo||ne===yo}if(N){const ne=A.texture.type,le=ne===Ln||ne===ri||ne===ms||ne===Wi||ne===go||ne===xo,me=he.getClearColor(),_e=he.getClearAlpha(),Ee=me.r,Re=me.g,Se=me.b;le?(f[0]=Ee,f[1]=Re,f[2]=Se,f[3]=_e,C.clearBufferuiv(C.COLOR,0,f)):(_[0]=Ee,_[1]=Re,_[2]=Se,_[3]=_e,C.clearBufferiv(C.COLOR,0,_))}else B|=C.COLOR_BUFFER_BIT}U&&(B|=C.DEPTH_BUFFER_BIT),F&&(B|=C.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),C.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",j,!1),t.removeEventListener("webglcontextrestored",Y,!1),t.removeEventListener("webglcontextcreationerror",te,!1),se.dispose(),ue.dispose(),Te.dispose(),R.dispose(),v.dispose(),$.dispose(),Ue.dispose(),rt.dispose(),K.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",qt),ee.removeEventListener("sessionend",As),tn.stop()};function j(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Y(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const S=ut.autoReset,U=Q.enabled,F=Q.autoUpdate,B=Q.needsUpdate,N=Q.type;I(),ut.autoReset=S,Q.enabled=U,Q.autoUpdate=F,Q.needsUpdate=B,Q.type=N}function te(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function we(S){const U=S.target;U.removeEventListener("dispose",we),Xe(U)}function Xe(S){ct(S),Te.remove(S)}function ct(S){const U=Te.get(S).programs;U!==void 0&&(U.forEach(function(F){K.releaseProgram(F)}),S.isShaderMaterial&&K.releaseShaderCache(S))}this.renderBufferDirect=function(S,U,F,B,N,ne){U===null&&(U=Ce);const le=N.isMesh&&N.matrixWorld.determinant()<0,me=xh(S,U,F,B,N);xe.setMaterial(B,le);let _e=F.index,Ee=1;if(B.wireframe===!0){if(_e=Z.getWireframeAttribute(F),_e===void 0)return;Ee=2}const Re=F.drawRange,Se=F.attributes.position;let Je=Re.start*Ee,dt=(Re.start+Re.count)*Ee;ne!==null&&(Je=Math.max(Je,ne.start*Ee),dt=Math.min(dt,(ne.start+ne.count)*Ee)),_e!==null?(Je=Math.max(Je,0),dt=Math.min(dt,_e.count)):Se!=null&&(Je=Math.max(Je,0),dt=Math.min(dt,Se.count));const ft=dt-Je;if(ft<0||ft===1/0)return;Ue.setup(N,B,me,F,_e);let Vt,Qe=be;if(_e!==null&&(Vt=k.get(_e),Qe=de,Qe.setIndex(Vt)),N.isMesh)B.wireframe===!0?(xe.setLineWidth(B.wireframeLinewidth*nt()),Qe.setMode(C.LINES)):Qe.setMode(C.TRIANGLES);else if(N.isLine){let ve=B.linewidth;ve===void 0&&(ve=1),xe.setLineWidth(ve*nt()),N.isLineSegments?Qe.setMode(C.LINES):N.isLineLoop?Qe.setMode(C.LINE_LOOP):Qe.setMode(C.LINE_STRIP)}else N.isPoints?Qe.setMode(C.POINTS):N.isSprite&&Qe.setMode(C.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)Qe.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if($e.get("WEBGL_multi_draw"))Qe.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const ve=N._multiDrawStarts,Rt=N._multiDrawCounts,et=N._multiDrawCount,nn=_e?k.get(_e).bytesPerElement:1,ui=Te.get(B).currentProgram.getUniforms();for(let Gt=0;Gt{function ne(){if(B.forEach(function(le){Te.get(le).currentProgram.isReady()&&B.delete(le)}),B.size===0){N(S);return}setTimeout(ne,10)}$e.get("KHR_parallel_shader_compile")!==null?ne():setTimeout(ne,10)})};let Ye=null;function Ht(S){Ye&&Ye(S)}function qt(){tn.stop()}function As(){tn.start()}const tn=new Vl;tn.setAnimationLoop(Ht),typeof self<"u"&&tn.setContext(self),this.setAnimationLoop=function(S){Ye=S,ee.setAnimationLoop(S),S===null?tn.stop():tn.start()},ee.addEventListener("sessionstart",qt),ee.addEventListener("sessionend",As),this.render=function(S,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(U),U=ee.getCamera()),S.isScene===!0&&S.onBeforeRender(x,S,U,A),m=ue.get(S,b.length),m.init(U),b.push(m),ce.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),He.setFromProjectionMatrix(ce),J=this.localClippingEnabled,W=De.init(this.clippingPlanes,J),g=se.get(S,p.length),g.init(),p.push(g),ee.enabled===!0&&ee.isPresenting===!0){const ne=x.xr.getDepthSensingMesh();ne!==null&&zr(ne,U,-1/0,x.sortObjects)}zr(S,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(V,ie),Be=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,Be&&he.addToRenderList(g,S),this.info.render.frame++,W===!0&&De.beginShadows();const F=m.state.shadowsArray;Q.render(F,S,U),W===!0&&De.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=g.opaque,N=g.transmissive;if(m.setupLights(),U.isArrayCamera){const ne=U.cameras;if(N.length>0)for(let le=0,me=ne.length;le0&&Vo(B,N,S,U),Be&&he.render(S),Ho(g,S,U);A!==null&&(Ie.updateMultisampleRenderTarget(A),Ie.updateRenderTargetMipmap(A)),S.isScene===!0&&S.onAfterRender(x,S,U),Ue.resetDefaultState(),D=-1,w=null,b.pop(),b.length>0?(m=b[b.length-1],W===!0&&De.setGlobalState(x.clippingPlanes,m.state.camera)):m=null,p.pop(),p.length>0?g=p[p.length-1]:g=null};function zr(S,U,F,B){if(S.visible===!1)return;if(S.layers.test(U.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(U);else if(S.isLight)m.pushLight(S),S.castShadow&&m.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||He.intersectsSprite(S)){B&&Ae.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ce);const le=$.update(S),me=S.material;me.visible&&g.push(S,le,me,F,Ae.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||He.intersectsObject(S))){const le=$.update(S),me=S.material;if(B&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),Ae.copy(S.boundingSphere.center)):(le.boundingSphere===null&&le.computeBoundingSphere(),Ae.copy(le.boundingSphere.center)),Ae.applyMatrix4(S.matrixWorld).applyMatrix4(ce)),Array.isArray(me)){const _e=le.groups;for(let Ee=0,Re=_e.length;Ee0&&Rs(N,U,F),ne.length>0&&Rs(ne,U,F),le.length>0&&Rs(le,U,F),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function Vo(S,U,F,B){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[B.id]===void 0&&(m.state.transmissionRenderTarget[B.id]=new ai(1,1,{generateMipmaps:!0,type:$e.has("EXT_color_buffer_half_float")||$e.has("EXT_color_buffer_float")?bs:Ln,minFilter:An,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ke.workingColorSpace}));const ne=m.state.transmissionRenderTarget[B.id],le=B.viewport||y;ne.setSize(le.z,le.w);const me=x.getRenderTarget();x.setRenderTarget(ne),x.getClearColor(O),G=x.getClearAlpha(),G<1&&x.setClearColor(16777215,.5),x.clear(),Be&&he.render(F);const _e=x.toneMapping;x.toneMapping=Xn;const Ee=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),m.setupLightsView(B),W===!0&&De.setGlobalState(x.clippingPlanes,B),Rs(S,F,B),Ie.updateMultisampleRenderTarget(ne),Ie.updateRenderTargetMipmap(ne),$e.has("WEBGL_multisampled_render_to_texture")===!1){let Re=!1;for(let Se=0,Je=U.length;Se0),Se=!!F.morphAttributes.position,Je=!!F.morphAttributes.normal,dt=!!F.morphAttributes.color;let ft=Xn;B.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(ft=x.toneMapping);const Vt=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,Qe=Vt!==void 0?Vt.length:0,ve=Te.get(B),Rt=m.state.lights;if(W===!0&&(J===!0||S!==w)){const Yt=S===w&&B.id===D;De.setState(B,S,Yt)}let et=!1;B.version===ve.__version?(ve.needsLights&&ve.lightsStateVersion!==Rt.state.version||ve.outputColorSpace!==me||N.isBatchedMesh&&ve.batching===!1||!N.isBatchedMesh&&ve.batching===!0||N.isBatchedMesh&&ve.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&ve.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&ve.instancing===!1||!N.isInstancedMesh&&ve.instancing===!0||N.isSkinnedMesh&&ve.skinning===!1||!N.isSkinnedMesh&&ve.skinning===!0||N.isInstancedMesh&&ve.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&ve.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&ve.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&ve.instancingMorph===!1&&N.morphTexture!==null||ve.envMap!==_e||B.fog===!0&&ve.fog!==ne||ve.numClippingPlanes!==void 0&&(ve.numClippingPlanes!==De.numPlanes||ve.numIntersection!==De.numIntersection)||ve.vertexAlphas!==Ee||ve.vertexTangents!==Re||ve.morphTargets!==Se||ve.morphNormals!==Je||ve.morphColors!==dt||ve.toneMapping!==ft||ve.morphTargetsCount!==Qe)&&(et=!0):(et=!0,ve.__version=B.version);let nn=ve.currentProgram;et===!0&&(nn=Cs(B,U,N));let ui=!1,Gt=!1,Hr=!1;const xt=nn.getUniforms(),Dn=ve.uniforms;if(xe.useProgram(nn.program)&&(ui=!0,Gt=!0,Hr=!0),B.id!==D&&(D=B.id,Gt=!0),ui||w!==S){xt.setValue(C,"projectionMatrix",S.projectionMatrix),xt.setValue(C,"viewMatrix",S.matrixWorldInverse);const Yt=xt.map.cameraPosition;Yt!==void 0&&Yt.setValue(C,ae.setFromMatrixPosition(S.matrixWorld)),qe.logarithmicDepthBuffer&&xt.setValue(C,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&xt.setValue(C,"isOrthographic",S.isOrthographicCamera===!0),w!==S&&(w=S,Gt=!0,Hr=!0)}if(N.isSkinnedMesh){xt.setOptional(C,N,"bindMatrix"),xt.setOptional(C,N,"bindMatrixInverse");const Yt=N.skeleton;Yt&&(Yt.boneTexture===null&&Yt.computeBoneTexture(),xt.setValue(C,"boneTexture",Yt.boneTexture,Ie))}N.isBatchedMesh&&(xt.setOptional(C,N,"batchingTexture"),xt.setValue(C,"batchingTexture",N._matricesTexture,Ie),xt.setOptional(C,N,"batchingIdTexture"),xt.setValue(C,"batchingIdTexture",N._indirectTexture,Ie),xt.setOptional(C,N,"batchingColorTexture"),N._colorsTexture!==null&&xt.setValue(C,"batchingColorTexture",N._colorsTexture,Ie));const Vr=F.morphAttributes;if((Vr.position!==void 0||Vr.normal!==void 0||Vr.color!==void 0)&&We.update(N,F,nn),(Gt||ve.receiveShadow!==N.receiveShadow)&&(ve.receiveShadow=N.receiveShadow,xt.setValue(C,"receiveShadow",N.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(Dn.envMap.value=_e,Dn.flipEnvMap.value=_e.isCubeTexture&&_e.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&U.environment!==null&&(Dn.envMapIntensity.value=U.environmentIntensity),Gt&&(xt.setValue(C,"toneMappingExposure",x.toneMappingExposure),ve.needsLights&&vh(Dn,Hr),ne&&B.fog===!0&&Me.refreshFogUniforms(Dn,ne),Me.refreshMaterialUniforms(Dn,B,q,H,m.state.transmissionRenderTarget[S.id]),fr.upload(C,Wo(ve),Dn,Ie)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(fr.upload(C,Wo(ve),Dn,Ie),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&xt.setValue(C,"center",N.center),xt.setValue(C,"modelViewMatrix",N.modelViewMatrix),xt.setValue(C,"normalMatrix",N.normalMatrix),xt.setValue(C,"modelMatrix",N.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const Yt=B.uniformsGroups;for(let Gr=0,Mh=Yt.length;Gr0&&Ie.useMultisampledRTT(S)===!1?N=Te.get(S).__webglMultisampledFramebuffer:Array.isArray(Re)?N=Re[F]:N=Re,y.copy(S.viewport),P.copy(S.scissor),z=S.scissorTest}else y.copy(oe).multiplyScalar(q).floor(),P.copy(pe).multiplyScalar(q).floor(),z=Oe;if(xe.bindFramebuffer(C.FRAMEBUFFER,N)&&B&&xe.drawBuffers(S,N),xe.viewport(y),xe.scissor(P),xe.setScissorTest(z),ne){const _e=Te.get(S.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+U,_e.__webglTexture,F)}else if(le){const _e=Te.get(S.texture),Ee=U||0;C.framebufferTextureLayer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,_e.__webglTexture,F||0,Ee)}D=-1},this.readRenderTargetPixels=function(S,U,F,B,N,ne,le){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let me=Te.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&le!==void 0&&(me=me[le]),me){xe.bindFramebuffer(C.FRAMEBUFFER,me);try{const _e=S.texture,Ee=_e.format,Re=_e.type;if(!qe.textureFormatReadable(Ee)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!qe.textureTypeReadable(Re)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=S.width-B&&F>=0&&F<=S.height-N&&C.readPixels(U,F,B,N,Pe.convert(Ee),Pe.convert(Re),ne)}finally{const _e=A!==null?Te.get(A).__webglFramebuffer:null;xe.bindFramebuffer(C.FRAMEBUFFER,_e)}}},this.readRenderTargetPixelsAsync=async function(S,U,F,B,N,ne,le){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let me=Te.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&le!==void 0&&(me=me[le]),me){xe.bindFramebuffer(C.FRAMEBUFFER,me);try{const _e=S.texture,Ee=_e.format,Re=_e.type;if(!qe.textureFormatReadable(Ee))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!qe.textureTypeReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(U>=0&&U<=S.width-B&&F>=0&&F<=S.height-N){const Se=C.createBuffer();C.bindBuffer(C.PIXEL_PACK_BUFFER,Se),C.bufferData(C.PIXEL_PACK_BUFFER,ne.byteLength,C.STREAM_READ),C.readPixels(U,F,B,N,Pe.convert(Ee),Pe.convert(Re),0),C.flush();const Je=C.fenceSync(C.SYNC_GPU_COMMANDS_COMPLETE,0);await Ou(C,Je,4);try{C.bindBuffer(C.PIXEL_PACK_BUFFER,Se),C.getBufferSubData(C.PIXEL_PACK_BUFFER,0,ne)}finally{C.deleteBuffer(Se),C.deleteSync(Je)}return ne}}finally{const _e=A!==null?Te.get(A).__webglFramebuffer:null;xe.bindFramebuffer(C.FRAMEBUFFER,_e)}}},this.copyFramebufferToTexture=function(S,U=null,F=0){S.isTexture!==!0&&(Bi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),U=arguments[0]||null,S=arguments[1]);const B=Math.pow(2,-F),N=Math.floor(S.image.width*B),ne=Math.floor(S.image.height*B),le=U!==null?U.x:0,me=U!==null?U.y:0;Ie.setTexture2D(S,0),C.copyTexSubImage2D(C.TEXTURE_2D,F,0,0,le,me,N,ne),xe.unbindTexture()},this.copyTextureToTexture=function(S,U,F=null,B=null,N=0){S.isTexture!==!0&&(Bi("WebGLRenderer: copyTextureToTexture function signature has changed."),B=arguments[0]||null,S=arguments[1],U=arguments[2],N=arguments[3]||0,F=null);let ne,le,me,_e,Ee,Re;F!==null?(ne=F.max.x-F.min.x,le=F.max.y-F.min.y,me=F.min.x,_e=F.min.y):(ne=S.image.width,le=S.image.height,me=0,_e=0),B!==null?(Ee=B.x,Re=B.y):(Ee=0,Re=0);const Se=Pe.convert(U.format),Je=Pe.convert(U.type);Ie.setTexture2D(U,0),C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,U.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,U.unpackAlignment);const dt=C.getParameter(C.UNPACK_ROW_LENGTH),ft=C.getParameter(C.UNPACK_IMAGE_HEIGHT),Vt=C.getParameter(C.UNPACK_SKIP_PIXELS),Qe=C.getParameter(C.UNPACK_SKIP_ROWS),ve=C.getParameter(C.UNPACK_SKIP_IMAGES),Rt=S.isCompressedTexture?S.mipmaps[N]:S.image;C.pixelStorei(C.UNPACK_ROW_LENGTH,Rt.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,Rt.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,me),C.pixelStorei(C.UNPACK_SKIP_ROWS,_e),S.isDataTexture?C.texSubImage2D(C.TEXTURE_2D,N,Ee,Re,ne,le,Se,Je,Rt.data):S.isCompressedTexture?C.compressedTexSubImage2D(C.TEXTURE_2D,N,Ee,Re,Rt.width,Rt.height,Se,Rt.data):C.texSubImage2D(C.TEXTURE_2D,N,Ee,Re,ne,le,Se,Je,Rt),C.pixelStorei(C.UNPACK_ROW_LENGTH,dt),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ft),C.pixelStorei(C.UNPACK_SKIP_PIXELS,Vt),C.pixelStorei(C.UNPACK_SKIP_ROWS,Qe),C.pixelStorei(C.UNPACK_SKIP_IMAGES,ve),N===0&&U.generateMipmaps&&C.generateMipmap(C.TEXTURE_2D),xe.unbindTexture()},this.copyTextureToTexture3D=function(S,U,F=null,B=null,N=0){S.isTexture!==!0&&(Bi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),F=arguments[0]||null,B=arguments[1]||null,S=arguments[2],U=arguments[3],N=arguments[4]||0);let ne,le,me,_e,Ee,Re,Se,Je,dt;const ft=S.isCompressedTexture?S.mipmaps[N]:S.image;F!==null?(ne=F.max.x-F.min.x,le=F.max.y-F.min.y,me=F.max.z-F.min.z,_e=F.min.x,Ee=F.min.y,Re=F.min.z):(ne=ft.width,le=ft.height,me=ft.depth,_e=0,Ee=0,Re=0),B!==null?(Se=B.x,Je=B.y,dt=B.z):(Se=0,Je=0,dt=0);const Vt=Pe.convert(U.format),Qe=Pe.convert(U.type);let ve;if(U.isData3DTexture)Ie.setTexture3D(U,0),ve=C.TEXTURE_3D;else if(U.isDataArrayTexture||U.isCompressedArrayTexture)Ie.setTexture2DArray(U,0),ve=C.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,U.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,U.unpackAlignment);const Rt=C.getParameter(C.UNPACK_ROW_LENGTH),et=C.getParameter(C.UNPACK_IMAGE_HEIGHT),nn=C.getParameter(C.UNPACK_SKIP_PIXELS),ui=C.getParameter(C.UNPACK_SKIP_ROWS),Gt=C.getParameter(C.UNPACK_SKIP_IMAGES);C.pixelStorei(C.UNPACK_ROW_LENGTH,ft.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ft.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,_e),C.pixelStorei(C.UNPACK_SKIP_ROWS,Ee),C.pixelStorei(C.UNPACK_SKIP_IMAGES,Re),S.isDataTexture||S.isData3DTexture?C.texSubImage3D(ve,N,Se,Je,dt,ne,le,me,Vt,Qe,ft.data):U.isCompressedArrayTexture?C.compressedTexSubImage3D(ve,N,Se,Je,dt,ne,le,me,Vt,ft.data):C.texSubImage3D(ve,N,Se,Je,dt,ne,le,me,Vt,Qe,ft),C.pixelStorei(C.UNPACK_ROW_LENGTH,Rt),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,et),C.pixelStorei(C.UNPACK_SKIP_PIXELS,nn),C.pixelStorei(C.UNPACK_SKIP_ROWS,ui),C.pixelStorei(C.UNPACK_SKIP_IMAGES,Gt),N===0&&U.generateMipmaps&&C.generateMipmap(ve),xe.unbindTexture()},this.initRenderTarget=function(S){Te.get(S).__webglFramebuffer===void 0&&Ie.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?Ie.setTextureCube(S,0):S.isData3DTexture?Ie.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?Ie.setTexture2DArray(S,0):Ie.setTexture2D(S,0),xe.unbindTexture()},this.resetState=function(){L=0,E=0,A=null,xe.reset(),Ue.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===wo?"display-p3":"srgb",t.unpackColorSpace=Ke.workingColorSpace===Pr?"display-p3":"srgb"}}let Y_=class extends it{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 mt,this.environmentIntensity=1,this.environmentRotation=new mt,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 K_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ro,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=un()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Bi("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;sn)return;xa.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(xa);if(!(ce.far))return{distance:c,point:Qc.clone().applyMatrix4(r.matrixWorld),index:i,face:null,faceIndex:null,object:r}}const el=new T,tl=new T;class eg extends Nr{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;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;si.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,object:a})}}class ig{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,c=s-1,l;for(;o<=c;)if(i=Math.floor(o+(c-o)/2),l=n[i]-a,l<0)o=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===a)return i/(s-1);const u=n[i],d=n[i+1]-u,f=(a-u)/d;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),c=t||(a.isVector2?new Ne:new T);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new T,i=[],s=[],a=[],o=new T,c=new fe;for(let f=0;f<=e;f++){const _=f/e;i[f]=this.getTangentAt(_,new T)}s[0]=new T,a[0]=new T;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const _=Math.acos(At(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(c.makeRotationAxis(o,_))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(At(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let _=1;_<=e;_++)s[_].applyMatrix4(c.makeRotationAxis(i[_],f*_)),a[_].crossVectors(i[_],s[_])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Lo extends zt{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:c};const l=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],d=[],f=[];let _=0;const g=[],m=n/2;let p=0;b(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new gt(h,3)),this.setAttribute("normal",new gt(d,3)),this.setAttribute("uv",new gt(f,2));function b(){const M=new T,L=new T;let E=0;const A=(t-e)/n;for(let D=0;D<=s;D++){const w=[],y=D/s,P=y*(t-e)+e;for(let z=0;z<=i;z++){const O=z/i,G=O*c+o,X=Math.sin(G),H=Math.cos(G);L.x=P*X,L.y=-y*n+m,L.z=P*H,h.push(L.x,L.y,L.z),M.set(X,A,H).normalize(),d.push(M.x,M.y,M.z),f.push(O,1-y),w.push(_++)}g.push(w)}for(let D=0;D80*t){o=l=r[0],c=u=r[1];for(let _=t;_l&&(l=h),d>u&&(u=d);f=Math.max(l-o,u-c),f=f!==0?32767/f:0}return vs(s,a,t,o,c,f,0),a}};function $l(r,e,t,n,i){let s,a;if(i===yg(r,e,t,n)>0)for(s=e;s=e;s-=n)a=sl(s,r[s],r[s+1],a);return a&&Fr(a,a.next)&&(Ms(a),a=a.next),a}function oi(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Fr(t,t.next)||ht(t.prev,t,t.next)===0)){if(Ms(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function vs(r,e,t,n,i,s,a){if(!r)return;!a&&s&&pg(r,n,i,s);let o=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?ag(r,n,i,s):rg(r)){e.push(c.i/t|0),e.push(r.i/t|0),e.push(l.i/t|0),Ms(r),r=l.next,o=l.next;continue}if(r=l,r===o){a?a===1?(r=og(oi(r),e,t),vs(r,e,t,n,i,s,2)):a===2&&cg(r,e,t,n,i,s):vs(oi(r),e,t,n,i,s,1);break}}}function rg(r){const e=r.prev,t=r,n=r.next;if(ht(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,c=t.y,l=n.y,u=is?i>a?i:a:s>a?s:a,f=o>c?o>l?o:l:c>l?c:l;let _=n.next;for(;_!==e;){if(_.x>=u&&_.x<=d&&_.y>=h&&_.y<=f&&Ui(i,o,s,c,a,l,_.x,_.y)&&ht(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function ag(r,e,t,n){const i=r.prev,s=r,a=r.next;if(ht(i,s,a)>=0)return!1;const o=i.x,c=s.x,l=a.x,u=i.y,h=s.y,d=a.y,f=oc?o>l?o:l:c>l?c:l,m=u>h?u>d?u:d:h>d?h:d,p=lo(f,_,e,t,n),b=lo(g,m,e,t,n);let x=r.prevZ,M=r.nextZ;for(;x&&x.z>=p&&M&&M.z<=b;){if(x.x>=f&&x.x<=g&&x.y>=_&&x.y<=m&&x!==i&&x!==a&&Ui(o,u,c,h,l,d,x.x,x.y)&&ht(x.prev,x,x.next)>=0||(x=x.prevZ,M.x>=f&&M.x<=g&&M.y>=_&&M.y<=m&&M!==i&&M!==a&&Ui(o,u,c,h,l,d,M.x,M.y)&&ht(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;x&&x.z>=p;){if(x.x>=f&&x.x<=g&&x.y>=_&&x.y<=m&&x!==i&&x!==a&&Ui(o,u,c,h,l,d,x.x,x.y)&&ht(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;M&&M.z<=b;){if(M.x>=f&&M.x<=g&&M.y>=_&&M.y<=m&&M!==i&&M!==a&&Ui(o,u,c,h,l,d,M.x,M.y)&&ht(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function og(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Fr(i,s)&&Jl(i,n,n.next,s)&&ys(i,s)&&ys(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),Ms(n),Ms(n.next),n=r=s),n=n.next}while(n!==r);return oi(n)}function cg(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&gg(a,o)){let c=Ql(a,o);a=oi(a,a.next),c=oi(c,c.next),vs(a,e,t,n,i,s,0),vs(c,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function lg(r,e,t,n){const i=[];let s,a,o,c,l;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const d=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>n&&(n=d,i=t.x=t.x&&t.x>=c&&s!==t.x&&Ui(ai.x||t.x===i.x&&fg(i,t)))&&(i=t,u=h)),t=t.next;while(t!==o);return i}function fg(r,e){return ht(r.prev,r,e.prev)<0&&ht(e.next,r,r.next)<0}function pg(r,e,t,n){let i=r;do i.z===0&&(i.z=lo(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,mg(i)}function mg(r){let e,t,n,i,s,a,o,c,l=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e0||c>0&&n;)o!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,l*=2}while(a>1);return r}function lo(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 _g(r){let e=r,t=r;do(e.x=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function gg(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!xg(r,e)&&(ys(r,e)&&ys(e,r)&&vg(r,e)&&(ht(r.prev,r,e.prev)||ht(r,e.prev,e))||Fr(r,e)&&ht(r.prev,r,r.next)>0&&ht(e.prev,e,e.next)>0)}function ht(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Fr(r,e){return r.x===e.x&&r.y===e.y}function Jl(r,e,t,n){const i=sr(ht(r,e,t)),s=sr(ht(r,e,n)),a=sr(ht(t,n,r)),o=sr(ht(t,n,e));return!!(i!==s&&a!==o||i===0&&ir(r,t,e)||s===0&&ir(r,n,e)||a===0&&ir(t,r,n)||o===0&&ir(t,e,n))}function ir(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 sr(r){return r>0?1:r<0?-1:0}function xg(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&&Jl(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function ys(r,e){return ht(r.prev,r,r.next)<0?ht(r,e,r.next)>=0&&ht(r,r.prev,e)>=0:ht(r,e,r.prev)<0||ht(r,r.next,e)<0}function vg(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 Ql(r,e){const t=new ho(r.i,r.x,r.y),n=new ho(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 sl(r,e,t,n){const i=new ho(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 Ms(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 ho(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function yg(r,e,t,n){let i=0;for(let s=e,a=t-n;s2&&r[e-1].equals(r[0])&&r.pop()}function al(r,e){for(let t=0;t0)&&f.push(x,M,E),(p!==n-1||c0!=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 va extends en{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ge(16777215),this.specular=new ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new Ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mt,this.combine=Ar,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 Mg extends en{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new Ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mt,this.combine=Ar,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function rr(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Sg(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function bg(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 ol(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let c=0;c!==e;++c)i[a++]=r[o+c]}return i}function eh(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}class Ts{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e=s)){const o=t[1];e=s)break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(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 a=null;for(let o=0;o!==s;o++){const c=n[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&Sg(i))for(let o=0,c=i.length;o!==c;++o){const l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Wr,s=e.length-1;let a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}xn.prototype.TimeBufferType=Float32Array;xn.prototype.ValueBufferType=Float32Array;xn.prototype.DefaultInterpolation=gs;class Zi extends xn{constructor(e,t,n){super(e,t,n)}}Zi.prototype.ValueTypeName="bool";Zi.prototype.ValueBufferType=Array;Zi.prototype.DefaultInterpolation=_s;Zi.prototype.InterpolantFactoryMethodLinear=void 0;Zi.prototype.InterpolantFactoryMethodSmooth=void 0;class nh extends xn{}nh.prototype.ValueTypeName="color";class ci extends xn{}ci.prototype.ValueTypeName="number";class Eg extends Ts{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t);let l=e*o;for(let u=l+o;l!==u;l+=4)pt.slerpFlat(s,0,a,l-o,a,l,c);return s}}class qn extends xn{InterpolantFactoryMethodLinear(e){return new Eg(this.times,this.values,this.getValueSize(),e)}}qn.prototype.ValueTypeName="quaternion";qn.prototype.InterpolantFactoryMethodSmooth=void 0;class $i extends xn{constructor(e,t,n){super(e,t,n)}}$i.prototype.ValueTypeName="string";$i.prototype.ValueBufferType=Array;$i.prototype.DefaultInterpolation=_s;$i.prototype.InterpolantFactoryMethodLinear=void 0;$i.prototype.InterpolantFactoryMethodSmooth=void 0;class li extends xn{}li.prototype.ValueTypeName="vector";class Tr{constructor(e="",t=-1,n=[],i=bo){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=un(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Rg(n[a]).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,a=n.length;s!==a;++s)t.push(xn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(l)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,f,_,g){if(f.length!==0){const m=[],p=[];eh(f,m,p,_),m.length!==0&&g.push(new h(d,m,p))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(wn[e]!==void 0){wn[e].push({onLoad:t,onProgress:n,onError:i});return}wn[e]=[],wn[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=wn[e],h=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,_=f!==0;let g=0;const m=new ReadableStream({start(p){b();function b(){h.read().then(({done:x,value:M})=>{if(x)p.close();else{g+=M.byteLength;const L=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:f});for(let E=0,A=u.length;E{p.error(x)})}}});return new Response(m)}else throw new Pg(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return l.json();default:if(o===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(_=>f.decode(_))}}}).then(l=>{Gn.add(e,l);const u=wn[e];delete wn[e];for(let h=0,d=u.length;h{const u=wn[e];if(u===void 0)throw this.manager.itemError(e),l;delete wn[e];for(let h=0,d=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Lg extends In{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Gn.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=xs("img");function c(){u(),Gn.add(e,this),t&&t(this),s.manager.itemEnd(e)}function l(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class Ss extends In{constructor(e){super(e)}load(e,t,n,i){const s=new St,a=new Lg(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class kr extends it{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ge(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}}const ya=new fe,cl=new T,ll=new T;class No{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ne(512,512),this.map=null,this.mapPass=null,this.matrix=new fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ao,this._frameExtents=new Ne(1,1),this._viewportCount=1,this._viewports=[new Ze(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;cl.setFromMatrixPosition(e.matrixWorld),t.position.copy(cl),ll.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ll),t.updateMatrixWorld(),ya.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ya),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(ya)}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 Ig extends No{constructor(){super(new Dt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ji*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 ih extends kr{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(it.DEFAULT_UP),this.updateMatrix(),this.target=new it,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Ig}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 hl=new fe,cs=new T,Ma=new T;class Dg extends No{constructor(){super(new Dt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ne(4,2),this._viewportCount=6,this._viewports=[new Ze(2,1,1,1),new Ze(0,1,1,1),new Ze(3,1,1,1),new Ze(1,1,1,1),new Ze(3,0,1,1),new Ze(1,0,1,1)],this._cubeDirections=[new T(1,0,0),new T(-1,0,0),new T(0,0,1),new T(0,0,-1),new T(0,1,0),new T(0,-1,0)],this._cubeUps=[new T(0,1,0),new T(0,1,0),new T(0,1,0),new T(0,1,0),new T(0,0,1),new T(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()),cs.setFromMatrixPosition(e.matrixWorld),n.position.copy(cs),Ma.copy(n.position),Ma.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ma),n.updateMatrixWorld(),i.makeTranslation(-cs.x,-cs.y,-cs.z),hl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hl)}}class lt extends kr{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 Dg}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 Ug extends No{constructor(){super(new Ir(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Fo extends kr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(it.DEFAULT_UP),this.updateMatrix(),this.target=new it,this.shadow=new Ug}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class sh extends kr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class zi{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n"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,a=Gn.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(l=>{t&&t(l),s.manager.itemEnd(e)}).catch(l=>{i&&i(l)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){return Gn.add(e,l),t&&t(l),s.manager.itemEnd(e),l}).catch(function(l){i&&i(l),Gn.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Gn.add(e,c),s.manager.itemStart(e)}}class Fg{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){pt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;pt.multiplyQuaternionsFlat(e,a,e,t,e,n),pt.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const Oo="\\[\\]\\.:\\/",Og=new RegExp("["+Oo+"]","g"),Bo="[^"+Oo+"]",Bg="[^"+Oo.replace("\\.","")+"]",kg=/((?:WC+[\/:])*)/.source.replace("WC",Bo),zg=/(WCOD+)?/.source.replace("WCOD",Bg),Hg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Bo),Vg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Bo),Gg=new RegExp("^"+kg+zg+Hg+Vg+"$"),Wg=["material","materials","bones","map"];class Xg{constructor(e,t,n){const i=n||je.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 je{constructor(e,t,n){this.path=t,this.parsedPath=n||je.parseTrackName(t),this.node=je.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 je.Composite(e,t,n):new je(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Og,"")}static parseTrackName(e){const t=Gg.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);Wg.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case cu:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulateAdditive(o);break;case bo:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===ou;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===ru){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const c=this.repetitions-s;if(c<=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(c===1){const l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ii,i.endingEnd=Ii):(e?i.endingStart=this.zeroSlopeAtStart?Ii:Li:i.endingStart=gr,t?i.endingEnd=this.zeroSlopeAtEnd?Ii:Li:i.endingEnd=gr)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=s,c[0]=t,o[1]=s+e,c[1]=n,this}}const qg=new Float32Array(1);class ko extends hi{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==s;++h){const d=i[h],f=d.name;let _=u[f];if(_!==void 0)++_.referenceCount,a[h]=_;else{if(_=a[h],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,c,f));continue}const g=t&&t._propertyBindings[h].binding.parsedPath;_=new Fg(je.create(n,f,g),d.ValueTypeName,d.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,c,f),a[h]=_}o[h].resultBuffer=_.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=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,a);const o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t=2.0 are supported."));return}const l=new E0(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&o[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function Yg(){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 Ge={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 Kg{constructor(e){this.parser=e,this.name=Ge.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=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class l0{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,a.source,c);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 h0{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,a.source,c);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,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class u0{constructor(e){this.name=Ge.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const c=i.byteOffset||0,l=i.byteLength||0,u=i.count,h=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(u,h,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(u*h);return a.decodeGltfBuffer(new Uint8Array(f),u,h,d,i.mode,i.filter),f})})}else return null}}class d0{constructor(e){this.name=Ge.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 l of i.primitives)if(l.mode!==Zt.TRIANGLES&&l.mode!==Zt.TRIANGLE_STRIP&&l.mode!==Zt.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const l in a)o.push(this.parser.getDependency("accessor",a[l]).then(u=>(c[l]=u,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const u=l.pop(),h=u.isGroup?u.children:[u],d=l[0].count,f=[];for(const _ of h){const g=new fe,m=new T,p=new pt,b=new T(1,1,1),x=new Q_(_.geometry,_.material,d);for(let M=0;M0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const T0=new fe;class E0{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Yg,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,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||s&&a<98?this.textureLoader=new Ss(this.options.manager):this.textureLoader=new Ng(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Uo(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ei(s,o,i),En(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(const c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,u]of a.children.entries())s(u,o.children[l])};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=2&&m.setY(w,E[A*c+1]),c>=3&&m.setZ(w,E[A*c+2]),c>=4&&m.setW(w,E[A*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const i=this,s=this.json,a=s.textures[e],o=s.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=a.name||o.name||"",u.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(u.name=o.uri);const d=(s.samplers||{})[a.sampler]||{};return u.magFilter=fl[d.magFilter]||jt,u.minFilter=fl[d.minFilter]||An,u.wrapS=pl[d.wrapS]||Jt,u.wrapT=pl[d.wrapT]||Jt,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const a=i.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(h){l=!0;const d=new Blob([h],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then(function(h){return new Promise(function(d,f){let _=d;t.isImageBitmapLoader===!0&&(_=function(g){const m=new St(g);m.needsUpdate=!0,d(m)}),t.load(zi.resolveURL(h,s.path),_,void 0,f)})}).then(function(h){return l===!0&&o.revokeObjectURL(c),En(h,a),h.userData.mimeType=a.mimeType||w0(a.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),h});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[Ge.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[Ge.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=s.associations.get(a);a=s.extensions[Ge.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,c)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new Zl,en.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new Po,en.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||s||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),s&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return Br}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let a;const o={},c=s.extensions||{},l=[];if(c[Ge.KHR_MATERIALS_UNLIT]){const h=i[Ge.KHR_MATERIALS_UNLIT];a=h.getMaterialType(),l.push(h.extendParams(o,s,t))}else{const h=s.pbrMetallicRoughness||{};if(o.color=new ge(1,1,1),o.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],Ct),o.opacity=d[3]}h.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",h.baseColorTexture,Mt)),o.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,o.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",h.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",h.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=fn);const u=s.alphaMode||ba.OPAQUE;if(u===ba.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===ba.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==Le&&(l.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new Ne(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;o.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&a!==Le&&(l.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==Le){const h=s.emissiveFactor;o.emissive=new ge().setRGB(h[0],h[1],h[2],Ct)}return s.emissiveTexture!==void 0&&a!==Le&&l.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,Mt)),Promise.all(l).then(function(){const h=new a(o);return s.name&&(h.name=s.name),En(h,s),t.associations.set(h,{materials:e}),s.extensions&&ei(i,h,s),h})}createUniqueName(e){const t=je.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(o){return n[Ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return ml(c,o,t)})}const a=[];for(let o=0,c=e.length;o0&&S0(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),En(p,s),m.extensions&&ei(i,p,m),t.assignFinalMaterial(p),h.push(p)}for(let f=0,_=h.length;f<_;f++)t.associations.set(h[f],{meshes:e,primitives:f});if(h.length===1)return s.extensions&&ei(i,h[0],s),h[0];const d=new Cn;s.extensions&&ei(i,d,s),t.associations.set(d,{meshes:e});for(let f=0,_=h.length;f<_;f++)d.add(h[f]);return d})}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 Dt(It.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Ir(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),En(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i1?u=new Cn:l.length===1?u=l[0]:u=new it,u!==l[0])for(let h=0,d=l.length;h{const h=new Map;for(const[d,f]of i.associations)(d instanceof en||d instanceof St)&&h.set(d,f);return u.traverse(d=>{const f=i.associations.get(d);f!=null&&h.set(d,f)}),h};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){const a=[],o=e.name?e.name:e.uuid,c=[];zn[s.path]===zn.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(zn[s.path]){case zn.weights:l=ci;break;case zn.rotation:l=qn;break;case zn.position:case zn.scale:l=li;break;default:switch(n.itemSize){case 1:l=ci;break;case 2:case 3:default:l=li;break}break}const u=i.interpolation!==void 0?v0[i.interpolation]:gs,h=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d{Date.now()-t.creationTime>=t.expirationTime?(t.remove(),this._particlesArray[e].splice(this._particlesArray[e].indexOf(t),1),this._particlesArray[e].length===0&&this._particlesArray.splice(e,1)):t.update()})}}class R0{constructor(e,t){this._position=t,this._params=e,this._scene=this._params.scene,this._colors=this._params.colors,this._radius=this._params.radius,this._opacity=this._params.opacity,this._transparency=this._params.transparency,this._velocityParams=this._params.velocity,this._expirationTime=this._params.expirationTime,this._boxX=this._params.boxX,this._boxY=this._params.boxY,this._boxZ=this._params.boxZ,this._mesh=new ye(new Or(Math.random()*this._radius.randomRadius+this._radius.baseRadius,Math.random()*1+5,Math.random()*1+5),new Le({color:this._colors[Math.floor(Math.random()*this._colors.length)],opacity:this._transparency?Math.random()*this._opacity.randomOpacity+this._opacity.baseOpacity:this._opacity.baseOpacity,transparent:this._transparency})),this._mesh.rotation.set(Math.random()*Math.PI*2,Math.random()*Math.PI*2,Math.random()*Math.PI*2),this._velocity=new T(this._velocityParams.baseSign.x*(this._velocityParams.randomSign.x&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.x+this._velocityParams.baseVelocity.x,this._velocityParams.baseSign.y*(this._velocityParams.randomSign.y&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.y+this._velocityParams.baseVelocity.y,this._velocityParams.baseSign.z*(this._velocityParams.randomSign.z&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.z+this._velocityParams.baseVelocity.z),this._creationTime=Date.now(),this._expirationTime=this._expirationTime.baseExpirationTime+Math.random()*this._expirationTime.randomExpirationTime}update(){this._velocityParams.update&&(this._velocity=new T(this._velocityParams.baseSign.x*(this._velocityParams.randomSign.x&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.x+this._velocityParams.baseVelocity.x,this._velocityParams.baseSign.y*(this._velocityParams.randomSign.y&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.y+this._velocityParams.baseVelocity.y,this._velocityParams.baseSign.z*(this._velocityParams.randomSign.z&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.z+this._velocityParams.baseVelocity.z));let e=!1,t=!1,n=!1;(this._mesh.position.xthis._position.x+(this._boxX.baseMax+Math.random()*this._boxX.randomMax))&&(e=!0),(this._mesh.position.ythis._position.y+(this._boxY.baseMax+Math.random()*this._boxY.randomMax))&&(t=!0),(this._mesh.position.zthis._position.z+(this._boxZ.baseMax+Math.random()*this._boxZ.randomMax))&&(n=!0),e&&this._boxX.blockAll||t&&this._boxY.blockAll||n&&this._boxZ.blockAll?(this._velocity=new T(0,0,0),this._mesh.visible=this._boxX.visible&&this._boxY.visible&&this._boxZ.visible):this._velocity=new T(e?0:this._velocity.x,t?0:this._velocity.y,n?0:this._velocity.z),this._mesh.position.add(this._velocity)}remove(){this._scene.remove(this._mesh)}get mesh(){return this._mesh}get creationTime(){return this._creationTime}get expirationTime(){return this._expirationTime}}class C0{constructor(e){this._params=e,this._Init()}_Init(){this._boundingBoxes=[],this._boundingBoxesVisible=!1,this._mixers=[],this._particleSpawnerParams={scene:this._params.scene,colors:[15556639,13059594,13066762],radius:{baseRadius:.1,randomRadius:.5},opacity:{baseOpacity:.8,randomOpacity:.2},transparency:!0,velocity:{baseVelocity:new T(0,.02,0),randomVelocity:new T(.1,.1,.1),baseSign:new T(1,1,1),randomSign:new T(!0,!1,!0),update:!0},expirationTime:{baseExpirationTime:1e3,randomExpirationTime:2e3},boxX:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!1},boxY:{baseMin:-100,baseMax:2,randomMin:0,randomMax:10,blockAll:!0,visible:!1},boxZ:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!1}},this._particleSpawner=new zo(this._particleSpawnerParams),this._AddFloor(),this._AddSky(),this._AddModel(),this._AddLights(),this._AddBoundingBoxes()}_AddFloor(){const t=new Ss().load("./textures/gray_rocks_floor.jpg");t.wrapS=Jt,t.wrapT=Jt,t.repeat.set(15,15);const n=new ye(new ws(600,600,10,10),new Br({map:t}));n.castShadow=!1,n.receiveShadow=!0,n.rotation.x=-Math.PI/2,this._params.scene.add(n)}_AddSky(){const t=new Ss().load("./textures/sky.jpg",a=>{a.wrapS=Jt,a.wrapT=Jt,a.repeat.set(1,1)}),n=new Or(300,32,32),i=new Le({map:t,side:Bt,color:3355443}),s=new ye(n,i);this._params.scene.add(s)}_AddModel(){const e=new Yi;e.load("./models/scene_objects/scene.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(1,1,1),t.scene.scale.set(20,20,20),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(120,18,178),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-120,18,178),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-42,18,152),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(42,18,152),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,130),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,130),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,50),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,-30),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,-110),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,60),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,-60),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,-130),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(40,18,-52),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-40,18,-52),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-40,18,-175),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(40,18,-175),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/fire_rocks.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(0,0,50),t.scene.rotation.y=0,t.scene.scale.set(5,5,5),this._params.scene.add(t.scene)})}_AddLights(){let e=new Fo(15788992,.8);e.position.set(100,100,0),e.target.position.set(0,0,0),e.castShadow=!0,e.shadow.bias=-.001,e.shadow.mapSize.width=4096,e.shadow.mapSize.height=4096,e.shadow.camera.near=.1,e.shadow.camera.far=500,e.shadow.camera.near=.5,e.shadow.camera.far=500,e.shadow.camera.left=50,e.shadow.camera.right=-50,e.shadow.camera.top=50,e.shadow.camera.bottom=-50,this._params.scene.add(e);let t=new sh(15788724,.5);this._params.scene.add(t);let n=new lt(16083734,1e3,100);n.position.set(-120,25,178),this._params.scene.add(n);let i=new lt(16083734,1e3,100);i.position.set(120,25,178),this._params.scene.add(i);let s=new lt(16083734,1e3,100);s.position.set(42,25,152),this._params.scene.add(s);let a=new lt(16083734,1e3,100);a.position.set(-42,25,152),this._params.scene.add(a);let o=new lt(16083734,1e3,100);o.position.set(158,25,130),this._params.scene.add(o);let c=new lt(16083734,1e3,100);c.position.set(-160,25,130),this._params.scene.add(c);let l=new lt(16083734,1e3,100);l.position.set(-160,25,50),this._params.scene.add(l);let u=new lt(16083734,1e3,100);u.position.set(-160,25,-30),this._params.scene.add(u);let h=new lt(16083734,1e3,100);h.position.set(-160,25,-110),this._params.scene.add(h);let d=new lt(16083734,1e3,100);d.position.set(158,25,60),this._params.scene.add(d);let f=new lt(16083734,1e3,100);f.position.set(158,25,-60),this._params.scene.add(f);let _=new lt(16083734,1e3,100);_.position.set(158,25,-130),this._params.scene.add(_);let g=new lt(16083734,1e3,100);g.position.set(40,25,-52),this._params.scene.add(g);let m=new lt(16083734,1e3,100);m.position.set(-40,25,-52),this._params.scene.add(m);let p=new lt(16083734,1e3,100);p.position.set(40,25,-175),this._params.scene.add(p);let b=new lt(16083734,1e3,100);b.position.set(-40,25,-175),this._params.scene.add(b);let x=new lt(16083734,1e3,100);x.position.set(-61,38,99),this._params.scene.add(x);let M=new lt(16083734,1e3,100);M.position.set(80,38,57),this._params.scene.add(M);let L=new lt(16083734,1e3,100);L.position.set(-81,38,-2),this._params.scene.add(L);let E=new lt(16083734,1e3,100);E.position.set(2,2,51),this._params.scene.add(E)}_AddBoundingBoxes(){const e=new ze(40,50,40),t=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),n=new ye(e,t);n.position.set(-45,25,185),this._params.scene.add(n),this._boundingBoxes.push(n);const i=new ze(40,50,40),s=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),a=new ye(i,s);a.position.set(45,25,185),this._params.scene.add(a),this._boundingBoxes.push(a);const o=new ze(130,50,20),c=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),l=new ye(o,c);l.position.set(-120,25,200),this._params.scene.add(l),this._boundingBoxes.push(l);const u=new ze(130,50,20),h=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),d=new ye(u,h);d.position.set(120,25,200),this._params.scene.add(d),this._boundingBoxes.push(d);const f=new ze(20,50,400),_=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),g=new ye(f,_);g.position.set(-180,25,0),this._params.scene.add(g),this._boundingBoxes.push(g);const m=new ze(20,50,400),p=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),b=new ye(m,p);b.position.set(180,25,0),this._params.scene.add(b),this._boundingBoxes.push(b);const x=new ze(400,50,20),M=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),L=new ye(x,M);L.position.set(0,25,-195),this._params.scene.add(L),this._boundingBoxes.push(L);const E=new ze(95,50,40),A=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),D=new ye(E,A);D.position.set(-60,25,-80),this._params.scene.add(D),this._boundingBoxes.push(D);const w=new ze(92,50,40),y=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),P=new ye(w,y);P.position.set(60,25,-80),this._params.scene.add(P),this._boundingBoxes.push(P);const z=new ze(20,50,130),O=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),G=new ye(z,O);G.position.set(-100,25,-120),this._params.scene.add(G),this._boundingBoxes.push(G);const X=new ze(20,50,130),H=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),q=new ye(X,H);q.position.set(100,25,-120),this._params.scene.add(q),this._boundingBoxes.push(q);const V=new ze(90,50,90),ie=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),oe=new ye(V,ie);oe.position.set(180,25,0),this._params.scene.add(oe),this._boundingBoxes.push(oe);const pe=new ze(30,50,40),Oe=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),He=new ye(pe,Oe);He.position.set(-80,25,5),this._params.scene.add(He),this._boundingBoxes.push(He);const W=new ze(30,50,40),J=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),ce=new ye(W,J);ce.position.set(-60,25,95),this._params.scene.add(ce),this._boundingBoxes.push(ce);const ae=new ze(40,50,35),Ae=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Ce=new ye(ae,Ae);Ce.position.set(77,25,58),this._params.scene.add(Ce),this._boundingBoxes.push(Ce);const Be=new ze(60,50,60),nt=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),C=new ye(Be,nt);C.position.set(-160,25,175),this._params.scene.add(C),this._boundingBoxes.push(C);const st=new ze(30,50,30),$e=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),qe=new ye(st,$e);qe.position.set(-170,25,45),this._params.scene.add(qe),this._boundingBoxes.push(qe);const xe=new ze(30,50,30),ut=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Te=new ye(xe,ut);Te.position.set(-170,25,-180),this._params.scene.add(Te),this._boundingBoxes.push(Te);const Ie=new ze(30,50,30),R=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),v=new ye(Ie,R);v.position.set(-110,25,-180),this._params.scene.add(v),this._boundingBoxes.push(v);const k=new ze(30,50,30),Z=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),$=new ye(k,Z);$.position.set(-105,25,-70),this._params.scene.add($),this._boundingBoxes.push($);const K=new ze(30,50,30),Me=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),se=new ye(K,Me);se.position.set(-95,25,-50),this._params.scene.add(se),this._boundingBoxes.push(se);const ue=new ze(60,50,50),De=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Q=new ye(ue,De);Q.position.set(170,25,-170),this._params.scene.add(Q),this._boundingBoxes.push(Q);const he=new ze(40,50,50),We=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),be=new ye(he,We);be.position.set(170,25,70),this._params.scene.add(be),this._boundingBoxes.push(be);const de=new ze(40,50,30),Pe=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Ue=new ye(de,Pe);Ue.position.set(170,25,180),this._params.scene.add(Ue),this._boundingBoxes.push(Ue);const rt=new ze(480,50,10),I=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),ee=new ye(rt,I);ee.position.set(0,25,240),this._params.scene.add(ee),this._boundingBoxes.push(ee);const j=new ze(480,50,10),Y=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),te=new ye(j,Y);te.position.set(0,25,-240),this._params.scene.add(te),this._boundingBoxes.push(te);const we=new ze(10,50,480),Xe=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),ct=new ye(we,Xe);ct.position.set(-240,25,0),this._params.scene.add(ct),this._boundingBoxes.push(ct);const yt=new ze(10,50,480),Ye=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Ht=new ye(yt,Ye);Ht.position.set(240,25,0),this._params.scene.add(Ht),this._boundingBoxes.push(Ht);const qt=new Lo(15,15,50,32),As=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),tn=new ye(qt,As);tn.position.set(2,7,50),this._params.scene.add(tn),this._boundingBoxes.push(tn)}update(){this._particleSpawner.create({x:-63,y:38,z:94,width:7,height:4,depth:7},5),this._particleSpawner.create({x:77,y:38,z:53,width:7,height:4,depth:7},5),this._particleSpawner.create({x:-83,y:38,z:-5,width:4,height:4,depth:8},5),this._particleSpawner.create({x:-3,y:-1,z:45,width:10,height:10,depth:10},100),this._particleSpawner.update()}get boundingBoxes(){return this._boundingBoxes}}class P0{constructor(){this._hearts=[],this._heartsContainer=document.createElement("div"),this._heartsContainer.style.position="absolute",this._heartsContainer.style.left="50%",this._heartsContainer.style.bottom="10px",this._heartsContainer.style.transform="translateX(-50%)",document.body.appendChild(this._heartsContainer);for(let e=0;e<10;e++){const t=document.createElement("img");t.src="./textures/heart.png",t.style.width="30px",t.style.height="30px",t.style.margin="0 2px",this._heartsContainer.appendChild(t),this._hearts.push(t)}}get hearts(){return this._hearts}removeHeart(){if(this._hearts.length>0){const e=this._hearts.pop();this._heartsContainer.removeChild(e)}}addHeart(){if(this._hearts.length<10){const e=document.createElement("img");e.src="./textures/heart.png",e.style.width="30px",e.style.height="30px",e.style.margin="0 2px",this._heartsContainer.appendChild(e),this._hearts.push(e)}}show(){this._heartsContainer.style.display="block"}hide(){this._heartsContainer.style.display="none"}}class L0{constructor(){this._swords=[],this._swordsContainer=document.createElement("div"),this._swordsContainer.style.position="absolute",this._swordsContainer.style.left="50%",this._swordsContainer.style.bottom="50px",this._swordsContainer.style.transform="translateX(-50%)",document.body.appendChild(this._swordsContainer);for(let e=0;e<1;e++){const t=document.createElement("img");t.src="./textures/sword.png",t.style.width="30px",t.style.height="30px",t.style.margin="0 2px",this._swordsContainer.appendChild(t),this._swords.push(t)}}get swords(){return this._swords}removeSword(){if(this._swords.length>0){const e=this._swords.pop();this._swordsContainer.removeChild(e)}}addSword(){if(this._swords.length<10){const e=document.createElement("img");e.src="./textures/sword.png",e.style.width="30px",e.style.height="30px",e.style.margin="0 2px",this._swordsContainer.appendChild(e),this._swords.push(e)}}show(){this._swordsContainer.style.display="block"}hide(){this._swordsContainer.style.display="none"}}class I0{constructor(){this._numOfStars=0,this._starCounter=document.createElement("div"),this._starCounter.style.position="absolute",this._starCounter.style.left="50px",this._starCounter.style.top="35px",this._starCounter.style.color="white",this._starCounter.style.fontSize="35px",this._starCounter.style.fontFamily="Handjet",this._starCounter.innerHTML=` ${this._numOfStars}`,document.body.appendChild(this._starCounter)}set stars(e){this._numOfStars=e,this._starCounter.innerHTML=` ${this._numOfStars}`}get stars(){return this._numOfStars}addStar(){this.stars=this.stars+1}removeStar(){this.stars=this.stars-1}reset(){this.stars=0}show(){this._starCounter.style.display="block"}hide(){this._starCounter.style.display="none"}}class D0{constructor(){this._gameOver=document.createElement("div"),this._gameOver.style.position="absolute",this._gameOver.style.left="50%",this._gameOver.style.top="40%",this._gameOver.style.transform="translate(-50%, -50%)",this._gameOver.style.color="white",this._gameOver.style.fontSize="150px",this._gameOver.style.fontFamily="Handjet",this._gameOver.innerHTML="Game Over",this._gameOver.style.textShadow="3px 4px 3px rgba(255, 0, 0, 0.5)",this._layer=document.createElement("div"),this._layer.style.position="absolute",this._layer.style.left="0",this._layer.style.top="0",this._layer.style.width="100%",this._layer.style.height="100%",this._layer.style.backgroundColor="rgba(100, 0, 0, 0.1)",this._layer.style.display="none";const e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="140%",e.style.transform="translate(-50%, -50%)",e.style.width="200px",e.style.height="90px",e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.color="rgba(255, 255, 255, 1)",e.style.textShadow="3px 4px 3px rgba(155, 0, 0, 0.5)",e.style.fontSize="50px",e.style.fontFamily="Handjet",e.style.border="solid 4px rgba(255, 0, 0, 0.5)",e.style.borderRadius="10px",e.innerHTML="Restart",e.onclick=()=>{window.location.reload()},e.onmouseover=()=>{e.style.backgroundColor="rgba(180, 180, 180, 0.7)",e.style.border="solid 6px rgba(255, 0, 0, 0.5)"},e.onmouseout=()=>{e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 4px rgba(255, 0, 0, 0.5)"},this._gameOver.appendChild(e),document.body.appendChild(this._layer),document.body.appendChild(this._gameOver)}show(){setTimeout(()=>{this._gameOver.style.display="block",this._layer.style.display="block"},1e3)}hide(){this._gameOver.style.display="none",this._layer.style.display="none"}}class U0{constructor(){this._gameWin=document.createElement("div"),this._gameWin.style.position="absolute",this._gameWin.style.left="50%",this._gameWin.style.top="40%",this._gameWin.style.transform="translate(-50%, -50%)",this._gameWin.style.color="white",this._gameWin.style.fontSize="150px",this._gameWin.style.fontFamily="Handjet",this._gameWin.innerHTML="Game Win",this._gameWin.style.textShadow="3px 4px 3px rgba(0, 255, 0, 0.5)",this._layer=document.createElement("div"),this._layer.style.position="absolute",this._layer.style.left="0",this._layer.style.top="0",this._layer.style.width="100%",this._layer.style.height="100%",this._layer.style.backgroundColor="rgba(0, 100, 0, 0.1)",this._layer.style.display="none";const e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="140%",e.style.transform="translate(-50%, -50%)",e.style.width="200px",e.style.height="90px",e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.color="rgba(255, 255, 255, 1)",e.style.textShadow="3px 4px 3px rgba(0, 155, 0, 0.5)",e.style.fontSize="50px",e.style.fontFamily="Handjet",e.style.border="solid 4px rgba(0, 255, 0, 0.5)",e.style.borderRadius="10px",e.innerHTML="Restart",e.onclick=()=>{window.location.reload()},e.onmouseover=()=>{e.style.backgroundColor="rgba(180, 180, 180, 0.7)",e.style.border="solid 6px rgba(0, 255, 0, 0.5)"},e.onmouseout=()=>{e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 4px rgba(0, 255, 0, 0.5)"},this._gameWin.appendChild(e),document.body.appendChild(this._layer),document.body.appendChild(this._gameWin)}show(){setTimeout(()=>{this._gameWin.style.display="block",this._layer.style.display="block"},1e3)}hide(){this._gameWin.style.display="none",this._layer.style.display="none"}}class N0{constructor(){this._start=document.createElement("div"),this._start.style.position="absolute",this._start.style.left="50%",this._start.style.top="25%",this._start.style.transform="translate(-50%, -50%)",this._start.style.color="white",this._start.style.fontSize="150px",this._start.style.fontFamily="Handjet",this._start.innerHTML="Kill the Monster",this._start.style.textShadow="3px 4px 3px rgba(0, 0, 155, 0.5)",this._layer=document.createElement("div"),this._layer.style.position="absolute",this._layer.style.left="0",this._layer.style.top="0",this._layer.style.width="100%",this._layer.style.height="100%",this._layer.style.backgroundColor="rgba(0, 0, 155, 0.1)",this._layer.style.display="none";const e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="285%",e.style.transform="translate(-50%, -50%)",e.style.width="200px",e.style.height="90px",e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.color="rgba(255, 255, 255, 1)",e.style.textShadow="3px 4px 3px rgba(0, 0, 155, 0.5)",e.style.fontSize="50px",e.style.fontFamily="Handjet",e.style.border="solid 4px rgba(0, 0, 155, 0.5)",e.style.borderRadius="10px",e.innerHTML="Start",e.onclick=()=>{this._play=!0,this.hide()},e.onmouseover=()=>{e.style.backgroundColor="rgba(180, 180, 180, 0.7)",e.style.border="solid 6px rgba(0, 0, 155, 0.5)"},e.onmouseout=()=>{e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 4px rgba(0, 0, 155, 0.5)"},this._start.appendChild(e);const t=document.createElement("div");t.style.position="absolute",t.style.left="50%",t.style.top="350%",t.style.transform="translate(-50%, -50%)",t.style.color="white",t.style.fontSize="35px",t.style.fontFamily="Handjet",t.innerHTML="Choose the difficulty",this._start.appendChild(t);const n=document.createElement("input");n.type="radio",n.name="difficulty",n.value="easy",n.checked=!1,n.style.width="27px",n.style.height="27px",n.style.margin="40 40px",n.style.position="absolute",n.style.left="29%",n.style.top="380%",n.style.transform="translate(-50%, -50%)",n.style.appearance="none",n.style.border="solid 1px rgba(0, 0, 155, 0.5)",n.style.backgroundColor="rgba(150, 150, 150, 0.5)",n.style.borderRadius="7px",this._start.appendChild(n);const i=document.createElement("label");i.innerHTML="Easy",i.style.color="white",i.style.fontSize="30px",i.style.fontFamily="Handjet",i.style.position="absolute",i.style.left="35%",i.style.top="381%",i.style.transform="translate(-50%, -50%)",this._start.appendChild(i);const s=document.createElement("input");s.type="radio",s.name="difficulty",s.value="medium",s.checked=!0,s.style.width="27px",s.style.height="27px",s.style.margin="40 40px",s.style.position="absolute",s.style.left="44%",s.style.top="380%",s.style.transform="translate(-50%, -50%)",s.style.appearance="none",s.style.border="solid 1px rgba(0, 0, 155, 0.5)",s.style.backgroundColor="rgba(0, 0, 155, 0.5)",s.style.borderRadius="7px",this._start.appendChild(s);const a=document.createElement("label");a.innerHTML="Medium",a.style.color="white",a.style.fontSize="30px",a.style.fontFamily="Handjet",a.style.position="absolute",a.style.left="52%",a.style.top="381%",a.style.transform="translate(-50%, -50%)",this._start.appendChild(a);const o=document.createElement("input");o.type="radio",o.name="difficulty",o.value="hard",o.checked=!1,o.style.width="27px",o.style.height="27px",o.style.margin="40 40px",o.style.position="absolute",o.style.left="62%",o.style.top="380%",o.style.transform="translate(-50%, -50%)",o.style.appearance="none",o.style.border="solid 1px rgba(0, 0, 155, 0.5)",o.style.backgroundColor="rgba(150, 150, 150, 0.5)",o.style.borderRadius="7px",this._start.appendChild(o);const c=document.createElement("label");c.innerHTML="Hard",c.style.color="white",c.style.fontSize="30px",c.style.fontFamily="Handjet",c.style.position="absolute",c.style.left="68%",c.style.top="381%",c.style.transform="translate(-50%, -50%)",this._start.appendChild(c);const l=document.createElement("div");l.style.position="absolute",l.style.left="50%",l.style.top="170%",l.style.width="800px",l.style.transform="translate(-50%, -50%)",l.style.color="white",l.style.fontSize="25px",l.style.fontFamily="Handjet",l.style.backgroundColor="rgba(180, 180, 180, 0.5)",l.style.border="solid 4px rgba(0, 0, 155, 0.5)",l.style.borderRadius="10px",l.style.padding="30px",l.innerHTML="- W A S D to move, Space to attack and Shift to run.
- Collect swords to increase the power of your attack and hearts to increase your life.
- Collect 5 stars to become bigger and stronger.
   The effect lasts for 15 seconds, then you will return to normal size and lose 2 swords.
   The transformation will give to you full health.
- Defeat the monster to win the game",this._start.appendChild(l),document.body.appendChild(this._layer),document.body.appendChild(this._start),this._play=!1,this._difficulty="medium"}show(){setTimeout(()=>{this._start.style.display="block",this._layer.style.display="block"},1e3)}hide(){this._start.style.display="none",this._layer.style.display="none"}update(){const e=document.querySelector('input[value="easy"]'),t=document.querySelector('input[value="medium"]'),n=document.querySelector('input[value="hard"]');e.checked?(e.style.backgroundColor="rgba(250, 250, 250, 0.8)",e.style.border="solid 5px rgba(0, 0, 155, 0.8)",t.style.backgroundColor="rgba(150, 150, 150, 0.5)",t.style.border="solid 3px rgba(0, 0, 155, 0.5)",n.style.backgroundColor="rgba(150, 150, 150, 0.5)",n.style.border="solid 3px rgba(0, 0, 155, 0.5)"):t.checked?(e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 3px rgba(0, 0, 155, 0.5)",t.style.backgroundColor="rgba(250, 250, 250, 0.8)",t.style.border="solid 5px rgba(0, 0, 155, 0.8)",n.style.backgroundColor="rgba(150, 150, 150, 0.5)",n.style.border="solid 3px rgba(0, 0, 155, 0.5)"):(e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 3px rgba(0, 0, 155, 0.5)",t.style.backgroundColor="rgba(150, 150, 150, 0.5)",t.style.border="solid 3px rgba(0, 0, 155, 0.5)",n.style.backgroundColor="rgba(250, 250, 250, 0.8)",n.style.border="solid 5px rgba(0, 0, 155, 0.8)"),this._difficulty=document.querySelector('input[name="difficulty"]:checked').value}get play(){return this._play}set play(e){this._play=e}get difficulty(){return this._difficulty}}class F0{constructor(){this._monsterLife=100,this._monsterLifeBar=document.createElement("div"),this._monsterLifeBar.style.position="absolute",this._monsterLifeBar.style.left="50%",this._monsterLifeBar.style.top="40px",this._monsterLifeBar.style.transform="translateX(-50%)",this._monsterLifeBar.style.width="500px",this._monsterLifeBar.style.height="25px",this._monsterLifeBar.style.border="solid 3px white",this._monsterLifeBar.style.borderRadius="5px",document.body.appendChild(this._monsterLifeBar),this._divs=[];for(let e=0;e<100;e++){const t=document.createElement("div");t.style.width="5px",t.style.height="25px",t.style.backgroundColor="rgba(240, 0, 0, 0.8)",t.style.float="left",this._monsterLifeBar.appendChild(t),this._divs.push(t)}}get monsterLife(){return this._monsterLife}set monsterLife(e){this._monsterLife=e}show(){this._monsterLifeBar.style.display="block"}hide(){this._monsterLifeBar.style.display="none"}update(){this._monsterLife<0&&(this._monsterLife=0);for(let e=0;e=0&&(M[ae]=null,x[ae].disconnect(le))}for(let J=0;J=M.length){M.push(le),ae=Ce;break}else if(M[Ce]===null){M[Ce]=le,ae=Ce;break}if(ae===-1)break}const Ae=x[ae];Ae&&Ae.connect(le)}}const H=new T,q=new T;function V(W,J,le){H.setFromMatrixPosition(J.matrixWorld),q.setFromMatrixPosition(le.matrixWorld);const ae=H.distanceTo(q),Ae=J.projectionMatrix.elements,Ce=le.projectionMatrix.elements,Be=Ae[14]/(Ae[10]-1),nt=Ae[14]/(Ae[10]+1),C=(Ae[9]+1)/Ae[5],st=(Ae[9]-1)/Ae[5],$e=(Ae[8]-1)/Ae[0],qe=(Ce[8]+1)/Ce[0],xe=Be*$e,ut=Be*qe,Te=ae/(-$e+qe),Ie=Te*-$e;J.matrixWorld.decompose(W.position,W.quaternion,W.scale),W.translateX(Ie),W.translateZ(Te),W.matrixWorld.compose(W.position,W.quaternion,W.scale),W.matrixWorldInverse.copy(W.matrixWorld).invert();const R=Be+Te,v=nt+Te,k=xe-Ie,Z=ut+(ae-Ie),$=C*nt/v*R,K=st*nt/v*R;W.projectionMatrix.makePerspective(k,Z,$,K,R,v),W.projectionMatrixInverse.copy(W.projectionMatrix).invert()}function ie(W,J){J===null?W.matrixWorld.copy(W.matrix):W.matrixWorld.multiplyMatrices(J.matrixWorld,W.matrix),W.matrixWorldInverse.copy(W.matrixWorld).invert()}this.updateCamera=function(W){if(i===null)return;g.texture!==null&&(W.near=g.depthNear,W.far=g.depthFar),y.near=D.near=A.near=W.near,y.far=D.far=A.far=W.far,(P!==y.near||z!==y.far)&&(i.updateRenderState({depthNear:y.near,depthFar:y.far}),P=y.near,z=y.far,A.near=P,A.far=z,D.near=P,D.far=z,A.updateProjectionMatrix(),D.updateProjectionMatrix(),W.updateProjectionMatrix());const J=W.parent,le=y.cameras;ie(y,J);for(let ae=0;ae0&&(m.alphaTest.value=p.alphaTest);const b=e.get(p),x=b.envMap,M=b.envMapRotation;x&&(m.envMap.value=x,Qn.copy(M),Qn.x*=-1,Qn.y*=-1,Qn.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Qn.y*=-1,Qn.z*=-1),m.envMapRotation.value.setFromMatrix4(W_.makeRotationFromEuler(Qn)),m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,b,x){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*b,m.scale.value=x*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,b){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Bt&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function g(m,p){const b=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function j_(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,x){const M=x.program;n.uniformBlockBinding(b,M)}function c(b,x){let M=i[b.id];M===void 0&&(_(b),M=u(b),i[b.id]=M,b.addEventListener("dispose",m));const L=x.program;n.updateUBOMapping(b,L);const E=e.render.frame;s[b.id]!==E&&(d(b),s[b.id]=E)}function u(b){const x=h();b.__bindingPointIndex=x;const M=r.createBuffer(),L=b.__size,E=b.usage;return r.bindBuffer(r.UNIFORM_BUFFER,M),r.bufferData(r.UNIFORM_BUFFER,L,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,M),M}function h(){for(let b=0;b0&&(M+=L-E),b.__size=M,b.__cache={},this}function g(b){const x={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function m(b){const x=b.target;x.removeEventListener("dispose",m);const M=a.indexOf(x.__bindingPointIndex);a.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function p(){for(const b in i)r.deleteBuffer(i[b]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class q_{constructor(e={}){const{canvas:t=Fu(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const f=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const p=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Mt,this.toneMapping=Xn,this.toneMappingExposure=1;const x=this;let M=!1,L=0,E=0,A=null,D=-1,w=null;const y=new Ze,P=new Ze;let z=null;const O=new ge(0);let G=0,X=t.width,H=t.height,q=1,V=null,ie=null;const oe=new Ze(0,0,X,H),pe=new Ze(0,0,X,H);let Oe=!1;const He=new Ao;let W=!1,J=!1;const le=new fe,ae=new T,Ae=new Ze,Ce={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function nt(){return A===null?q:1}let C=n;function st(S,U){return t.getContext(S,U)}try{const S={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${mo}`),t.addEventListener("webglcontextlost",j,!1),t.addEventListener("webglcontextrestored",Y,!1),t.addEventListener("webglcontextcreationerror",te,!1),C===null){const U="webgl2";if(C=st(U,S),C===null)throw st(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let $e,qe,xe,ut,Te,Ie,R,v,k,Z,$,K,Me,se,ue,De,Q,he,We,be,de,Pe,Ue,rt;function I(){$e=new Qp(C),$e.init(),Pe=new O_(C,$e),qe=new qp(C,$e,e,Pe),xe=new U_(C),ut=new nm(C),Te=new y_,Ie=new F_(C,$e,xe,Te,qe,Pe,ut),R=new Kp(x),v=new Jp(x),k=new ld(C),Ue=new Xp(C,k),Z=new em(C,k,ut,Ue),$=new sm(C,Z,k,ut),We=new im(C,qe,Ie),De=new Yp(Te),K=new v_(x,R,v,$e,qe,Ue,De),Me=new X_(x,Te),se=new S_,ue=new R_($e),he=new Wp(x,R,v,xe,$,d,l),Q=new D_(x,$,qe),rt=new j_(C,ut,qe,xe),be=new jp(C,$e,ut),de=new tm(C,$e,ut),ut.programs=K.programs,x.capabilities=qe,x.extensions=$e,x.properties=Te,x.renderLists=se,x.shadowMap=Q,x.state=xe,x.info=ut}I();const ee=new G_(x,C);this.xr=ee,this.getContext=function(){return C},this.getContextAttributes=function(){return C.getContextAttributes()},this.forceContextLoss=function(){const S=$e.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=$e.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(S){S!==void 0&&(q=S,this.setSize(X,H,!1))},this.getSize=function(S){return S.set(X,H)},this.setSize=function(S,U,F=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=S,H=U,t.width=Math.floor(S*q),t.height=Math.floor(U*q),F===!0&&(t.style.width=S+"px",t.style.height=U+"px"),this.setViewport(0,0,S,U)},this.getDrawingBufferSize=function(S){return S.set(X*q,H*q).floor()},this.setDrawingBufferSize=function(S,U,F){X=S,H=U,q=F,t.width=Math.floor(S*F),t.height=Math.floor(U*F),this.setViewport(0,0,S,U)},this.getCurrentViewport=function(S){return S.copy(y)},this.getViewport=function(S){return S.copy(oe)},this.setViewport=function(S,U,F,B){S.isVector4?oe.set(S.x,S.y,S.z,S.w):oe.set(S,U,F,B),xe.viewport(y.copy(oe).multiplyScalar(q).round())},this.getScissor=function(S){return S.copy(pe)},this.setScissor=function(S,U,F,B){S.isVector4?pe.set(S.x,S.y,S.z,S.w):pe.set(S,U,F,B),xe.scissor(P.copy(pe).multiplyScalar(q).round())},this.getScissorTest=function(){return Oe},this.setScissorTest=function(S){xe.setScissorTest(Oe=S)},this.setOpaqueSort=function(S){V=S},this.setTransparentSort=function(S){ie=S},this.getClearColor=function(S){return S.copy(he.getClearColor())},this.setClearColor=function(){he.setClearColor.apply(he,arguments)},this.getClearAlpha=function(){return he.getClearAlpha()},this.setClearAlpha=function(){he.setClearAlpha.apply(he,arguments)},this.clear=function(S=!0,U=!0,F=!0){let B=0;if(S){let N=!1;if(A!==null){const ne=A.texture.format;N=ne===So||ne===Mo||ne===yo}if(N){const ne=A.texture.type,ce=ne===Ln||ne===ri||ne===ps||ne===Wi||ne===go||ne===xo,me=he.getClearColor(),_e=he.getClearAlpha(),Ee=me.r,Re=me.g,Se=me.b;ce?(f[0]=Ee,f[1]=Re,f[2]=Se,f[3]=_e,C.clearBufferuiv(C.COLOR,0,f)):(_[0]=Ee,_[1]=Re,_[2]=Se,_[3]=_e,C.clearBufferiv(C.COLOR,0,_))}else B|=C.COLOR_BUFFER_BIT}U&&(B|=C.DEPTH_BUFFER_BIT),F&&(B|=C.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),C.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",j,!1),t.removeEventListener("webglcontextrestored",Y,!1),t.removeEventListener("webglcontextcreationerror",te,!1),se.dispose(),ue.dispose(),Te.dispose(),R.dispose(),v.dispose(),$.dispose(),Ue.dispose(),rt.dispose(),K.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",qt),ee.removeEventListener("sessionend",As),tn.stop()};function j(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Y(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const S=ut.autoReset,U=Q.enabled,F=Q.autoUpdate,B=Q.needsUpdate,N=Q.type;I(),ut.autoReset=S,Q.enabled=U,Q.autoUpdate=F,Q.needsUpdate=B,Q.type=N}function te(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function we(S){const U=S.target;U.removeEventListener("dispose",we),Xe(U)}function Xe(S){lt(S),Te.remove(S)}function lt(S){const U=Te.get(S).programs;U!==void 0&&(U.forEach(function(F){K.releaseProgram(F)}),S.isShaderMaterial&&K.releaseShaderCache(S))}this.renderBufferDirect=function(S,U,F,B,N,ne){U===null&&(U=Ce);const ce=N.isMesh&&N.matrixWorld.determinant()<0,me=xh(S,U,F,B,N);xe.setMaterial(B,ce);let _e=F.index,Ee=1;if(B.wireframe===!0){if(_e=Z.getWireframeAttribute(F),_e===void 0)return;Ee=2}const Re=F.drawRange,Se=F.attributes.position;let Je=Re.start*Ee,dt=(Re.start+Re.count)*Ee;ne!==null&&(Je=Math.max(Je,ne.start*Ee),dt=Math.min(dt,(ne.start+ne.count)*Ee)),_e!==null?(Je=Math.max(Je,0),dt=Math.min(dt,_e.count)):Se!=null&&(Je=Math.max(Je,0),dt=Math.min(dt,Se.count));const ft=dt-Je;if(ft<0||ft===1/0)return;Ue.setup(N,B,me,F,_e);let Vt,Qe=be;if(_e!==null&&(Vt=k.get(_e),Qe=de,Qe.setIndex(Vt)),N.isMesh)B.wireframe===!0?(xe.setLineWidth(B.wireframeLinewidth*nt()),Qe.setMode(C.LINES)):Qe.setMode(C.TRIANGLES);else if(N.isLine){let ve=B.linewidth;ve===void 0&&(ve=1),xe.setLineWidth(ve*nt()),N.isLineSegments?Qe.setMode(C.LINES):N.isLineLoop?Qe.setMode(C.LINE_LOOP):Qe.setMode(C.LINE_STRIP)}else N.isPoints?Qe.setMode(C.POINTS):N.isSprite&&Qe.setMode(C.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)Qe.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if($e.get("WEBGL_multi_draw"))Qe.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const ve=N._multiDrawStarts,Rt=N._multiDrawCounts,et=N._multiDrawCount,nn=_e?k.get(_e).bytesPerElement:1,ui=Te.get(B).currentProgram.getUniforms();for(let Gt=0;Gt{function ne(){if(B.forEach(function(ce){Te.get(ce).currentProgram.isReady()&&B.delete(ce)}),B.size===0){N(S);return}setTimeout(ne,10)}$e.get("KHR_parallel_shader_compile")!==null?ne():setTimeout(ne,10)})};let Ye=null;function Ht(S){Ye&&Ye(S)}function qt(){tn.stop()}function As(){tn.start()}const tn=new Vc;tn.setAnimationLoop(Ht),typeof self<"u"&&tn.setContext(self),this.setAnimationLoop=function(S){Ye=S,ee.setAnimationLoop(S),S===null?tn.stop():tn.start()},ee.addEventListener("sessionstart",qt),ee.addEventListener("sessionend",As),this.render=function(S,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(U),U=ee.getCamera()),S.isScene===!0&&S.onBeforeRender(x,S,U,A),m=ue.get(S,b.length),m.init(U),b.push(m),le.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),He.setFromProjectionMatrix(le),J=this.localClippingEnabled,W=De.init(this.clippingPlanes,J),g=se.get(S,p.length),g.init(),p.push(g),ee.enabled===!0&&ee.isPresenting===!0){const ne=x.xr.getDepthSensingMesh();ne!==null&&zr(ne,U,-1/0,x.sortObjects)}zr(S,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(V,ie),Be=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,Be&&he.addToRenderList(g,S),this.info.render.frame++,W===!0&&De.beginShadows();const F=m.state.shadowsArray;Q.render(F,S,U),W===!0&&De.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=g.opaque,N=g.transmissive;if(m.setupLights(),U.isArrayCamera){const ne=U.cameras;if(N.length>0)for(let ce=0,me=ne.length;ce0&&Vo(B,N,S,U),Be&&he.render(S),Ho(g,S,U);A!==null&&(Ie.updateMultisampleRenderTarget(A),Ie.updateRenderTargetMipmap(A)),S.isScene===!0&&S.onAfterRender(x,S,U),Ue.resetDefaultState(),D=-1,w=null,b.pop(),b.length>0?(m=b[b.length-1],W===!0&&De.setGlobalState(x.clippingPlanes,m.state.camera)):m=null,p.pop(),p.length>0?g=p[p.length-1]:g=null};function zr(S,U,F,B){if(S.visible===!1)return;if(S.layers.test(U.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(U);else if(S.isLight)m.pushLight(S),S.castShadow&&m.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||He.intersectsSprite(S)){B&&Ae.setFromMatrixPosition(S.matrixWorld).applyMatrix4(le);const ce=$.update(S),me=S.material;me.visible&&g.push(S,ce,me,F,Ae.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||He.intersectsObject(S))){const ce=$.update(S),me=S.material;if(B&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),Ae.copy(S.boundingSphere.center)):(ce.boundingSphere===null&&ce.computeBoundingSphere(),Ae.copy(ce.boundingSphere.center)),Ae.applyMatrix4(S.matrixWorld).applyMatrix4(le)),Array.isArray(me)){const _e=ce.groups;for(let Ee=0,Re=_e.length;Ee0&&Rs(N,U,F),ne.length>0&&Rs(ne,U,F),ce.length>0&&Rs(ce,U,F),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function Vo(S,U,F,B){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[B.id]===void 0&&(m.state.transmissionRenderTarget[B.id]=new ai(1,1,{generateMipmaps:!0,type:$e.has("EXT_color_buffer_half_float")||$e.has("EXT_color_buffer_float")?Ss:Ln,minFilter:An,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ke.workingColorSpace}));const ne=m.state.transmissionRenderTarget[B.id],ce=B.viewport||y;ne.setSize(ce.z,ce.w);const me=x.getRenderTarget();x.setRenderTarget(ne),x.getClearColor(O),G=x.getClearAlpha(),G<1&&x.setClearColor(16777215,.5),x.clear(),Be&&he.render(F);const _e=x.toneMapping;x.toneMapping=Xn;const Ee=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),m.setupLightsView(B),W===!0&&De.setGlobalState(x.clippingPlanes,B),Rs(S,F,B),Ie.updateMultisampleRenderTarget(ne),Ie.updateRenderTargetMipmap(ne),$e.has("WEBGL_multisampled_render_to_texture")===!1){let Re=!1;for(let Se=0,Je=U.length;Se0),Se=!!F.morphAttributes.position,Je=!!F.morphAttributes.normal,dt=!!F.morphAttributes.color;let ft=Xn;B.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(ft=x.toneMapping);const Vt=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,Qe=Vt!==void 0?Vt.length:0,ve=Te.get(B),Rt=m.state.lights;if(W===!0&&(J===!0||S!==w)){const Yt=S===w&&B.id===D;De.setState(B,S,Yt)}let et=!1;B.version===ve.__version?(ve.needsLights&&ve.lightsStateVersion!==Rt.state.version||ve.outputColorSpace!==me||N.isBatchedMesh&&ve.batching===!1||!N.isBatchedMesh&&ve.batching===!0||N.isBatchedMesh&&ve.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&ve.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&ve.instancing===!1||!N.isInstancedMesh&&ve.instancing===!0||N.isSkinnedMesh&&ve.skinning===!1||!N.isSkinnedMesh&&ve.skinning===!0||N.isInstancedMesh&&ve.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&ve.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&ve.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&ve.instancingMorph===!1&&N.morphTexture!==null||ve.envMap!==_e||B.fog===!0&&ve.fog!==ne||ve.numClippingPlanes!==void 0&&(ve.numClippingPlanes!==De.numPlanes||ve.numIntersection!==De.numIntersection)||ve.vertexAlphas!==Ee||ve.vertexTangents!==Re||ve.morphTargets!==Se||ve.morphNormals!==Je||ve.morphColors!==dt||ve.toneMapping!==ft||ve.morphTargetsCount!==Qe)&&(et=!0):(et=!0,ve.__version=B.version);let nn=ve.currentProgram;et===!0&&(nn=Cs(B,U,N));let ui=!1,Gt=!1,Hr=!1;const xt=nn.getUniforms(),Dn=ve.uniforms;if(xe.useProgram(nn.program)&&(ui=!0,Gt=!0,Hr=!0),B.id!==D&&(D=B.id,Gt=!0),ui||w!==S){xt.setValue(C,"projectionMatrix",S.projectionMatrix),xt.setValue(C,"viewMatrix",S.matrixWorldInverse);const Yt=xt.map.cameraPosition;Yt!==void 0&&Yt.setValue(C,ae.setFromMatrixPosition(S.matrixWorld)),qe.logarithmicDepthBuffer&&xt.setValue(C,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&xt.setValue(C,"isOrthographic",S.isOrthographicCamera===!0),w!==S&&(w=S,Gt=!0,Hr=!0)}if(N.isSkinnedMesh){xt.setOptional(C,N,"bindMatrix"),xt.setOptional(C,N,"bindMatrixInverse");const Yt=N.skeleton;Yt&&(Yt.boneTexture===null&&Yt.computeBoneTexture(),xt.setValue(C,"boneTexture",Yt.boneTexture,Ie))}N.isBatchedMesh&&(xt.setOptional(C,N,"batchingTexture"),xt.setValue(C,"batchingTexture",N._matricesTexture,Ie),xt.setOptional(C,N,"batchingIdTexture"),xt.setValue(C,"batchingIdTexture",N._indirectTexture,Ie),xt.setOptional(C,N,"batchingColorTexture"),N._colorsTexture!==null&&xt.setValue(C,"batchingColorTexture",N._colorsTexture,Ie));const Vr=F.morphAttributes;if((Vr.position!==void 0||Vr.normal!==void 0||Vr.color!==void 0)&&We.update(N,F,nn),(Gt||ve.receiveShadow!==N.receiveShadow)&&(ve.receiveShadow=N.receiveShadow,xt.setValue(C,"receiveShadow",N.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(Dn.envMap.value=_e,Dn.flipEnvMap.value=_e.isCubeTexture&&_e.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&U.environment!==null&&(Dn.envMapIntensity.value=U.environmentIntensity),Gt&&(xt.setValue(C,"toneMappingExposure",x.toneMappingExposure),ve.needsLights&&vh(Dn,Hr),ne&&B.fog===!0&&Me.refreshFogUniforms(Dn,ne),Me.refreshMaterialUniforms(Dn,B,q,H,m.state.transmissionRenderTarget[S.id]),fr.upload(C,Wo(ve),Dn,Ie)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(fr.upload(C,Wo(ve),Dn,Ie),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&xt.setValue(C,"center",N.center),xt.setValue(C,"modelViewMatrix",N.modelViewMatrix),xt.setValue(C,"normalMatrix",N.normalMatrix),xt.setValue(C,"modelMatrix",N.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const Yt=B.uniformsGroups;for(let Gr=0,Mh=Yt.length;Gr0&&Ie.useMultisampledRTT(S)===!1?N=Te.get(S).__webglMultisampledFramebuffer:Array.isArray(Re)?N=Re[F]:N=Re,y.copy(S.viewport),P.copy(S.scissor),z=S.scissorTest}else y.copy(oe).multiplyScalar(q).floor(),P.copy(pe).multiplyScalar(q).floor(),z=Oe;if(xe.bindFramebuffer(C.FRAMEBUFFER,N)&&B&&xe.drawBuffers(S,N),xe.viewport(y),xe.scissor(P),xe.setScissorTest(z),ne){const _e=Te.get(S.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+U,_e.__webglTexture,F)}else if(ce){const _e=Te.get(S.texture),Ee=U||0;C.framebufferTextureLayer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,_e.__webglTexture,F||0,Ee)}D=-1},this.readRenderTargetPixels=function(S,U,F,B,N,ne,ce){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let me=Te.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(me=me[ce]),me){xe.bindFramebuffer(C.FRAMEBUFFER,me);try{const _e=S.texture,Ee=_e.format,Re=_e.type;if(!qe.textureFormatReadable(Ee)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!qe.textureTypeReadable(Re)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=S.width-B&&F>=0&&F<=S.height-N&&C.readPixels(U,F,B,N,Pe.convert(Ee),Pe.convert(Re),ne)}finally{const _e=A!==null?Te.get(A).__webglFramebuffer:null;xe.bindFramebuffer(C.FRAMEBUFFER,_e)}}},this.readRenderTargetPixelsAsync=async function(S,U,F,B,N,ne,ce){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let me=Te.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(me=me[ce]),me){xe.bindFramebuffer(C.FRAMEBUFFER,me);try{const _e=S.texture,Ee=_e.format,Re=_e.type;if(!qe.textureFormatReadable(Ee))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!qe.textureTypeReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(U>=0&&U<=S.width-B&&F>=0&&F<=S.height-N){const Se=C.createBuffer();C.bindBuffer(C.PIXEL_PACK_BUFFER,Se),C.bufferData(C.PIXEL_PACK_BUFFER,ne.byteLength,C.STREAM_READ),C.readPixels(U,F,B,N,Pe.convert(Ee),Pe.convert(Re),0),C.flush();const Je=C.fenceSync(C.SYNC_GPU_COMMANDS_COMPLETE,0);await Ou(C,Je,4);try{C.bindBuffer(C.PIXEL_PACK_BUFFER,Se),C.getBufferSubData(C.PIXEL_PACK_BUFFER,0,ne)}finally{C.deleteBuffer(Se),C.deleteSync(Je)}return ne}}finally{const _e=A!==null?Te.get(A).__webglFramebuffer:null;xe.bindFramebuffer(C.FRAMEBUFFER,_e)}}},this.copyFramebufferToTexture=function(S,U=null,F=0){S.isTexture!==!0&&(Bi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),U=arguments[0]||null,S=arguments[1]);const B=Math.pow(2,-F),N=Math.floor(S.image.width*B),ne=Math.floor(S.image.height*B),ce=U!==null?U.x:0,me=U!==null?U.y:0;Ie.setTexture2D(S,0),C.copyTexSubImage2D(C.TEXTURE_2D,F,0,0,ce,me,N,ne),xe.unbindTexture()},this.copyTextureToTexture=function(S,U,F=null,B=null,N=0){S.isTexture!==!0&&(Bi("WebGLRenderer: copyTextureToTexture function signature has changed."),B=arguments[0]||null,S=arguments[1],U=arguments[2],N=arguments[3]||0,F=null);let ne,ce,me,_e,Ee,Re;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,me=F.min.x,_e=F.min.y):(ne=S.image.width,ce=S.image.height,me=0,_e=0),B!==null?(Ee=B.x,Re=B.y):(Ee=0,Re=0);const Se=Pe.convert(U.format),Je=Pe.convert(U.type);Ie.setTexture2D(U,0),C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,U.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,U.unpackAlignment);const dt=C.getParameter(C.UNPACK_ROW_LENGTH),ft=C.getParameter(C.UNPACK_IMAGE_HEIGHT),Vt=C.getParameter(C.UNPACK_SKIP_PIXELS),Qe=C.getParameter(C.UNPACK_SKIP_ROWS),ve=C.getParameter(C.UNPACK_SKIP_IMAGES),Rt=S.isCompressedTexture?S.mipmaps[N]:S.image;C.pixelStorei(C.UNPACK_ROW_LENGTH,Rt.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,Rt.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,me),C.pixelStorei(C.UNPACK_SKIP_ROWS,_e),S.isDataTexture?C.texSubImage2D(C.TEXTURE_2D,N,Ee,Re,ne,ce,Se,Je,Rt.data):S.isCompressedTexture?C.compressedTexSubImage2D(C.TEXTURE_2D,N,Ee,Re,Rt.width,Rt.height,Se,Rt.data):C.texSubImage2D(C.TEXTURE_2D,N,Ee,Re,ne,ce,Se,Je,Rt),C.pixelStorei(C.UNPACK_ROW_LENGTH,dt),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ft),C.pixelStorei(C.UNPACK_SKIP_PIXELS,Vt),C.pixelStorei(C.UNPACK_SKIP_ROWS,Qe),C.pixelStorei(C.UNPACK_SKIP_IMAGES,ve),N===0&&U.generateMipmaps&&C.generateMipmap(C.TEXTURE_2D),xe.unbindTexture()},this.copyTextureToTexture3D=function(S,U,F=null,B=null,N=0){S.isTexture!==!0&&(Bi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),F=arguments[0]||null,B=arguments[1]||null,S=arguments[2],U=arguments[3],N=arguments[4]||0);let ne,ce,me,_e,Ee,Re,Se,Je,dt;const ft=S.isCompressedTexture?S.mipmaps[N]:S.image;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,me=F.max.z-F.min.z,_e=F.min.x,Ee=F.min.y,Re=F.min.z):(ne=ft.width,ce=ft.height,me=ft.depth,_e=0,Ee=0,Re=0),B!==null?(Se=B.x,Je=B.y,dt=B.z):(Se=0,Je=0,dt=0);const Vt=Pe.convert(U.format),Qe=Pe.convert(U.type);let ve;if(U.isData3DTexture)Ie.setTexture3D(U,0),ve=C.TEXTURE_3D;else if(U.isDataArrayTexture||U.isCompressedArrayTexture)Ie.setTexture2DArray(U,0),ve=C.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,U.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,U.unpackAlignment);const Rt=C.getParameter(C.UNPACK_ROW_LENGTH),et=C.getParameter(C.UNPACK_IMAGE_HEIGHT),nn=C.getParameter(C.UNPACK_SKIP_PIXELS),ui=C.getParameter(C.UNPACK_SKIP_ROWS),Gt=C.getParameter(C.UNPACK_SKIP_IMAGES);C.pixelStorei(C.UNPACK_ROW_LENGTH,ft.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ft.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,_e),C.pixelStorei(C.UNPACK_SKIP_ROWS,Ee),C.pixelStorei(C.UNPACK_SKIP_IMAGES,Re),S.isDataTexture||S.isData3DTexture?C.texSubImage3D(ve,N,Se,Je,dt,ne,ce,me,Vt,Qe,ft.data):U.isCompressedArrayTexture?C.compressedTexSubImage3D(ve,N,Se,Je,dt,ne,ce,me,Vt,ft.data):C.texSubImage3D(ve,N,Se,Je,dt,ne,ce,me,Vt,Qe,ft),C.pixelStorei(C.UNPACK_ROW_LENGTH,Rt),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,et),C.pixelStorei(C.UNPACK_SKIP_PIXELS,nn),C.pixelStorei(C.UNPACK_SKIP_ROWS,ui),C.pixelStorei(C.UNPACK_SKIP_IMAGES,Gt),N===0&&U.generateMipmaps&&C.generateMipmap(ve),xe.unbindTexture()},this.initRenderTarget=function(S){Te.get(S).__webglFramebuffer===void 0&&Ie.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?Ie.setTextureCube(S,0):S.isData3DTexture?Ie.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?Ie.setTexture2DArray(S,0):Ie.setTexture2D(S,0),xe.unbindTexture()},this.resetState=function(){L=0,E=0,A=null,xe.reset(),Ue.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===wo?"display-p3":"srgb",t.unpackColorSpace=Ke.workingColorSpace===Pr?"display-p3":"srgb"}}let Y_=class extends it{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 mt,this.environmentIntensity=1,this.environmentRotation=new mt,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 K_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ro,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=un()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Bi("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;sn)return;xa.applyMatrix4(r.matrixWorld);const l=e.ray.origin.distanceTo(xa);if(!(le.far))return{distance:l,point:Ql.clone().applyMatrix4(r.matrixWorld),index:i,face:null,faceIndex:null,object:r}}const ec=new T,tc=new T;class eg extends Nr{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;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class ig{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const u=n[i],d=n[i+1]-u,f=(a-u)/d;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=t||(a.isVector2?new Ne:new T);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new T,i=[],s=[],a=[],o=new T,l=new fe;for(let f=0;f<=e;f++){const _=f/e;i[f]=this.getTangentAt(_,new T)}s[0]=new T,a[0]=new T;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const _=Math.acos(At(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,_))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(At(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let _=1;_<=e;_++)s[_].applyMatrix4(l.makeRotationAxis(i[_],f*_)),a[_].crossVectors(i[_],s[_])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Lo extends zt{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],d=[],f=[];let _=0;const g=[],m=n/2;let p=0;b(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new gt(h,3)),this.setAttribute("normal",new gt(d,3)),this.setAttribute("uv",new gt(f,2));function b(){const M=new T,L=new T;let E=0;const A=(t-e)/n;for(let D=0;D<=s;D++){const w=[],y=D/s,P=y*(t-e)+e;for(let z=0;z<=i;z++){const O=z/i,G=O*l+o,X=Math.sin(G),H=Math.cos(G);L.x=P*X,L.y=-y*n+m,L.z=P*H,h.push(L.x,L.y,L.z),M.set(X,A,H).normalize(),d.push(M.x,M.y,M.z),f.push(O,1-y),w.push(_++)}g.push(w)}for(let D=0;D80*t){o=c=r[0],l=u=r[1];for(let _=t;_c&&(c=h),d>u&&(u=d);f=Math.max(c-o,u-l),f=f!==0?32767/f:0}return xs(s,a,t,o,l,f,0),a}};function $c(r,e,t,n,i){let s,a;if(i===yg(r,e,t,n)>0)for(s=e;s=e;s-=n)a=sc(s,r[s],r[s+1],a);return a&&Fr(a,a.next)&&(ys(a),a=a.next),a}function oi(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Fr(t,t.next)||ht(t.prev,t,t.next)===0)){if(ys(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function xs(r,e,t,n,i,s,a){if(!r)return;!a&&s&&pg(r,n,i,s);let o=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?ag(r,n,i,s):rg(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),ys(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=og(oi(r),e,t),xs(r,e,t,n,i,s,2)):a===2&&lg(r,e,t,n,i,s):xs(oi(r),e,t,n,i,s,1);break}}}function rg(r){const e=r.prev,t=r,n=r.next;if(ht(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,u=is?i>a?i:a:s>a?s:a,f=o>l?o>c?o:c:l>c?l:c;let _=n.next;for(;_!==e;){if(_.x>=u&&_.x<=d&&_.y>=h&&_.y<=f&&Ui(i,o,s,l,a,c,_.x,_.y)&&ht(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function ag(r,e,t,n){const i=r.prev,s=r,a=r.next;if(ht(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,u=i.y,h=s.y,d=a.y,f=ol?o>c?o:c:l>c?l:c,m=u>h?u>d?u:d:h>d?h:d,p=co(f,_,e,t,n),b=co(g,m,e,t,n);let x=r.prevZ,M=r.nextZ;for(;x&&x.z>=p&&M&&M.z<=b;){if(x.x>=f&&x.x<=g&&x.y>=_&&x.y<=m&&x!==i&&x!==a&&Ui(o,u,l,h,c,d,x.x,x.y)&&ht(x.prev,x,x.next)>=0||(x=x.prevZ,M.x>=f&&M.x<=g&&M.y>=_&&M.y<=m&&M!==i&&M!==a&&Ui(o,u,l,h,c,d,M.x,M.y)&&ht(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;x&&x.z>=p;){if(x.x>=f&&x.x<=g&&x.y>=_&&x.y<=m&&x!==i&&x!==a&&Ui(o,u,l,h,c,d,x.x,x.y)&&ht(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;M&&M.z<=b;){if(M.x>=f&&M.x<=g&&M.y>=_&&M.y<=m&&M!==i&&M!==a&&Ui(o,u,l,h,c,d,M.x,M.y)&&ht(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function og(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Fr(i,s)&&Jc(i,n,n.next,s)&&vs(i,s)&&vs(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),ys(n),ys(n.next),n=r=s),n=n.next}while(n!==r);return oi(n)}function lg(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&gg(a,o)){let l=Qc(a,o);a=oi(a,a.next),l=oi(l,l.next),xs(a,e,t,n,i,s,0),xs(l,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function cg(r,e,t,n){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const d=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>n&&(n=d,i=t.x=t.x&&t.x>=l&&s!==t.x&&Ui(ai.x||t.x===i.x&&fg(i,t)))&&(i=t,u=h)),t=t.next;while(t!==o);return i}function fg(r,e){return ht(r.prev,r,e.prev)<0&&ht(e.next,r,r.next)<0}function pg(r,e,t,n){let i=r;do i.z===0&&(i.z=co(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,mg(i)}function mg(r){let e,t,n,i,s,a,o,l,c=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e0||l>0&&n;)o!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(a>1);return r}function co(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 _g(r){let e=r,t=r;do(e.x=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function gg(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!xg(r,e)&&(vs(r,e)&&vs(e,r)&&vg(r,e)&&(ht(r.prev,r,e.prev)||ht(r,e.prev,e))||Fr(r,e)&&ht(r.prev,r,r.next)>0&&ht(e.prev,e,e.next)>0)}function ht(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Fr(r,e){return r.x===e.x&&r.y===e.y}function Jc(r,e,t,n){const i=sr(ht(r,e,t)),s=sr(ht(r,e,n)),a=sr(ht(t,n,r)),o=sr(ht(t,n,e));return!!(i!==s&&a!==o||i===0&&ir(r,t,e)||s===0&&ir(r,n,e)||a===0&&ir(t,r,n)||o===0&&ir(t,e,n))}function ir(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 sr(r){return r>0?1:r<0?-1:0}function xg(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&&Jc(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function vs(r,e){return ht(r.prev,r,r.next)<0?ht(r,e,r.next)>=0&&ht(r,r.prev,e)>=0:ht(r,e,r.prev)<0||ht(r,r.next,e)<0}function vg(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 Qc(r,e){const t=new ho(r.i,r.x,r.y),n=new ho(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 sc(r,e,t,n){const i=new ho(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 ys(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 ho(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function yg(r,e,t,n){let i=0;for(let s=e,a=t-n;s2&&r[e-1].equals(r[0])&&r.pop()}function ac(r,e){for(let t=0;t0)&&f.push(x,M,E),(p!==n-1||l0!=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 va extends en{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ge(16777215),this.specular=new ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new Ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mt,this.combine=Ar,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 Mg extends en{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new Ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mt,this.combine=Ar,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function rr(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Sg(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function bg(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 oc(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function eh(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}class ws{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e=s)){const o=t[1];e=s)break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(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 a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&Sg(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Wr,s=e.length-1;let a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}xn.prototype.TimeBufferType=Float32Array;xn.prototype.ValueBufferType=Float32Array;xn.prototype.DefaultInterpolation=_s;class Zi extends xn{constructor(e,t,n){super(e,t,n)}}Zi.prototype.ValueTypeName="bool";Zi.prototype.ValueBufferType=Array;Zi.prototype.DefaultInterpolation=ms;Zi.prototype.InterpolantFactoryMethodLinear=void 0;Zi.prototype.InterpolantFactoryMethodSmooth=void 0;class nh extends xn{}nh.prototype.ValueTypeName="color";class li extends xn{}li.prototype.ValueTypeName="number";class Eg extends ws{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let u=c+o;c!==u;c+=4)pt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class qn extends xn{InterpolantFactoryMethodLinear(e){return new Eg(this.times,this.values,this.getValueSize(),e)}}qn.prototype.ValueTypeName="quaternion";qn.prototype.InterpolantFactoryMethodSmooth=void 0;class $i extends xn{constructor(e,t,n){super(e,t,n)}}$i.prototype.ValueTypeName="string";$i.prototype.ValueBufferType=Array;$i.prototype.DefaultInterpolation=ms;$i.prototype.InterpolantFactoryMethodLinear=void 0;$i.prototype.InterpolantFactoryMethodSmooth=void 0;class ci extends xn{}ci.prototype.ValueTypeName="vector";class Tr{constructor(e="",t=-1,n=[],i=bo){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=un(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Rg(n[a]).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,a=n.length;s!==a;++s)t.push(xn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,f,_,g){if(f.length!==0){const m=[],p=[];eh(f,m,p,_),m.length!==0&&g.push(new h(d,m,p))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(wn[e]!==void 0){wn[e].push({onLoad:t,onProgress:n,onError:i});return}wn[e]=[],wn[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=wn[e],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,_=f!==0;let g=0;const m=new ReadableStream({start(p){b();function b(){h.read().then(({done:x,value:M})=>{if(x)p.close();else{g+=M.byteLength;const L=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:f});for(let E=0,A=u.length;E{p.error(x)})}}});return new Response(m)}else throw new Pg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(_=>f.decode(_))}}}).then(c=>{Gn.add(e,c);const u=wn[e];delete wn[e];for(let h=0,d=u.length;h{const u=wn[e];if(u===void 0)throw this.manager.itemError(e),c;delete wn[e];for(let h=0,d=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Lg extends In{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Gn.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=gs("img");function l(){u(),Gn.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class Ms extends In{constructor(e){super(e)}load(e,t,n,i){const s=new St,a=new Lg(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class kr extends it{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ge(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}}const ya=new fe,lc=new T,cc=new T;class No{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ne(512,512),this.map=null,this.mapPass=null,this.matrix=new fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ao,this._frameExtents=new Ne(1,1),this._viewportCount=1,this._viewports=[new Ze(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;lc.setFromMatrixPosition(e.matrixWorld),t.position.copy(lc),cc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(cc),t.updateMatrixWorld(),ya.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ya),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(ya)}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 Ig extends No{constructor(){super(new Dt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ji*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 ih extends kr{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(it.DEFAULT_UP),this.updateMatrix(),this.target=new it,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Ig}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 hc=new fe,os=new T,Ma=new T;class Dg extends No{constructor(){super(new Dt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ne(4,2),this._viewportCount=6,this._viewports=[new Ze(2,1,1,1),new Ze(0,1,1,1),new Ze(3,1,1,1),new Ze(1,1,1,1),new Ze(3,0,1,1),new Ze(1,0,1,1)],this._cubeDirections=[new T(1,0,0),new T(-1,0,0),new T(0,0,1),new T(0,0,-1),new T(0,1,0),new T(0,-1,0)],this._cubeUps=[new T(0,1,0),new T(0,1,0),new T(0,1,0),new T(0,1,0),new T(0,0,1),new T(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()),os.setFromMatrixPosition(e.matrixWorld),n.position.copy(os),Ma.copy(n.position),Ma.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ma),n.updateMatrixWorld(),i.makeTranslation(-os.x,-os.y,-os.z),hc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hc)}}class ct extends kr{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 Dg}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 Ug extends No{constructor(){super(new Ir(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Fo extends kr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(it.DEFAULT_UP),this.updateMatrix(),this.target=new it,this.shadow=new Ug}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class sh extends kr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class zi{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n"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,a=Gn.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Gn.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Gn.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Gn.add(e,l),s.manager.itemStart(e)}}class Fg{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){pt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;pt.multiplyQuaternionsFlat(e,a,e,t,e,n),pt.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const Oo="\\[\\]\\.:\\/",Og=new RegExp("["+Oo+"]","g"),Bo="[^"+Oo+"]",Bg="[^"+Oo.replace("\\.","")+"]",kg=/((?:WC+[\/:])*)/.source.replace("WC",Bo),zg=/(WCOD+)?/.source.replace("WCOD",Bg),Hg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Bo),Vg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Bo),Gg=new RegExp("^"+kg+zg+Hg+Vg+"$"),Wg=["material","materials","bones","map"];class Xg{constructor(e,t,n){const i=n||je.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 je{constructor(e,t,n){this.path=t,this.parsedPath=n||je.parseTrackName(t),this.node=je.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 je.Composite(e,t,n):new je(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Og,"")}static parseTrackName(e){const t=Gg.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);Wg.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case lu:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case bo:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===ou;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===ru){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=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(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ii,i.endingEnd=Ii):(e?i.endingStart=this.zeroSlopeAtStart?Ii:Li:i.endingStart=gr,t?i.endingEnd=this.zeroSlopeAtEnd?Ii:Li:i.endingEnd=gr)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}const qg=new Float32Array(1);class ko extends hi{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const d=i[h],f=d.name;let _=u[f];if(_!==void 0)++_.referenceCount,a[h]=_;else{if(_=a[h],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,l,f));continue}const g=t&&t._propertyBindings[h].binding.parsedPath;_=new Fg(je.create(n,f,g),d.ValueTypeName,d.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,l,f),a[h]=_}o[h].resultBuffer=_.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=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t=2.0 are supported."));return}const c=new E0(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&o[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function Yg(){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 Ge={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 Kg{constructor(e){this.parser=e,this.name=Ge.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=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class c0{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,a.source,l);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 h0{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,a.source,l);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,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class u0{constructor(e){this.name=Ge.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const l=i.byteOffset||0,c=i.byteLength||0,u=i.count,h=i.byteStride,d=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(u,h,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(u*h);return a.decodeGltfBuffer(new Uint8Array(f),u,h,d,i.mode,i.filter),f})})}else return null}}class d0{constructor(e){this.name=Ge.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 c of i.primitives)if(c.mode!==Zt.TRIANGLES&&c.mode!==Zt.TRIANGLE_STRIP&&c.mode!==Zt.TRIANGLE_FAN&&c.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],l={};for(const c in a)o.push(this.parser.getDependency("accessor",a[c]).then(u=>(l[c]=u,l[c])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(c=>{const u=c.pop(),h=u.isGroup?u.children:[u],d=c[0].count,f=[];for(const _ of h){const g=new fe,m=new T,p=new pt,b=new T(1,1,1),x=new Q_(_.geometry,_.material,d);for(let M=0;M0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const T0=new fe;class E0{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Yg,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,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);i=n&&l?parseInt(l[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||s&&a<98?this.textureLoader=new Ms(this.options.manager):this.textureLoader=new Ng(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Uo(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ei(s,o,i),En(o,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[c,u]of a.children.entries())s(u,o.children[c])};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=2&&m.setY(w,E[A*l+1]),l>=3&&m.setZ(w,E[A*l+2]),l>=4&&m.setW(w,E[A*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const l=n.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const i=this,s=this.json,a=s.textures[e],o=s.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=a.name||o.name||"",u.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(u.name=o.uri);const d=(s.samplers||{})[a.sampler]||{};return u.magFilter=fc[d.magFilter]||jt,u.minFilter=fc[d.minFilter]||An,u.wrapS=pc[d.wrapS]||Jt,u.wrapT=pc[d.wrapT]||Jt,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const a=i.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=n.getDependency("bufferView",a.bufferView).then(function(h){c=!0;const d=new Blob([h],{type:a.mimeType});return l=o.createObjectURL(d),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(d,f){let _=d;t.isImageBitmapLoader===!0&&(_=function(g){const m=new St(g);m.needsUpdate=!0,d(m)}),t.load(zi.resolveURL(h,s.path),_,void 0,f)})}).then(function(h){return c===!0&&o.revokeObjectURL(l),En(h,a),h.userData.mimeType=a.mimeType||w0(a.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[Ge.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[Ge.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[Ge.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new Zc,en.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(o,l)),n=l}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new Po,en.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(o,l)),n=l}if(i||s||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=n.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return Br}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let a;const o={},l=s.extensions||{},c=[];if(l[Ge.KHR_MATERIALS_UNLIT]){const h=i[Ge.KHR_MATERIALS_UNLIT];a=h.getMaterialType(),c.push(h.extendParams(o,s,t))}else{const h=s.pbrMetallicRoughness||{};if(o.color=new ge(1,1,1),o.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],Ct),o.opacity=d[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(o,"map",h.baseColorTexture,Mt)),o.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,o.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",h.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=fn);const u=s.alphaMode||ba.OPAQUE;if(u===ba.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===ba.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==Le&&(c.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new Ne(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;o.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&a!==Le&&(c.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==Le){const h=s.emissiveFactor;o.emissive=new ge().setRGB(h[0],h[1],h[2],Ct)}return s.emissiveTexture!==void 0&&a!==Le&&c.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,Mt)),Promise.all(c).then(function(){const h=new a(o);return s.name&&(h.name=s.name),En(h,s),t.associations.set(h,{materials:e}),s.extensions&&ei(i,h,s),h})}createUniqueName(e){const t=je.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(o){return n[Ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(l){return mc(l,o,t)})}const a=[];for(let o=0,l=e.length;o0&&S0(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),En(p,s),m.extensions&&ei(i,p,m),t.assignFinalMaterial(p),h.push(p)}for(let f=0,_=h.length;f<_;f++)t.associations.set(h[f],{meshes:e,primitives:f});if(h.length===1)return s.extensions&&ei(i,h[0],s),h[0];const d=new Cn;s.extensions&&ei(i,d,s),t.associations.set(d,{meshes:e});for(let f=0,_=h.length;f<_;f++)d.add(h[f]);return d})}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 Dt(It.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Ir(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),En(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i1?u=new Cn:c.length===1?u=c[0]:u=new it,u!==c[0])for(let h=0,d=c.length;h{const h=new Map;for(const[d,f]of i.associations)(d instanceof en||d instanceof St)&&h.set(d,f);return u.traverse(d=>{const f=i.associations.get(d);f!=null&&h.set(d,f)}),h};return i.associations=c(s),s})}_createAnimationTracks(e,t,n,i,s){const a=[],o=e.name?e.name:e.uuid,l=[];zn[s.path]===zn.weights?e.traverse(function(d){d.morphTargetInfluences&&l.push(d.name?d.name:d.uuid)}):l.push(o);let c;switch(zn[s.path]){case zn.weights:c=li;break;case zn.rotation:c=qn;break;case zn.position:case zn.scale:c=ci;break;default:switch(n.itemSize){case 1:c=li;break;case 2:case 3:default:c=ci;break}break}const u=i.interpolation!==void 0?v0[i.interpolation]:_s,h=this._getArrayFromAccessor(n);for(let d=0,f=l.length;d{Date.now()-t.creationTime>=t.expirationTime?(t.remove(),this._particlesArray[e].splice(this._particlesArray[e].indexOf(t),1),this._particlesArray[e].length===0&&this._particlesArray.splice(e,1)):t.update()})}}class R0{constructor(e,t){this._position=t,this._params=e,this._scene=this._params.scene,this._colors=this._params.colors,this._radius=this._params.radius,this._opacity=this._params.opacity,this._transparency=this._params.transparency,this._velocityParams=this._params.velocity,this._expirationTime=this._params.expirationTime,this._boxX=this._params.boxX,this._boxY=this._params.boxY,this._boxZ=this._params.boxZ,this._mesh=new ye(new Or(Math.random()*this._radius.randomRadius+this._radius.baseRadius,Math.random()*1+5,Math.random()*1+5),new Le({color:this._colors[Math.floor(Math.random()*this._colors.length)],opacity:this._transparency?Math.random()*this._opacity.randomOpacity+this._opacity.baseOpacity:this._opacity.baseOpacity,transparent:this._transparency})),this._mesh.rotation.set(Math.random()*Math.PI*2,Math.random()*Math.PI*2,Math.random()*Math.PI*2),this._velocity=new T(this._velocityParams.baseSign.x*(this._velocityParams.randomSign.x&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.x+this._velocityParams.baseVelocity.x,this._velocityParams.baseSign.y*(this._velocityParams.randomSign.y&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.y+this._velocityParams.baseVelocity.y,this._velocityParams.baseSign.z*(this._velocityParams.randomSign.z&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.z+this._velocityParams.baseVelocity.z),this._creationTime=Date.now(),this._expirationTime=this._expirationTime.baseExpirationTime+Math.random()*this._expirationTime.randomExpirationTime}update(){this._velocityParams.update&&(this._velocity=new T(this._velocityParams.baseSign.x*(this._velocityParams.randomSign.x&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.x+this._velocityParams.baseVelocity.x,this._velocityParams.baseSign.y*(this._velocityParams.randomSign.y&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.y+this._velocityParams.baseVelocity.y,this._velocityParams.baseSign.z*(this._velocityParams.randomSign.z&&Math.random()<.5?-1:1)*Math.random()*this._velocityParams.randomVelocity.z+this._velocityParams.baseVelocity.z));let e=!1,t=!1,n=!1;(this._mesh.position.xthis._position.x+(this._boxX.baseMax+Math.random()*this._boxX.randomMax))&&(e=!0),(this._mesh.position.ythis._position.y+(this._boxY.baseMax+Math.random()*this._boxY.randomMax))&&(t=!0),(this._mesh.position.zthis._position.z+(this._boxZ.baseMax+Math.random()*this._boxZ.randomMax))&&(n=!0),e&&this._boxX.blockAll||t&&this._boxY.blockAll||n&&this._boxZ.blockAll?(this._velocity=new T(0,0,0),this._mesh.visible=this._boxX.visible&&this._boxY.visible&&this._boxZ.visible):this._velocity=new T(e?0:this._velocity.x,t?0:this._velocity.y,n?0:this._velocity.z),this._mesh.position.add(this._velocity)}remove(){this._scene.remove(this._mesh)}get mesh(){return this._mesh}get creationTime(){return this._creationTime}get expirationTime(){return this._expirationTime}}class C0{constructor(e){this._params=e,this._Init()}_Init(){this._boundingBoxes=[],this._boundingBoxesVisible=!1,this._mixers=[],this._particleSpawnerParams={scene:this._params.scene,colors:[15556639,13059594,13066762],radius:{baseRadius:.1,randomRadius:.5},opacity:{baseOpacity:.8,randomOpacity:.2},transparency:!0,velocity:{baseVelocity:new T(0,.02,0),randomVelocity:new T(.1,.1,.1),baseSign:new T(1,1,1),randomSign:new T(!0,!1,!0),update:!0},expirationTime:{baseExpirationTime:1e3,randomExpirationTime:2e3},boxX:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!1},boxY:{baseMin:-100,baseMax:2,randomMin:0,randomMax:10,blockAll:!0,visible:!1},boxZ:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!1}},this._particleSpawner=new zo(this._particleSpawnerParams),this._AddFloor(),this._AddSky(),this._AddModel(),this._AddLights(),this._AddBoundingBoxes()}_AddFloor(){const t=new Ms().load("./textures/gray_rocks_floor.jpg");t.wrapS=Jt,t.wrapT=Jt,t.repeat.set(15,15);const n=new ye(new bs(600,600,10,10),new Br({map:t}));n.castShadow=!1,n.receiveShadow=!0,n.rotation.x=-Math.PI/2,this._params.scene.add(n)}_AddSky(){const t=new Ms().load("./textures/sky.jpg",a=>{a.wrapS=Jt,a.wrapT=Jt,a.repeat.set(1,1)}),n=new Or(300,32,32),i=new Le({map:t,side:Bt,color:3355443}),s=new ye(n,i);this._params.scene.add(s)}_AddModel(){const e=new Yi;e.load("./models/scene_objects/scene.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(1,1,1),t.scene.scale.set(20,20,20),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(120,18,178),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-120,18,178),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-42,18,152),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(42,18,152),t.scene.rotation.y=Math.PI,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,130),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,130),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,50),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,-30),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-160,18,-110),t.scene.rotation.y=Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,60),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,-60),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(158,18,-130),t.scene.rotation.y=-Math.PI/2,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(40,18,-52),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-40,18,-52),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(-40,18,-175),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/torch.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(40,18,-175),t.scene.rotation.y=0,t.scene.scale.set(4,4,4),this._params.scene.add(t.scene)}),e.load("./models/scene_objects/fire_rocks.glb",t=>{t.scene.traverse(n=>{n.castShadow=!0}),t.scene.position.set(0,0,50),t.scene.rotation.y=0,t.scene.scale.set(5,5,5),this._params.scene.add(t.scene)})}_AddLights(){let e=new Fo(15788992,.8);e.position.set(100,100,0),e.target.position.set(0,0,0),e.castShadow=!0,e.shadow.bias=-.001,e.shadow.mapSize.width=4096,e.shadow.mapSize.height=4096,e.shadow.camera.near=.1,e.shadow.camera.far=500,e.shadow.camera.near=.5,e.shadow.camera.far=500,e.shadow.camera.left=50,e.shadow.camera.right=-50,e.shadow.camera.top=50,e.shadow.camera.bottom=-50,this._params.scene.add(e);let t=new sh(15788724,.5);this._params.scene.add(t);let n=new ct(16083734,1e3,100);n.position.set(-120,25,178),this._params.scene.add(n);let i=new ct(16083734,1e3,100);i.position.set(120,25,178),this._params.scene.add(i);let s=new ct(16083734,1e3,100);s.position.set(42,25,152),this._params.scene.add(s);let a=new ct(16083734,1e3,100);a.position.set(-42,25,152),this._params.scene.add(a);let o=new ct(16083734,1e3,100);o.position.set(158,25,130),this._params.scene.add(o);let l=new ct(16083734,1e3,100);l.position.set(-160,25,130),this._params.scene.add(l);let c=new ct(16083734,1e3,100);c.position.set(-160,25,50),this._params.scene.add(c);let u=new ct(16083734,1e3,100);u.position.set(-160,25,-30),this._params.scene.add(u);let h=new ct(16083734,1e3,100);h.position.set(-160,25,-110),this._params.scene.add(h);let d=new ct(16083734,1e3,100);d.position.set(158,25,60),this._params.scene.add(d);let f=new ct(16083734,1e3,100);f.position.set(158,25,-60),this._params.scene.add(f);let _=new ct(16083734,1e3,100);_.position.set(158,25,-130),this._params.scene.add(_);let g=new ct(16083734,1e3,100);g.position.set(40,25,-52),this._params.scene.add(g);let m=new ct(16083734,1e3,100);m.position.set(-40,25,-52),this._params.scene.add(m);let p=new ct(16083734,1e3,100);p.position.set(40,25,-175),this._params.scene.add(p);let b=new ct(16083734,1e3,100);b.position.set(-40,25,-175),this._params.scene.add(b);let x=new ct(16083734,1e3,100);x.position.set(-61,38,99),this._params.scene.add(x);let M=new ct(16083734,1e3,100);M.position.set(80,38,57),this._params.scene.add(M);let L=new ct(16083734,1e3,100);L.position.set(-81,38,-2),this._params.scene.add(L);let E=new ct(16083734,1e3,100);E.position.set(2,2,51),this._params.scene.add(E)}_AddBoundingBoxes(){const e=new ze(40,50,40),t=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),n=new ye(e,t);n.position.set(-45,25,185),this._params.scene.add(n),this._boundingBoxes.push(n);const i=new ze(40,50,40),s=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),a=new ye(i,s);a.position.set(45,25,185),this._params.scene.add(a),this._boundingBoxes.push(a);const o=new ze(130,50,20),l=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),c=new ye(o,l);c.position.set(-120,25,200),this._params.scene.add(c),this._boundingBoxes.push(c);const u=new ze(130,50,20),h=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),d=new ye(u,h);d.position.set(120,25,200),this._params.scene.add(d),this._boundingBoxes.push(d);const f=new ze(20,50,400),_=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),g=new ye(f,_);g.position.set(-180,25,0),this._params.scene.add(g),this._boundingBoxes.push(g);const m=new ze(20,50,400),p=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),b=new ye(m,p);b.position.set(180,25,0),this._params.scene.add(b),this._boundingBoxes.push(b);const x=new ze(400,50,20),M=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),L=new ye(x,M);L.position.set(0,25,-195),this._params.scene.add(L),this._boundingBoxes.push(L);const E=new ze(95,50,40),A=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),D=new ye(E,A);D.position.set(-60,25,-80),this._params.scene.add(D),this._boundingBoxes.push(D);const w=new ze(92,50,40),y=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),P=new ye(w,y);P.position.set(60,25,-80),this._params.scene.add(P),this._boundingBoxes.push(P);const z=new ze(20,50,130),O=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),G=new ye(z,O);G.position.set(-100,25,-120),this._params.scene.add(G),this._boundingBoxes.push(G);const X=new ze(20,50,130),H=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),q=new ye(X,H);q.position.set(100,25,-120),this._params.scene.add(q),this._boundingBoxes.push(q);const V=new ze(90,50,90),ie=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),oe=new ye(V,ie);oe.position.set(180,25,0),this._params.scene.add(oe),this._boundingBoxes.push(oe);const pe=new ze(30,50,40),Oe=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),He=new ye(pe,Oe);He.position.set(-80,25,5),this._params.scene.add(He),this._boundingBoxes.push(He);const W=new ze(30,50,40),J=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),le=new ye(W,J);le.position.set(-60,25,95),this._params.scene.add(le),this._boundingBoxes.push(le);const ae=new ze(40,50,35),Ae=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Ce=new ye(ae,Ae);Ce.position.set(77,25,58),this._params.scene.add(Ce),this._boundingBoxes.push(Ce);const Be=new ze(60,50,60),nt=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),C=new ye(Be,nt);C.position.set(-160,25,175),this._params.scene.add(C),this._boundingBoxes.push(C);const st=new ze(30,50,30),$e=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),qe=new ye(st,$e);qe.position.set(-170,25,45),this._params.scene.add(qe),this._boundingBoxes.push(qe);const xe=new ze(30,50,30),ut=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Te=new ye(xe,ut);Te.position.set(-170,25,-180),this._params.scene.add(Te),this._boundingBoxes.push(Te);const Ie=new ze(30,50,30),R=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),v=new ye(Ie,R);v.position.set(-110,25,-180),this._params.scene.add(v),this._boundingBoxes.push(v);const k=new ze(30,50,30),Z=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),$=new ye(k,Z);$.position.set(-105,25,-70),this._params.scene.add($),this._boundingBoxes.push($);const K=new ze(30,50,30),Me=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),se=new ye(K,Me);se.position.set(-95,25,-50),this._params.scene.add(se),this._boundingBoxes.push(se);const ue=new ze(60,50,50),De=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Q=new ye(ue,De);Q.position.set(170,25,-170),this._params.scene.add(Q),this._boundingBoxes.push(Q);const he=new ze(40,50,50),We=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),be=new ye(he,We);be.position.set(170,25,70),this._params.scene.add(be),this._boundingBoxes.push(be);const de=new ze(40,50,30),Pe=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Ue=new ye(de,Pe);Ue.position.set(170,25,180),this._params.scene.add(Ue),this._boundingBoxes.push(Ue);const rt=new ze(480,50,10),I=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),ee=new ye(rt,I);ee.position.set(0,25,240),this._params.scene.add(ee),this._boundingBoxes.push(ee);const j=new ze(480,50,10),Y=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),te=new ye(j,Y);te.position.set(0,25,-240),this._params.scene.add(te),this._boundingBoxes.push(te);const we=new ze(10,50,480),Xe=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),lt=new ye(we,Xe);lt.position.set(-240,25,0),this._params.scene.add(lt),this._boundingBoxes.push(lt);const yt=new ze(10,50,480),Ye=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),Ht=new ye(yt,Ye);Ht.position.set(240,25,0),this._params.scene.add(Ht),this._boundingBoxes.push(Ht);const qt=new Lo(15,15,50,32),As=new Le({color:65280,wireframe:!0,visible:this._boundingBoxesVisible}),tn=new ye(qt,As);tn.position.set(2,7,50),this._params.scene.add(tn),this._boundingBoxes.push(tn)}update(){this._particleSpawner.create({x:-63,y:38,z:94,width:7,height:4,depth:7},5),this._particleSpawner.create({x:77,y:38,z:53,width:7,height:4,depth:7},5),this._particleSpawner.create({x:-83,y:38,z:-5,width:4,height:4,depth:8},5),this._particleSpawner.create({x:-3,y:-1,z:45,width:10,height:10,depth:10},100),this._particleSpawner.update()}get boundingBoxes(){return this._boundingBoxes}}class P0{constructor(){this._hearts=[],this._heartsContainer=document.createElement("div"),this._heartsContainer.style.position="absolute",this._heartsContainer.style.left="50%",this._heartsContainer.style.bottom="10px",this._heartsContainer.style.transform="translateX(-50%)",document.body.appendChild(this._heartsContainer);for(let e=0;e<10;e++){const t=document.createElement("img");t.src="./textures/heart.png",t.style.width="30px",t.style.height="30px",t.style.margin="0 2px",this._heartsContainer.appendChild(t),this._hearts.push(t)}}get hearts(){return this._hearts}removeHeart(){if(this._hearts.length>0){const e=this._hearts.pop();this._heartsContainer.removeChild(e)}}addHeart(){if(this._hearts.length<10){const e=document.createElement("img");e.src="./textures/heart.png",e.style.width="30px",e.style.height="30px",e.style.margin="0 2px",this._heartsContainer.appendChild(e),this._hearts.push(e)}}show(){this._heartsContainer.style.display="block"}hide(){this._heartsContainer.style.display="none"}}class L0{constructor(){this._swords=[],this._swordsContainer=document.createElement("div"),this._swordsContainer.style.position="absolute",this._swordsContainer.style.left="50%",this._swordsContainer.style.bottom="50px",this._swordsContainer.style.transform="translateX(-50%)",document.body.appendChild(this._swordsContainer);for(let e=0;e<1;e++){const t=document.createElement("img");t.src="./textures/sword.png",t.style.width="30px",t.style.height="30px",t.style.margin="0 2px",this._swordsContainer.appendChild(t),this._swords.push(t)}}get swords(){return this._swords}removeSword(){if(this._swords.length>0){const e=this._swords.pop();this._swordsContainer.removeChild(e)}}addSword(){if(this._swords.length<10){const e=document.createElement("img");e.src="./textures/sword.png",e.style.width="30px",e.style.height="30px",e.style.margin="0 2px",this._swordsContainer.appendChild(e),this._swords.push(e)}}show(){this._swordsContainer.style.display="block"}hide(){this._swordsContainer.style.display="none"}}class I0{constructor(){this._numOfStars=0,this._starCounter=document.createElement("div"),this._starCounter.style.position="absolute",this._starCounter.style.left="50px",this._starCounter.style.top="35px",this._starCounter.style.color="white",this._starCounter.style.fontSize="35px",this._starCounter.style.fontFamily="Handjet",this._starCounter.innerHTML=` ${this._numOfStars}`,document.body.appendChild(this._starCounter)}set stars(e){this._numOfStars=e,this._starCounter.innerHTML=` ${this._numOfStars}`}get stars(){return this._numOfStars}addStar(){this.stars=this.stars+1}removeStar(){this.stars=this.stars-1}reset(){this.stars=0}show(){this._starCounter.style.display="block"}hide(){this._starCounter.style.display="none"}}class D0{constructor(){this._gameOver=document.createElement("div"),this._gameOver.style.position="absolute",this._gameOver.style.left="50%",this._gameOver.style.top="40%",this._gameOver.style.transform="translate(-50%, -50%)",this._gameOver.style.color="white",this._gameOver.style.fontSize="150px",this._gameOver.style.fontFamily="Handjet",this._gameOver.innerHTML="Game Over",this._gameOver.style.textShadow="3px 4px 3px rgba(255, 0, 0, 0.5)",this._layer=document.createElement("div"),this._layer.style.position="absolute",this._layer.style.left="0",this._layer.style.top="0",this._layer.style.width="100%",this._layer.style.height="100%",this._layer.style.backgroundColor="rgba(100, 0, 0, 0.1)",this._layer.style.display="none";const e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="140%",e.style.transform="translate(-50%, -50%)",e.style.width="200px",e.style.height="90px",e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.color="rgba(255, 255, 255, 1)",e.style.textShadow="3px 4px 3px rgba(155, 0, 0, 0.5)",e.style.fontSize="50px",e.style.fontFamily="Handjet",e.style.border="solid 4px rgba(255, 0, 0, 0.5)",e.style.borderRadius="10px",e.innerHTML="Restart",e.onclick=()=>{window.location.reload()},e.onmouseover=()=>{e.style.backgroundColor="rgba(180, 180, 180, 0.7)",e.style.border="solid 6px rgba(255, 0, 0, 0.5)"},e.onmouseout=()=>{e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 4px rgba(255, 0, 0, 0.5)"},this._gameOver.appendChild(e),document.body.appendChild(this._layer),document.body.appendChild(this._gameOver)}show(){setTimeout(()=>{this._gameOver.style.display="block",this._layer.style.display="block"},1e3)}hide(){this._gameOver.style.display="none",this._layer.style.display="none"}}class U0{constructor(){this._gameWin=document.createElement("div"),this._gameWin.style.position="absolute",this._gameWin.style.left="50%",this._gameWin.style.top="40%",this._gameWin.style.transform="translate(-50%, -50%)",this._gameWin.style.color="white",this._gameWin.style.fontSize="150px",this._gameWin.style.fontFamily="Handjet",this._gameWin.innerHTML="Game Win",this._gameWin.style.textShadow="3px 4px 3px rgba(0, 255, 0, 0.5)",this._layer=document.createElement("div"),this._layer.style.position="absolute",this._layer.style.left="0",this._layer.style.top="0",this._layer.style.width="100%",this._layer.style.height="100%",this._layer.style.backgroundColor="rgba(0, 100, 0, 0.1)",this._layer.style.display="none";const e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="140%",e.style.transform="translate(-50%, -50%)",e.style.width="200px",e.style.height="90px",e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.color="rgba(255, 255, 255, 1)",e.style.textShadow="3px 4px 3px rgba(0, 155, 0, 0.5)",e.style.fontSize="50px",e.style.fontFamily="Handjet",e.style.border="solid 4px rgba(0, 255, 0, 0.5)",e.style.borderRadius="10px",e.innerHTML="Restart",e.onclick=()=>{window.location.reload()},e.onmouseover=()=>{e.style.backgroundColor="rgba(180, 180, 180, 0.7)",e.style.border="solid 6px rgba(0, 255, 0, 0.5)"},e.onmouseout=()=>{e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 4px rgba(0, 255, 0, 0.5)"},this._gameWin.appendChild(e),document.body.appendChild(this._layer),document.body.appendChild(this._gameWin)}show(){setTimeout(()=>{this._gameWin.style.display="block",this._layer.style.display="block"},1e3)}hide(){this._gameWin.style.display="none",this._layer.style.display="none"}}class N0{constructor(){this._start=document.createElement("div"),this._start.style.position="absolute",this._start.style.left="50%",this._start.style.top="25%",this._start.style.transform="translate(-50%, -50%)",this._start.style.color="white",this._start.style.fontSize="150px",this._start.style.fontFamily="Handjet",this._start.innerHTML="Kill the Monster",this._start.style.textShadow="3px 4px 3px rgba(0, 0, 155, 0.5)",this._layer=document.createElement("div"),this._layer.style.position="absolute",this._layer.style.left="0",this._layer.style.top="0",this._layer.style.width="100%",this._layer.style.height="100%",this._layer.style.backgroundColor="rgba(0, 0, 155, 0.1)",this._layer.style.display="none";const e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="285%",e.style.transform="translate(-50%, -50%)",e.style.width="200px",e.style.height="90px",e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.color="rgba(255, 255, 255, 1)",e.style.textShadow="3px 4px 3px rgba(0, 0, 155, 0.5)",e.style.fontSize="50px",e.style.fontFamily="Handjet",e.style.border="solid 4px rgba(0, 0, 155, 0.5)",e.style.borderRadius="10px",e.innerHTML="Start",e.onclick=()=>{this._play=!0,this.hide()},e.onmouseover=()=>{e.style.backgroundColor="rgba(180, 180, 180, 0.7)",e.style.border="solid 6px rgba(0, 0, 155, 0.5)"},e.onmouseout=()=>{e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 4px rgba(0, 0, 155, 0.5)"},this._start.appendChild(e);const t=document.createElement("div");t.style.position="absolute",t.style.left="50%",t.style.top="350%",t.style.transform="translate(-50%, -50%)",t.style.color="white",t.style.fontSize="35px",t.style.fontFamily="Handjet",t.innerHTML="Choose the difficulty",this._start.appendChild(t);const n=document.createElement("input");n.type="radio",n.name="difficulty",n.value="easy",n.checked=!1,n.style.width="27px",n.style.height="27px",n.style.margin="40 40px",n.style.position="absolute",n.style.left="29%",n.style.top="380%",n.style.transform="translate(-50%, -50%)",n.style.appearance="none",n.style.border="solid 1px rgba(0, 0, 155, 0.5)",n.style.backgroundColor="rgba(150, 150, 150, 0.5)",n.style.borderRadius="7px",this._start.appendChild(n);const i=document.createElement("label");i.innerHTML="Easy",i.style.color="white",i.style.fontSize="30px",i.style.fontFamily="Handjet",i.style.position="absolute",i.style.left="35%",i.style.top="381%",i.style.transform="translate(-50%, -50%)",this._start.appendChild(i);const s=document.createElement("input");s.type="radio",s.name="difficulty",s.value="medium",s.checked=!0,s.style.width="27px",s.style.height="27px",s.style.margin="40 40px",s.style.position="absolute",s.style.left="44%",s.style.top="380%",s.style.transform="translate(-50%, -50%)",s.style.appearance="none",s.style.border="solid 1px rgba(0, 0, 155, 0.5)",s.style.backgroundColor="rgba(0, 0, 155, 0.5)",s.style.borderRadius="7px",this._start.appendChild(s);const a=document.createElement("label");a.innerHTML="Medium",a.style.color="white",a.style.fontSize="30px",a.style.fontFamily="Handjet",a.style.position="absolute",a.style.left="52%",a.style.top="381%",a.style.transform="translate(-50%, -50%)",this._start.appendChild(a);const o=document.createElement("input");o.type="radio",o.name="difficulty",o.value="hard",o.checked=!1,o.style.width="27px",o.style.height="27px",o.style.margin="40 40px",o.style.position="absolute",o.style.left="62%",o.style.top="380%",o.style.transform="translate(-50%, -50%)",o.style.appearance="none",o.style.border="solid 1px rgba(0, 0, 155, 0.5)",o.style.backgroundColor="rgba(150, 150, 150, 0.5)",o.style.borderRadius="7px",this._start.appendChild(o);const l=document.createElement("label");l.innerHTML="Hard",l.style.color="white",l.style.fontSize="30px",l.style.fontFamily="Handjet",l.style.position="absolute",l.style.left="68%",l.style.top="381%",l.style.transform="translate(-50%, -50%)",this._start.appendChild(l);const c=document.createElement("div");c.style.position="absolute",c.style.left="50%",c.style.top="170%",c.style.width="800px",c.style.transform="translate(-50%, -50%)",c.style.color="white",c.style.fontSize="25px",c.style.fontFamily="Handjet",c.style.backgroundColor="rgba(180, 180, 180, 0.5)",c.style.border="solid 4px rgba(0, 0, 155, 0.5)",c.style.borderRadius="10px",c.style.padding="30px",c.innerHTML="- W A S D to move, Space to attack and Shift to run.
- Collect swords to increase the power of your attack and hearts to increase your life.
- Collect 5 stars to become bigger and stronger.
   The effect lasts for 15 seconds, then you will return to normal size and lose 2 swords.
   The transformation will give to you full health.
- Defeat the monster to win the game.",this._start.appendChild(c),document.body.appendChild(this._layer),document.body.appendChild(this._start),this._play=!1,this._difficulty="medium"}show(){setTimeout(()=>{this._start.style.display="block",this._layer.style.display="block"},1e3)}hide(){this._start.style.display="none",this._layer.style.display="none"}update(){const e=document.querySelector('input[value="easy"]'),t=document.querySelector('input[value="medium"]'),n=document.querySelector('input[value="hard"]');e.checked?(e.style.backgroundColor="rgba(250, 250, 250, 0.8)",e.style.border="solid 5px rgba(0, 0, 155, 0.8)",t.style.backgroundColor="rgba(150, 150, 150, 0.5)",t.style.border="solid 3px rgba(0, 0, 155, 0.5)",n.style.backgroundColor="rgba(150, 150, 150, 0.5)",n.style.border="solid 3px rgba(0, 0, 155, 0.5)"):t.checked?(e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 3px rgba(0, 0, 155, 0.5)",t.style.backgroundColor="rgba(250, 250, 250, 0.8)",t.style.border="solid 5px rgba(0, 0, 155, 0.8)",n.style.backgroundColor="rgba(150, 150, 150, 0.5)",n.style.border="solid 3px rgba(0, 0, 155, 0.5)"):(e.style.backgroundColor="rgba(150, 150, 150, 0.5)",e.style.border="solid 3px rgba(0, 0, 155, 0.5)",t.style.backgroundColor="rgba(150, 150, 150, 0.5)",t.style.border="solid 3px rgba(0, 0, 155, 0.5)",n.style.backgroundColor="rgba(250, 250, 250, 0.8)",n.style.border="solid 5px rgba(0, 0, 155, 0.8)"),this._difficulty=document.querySelector('input[name="difficulty"]:checked').value}get play(){return this._play}set play(e){this._play=e}get difficulty(){return this._difficulty}}class F0{constructor(){this._monsterLife=100,this._monsterLifeBar=document.createElement("div"),this._monsterLifeBar.style.position="absolute",this._monsterLifeBar.style.left="50%",this._monsterLifeBar.style.top="40px",this._monsterLifeBar.style.transform="translateX(-50%)",this._monsterLifeBar.style.width="500px",this._monsterLifeBar.style.height="25px",this._monsterLifeBar.style.border="solid 3px white",this._monsterLifeBar.style.borderRadius="5px",document.body.appendChild(this._monsterLifeBar),this._divs=[];for(let e=0;e<100;e++){const t=document.createElement("div");t.style.width="5px",t.style.height="25px",t.style.backgroundColor="rgba(240, 0, 0, 0.8)",t.style.float="left",this._monsterLifeBar.appendChild(t),this._divs.push(t)}}get monsterLife(){return this._monsterLife}set monsterLife(e){this._monsterLife=e}show(){this._monsterLifeBar.style.display="block"}hide(){this._monsterLifeBar.style.display="none"}update(){this._monsterLife<0&&(this._monsterLife=0);for(let e=0;e Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.8.2 -*/var $t=Uint8Array,Ni=Uint16Array,k0=Int32Array,oh=new $t([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]),ch=new $t([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]),z0=new $t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lh=function(r,e){for(var t=new Ni(31),n=0;n<31;++n)t[n]=e+=1<>1|(ot&21845)<<1;Hn=(Hn&52428)>>2|(Hn&13107)<<2,Hn=(Hn&61680)>>4|(Hn&3855)<<4,po[ot]=((Hn&65280)>>8|(Hn&255)<<8)>>1}var ps=function(r,e,t){for(var n=r.length,i=0,s=new Ni(e);i>c]=l}else for(o=new Ni(n),i=0;i>15-r[i]);return o},Es=new $t(288);for(var ot=0;ot<144;++ot)Es[ot]=8;for(var ot=144;ot<256;++ot)Es[ot]=9;for(var ot=256;ot<280;++ot)Es[ot]=7;for(var ot=280;ot<288;++ot)Es[ot]=8;var dh=new $t(32);for(var ot=0;ot<32;++ot)dh[ot]=5;var W0=ps(Es,9,1),X0=ps(dh,5,1),Ta=function(r){for(var e=r[0],t=1;te&&(e=r[t]);return e},on=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},Ea=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},j0=function(r){return(r+7)/8|0},q0=function(r,e,t){return(t==null||t>r.length)&&(t=r.length),new $t(r.subarray(e,t))},Y0=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],cn=function(r,e,t){var n=new Error(e||Y0[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,cn),!t)throw n;return n},K0=function(r,e,t,n){var i=r.length,s=0;if(!i||e.f&&!e.l)return t||new $t(0);var a=!t,o=a||e.i!=2,c=e.i;a&&(t=new $t(i*3));var l=function(nt){var C=t.length;if(nt>C){var st=new $t(Math.max(C*2,nt));st.set(t),t=st}},u=e.f||0,h=e.p||0,d=e.b||0,f=e.l,_=e.d,g=e.m,m=e.n,p=i*8;do{if(!f){u=on(r,h,1);var b=on(r,h+1,3);if(h+=3,b)if(b==1)f=W0,_=X0,g=9,m=5;else if(b==2){var E=on(r,h,31)+257,A=on(r,h+10,15)+4,D=E+on(r,h+5,31)+1;h+=14;for(var w=new $t(D),y=new $t(19),P=0;P>4;if(x<16)w[P++]=x;else{var H=0,q=0;for(x==16?(q=3+on(r,h,3),h+=2,H=w[P-1]):x==17?(q=3+on(r,h,7),h+=3):x==18&&(q=11+on(r,h,127),h+=7);q--;)w[P++]=H}}var V=w.subarray(0,E),ie=w.subarray(E);g=Ta(V),m=Ta(ie),f=ps(V,g,1),_=ps(ie,m,1)}else cn(1);else{var x=j0(h)+4,M=r[x-4]|r[x-3]<<8,L=x+M;if(L>i){c&&cn(0);break}o&&l(d+M),t.set(r.subarray(x,L),d),e.b=d+=M,e.p=h=L*8,e.f=u;continue}if(h>p){c&&cn(0);break}}o&&l(d+131072);for(var oe=(1<>4;if(h+=H&15,h>p){c&&cn(0);break}if(H||cn(2),He<256)t[d++]=He;else if(He==256){Oe=h,f=null;break}else{var W=He-254;if(He>264){var P=He-257,J=oh[P];W=on(r,h,(1<>4;ce||cn(3),h+=ce&15;var ie=G0[ae];if(ae>3){var J=ch[ae];ie+=Ea(r,h)&(1<p){c&&cn(0);break}o&&l(d+131072);var Ae=d+W;if(d>4>7||(r[0]<<8|r[1])%31)&&cn(6,"invalid zlib data"),(r[1]>>5&1)==+!e&&cn(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function J0(r,e){return K0(r.subarray($0(r,e),-4),{i:2},e,e)}var Q0=typeof TextDecoder<"u"&&new TextDecoder,ex=0;try{Q0.decode(Z0,{stream:!0}),ex=1}catch{}function fh(r,e,t){const n=t.length-r-1;if(e>=t[n])return n-1;if(e<=t[r])return r;let i=r,s=n,a=Math.floor((i+s)/2);for(;e=t[a+1];)e=g&&(_[f][0]=_[d][0]/o[b+1][p],m=_[f][0]*o[p][b]);const x=p>=-1?1:-p,M=h-1<=b?g-1:t-h;for(let E=x;E<=M;++E)_[f][E]=(_[d][E]-_[d][E-1])/o[b+1][p+E],m+=_[f][E]*o[p+E][b];h<=b&&(_[f][g]=-_[d][g-1]/o[b+1][h],m+=_[f][g]*o[h][b]),a[g][h]=m;const L=d;d=f,f=L}}let u=t;for(let h=1;h<=n;++h){for(let d=0;d<=t;++d)a[h][d]*=u;u*=t-h}return a}function sx(r,e,t,n,i){const s=i0,c=typeof s.Content=="string"&&s.Content!=="";if(o||c){const l=this.parseImage(n[i]);t[s.RelativeFilename||s.Filename]=l}}}}for(const n in e){const i=e[n];t[i]!==void 0?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Ve.Objects){const n=Ve.Objects.Texture;for(const i in n){const s=this.parseTexture(n[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,a=i!==void 0?i.value:0,o=s!==void 0?s.value:0;if(n.wrapS=a===0?Jt:mn,n.wrapT=o===0?Jt:mn,"Scaling"in e){const c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}if("Translation"in e){const c=e.Translation.value;n.offset.x=c[0],n.offset.y=c[1]}return n}loadTexture(e,t){const n=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),i=e.FileName.split(".").pop().toLowerCase(),s=n.has(i)?this.manager.getHandler(`.${i}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${i.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new St;const a=s.path;a||s.setPath(this.textureLoader.path);const o=_t.get(e.id).children;let c;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(c=t[o[0].ID],(c.indexOf("blob:")===0||c.indexOf("data:")===0)&&s.setPath(void 0));const l=s.load(c);return s.setPath(a),l}parseMaterials(e){const t=new Map;if("Material"in Ve.Objects){const n=Ve.Objects.Material;for(const i in n){const s=this.parseMaterial(n[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!_t.has(n))return null;const a=this.parseParameters(e,t,n);let o;switch(s.toLowerCase()){case"phong":o=new va;break;case"lambert":o=new Mg;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),o=new va;break}return o.setValues(a),o.name=i,o}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new ge().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new ge().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new ge().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new ge().fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new ge().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new ge().fromArray(e.SpecularColor.value).convertSRGBToLinear());const s=this;return _t.get(n).children.forEach(function(a){const o=a.relationship;switch(o){case"Bump":i.bumpMap=s.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,a.ID),i.map!==void 0&&(i.map.colorSpace=Mt);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,a.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,a.ID),i.emissiveMap!==void 0&&(i.emissiveMap.colorSpace=Mt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,a.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,a.ID),i.envMap!==void 0&&(i.envMap.mapping=mr,i.envMap.colorSpace=Mt);break;case"SpecularColor":i.specularMap=s.getTexture(t,a.ID),i.specularMap!==void 0&&(i.specularMap.colorSpace=Mt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,a.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),i}getTexture(e,t){return"LayeredTexture"in Ve.Objects&&t in Ve.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=_t.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Ve.Objects){const n=Ve.Objects.Deformer;for(const i in n){const s=n[i],a=_t.get(parseInt(i));if(s.attrType==="Skin"){const o=this.parseSkeleton(a,n);o.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[i]=o}else if(s.attrType==="BlendShape"){const o={id:i};o.rawTargets=this.parseMorphTargets(a,n),o.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=o}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const a={ID:i.ID,indices:[],weights:[],transformLink:new fe().fromArray(s.TransformLink.a)};"Indexes"in s&&(a.indices=s.Indexes.a,a.weights=s.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i1?a=o:o.length>0?a=o[0]:(a=new va({name:In.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in s.attributes&&o.forEach(function(c){c.vertexColors=!0}),s.FBX_Deformer?(i=new Yl(s,a),i.normalizeSkinWeights()):i=new ye(s,a),i}createCurve(e,t){const n=e.children.reduce(function(s,a){return t.has(a.ID)&&(s=t.get(a.ID)),s},null),i=new Po({name:In.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Nr(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=_h(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&_t.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=Ve.Objects.Model[i.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),Ft.add(e.target)):e.lookAt(new T().fromArray(a))}}})}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const s in e){const a=e[s];_t.get(parseInt(a.ID)).parents.forEach(function(c){if(t.has(c.ID)){const l=c.ID;_t.get(l).parents.forEach(function(h){n.has(h.ID)&&n.get(h.ID).bind(new Ur(a.bones),i[h.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Ve.Objects){const t=Ve.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new fe().fromArray(s.Matrix.a)}):e[i.Node]=new fe().fromArray(i.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Ve){if("AmbientColor"in Ve.GlobalSettings){const e=Ve.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(t!==0||n!==0||i!==0){const s=new ge(t,n,i).convertSRGBToLinear();Ft.add(new sh(s,1))}}"UnitScaleFactor"in Ve.GlobalSettings&&(Ft.userData.unitScaleFactor=Ve.GlobalSettings.UnitScaleFactor.value)}}}class hx{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Ve.Objects){const n=Ve.Objects.Geometry;for(const i in n){const s=_t.get(parseInt(i)),a=this.parseGeometry(s,n[i],e);t.set(parseInt(i),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,s=[],a=e.parents.map(function(h){return Ve.Objects.Model[h.ID]});if(a.length===0)return;const o=e.children.reduce(function(h,d){return i[d.ID]!==void 0&&(h=i[d.ID]),h},null);e.children.forEach(function(h){n.morphTargets[h.ID]!==void 0&&s.push(n.morphTargets[h.ID])});const c=a[0],l={};"RotationOrder"in c&&(l.eulerOrder=_h(c.RotationOrder.value)),"InheritType"in c&&(l.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(l.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(l.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(l.scale=c.GeometricScaling.value);const u=mh(l);return this.genGeometry(t,o,s,u)}genGeometry(e,t,n,i){const s=new zt;e.attrName&&(s.name=e.attrName);const a=this.parseGeoNode(e,t),o=this.genBuffers(a),c=new gt(o.vertex,3);if(c.applyMatrix4(i),s.setAttribute("position",c),o.colors.length>0&&s.setAttribute("color",new gt(o.colors,3)),t&&(s.setAttribute("skinIndex",new Eo(o.weightsIndices,4)),s.setAttribute("skinWeight",new gt(o.vertexWeights,4)),s.FBX_Deformer=t),o.normal.length>0){const l=new Fe().getNormalMatrix(i),u=new gt(o.normal,3);u.applyNormalMatrix(l),s.setAttribute("normal",u)}if(o.uvs.forEach(function(l,u){const h=u===0?"uv":`uv${u}`;s.setAttribute(h,new gt(o.uvs[u],2))}),a.material&&a.material.mappingType!=="AllSame"){let l=o.materialIndex[0],u=0;if(o.materialIndex.forEach(function(h,d){h!==l&&(s.addGroup(u,d-u,l),l=h,u=d)}),s.groups.length>0){const h=s.groups[s.groups.length-1],d=h.start+h.count;d!==o.materialIndex.length&&s.addGroup(d,o.materialIndex.length-d,l)}s.groups.length===0&&s.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(s,e,n,i),s}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(a,o){n.weightTable[a]===void 0&&(n.weightTable[a]=[]),n.weightTable[a].push({id:s,weight:i.weights[o]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,s=!1,a=[],o=[],c=[],l=[],u=[],h=[];const d=this;return e.vertexIndices.forEach(function(f,_){let g,m=!1;f<0&&(f=f^-1,m=!0);let p=[],b=[];if(a.push(f*3,f*3+1,f*3+2),e.color){const x=ar(_,n,f,e.color);c.push(x[0],x[1],x[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(x){b.push(x.weight),p.push(x.id)}),b.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const x=[0,0,0,0],M=[0,0,0,0];b.forEach(function(L,E){let A=L,D=p[E];M.forEach(function(w,y,P){if(A>w){P[y]=A,A=w;const z=x[y];x[y]=D,D=z}})}),p=x,b=M}for(;b.length<4;)b.push(0),p.push(0);for(let x=0;x<4;++x)u.push(b[x]),h.push(p[x])}if(e.normal){const x=ar(_,n,f,e.normal);o.push(x[0],x[1],x[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=ar(_,n,f,e.material)[0],g<0&&(d.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(x,M){const L=ar(_,n,f,x);l[M]===void 0&&(l[M]=[]),l[M].push(L[0]),l[M].push(L[1])}),i++,m&&(d.genFace(t,e,a,g,o,c,l,u,h,i),n++,i=0,a=[],o=[],c=[],l=[],u=[],h=[])}),t}getNormalNewell(e){const t=new T(0,0,0);for(let n=0;n.5?new T(0,1,0):new T(0,0,1)).cross(t).normalize(),s=t.clone().cross(i).normalize();return{normal:t,tangent:i,bitangent:s}}flattenVertex(e,t,n){return new Ne(e.dot(t),e.dot(n))}genFace(e,t,n,i,s,a,o,c,l,u){let h;if(u>3){const d=[],f=t.baseVertexPositions||t.vertexPositions;for(let p=0;p1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);n[i]={name:t[i].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(i){t=t.concat(n.generateTracks(i))}),new Tr(e.name,-1,t)}generateTracks(e){const t=[];let n=new T,i=new T;if(e.transform&&e.transform.decompose(n,new pt,i),n=n.toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,n,i){const s=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(s,t,n);return new li(e+"."+i,s,a)}generateRotationTrack(e,t,n,i,s){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const h=this.interpolateRotations(t.x,t.y,t.z,s);a=h[0],o=h[1]}n!==void 0&&(n=n.map(It.degToRad),n.push(s),n=new mt().fromArray(n),n=new pt().setFromEuler(n)),i!==void 0&&(i=i.map(It.degToRad),i.push(s),i=new mt().fromArray(i),i=new pt().setFromEuler(i).invert());const c=new pt,l=new mt,u=[];if(!o||!a)return new qn(e+".quaternion",[0],[0]);for(let h=0;h2&&new pt().fromArray(u,(h-3)/3*4).dot(c)<0&&c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(u,h/3*4);return new qn(e+".quaternion",a,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(s){return s/100}),i=Ft.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new ci(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,i){return n-i}),t.length>1){let n=1,i=t[0];for(let s=1;s=180||f[1]>=180||f[2]>=180){const g=Math.max(...f)/180,m=new mt(...l,i),p=new mt(...h,i),b=new pt().setFromEuler(m),x=new pt().setFromEuler(p);b.dot(x)&&x.set(-x.x,-x.y,-x.z,-x.w);const M=e.times[o-1],L=e.times[o]-M,E=new pt,A=new mt;for(let D=0;D<1;D+=1/g)E.copy(b.clone().slerp(x.clone(),D)),s.push(M+D*L),A.setFromQuaternion(E,i),a.push(A.x),a.push(A.y),a.push(A.z)}else s.push(e.times[o]),a.push(It.degToRad(e.values[o])),a.push(It.degToRad(t.values[o])),a.push(It.degToRad(n.values[o]))}return[s,a]}}class dx{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new ph,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(i,s){const a=i.match(/^[\s\t]*;/),o=i.match(/^[\s\t]*$/);if(a||o)return;const c=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=i.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(i,c):l?t.parseNodeProperty(i,l,n[++s]):u?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},a=this.parseNodeAttr(i),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in o?(n==="PoseNode"?o.PoseNode.push(s):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==""&&(o[n][a.id]=s)):typeof a.id=="number"?(o[n]={},o[n][a.id]=s):n!=="Properties70"&&(n==="PoseNode"?o[n]=[s]:o[n]=s),typeof a.id=="number"&&(s.id=a.id),a.name!==""&&(s.attrName=a.name),a.type!==""&&(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const c=s.split(",").slice(1),l=parseInt(c[0]),u=parseInt(c[1]);let h=s.split(",").slice(3);h=h.map(function(d){return d.trim().replace(/^"/,"")}),i="connections",s=[l,u],xx(s,h),a[i]===void 0&&(a[i]=[])}i==="Node"&&(a.id=s),i in a&&Array.isArray(a[i])?a[i].push(s):i!=="a"?a[i]=s:a.a=s,this.setCurrentProp(a,i),i==="a"&&s.slice(-1)!==","&&(a.a=Ra(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Ra(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],a=i[1],o=i[2],c=i[3];let l=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=Ra(l);break}this.getPrevNode()[s]={type:a,type2:o,flag:c,value:l},this.setCurrentProp(this.getPrevNode(),s)}}class fx{parse(e){const t=new _l(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new ph;for(;!this.endOfContent(t);){const s=this.parseNode(t,n);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),o=e.getString(a);if(i===0)return null;const c=[];for(let d=0;d0?c[0]:"",u=c.length>1?c[1]:"",h=c.length>2?c[2]:"";for(n.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(o,n,d)}return n.propertyList=c,typeof l=="number"&&(n.id=l),u!==""&&(n.attrName=u),h!==""&&(n.attrType=h),o!==""&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if(e==="Connections"&&n.name==="C"){const i=[];n.propertyList.forEach(function(s,a){a!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&&n.name==="P"){let i=n.propertyList[0],s=n.propertyList[1];const a=n.propertyList[2],o=n.propertyList[3];let c;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[i]={type:s,type2:a,flag:o,value:c}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const o=J0(new Uint8Array(e.getArrayBuffer(a))),c=new _l(o.buffer);switch(t){case"b":case"c":return c.getBooleanArray(i);case"d":return c.getFloat64Array(i);case"f":return c.getFloat32Array(i);case"i":return c.getInt32Array(i);case"l":return c.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class _l{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(n)}}class ph{add(e,t){this[e]=t}}function px(r){const e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===gh(r,0,e.length)}function mx(r){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(i){const s=r[i-1];return r=r.slice(t+i),t++,s}for(let i=0;i{t.scale.setScalar(this._normalScale),t.traverse(s=>{s.castShadow=!0}),t.position.set(0,0,190),t.rotation.y=0,this._target=t,this._params.scene.add(this._target),this._mixer=new ko(this._target),this._manager=new Do,this._manager.onLoad=()=>{this._stateMachine.SetState("idle")};const n=(s,a)=>{const o=a.animations[0],c=this._mixer.clipAction(o);this._animations[s]={clip:o,action:c}},i=new Er(this._manager);i.setPath("./models/knight/"),i.load("walk.fbx",s=>{n("walk",s)}),i.load("run.fbx",s=>{n("run",s)}),i.load("idle.fbx",s=>{n("idle",s)}),i.load("attack_1.fbx",s=>{n("attack_1",s)}),i.load("attack_2.fbx",s=>{n("attack_2",s)}),i.load("death.fbx",s=>{n("death",s)})})}get position(){return this._position}get previousPosition(){return this._previousPosition}get rotation(){return this._target?this._target.quaternion:new pt}set rotation(e){this._target&&this._target.quaternion.copy(e)}get keyPressed(){const e=this._input._keys;return{w:e.forward,a:e.left,s:e.backward,d:e.right,shift:e.shift,space:e.space}}get hitFlag(){return this._hitFlag}set hitFlag(e){this._hitFlag=e}get hitDirection(){return this._hitDirection}set hitDirection(e){this._hitDirection=e}get hitIntensity(){return this._hitIntensity}set hitIntensity(e){this._hitIntensity=e}get damage(){return this._damage}get attackRange(){return this._attackRange}get transformed(){return this._transformed}get timeTransformed(){return this._timeTransformed}get transformationTime(){return this._transformationTime}_PlayerMovementHandler(e){const t=this._velocity,n=new T(t.x*this._decceleration.x,t.y*this._decceleration.y,t.z*this._decceleration.z);n.multiplyScalar(e),n.z=Math.sign(n.z)*Math.min(Math.abs(n.z),Math.abs(t.z)),t.add(n);const i=this._target,s=new pt,a=new T,o=i.quaternion.clone(),c=this._acceleration.clone();this._input._keys.shift&&c.multiplyScalar(3),this._input._keys.forward&&(t.z+=c.z*e),this._input._keys.backward&&(t.z-=c.z*e),this._input._keys.left&&(a.set(0,1,0),s.setFromAxisAngle(a,4*Math.PI*e*this._acceleration.y),o.multiply(s)),this._input._keys.right&&(a.set(0,1,0),s.setFromAxisAngle(a,4*-Math.PI*e*this._acceleration.y),o.multiply(s)),i.quaternion.copy(o);const l=new T;l.copy(i.position);const u=new T(0,0,1);u.applyQuaternion(i.quaternion),u.normalize(),u.multiplyScalar(t.z*e),i.position.add(u);const h=new T(1,0,0);h.applyQuaternion(i.quaternion),h.normalize(),h.multiplyScalar(t.x*e),i.position.add(h),this._worldBoundingBoxes.map(d=>{new bt().setFromObject(d).containsPoint(i.position)&&i.position.copy(l)}),this._position.copy(i.position),this._previousPosition.copy(l)}_DeathHandler(){this._params.healthBar.hearts.length===0&&this._stateMachine.SetState("death")}_HitHandler(){if(this._hitFlag){const e=Math.random()<.5?-1:1;this._target.rotation.y+=Math.PI/40*e;const t=this._target.position.z-this._hitDirection.z*this._hitIntensity;let n=!0;for(const i of this._params.world.boundingBoxes)if(new bt().setFromObject(i).containsPoint(new T(this._target.position.x,this._target.position.y,t))){n=!1;break}n&&(this._target.position.z=t),this._hitTime=Date.now()}}_TransformationHandler(){if(this._normalDamage=this._params.powerBar.swords.length,this._bigDamage=this._params.powerBar.swords.length*2,this._params.starCounter.stars>=this._starsToGetBigger&&!this._transformed){if(this._transformed=!0,this._timeTransformed=Date.now(),this._params.starCounter.stars=0,this._target.scale.setScalar(this._bigScale),this._damage=this._bigDamage,this._attackRange=this._bigAttackRange,this._params.healthBar.hearts.length<10){const e=this._params.healthBar.hearts.length;for(let t=0;t<10-e;t++)this._params.healthBar.addHeart()}this._particleSpawner.create({x:this._position.x-10,y:this._position.y,z:this._position.z-10,width:15,height:30,depth:15},300)}if(this._transformed&&Date.now()-this._timeTransformed>this._transformationTime&&(this._transformed=!1,this._timeTransformed=0,this._target.scale.setScalar(this._normalScale),this._damage=this._normalDamage,this._attackRange=this._normalAttackRange,this._params.powerBar.swords.length>1))for(let e=0;ethis._onKeyDown(e),!1),document.addEventListener("keyup",e=>this._onKeyUp(e),!1)}_onKeyDown(e){switch(e.keyCode){case 87:this._keys.forward=!0;break;case 65:this._keys.left=!0;break;case 83:this._keys.backward=!0;break;case 68:this._keys.right=!0;break;case 32:this._keys.space=!0;break;case 16:this._keys.shift=!0;break;case 17:this._keys.ctrl=!0;break}}_onKeyUp(e){switch(e.keyCode){case 87:this._keys.forward=!1;break;case 65:this._keys.left=!1;break;case 83:this._keys.backward=!1;break;case 68:this._keys.right=!1;break;case 32:this._keys.space=!1;break;case 16:this._keys.shift=!1;break;case 17:this._keys.ctrl=!1;break}}}class Lx{constructor(e){this._params=e,this._camera=e.camera,this._currentPosition=new T,this._currentLookat=new T}_CalculateIdealOffset(){const e=new T(-5,20,-30);return e.applyQuaternion(this._params.target.rotation),e.add(this._params.target.position),e}_CalculateIdealLookat(){const e=new T(0,10,50);return e.applyQuaternion(this._params.target.rotation),e.add(this._params.target.position),e}Update(e){const t=this._CalculateIdealOffset(),n=this._CalculateIdealLookat(),i=1-Math.pow(.001,e);this._currentPosition.lerp(t,i),this._currentLookat.lerp(n,i),this._camera.position.copy(this._currentPosition),this._camera.lookAt(this._currentLookat)}}class Ix{constructor(e){this._params=e,this._stars=[],this._lastSpawnTime=0,this._spawnInterval=12,this._maxstars=5,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t)}_LoadModels(){const e=new Yi;this._lastSpawnTime=Date.now(),e.load("./models/scene_objects/star.glb",t=>{t.scene.traverse(l=>{l.castShadow=!0});const n=t.scene;n.scale.set(3,3,3);let i=new T,s=!1;const a=new ze(230,50,150),o=new Le({color:65280,wireframe:!0,visible:!1}),c=new ye(a,o);for(c.position.set(0,25,-130),this._params.scene.add(c),this._worldBoundingBoxes.push(c);!s;){i.x=Math.random()*200-100,i.y=1,i.z=Math.random()*200-100,s=!0;for(const l of this._worldBoundingBoxes)if(new bt().setFromObject(l).containsPoint(i)){s=!1;break}}n.position.set(i.x,i.y,i.z),this._params.scene.add(n),this._stars.push(n)})}Update(e){Date.now()-this._lastSpawnTime>this._spawnInterval*1e3&&this._stars.length{t.rotation.y+=1*e})}get stars(){return this._stars}set stars(e){this._stars=e}}class Dx{constructor(e){this._params=e,this._hearts=[],this._lastSpawnTime=0,this._spawnInterval=18,this._maxHearts=5,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t)}_LoadModels(){const e=new Yi;this._lastSpawnTime=Date.now(),e.load("./models/scene_objects/heart.glb",t=>{t.scene.traverse(l=>{l.castShadow=!0});const n=t.scene;n.scale.set(5,5,5);let i=new T,s=!1;const a=new ze(230,50,150),o=new Le({color:65280,wireframe:!0,visible:!1}),c=new ye(a,o);for(c.position.set(0,25,-130),this._params.scene.add(c),this._worldBoundingBoxes.push(c);!s;){i.x=Math.random()*200-100,i.y=4,i.z=Math.random()*200-100,s=!0;for(const l of this._worldBoundingBoxes)if(new bt().setFromObject(l).containsPoint(i)){s=!1;break}}n.position.set(i.x,i.y,i.z),this._params.scene.add(n),this._hearts.push(n)})}Update(e){Date.now()-this._lastSpawnTime>this._spawnInterval*1e3&&this._hearts.length{t.rotation.y+=1*e})}get hearts(){return this._hearts}set hearts(e){this._hearts=e}}class Ux{constructor(e){this._params=e,this._swords=[],this._lastSpawnTime=0,this._spawnInterval=20,this._maxSwords=5,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t)}_LoadModels(){const e=new Yi;this._lastSpawnTime=Date.now(),e.load("./models/scene_objects/sword.glb",t=>{t.scene.traverse(l=>{l.castShadow=!0});const n=t.scene;n.scale.set(20,20,20);let i=new T,s=!1;const a=new ze(230,50,150),o=new Le({color:65280,wireframe:!0,visible:!1}),c=new ye(a,o);for(c.position.set(0,25,-130),this._params.scene.add(c),this._worldBoundingBoxes.push(c);!s;){i.x=Math.random()*200-100,i.y=4,i.z=Math.random()*200-100,s=!0;for(const l of this._worldBoundingBoxes)if(new bt().setFromObject(l).containsPoint(i)){s=!1;break}}n.position.set(i.x,i.y,i.z),n.rotation.x=Math.PI/4,this._params.scene.add(n),this._swords.push(n)})}Update(e){Date.now()-this._lastSpawnTime>this._spawnInterval*1e3&&this._swords.length{t.rotation.z+=1*e})}get swords(){return this._swords}set swords(e){this._swords=e}}class Nx{constructor(e){this._params=e,this._mobs=[],this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t);this._playerPosition=this._params.playerPosition,this._mobAttackDistance=6,this._mobAttackTime=this._params.mobAttackTime,this._lastSpawnTime=0,this._minNumberOfMobs=12,this._LoadModels()}get mobs(){return this._mobs}get mobAttackDistance(){return this._mobAttackDistance}get mobAttackTime(){return this._mobAttackTime}_LoadModels(){const e=new Yi;this._mobPositions=[],this._mobPositions.push(new T(0,1,-20)),this._mobPositions.push(new T(0,1,110)),this._mobPositions.push(new T(-50,1,30)),this._mobPositions.push(new T(50,1,30)),this._mobPositions.push(new T(80,1,130)),this._mobPositions.push(new T(-80,1,130)),this._mobPositions.push(new T(-150,1,100)),this._mobPositions.push(new T(150,1,100)),this._mobPositions.push(new T(-110,1,50)),this._mobPositions.push(new T(110,1,50)),this._mobPositions.push(new T(-120,1,0)),this._mobPositions.push(new T(120,1,0));const t=this._mobPositions.length;for(let l=0;l{i.scene.traverse(h=>{h.castShadow=!0});const s=i.scene;s.scale.set(4,4,4),s.position.set(t.x,t.y,t.z),this._params.scene.add(s),n.mob=s,n.position=s.position,n.rotation=s.rotation,n.velocity=new T(0,0,1);const a=new ko(s),o=a.clipAction(i.animations[6]),c=a.clipAction(i.animations[5]),l=a.clipAction(i.animations[0]),u=a.clipAction(i.animations[1]);o.play(),n.walk=o,n.run=c,n.attack=l,n.dead=u,n.currentAction=o,n.mixer=a,this._walkY=s.position.y-1,this._runY=s.position.y-1.2,this._mobs.push(n)})}update(e){if(Date.now()-this._lastSpawnTime>1e4&&this._mobs.lengthn.mixer))t.update(e);for(const t of this._mobs){const n=this._playerPosition.distanceTo(t.position);let i=!1;for(const s of this._worldBoundingBoxes)if(new bt().setFromObject(s).containsPoint(this._playerPosition)){i=!0;break}t.currentAction!==t.dead&&(n<40&&!i?this.moveMobTowardsPlayer(t):this.moveMobRandomly(t)),t.life<=0&&this.dead(t)}}moveMobTowardsPlayer(e){const t=e.position,n=e.velocity,i=this._playerPosition.distanceTo(t);let s=!1;for(const a of this._worldBoundingBoxes)if(new bt().setFromObject(a).containsPoint(t)){s=!0;break}if(i5e3&&(n.set(Math.random()<.5?1:-1*Math.random(),0,Math.random()<.5?1:-1*Math.random()).normalize().multiplyScalar(.05+Math.random()*.1),e.time=s);for(const c of this._worldBoundingBoxes)new bt().setFromObject(c).containsPoint(t)&&(n.set(-n.x,0,-n.z).normalize().multiplyScalar(.05+Math.random()*.1),e.time=s);t.add(n),t.y=this._walkY;const o=Math.atan2(n.x,n.z);e.mob.rotation.y=o}dead(e){e.deadFlag?new Date().getTime()-e.deadTime>1e4?(this._params.scene.remove(e.mob),this._mobs=this._mobs.filter(t=>t!==e)):e.currentAction.time>e.currentAction.getClip().duration-.1&&(e.currentAction.paused=!0):(e.currentAction.stop(),e.currentAction=e.dead,e.currentAction.play(),e.deadFlag=!0,e.deadTime=new Date().getTime())}}class Fx{constructor(e){this._params=e,this._animations={},this._stateMachine=new kx(new Ox(this._animations)),this._velocity=new T,this._position=new T,this._previousPosition=new T,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t);this._playerPosition=this._params.playerPosition,this._monsterAttackRange={min:15,max:20},this._monsterAttackTime=this._params.monsterAttackTime,this._LoadModel(),this._timeLastWalk=0,this._timeLastIdle=0,this._timeLastAttack=0,this._timeLastRoar=0,this._monsterLife=100,this._monsterDamage=2,this._monsterLastHit=0,this._monsterState="roar"}get monsterAttackRange(){return this._monsterAttackRange}get monsterAttackTime(){return this._monsterAttackTime}get monsterDamage(){return this._monsterDamage}set monsterDamage(e){this._monsterDamage=e}get monsterLife(){return this._monsterLife}set monsterLife(e){this._monsterLife=e}get monsterLastHit(){return this._monsterLastHit}set monsterLastHit(e){this._monsterLastHit=e}get monsterPosition(){return this._position}get monsterState(){return this._monsterState}_LoadModel(){const e=new Er;e.setPath("./models/monster/"),e.load("monster.fbx",o=>{o.scale.setScalar(.06),o.traverse(d=>{d.castShadow=!0}),o.position.set(0,0,-140),o.rotation.y=0,o.scale.set(.13,.13,.13);const l=new Ss().load("./models/monster/monster_texture.png");o.traverse(d=>{d.isMesh&&(d.material.map=l)}),this._target=o,this._params.scene.add(this._target),this._position=this._target.position,this._previousPosition=this._target.position,this._rotation=this._target.rotation,this._velocity=new T(0,0,0),this._mixer=new ko(this._target),this._manager=new Do,this._manager.onLoad=()=>{this._stateMachine.SetState("idle")};const u=(d,f)=>{const _=f.animations[0],g=this._mixer.clipAction(_);this._animations[d]={clip:_,action:g}},h=new Er(this._manager);h.setPath("./models/monster/"),h.load("walk.fbx",d=>{u("walk",d)}),h.load("idle.fbx",d=>{u("idle",d)}),h.load("roar.fbx",d=>{u("roar",d)}),h.load("attack_1.fbx",d=>{u("attack_1",d)}),h.load("attack_2.fbx",d=>{u("attack_2",d)}),h.load("death.fbx",d=>{u("death",d)})});const t=new ze(30,50,10),n=new Le({color:65280,wireframe:!0,visible:!1}),i=new ye(t,n);i.position.set(0,25,-70),this._params.scene.add(i),this._worldBoundingBoxes.push(i);const s=new ze(201,50,100),a=new Le({color:65280,wireframe:!0,visible:!1});this._insideTowers=new ye(s,a),this._insideTowers.position.set(1,25,-145),this._params.scene.add(this._insideTowers)}update(e){this._stateMachine._currentState&&(this._stateMachine._currentState.Update(e),this._monsterLife<=0&&this._monsterState!=="death"?(this._stateMachine.SetState("death"),this._monsterState="death"):new bt().setFromObject(this._insideTowers).containsPoint(this._playerPosition)?this.attackPlayer():this.moveMonsterRandomly(e),this._mixer&&this._mixer.update(e))}moveMonsterRandomly(e){if(this._timeLastAttack=0,this._timeLastRoar=0,(this._stateMachine._currentState.Name==="attack_1"||this._stateMachine._currentState.Name==="attack_2")&&(this._stateMachine.SetState("idle"),this._monsterState="idle",this._timeLastIdle=Date.now()),this._stateMachine._currentState.Name==="idle"&&Date.now()-this._timeLastIdle>5e3?(this._stateMachine.SetState("walk"),this._monsterState="walk",this._timeLastWalk=Date.now(),this._velocity.set(Math.random()<.5?1:-1*Math.random(),0,Math.random()<.5?1:-1*Math.random()).normalize().multiplyScalar(.6)):this._stateMachine._currentState.Name==="walk"&&Date.now()-this._timeLastWalk>5e3&&(this._stateMachine.SetState("idle"),this._monsterState="idle",this._timeLastIdle=Date.now()),this._stateMachine._currentState.Name==="walk"){for(const n of this._worldBoundingBoxes)if(new bt().setFromObject(n).containsPoint(this._position)){this._velocity.set(-this._velocity.x,0,-this._velocity.z).normalize().multiplyScalar(.6),this._position=this._previousPosition;break}this._position.add(this._velocity);const t=Math.atan2(this._velocity.x,this._velocity.z);this._rotation.y=t}}attackPlayer(){const e=this._playerPosition.distanceTo(this._position);if(this._timeLastAttack===0&&(this._timeLastAttack=Date.now()),this._timeLastRoar===0&&(this._timeLastRoar=Date.now()),ethis._monsterAttackRange.max){this._stateMachine.SetState("walk"),this._velocity.copy(this._playerPosition).sub(this._position).normalize().multiplyScalar(.6),this._position.add(this._velocity);const t=Math.atan2(this._playerPosition.x-this._position.x,this._playerPosition.z-this._position.z);this._rotation.y=t}else{const t=Math.atan2(this._playerPosition.x-this._position.x,this._playerPosition.z-this._position.z);this._rotation.y=t,(this._stateMachine._currentState.Name==="roar"||this._stateMachine._currentState.Name==="walk")&&Date.now()-this._timeLastRoar>2500?(this._stateMachine.SetState("attack_1"),this._timeLastAttack=Date.now(),this._monsterState="attack",this._monsterLastHit=Date.now()):(this._stateMachine._currentState.Name==="attack_1"||this._stateMachine._currentState.Name==="attack_2")&&Date.now()-this._timeLastAttack>2500&&(this._stateMachine.SetState("roar"),this._timeLastRoar=Date.now(),this._monsterState="roar")}}}class Ox{constructor(e){this._animations=e}get animations(){return this._animations}}class Bx{constructor(){this._states={},this._currentState=null}_AddState(e,t){this._states[e]=t}SetState(e){const t=this._currentState;if(t){if(t.Name==e)return;t.Exit()}const n=new this._states[e](this);this._currentState=n,n.Enter(t)}Update(e){this._currentState&&this._currentState.Update(e)}}class kx extends Bx{constructor(e){super(),this._proxy=e,this._Init()}_Init(){this._AddState("idle",zx),this._AddState("walk",Hx),this._AddState("roar",Vx),this._AddState("attack_1",Gx),this._AddState("attack_2",Wx),this._AddState("death",Xx)}}class Qi{constructor(e){this._parent=e}Enter(){}Exit(){}Update(){}}class zx extends Qi{constructor(e){super(e)}get Name(){return"idle"}Enter(e){const t=this._parent._proxy._animations.idle.action;if(e){const n=this._parent._proxy._animations[e.Name].action;t.time=0,t.enabled=!0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1),t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){}}class Hx extends Qi{constructor(e){super(e)}get Name(){return"walk"}Enter(e){const t=this._parent._proxy._animations.walk.action;if(e){const n=this._parent._proxy._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){}}class Vx extends Qi{constructor(e){super(e)}get Name(){return"roar"}Enter(e){const t=this._parent._proxy._animations.roar.action;if(e){const n=this._parent._proxy._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){}}class Gx extends Qi{constructor(e){super(e)}get Name(){return"attack_1"}Enter(e){const t=this._parent._proxy._animations.attack_1.action;if(e){const n=this._parent._proxy._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){}}class Wx extends Qi{constructor(e){super(e)}get Name(){return"attack_2"}Enter(e){const t=this._parent._proxy._animations.attack_2.action;if(e){const n=this._parent._proxy._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){}}class Xx extends Qi{constructor(e){super(e)}get Name(){return"death"}Enter(e){const t=this._parent._proxy._animations.death.action;if(e){const n=this._parent._proxy._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){}}class jx{constructor(){this._Initialize()}_Initialize(){this._threejs=new q_({antialias:!0}),this._threejs.outputEncoding=void 0,this._threejs.shadowMap.enabled=!0,this._threejs.shadowMap.type=vl,this._threejs.setPixelRatio(window.devicePixelRatio),this._threejs.setSize(window.innerWidth,window.innerHeight),document.body.appendChild(this._threejs.domElement),window.addEventListener("resize",()=>{this._OnWindowResize()},!1);const e=60,t=1920/1080,n=1,i=1e3;this._camera=new Dt(e,t,n,i),this._camera.position.set(150,200,300),this._camera.lookAt(new T(-44,0,-100)),this._scene=new Y_,this._mixers=[],this._previousRAF=null,this._currentCollectedStars=0,this._currentHitFromMobs=0,this._currentHitFromMonster=0,this._lastAttackTime=0,this._gameOver=!1,this._gameOverTime=0,this._gameWin=!1,this._gameWinTime=0,this._blockGame=!1,this._blockGui=!1,this._difficulty="medium",this._mobAttackTime={easy:1e3,medium:500,hard:300},this._mobHitsToDamage={easy:4,medium:3,hard:2},this._monsterAttackTime={easy:1100,medium:600,hard:400},this._monsterHitsToDamage={easy:2,medium:1,hard:1},this._monsterDamageNormal={easy:2,medium:2,hard:3},this._monsterDamageTransformed={easy:1,medium:1,hard:2},this._bloodSpawnerParams={scene:this._scene,colors:[9052185,8850949,6032904],radius:{baseRadius:.1,randomRadius:.1},opacity:{baseOpacity:1,randomOpacity:0},transparency:!1,velocity:{baseVelocity:new T(-.05,-.15,-.05),randomVelocity:new T(.5,.8,.5),baseSign:new T(1,-1,1),randomSign:new T(!0,!1,!0),update:!1},expirationTime:{baseExpirationTime:5e3,randomExpirationTime:2e3},boxX:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!0},boxY:{baseMin:.1,baseMax:100,randomMin:0,randomMax:0,blockAll:!0,visible:!0},boxZ:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!0}},this._bloodSpawner=new zo(this._bloodSpawnerParams),this._LoadWorld(),this._LoadGUI(),this._LoadStars(),this._LoadHearts(),this._LoadSwords(),this._LoadPlayer(),this._LoadMobs(),this._LoadMonster(),this._RAF()}_LoadWorld(){this._world=new C0({scene:this._scene})}_LoadGUI(){this._gui=new B0({player:this._player})}_LoadPlayer(){const e={camera:this._camera,scene:this._scene,world:this._world,healthBar:this._gui._healthBar,powerBar:this._gui._powerBar,starCounter:this._gui._starCounter};this._player=new Rx(e),this._thirdPersonCamera=new Lx({camera:this._camera,target:this._player})}_LoadStars(){this._starsSpawner=new Ix({scene:this._scene,world:this._world})}_LoadHearts(){this._heartSpawner=new Dx({scene:this._scene,world:this._world})}_LoadSwords(){this._swordSpawner=new Ux({scene:this._scene,world:this._world})}_LoadMobs(){this._mobSpawner=new Nx({scene:this._scene,world:this._world,playerPosition:this._player.position,mobAttackTime:this._mobAttackTime[this._difficulty]})}_LoadMonster(){this._monsterSpawner=new Fx({scene:this._scene,world:this._world,playerPosition:this._player.position,monsterAttackTime:this._monsterAttackTime[this._difficulty]})}_OnWindowResize(){this._camera.aspect=window.innerWidth/window.innerHeight,this._camera.updateProjectionMatrix(),this._threejs.setSize(window.innerWidth,window.innerHeight)}_RAF(){requestAnimationFrame(e=>{this._previousRAF===null&&(this._previousRAF=e),this._RAF(),this._threejs.render(this._scene,this._camera),this._Step(e-this._previousRAF),this._previousRAF=e})}_Update(e){this._mixers&&!this._blockGame&&this._mixers.map(t=>t.update(e)),this._player&&!this._blockGame&&this._player.Update(e),this._starsSpawner&&!this._blockGame&&this._starsSpawner.Update(e),this._heartSpawner&&!this._blockGame&&this._heartSpawner.Update(e),this._swordSpawner&&!this._blockGame&&this._swordSpawner.Update(e),this._mobSpawner&&!this._blockGame&&this._mobSpawner.update(e),this._monsterSpawner&&!this._blockGame&&this._monsterSpawner.update(e),this._bloodSpawner&&!this._blockGame&&this._bloodSpawner.update(),this._world&&!this._blockGame&&this._world.update(e),this._gui&&!this._blockGui&&(this._gui.start.play?(this._blockGame&&(this._player.rotation=new pt(0,1,0,0)),this._blockGame=!1,this._gui.healthBar.show(),this._gui.powerBar.show(),this._gui.starCounter.show(),this._gui.monsterLifeBar.show(),this._gui.transformationTime.show()):this._blockGame=!0,this._gui.monsterLifeBar.update(),this._gui.transformationTime.update(this._player.transformed),this._gui.start.update(),this._difficulty=this._gui.start._difficulty,this._gui._monsterLifeBar.monsterLife=this._monsterSpawner.monsterLife,this._player.transformed?this._gui._transformationTime.time=Math.ceil((this._gui._transformationTime.time=this._player.transformationTime-(Date.now()-this._player.timeTransformed))/1e3):this._gui._transformationTime.time=Math.ceil(this._player.transformationTime/1e3)),this._blockGame||this._thirdPersonCamera.Update(e)}_GameOverWinHandler(){this._gui._healthBar.hearts.length===0&&!this._gameOver&&(this._gameOver=!0,this._gameOverTime=new Date().getTime(),this._gui._gameOver.show()),this._monsterSpawner.monsterState==="death"&&!this._gameWin&&(this._gameWin=!0,this._gameWinTime=new Date().getTime(),this._gui._gameWin.show()),(this._gameOver&&Date.now()-this._gameOverTime>2e3||this._gameWin&&Date.now()-this._gameWinTime>2e3)&&(this._blockGame=!0,this._blockGui=!0)}_CollectorHandler(){this._player.transformed||(this._stars=this._starsSpawner.stars,this._playerPosition=this._player.position,this._stars.map(e=>{e.position.distanceTo(this._playerPosition)<8&&(this._scene.remove(e),this._stars=this._stars.filter(t=>t!==e),this._starsSpawner.stars=this._stars,this._gui._starCounter.addStar())})),this._hearts=this._heartSpawner.hearts,this._playerPosition=this._player.position,this._hearts.map(e=>{e.position.distanceTo(this._playerPosition)<8&&(this._scene.remove(e),this._hearts=this._hearts.filter(t=>t!==e),this._heartSpawner.hearts=this._hearts,this._gui._healthBar.addHeart())}),this._swords=this._swordSpawner.swords,this._playerPosition=this._player.position,this._swords.map(e=>{e.position.distanceTo(this._playerPosition)<8&&(this._scene.remove(e),this._swords=this._swords.filter(t=>t!==e),this._swordSpawner.swords=this._swords,this._gui._powerBar.addSword())})}_MobAttackHandler(){this._mobs=this._mobSpawner.mobs,this._mobAttackDistance=this._mobSpawner.mobAttackDistance,this._mobAttackTime=this._mobSpawner.mobAttackTime,this._player.hitFlag=!1;for(const t of this._mobs)this._playerPosition.distanceTo(t.position)this._mobAttackTime&&!t.deadFlag&&(t.lastHit=new Date().getTime(),this._player.hitFlag=!0,this._player.hitDirection=t.position.clone().sub(this._playerPosition).normalize(),this._player.transformed?this._player.hitIntensity=.3:this._player.hitIntensity=1,this._currentHitFromMobs+=1);this._currentHitFromMobs===this._mobHitsToDamage[this._difficulty]&&(this._gui._healthBar.removeHeart(),this._currentHitFromMobs=0,this._bloodSpawner.create({x:this._player.position.x,y:this._player.position.y,z:this._player.position.z,width:5,height:5,depth:5},30));const e=this._player.damage;if(this._player._stateMachine._currentState&&(this._player._stateMachine._currentState.Name==="attack_1"||this._player._stateMachine._currentState.Name==="attack_2")&&Date.now()-this._lastAttackTime>1e3)for(const t of this._mobs){const n=this._playerPosition.distanceTo(t.position),i=t.position.clone().sub(this._playerPosition).normalize(),o=this._player.position.clone().sub(this._player.previousPosition).normalize().dot(i)>.5;nthis._monsterAttackRange.min&&ethis._monsterAttackTime&&this._monsterState==="attack"&&(this._monsterSpawner.monsterLastHit=new Date().getTime(),this._currentHitFromMonster+=1,this._player.hitFlag=!0,this._player.hitDirection=this._monsterSpawner.monsterPosition.clone().sub(this._playerPosition).normalize(),this._player.transformed?this._player.hitIntensity=1:this._player.hitIntensity=3),this._currentHitFromMonster===this._monsterHitsToDamage[this._difficulty]){for(let t=0;t1e3&&e{new jx}); +*/var $t=Uint8Array,Ni=Uint16Array,k0=Int32Array,oh=new $t([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]),lh=new $t([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]),z0=new $t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ch=function(r,e){for(var t=new Ni(31),n=0;n<31;++n)t[n]=e+=1<>1|(ot&21845)<<1;Hn=(Hn&52428)>>2|(Hn&13107)<<2,Hn=(Hn&61680)>>4|(Hn&3855)<<4,po[ot]=((Hn&65280)>>8|(Hn&255)<<8)>>1}var fs=function(r,e,t){for(var n=r.length,i=0,s=new Ni(e);i>l]=c}else for(o=new Ni(n),i=0;i>15-r[i]);return o},Ts=new $t(288);for(var ot=0;ot<144;++ot)Ts[ot]=8;for(var ot=144;ot<256;++ot)Ts[ot]=9;for(var ot=256;ot<280;++ot)Ts[ot]=7;for(var ot=280;ot<288;++ot)Ts[ot]=8;var dh=new $t(32);for(var ot=0;ot<32;++ot)dh[ot]=5;var W0=fs(Ts,9,1),X0=fs(dh,5,1),Ta=function(r){for(var e=r[0],t=1;te&&(e=r[t]);return e},on=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},Ea=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},j0=function(r){return(r+7)/8|0},q0=function(r,e,t){return(t==null||t>r.length)&&(t=r.length),new $t(r.subarray(e,t))},Y0=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ln=function(r,e,t){var n=new Error(e||Y0[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,ln),!t)throw n;return n},K0=function(r,e,t,n){var i=r.length,s=0;if(!i||e.f&&!e.l)return t||new $t(0);var a=!t,o=a||e.i!=2,l=e.i;a&&(t=new $t(i*3));var c=function(nt){var C=t.length;if(nt>C){var st=new $t(Math.max(C*2,nt));st.set(t),t=st}},u=e.f||0,h=e.p||0,d=e.b||0,f=e.l,_=e.d,g=e.m,m=e.n,p=i*8;do{if(!f){u=on(r,h,1);var b=on(r,h+1,3);if(h+=3,b)if(b==1)f=W0,_=X0,g=9,m=5;else if(b==2){var E=on(r,h,31)+257,A=on(r,h+10,15)+4,D=E+on(r,h+5,31)+1;h+=14;for(var w=new $t(D),y=new $t(19),P=0;P>4;if(x<16)w[P++]=x;else{var H=0,q=0;for(x==16?(q=3+on(r,h,3),h+=2,H=w[P-1]):x==17?(q=3+on(r,h,7),h+=3):x==18&&(q=11+on(r,h,127),h+=7);q--;)w[P++]=H}}var V=w.subarray(0,E),ie=w.subarray(E);g=Ta(V),m=Ta(ie),f=fs(V,g,1),_=fs(ie,m,1)}else ln(1);else{var x=j0(h)+4,M=r[x-4]|r[x-3]<<8,L=x+M;if(L>i){l&&ln(0);break}o&&c(d+M),t.set(r.subarray(x,L),d),e.b=d+=M,e.p=h=L*8,e.f=u;continue}if(h>p){l&&ln(0);break}}o&&c(d+131072);for(var oe=(1<>4;if(h+=H&15,h>p){l&&ln(0);break}if(H||ln(2),He<256)t[d++]=He;else if(He==256){Oe=h,f=null;break}else{var W=He-254;if(He>264){var P=He-257,J=oh[P];W=on(r,h,(1<>4;le||ln(3),h+=le&15;var ie=G0[ae];if(ae>3){var J=lh[ae];ie+=Ea(r,h)&(1<p){l&&ln(0);break}o&&c(d+131072);var Ae=d+W;if(d>4>7||(r[0]<<8|r[1])%31)&&ln(6,"invalid zlib data"),(r[1]>>5&1)==+!e&&ln(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function J0(r,e){return K0(r.subarray($0(r,e),-4),{i:2},e,e)}var Q0=typeof TextDecoder<"u"&&new TextDecoder,ex=0;try{Q0.decode(Z0,{stream:!0}),ex=1}catch{}function fh(r,e,t){const n=t.length-r-1;if(e>=t[n])return n-1;if(e<=t[r])return r;let i=r,s=n,a=Math.floor((i+s)/2);for(;e=t[a+1];)e=g&&(_[f][0]=_[d][0]/o[b+1][p],m=_[f][0]*o[p][b]);const x=p>=-1?1:-p,M=h-1<=b?g-1:t-h;for(let E=x;E<=M;++E)_[f][E]=(_[d][E]-_[d][E-1])/o[b+1][p+E],m+=_[f][E]*o[p+E][b];h<=b&&(_[f][g]=-_[d][g-1]/o[b+1][h],m+=_[f][g]*o[h][b]),a[g][h]=m;const L=d;d=f,f=L}}let u=t;for(let h=1;h<=n;++h){for(let d=0;d<=t;++d)a[h][d]*=u;u*=t-h}return a}function sx(r,e,t,n,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(o||l){const c=this.parseImage(n[i]);t[s.RelativeFilename||s.Filename]=c}}}}for(const n in e){const i=e[n];t[i]!==void 0?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Ve.Objects){const n=Ve.Objects.Texture;for(const i in n){const s=this.parseTexture(n[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,a=i!==void 0?i.value:0,o=s!==void 0?s.value:0;if(n.wrapS=a===0?Jt:mn,n.wrapT=o===0?Jt:mn,"Scaling"in e){const l=e.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;n.offset.x=l[0],n.offset.y=l[1]}return n}loadTexture(e,t){const n=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),i=e.FileName.split(".").pop().toLowerCase(),s=n.has(i)?this.manager.getHandler(`.${i}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${i.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new St;const a=s.path;a||s.setPath(this.textureLoader.path);const o=_t.get(e.id).children;let l;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(l=t[o[0].ID],(l.indexOf("blob:")===0||l.indexOf("data:")===0)&&s.setPath(void 0));const c=s.load(l);return s.setPath(a),c}parseMaterials(e){const t=new Map;if("Material"in Ve.Objects){const n=Ve.Objects.Material;for(const i in n){const s=this.parseMaterial(n[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!_t.has(n))return null;const a=this.parseParameters(e,t,n);let o;switch(s.toLowerCase()){case"phong":o=new va;break;case"lambert":o=new Mg;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),o=new va;break}return o.setValues(a),o.name=i,o}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new ge().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new ge().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new ge().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new ge().fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new ge().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new ge().fromArray(e.SpecularColor.value).convertSRGBToLinear());const s=this;return _t.get(n).children.forEach(function(a){const o=a.relationship;switch(o){case"Bump":i.bumpMap=s.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,a.ID),i.map!==void 0&&(i.map.colorSpace=Mt);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,a.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,a.ID),i.emissiveMap!==void 0&&(i.emissiveMap.colorSpace=Mt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,a.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,a.ID),i.envMap!==void 0&&(i.envMap.mapping=mr,i.envMap.colorSpace=Mt);break;case"SpecularColor":i.specularMap=s.getTexture(t,a.ID),i.specularMap!==void 0&&(i.specularMap.colorSpace=Mt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,a.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),i}getTexture(e,t){return"LayeredTexture"in Ve.Objects&&t in Ve.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=_t.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Ve.Objects){const n=Ve.Objects.Deformer;for(const i in n){const s=n[i],a=_t.get(parseInt(i));if(s.attrType==="Skin"){const o=this.parseSkeleton(a,n);o.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[i]=o}else if(s.attrType==="BlendShape"){const o={id:i};o.rawTargets=this.parseMorphTargets(a,n),o.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=o}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const a={ID:i.ID,indices:[],weights:[],transformLink:new fe().fromArray(s.TransformLink.a)};"Indexes"in s&&(a.indices=s.Indexes.a,a.weights=s.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i1?a=o:o.length>0?a=o[0]:(a=new va({name:In.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in s.attributes&&o.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new Yc(s,a),i.normalizeSkinWeights()):i=new ye(s,a),i}createCurve(e,t){const n=e.children.reduce(function(s,a){return t.has(a.ID)&&(s=t.get(a.ID)),s},null),i=new Po({name:In.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Nr(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=_h(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&_t.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=Ve.Objects.Model[i.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),Ft.add(e.target)):e.lookAt(new T().fromArray(a))}}})}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const s in e){const a=e[s];_t.get(parseInt(a.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;_t.get(c).parents.forEach(function(h){n.has(h.ID)&&n.get(h.ID).bind(new Ur(a.bones),i[h.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Ve.Objects){const t=Ve.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new fe().fromArray(s.Matrix.a)}):e[i.Node]=new fe().fromArray(i.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Ve){if("AmbientColor"in Ve.GlobalSettings){const e=Ve.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(t!==0||n!==0||i!==0){const s=new ge(t,n,i).convertSRGBToLinear();Ft.add(new sh(s,1))}}"UnitScaleFactor"in Ve.GlobalSettings&&(Ft.userData.unitScaleFactor=Ve.GlobalSettings.UnitScaleFactor.value)}}}class hx{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Ve.Objects){const n=Ve.Objects.Geometry;for(const i in n){const s=_t.get(parseInt(i)),a=this.parseGeometry(s,n[i],e);t.set(parseInt(i),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,s=[],a=e.parents.map(function(h){return Ve.Objects.Model[h.ID]});if(a.length===0)return;const o=e.children.reduce(function(h,d){return i[d.ID]!==void 0&&(h=i[d.ID]),h},null);e.children.forEach(function(h){n.morphTargets[h.ID]!==void 0&&s.push(n.morphTargets[h.ID])});const l=a[0],c={};"RotationOrder"in l&&(c.eulerOrder=_h(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const u=mh(c);return this.genGeometry(t,o,s,u)}genGeometry(e,t,n,i){const s=new zt;e.attrName&&(s.name=e.attrName);const a=this.parseGeoNode(e,t),o=this.genBuffers(a),l=new gt(o.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),o.colors.length>0&&s.setAttribute("color",new gt(o.colors,3)),t&&(s.setAttribute("skinIndex",new Eo(o.weightsIndices,4)),s.setAttribute("skinWeight",new gt(o.vertexWeights,4)),s.FBX_Deformer=t),o.normal.length>0){const c=new Fe().getNormalMatrix(i),u=new gt(o.normal,3);u.applyNormalMatrix(c),s.setAttribute("normal",u)}if(o.uvs.forEach(function(c,u){const h=u===0?"uv":`uv${u}`;s.setAttribute(h,new gt(o.uvs[u],2))}),a.material&&a.material.mappingType!=="AllSame"){let c=o.materialIndex[0],u=0;if(o.materialIndex.forEach(function(h,d){h!==c&&(s.addGroup(u,d-u,c),c=h,u=d)}),s.groups.length>0){const h=s.groups[s.groups.length-1],d=h.start+h.count;d!==o.materialIndex.length&&s.addGroup(d,o.materialIndex.length-d,c)}s.groups.length===0&&s.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(s,e,n,i),s}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(a,o){n.weightTable[a]===void 0&&(n.weightTable[a]=[]),n.weightTable[a].push({id:s,weight:i.weights[o]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,s=!1,a=[],o=[],l=[],c=[],u=[],h=[];const d=this;return e.vertexIndices.forEach(function(f,_){let g,m=!1;f<0&&(f=f^-1,m=!0);let p=[],b=[];if(a.push(f*3,f*3+1,f*3+2),e.color){const x=ar(_,n,f,e.color);l.push(x[0],x[1],x[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(x){b.push(x.weight),p.push(x.id)}),b.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const x=[0,0,0,0],M=[0,0,0,0];b.forEach(function(L,E){let A=L,D=p[E];M.forEach(function(w,y,P){if(A>w){P[y]=A,A=w;const z=x[y];x[y]=D,D=z}})}),p=x,b=M}for(;b.length<4;)b.push(0),p.push(0);for(let x=0;x<4;++x)u.push(b[x]),h.push(p[x])}if(e.normal){const x=ar(_,n,f,e.normal);o.push(x[0],x[1],x[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=ar(_,n,f,e.material)[0],g<0&&(d.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(x,M){const L=ar(_,n,f,x);c[M]===void 0&&(c[M]=[]),c[M].push(L[0]),c[M].push(L[1])}),i++,m&&(d.genFace(t,e,a,g,o,l,c,u,h,i),n++,i=0,a=[],o=[],l=[],c=[],u=[],h=[])}),t}getNormalNewell(e){const t=new T(0,0,0);for(let n=0;n.5?new T(0,1,0):new T(0,0,1)).cross(t).normalize(),s=t.clone().cross(i).normalize();return{normal:t,tangent:i,bitangent:s}}flattenVertex(e,t,n){return new Ne(e.dot(t),e.dot(n))}genFace(e,t,n,i,s,a,o,l,c,u){let h;if(u>3){const d=[],f=t.baseVertexPositions||t.vertexPositions;for(let p=0;p1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);n[i]={name:t[i].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(i){t=t.concat(n.generateTracks(i))}),new Tr(e.name,-1,t)}generateTracks(e){const t=[];let n=new T,i=new T;if(e.transform&&e.transform.decompose(n,new pt,i),n=n.toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,n,i){const s=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(s,t,n);return new ci(e+"."+i,s,a)}generateRotationTrack(e,t,n,i,s){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const h=this.interpolateRotations(t.x,t.y,t.z,s);a=h[0],o=h[1]}n!==void 0&&(n=n.map(It.degToRad),n.push(s),n=new mt().fromArray(n),n=new pt().setFromEuler(n)),i!==void 0&&(i=i.map(It.degToRad),i.push(s),i=new mt().fromArray(i),i=new pt().setFromEuler(i).invert());const l=new pt,c=new mt,u=[];if(!o||!a)return new qn(e+".quaternion",[0],[0]);for(let h=0;h2&&new pt().fromArray(u,(h-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(u,h/3*4);return new qn(e+".quaternion",a,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(s){return s/100}),i=Ft.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new li(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,i){return n-i}),t.length>1){let n=1,i=t[0];for(let s=1;s=180||f[1]>=180||f[2]>=180){const g=Math.max(...f)/180,m=new mt(...c,i),p=new mt(...h,i),b=new pt().setFromEuler(m),x=new pt().setFromEuler(p);b.dot(x)&&x.set(-x.x,-x.y,-x.z,-x.w);const M=e.times[o-1],L=e.times[o]-M,E=new pt,A=new mt;for(let D=0;D<1;D+=1/g)E.copy(b.clone().slerp(x.clone(),D)),s.push(M+D*L),A.setFromQuaternion(E,i),a.push(A.x),a.push(A.y),a.push(A.z)}else s.push(e.times[o]),a.push(It.degToRad(e.values[o])),a.push(It.degToRad(t.values[o])),a.push(It.degToRad(n.values[o]))}return[s,a]}}class dx{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new ph,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(i,s){const a=i.match(/^[\s\t]*;/),o=i.match(/^[\s\t]*$/);if(a||o)return;const l=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=i.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(i,l):c?t.parseNodeProperty(i,c,n[++s]):u?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},a=this.parseNodeAttr(i),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in o?(n==="PoseNode"?o.PoseNode.push(s):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==""&&(o[n][a.id]=s)):typeof a.id=="number"?(o[n]={},o[n][a.id]=s):n!=="Properties70"&&(n==="PoseNode"?o[n]=[s]:o[n]=s),typeof a.id=="number"&&(s.id=a.id),a.name!==""&&(s.attrName=a.name),a.type!==""&&(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),u=parseInt(l[1]);let h=s.split(",").slice(3);h=h.map(function(d){return d.trim().replace(/^"/,"")}),i="connections",s=[c,u],xx(s,h),a[i]===void 0&&(a[i]=[])}i==="Node"&&(a.id=s),i in a&&Array.isArray(a[i])?a[i].push(s):i!=="a"?a[i]=s:a.a=s,this.setCurrentProp(a,i),i==="a"&&s.slice(-1)!==","&&(a.a=Ra(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Ra(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],a=i[1],o=i[2],l=i[3];let c=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=Ra(c);break}this.getPrevNode()[s]={type:a,type2:o,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class fx{parse(e){const t=new _c(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new ph;for(;!this.endOfContent(t);){const s=this.parseNode(t,n);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),o=e.getString(a);if(i===0)return null;const l=[];for(let d=0;d0?l[0]:"",u=l.length>1?l[1]:"",h=l.length>2?l[2]:"";for(n.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(o,n,d)}return n.propertyList=l,typeof c=="number"&&(n.id=c),u!==""&&(n.attrName=u),h!==""&&(n.attrType=h),o!==""&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if(e==="Connections"&&n.name==="C"){const i=[];n.propertyList.forEach(function(s,a){a!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&&n.name==="P"){let i=n.propertyList[0],s=n.propertyList[1];const a=n.propertyList[2],o=n.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:l=n.propertyList[4],t[i]={type:s,type2:a,flag:o,value:l}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const o=J0(new Uint8Array(e.getArrayBuffer(a))),l=new _c(o.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class _c{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(n)}}class ph{add(e,t){this[e]=t}}function px(r){const e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===gh(r,0,e.length)}function mx(r){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(i){const s=r[i-1];return r=r.slice(t+i),t++,s}for(let i=0;i{t.scale.setScalar(this._normalScale),t.traverse(s=>{s.castShadow=!0}),t.position.set(0,0,190),t.rotation.y=0,this._target=t,this._params.scene.add(this._target),this._mixer=new ko(this._target),this._manager=new Do,this._manager.onLoad=()=>{this._stateMachine.SetState("idle")};const n=(s,a)=>{const o=a.animations[0],l=this._mixer.clipAction(o);this._animations[s]={clip:o,action:l}},i=new Er(this._manager);i.setPath("./models/knight/"),i.load("walk.fbx",s=>{n("walk",s)}),i.load("run.fbx",s=>{n("run",s)}),i.load("idle.fbx",s=>{n("idle",s)}),i.load("attack_1.fbx",s=>{n("attack_1",s)}),i.load("attack_2.fbx",s=>{n("attack_2",s)}),i.load("death.fbx",s=>{n("death",s)})})}_PlayerMovementHandler(e){const t=this._velocity,n=new T(t.x*this._decceleration.x,t.y*this._decceleration.y,t.z*this._decceleration.z);n.multiplyScalar(e),n.z=Math.sign(n.z)*Math.min(Math.abs(n.z),Math.abs(t.z)),t.add(n);const i=this._target,s=new pt,a=new T,o=i.quaternion.clone(),l=this._acceleration.clone();this._input._keys.shift&&l.multiplyScalar(3),this._input._keys.forward&&(t.z+=l.z*e),this._input._keys.backward&&(t.z-=l.z*e),this._input._keys.left&&(a.set(0,1,0),s.setFromAxisAngle(a,4*Math.PI*e*this._acceleration.y),o.multiply(s)),this._input._keys.right&&(a.set(0,1,0),s.setFromAxisAngle(a,4*-Math.PI*e*this._acceleration.y),o.multiply(s)),i.quaternion.copy(o);const c=new T;c.copy(i.position);const u=new T(0,0,1);u.applyQuaternion(i.quaternion),u.normalize(),u.multiplyScalar(t.z*e),i.position.add(u);const h=new T(1,0,0);h.applyQuaternion(i.quaternion),h.normalize(),h.multiplyScalar(t.x*e),i.position.add(h),this._worldBoundingBoxes.map(d=>{new bt().setFromObject(d).containsPoint(i.position)&&i.position.copy(c)}),this._position.copy(i.position),this._previousPosition.copy(c)}_HitHandler(){if(this._hitFlag){const e=Math.random()<.5?-1:1;this._target.rotation.y+=Math.PI/40*e;const t=this._target.position.z-this._hitDirection.z*this._hitIntensity;let n=!0;for(const i of this._params.world.boundingBoxes)if(new bt().setFromObject(i).containsPoint(new T(this._target.position.x,this._target.position.y,t))){n=!1;break}n&&(this._target.position.z=t),this._hitTime=Date.now()}}_TransformationHandler(){if(this._normalDamage=this._params.powerBar.swords.length,this._bigDamage=this._params.powerBar.swords.length*2,this._params.starCounter.stars>=this._starsToGetBigger&&!this._transformed){if(this._transformed=!0,this._timeTransformed=Date.now(),this._params.starCounter.stars=0,this._target.scale.setScalar(this._bigScale),this._damage=this._bigDamage,this._attackRange=this._bigAttackRange,this._params.healthBar.hearts.length<10){const e=this._params.healthBar.hearts.length;for(let t=0;t<10-e;t++)this._params.healthBar.addHeart()}this._particleSpawner.create({x:this._position.x-10,y:this._position.y,z:this._position.z-10,width:15,height:30,depth:15},300)}if(this._transformed&&Date.now()-this._timeTransformed>this._transformationTime&&(this._transformed=!1,this._timeTransformed=0,this._target.scale.setScalar(this._normalScale),this._damage=this._normalDamage,this._attackRange=this._normalAttackRange,this._params.powerBar.swords.length>1))for(let e=0;ethis._onKeyDown(e),!1),document.addEventListener("keyup",e=>this._onKeyUp(e),!1)}_onKeyDown(e){switch(e.keyCode){case 87:this._keys.forward=!0;break;case 65:this._keys.left=!0;break;case 83:this._keys.backward=!0;break;case 68:this._keys.right=!0;break;case 32:this._keys.space=!0;break;case 16:this._keys.shift=!0;break;case 17:this._keys.ctrl=!0;break}}_onKeyUp(e){switch(e.keyCode){case 87:this._keys.forward=!1;break;case 65:this._keys.left=!1;break;case 83:this._keys.backward=!1;break;case 68:this._keys.right=!1;break;case 32:this._keys.space=!1;break;case 16:this._keys.shift=!1;break;case 17:this._keys.ctrl=!1;break}}}let Sx=class{constructor(){this._states={},this._currentState=null}_AddState(e,t){this._states[e]=t}SetState(e){const t=this._currentState;if(t){if(t.Name==e)return;t.Exit()}const n=new this._states[e](this);this._currentState=n,n.Enter(t)}Update(e,t){this._currentState&&this._currentState.Update(e,t)}},bx=class extends Sx{constructor(e){super(),this._animations=e,this._playerLife=10,this._Init()}_Init(){this._AddState("idle",wx),this._AddState("walk",Tx),this._AddState("run",Ex),this._AddState("attack_1",Ax),this._AddState("attack_2",Rx),this._AddState("death",Cx)}get playerLife(){return this._playerLife}set playerLife(e){this._playerLife=e}},Ji=class{constructor(e){this._parent=e}Enter(){}Exit(){}Update(){}},wx=class extends Ji{constructor(e){super(e)}get Name(){return"idle"}Enter(e){const t=this._parent._animations.idle.action;if(e){const n=this._parent._animations[e.Name].action;t.time=0,t.enabled=!0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1),t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e,t){if(this._parent.playerLife<=0)this._parent.SetState("death");else if(t._keys.forward||t._keys.backward)this._parent.SetState("walk");else if(t._keys.space){const n=Math.random()<.5?"attack_1":"attack_2";this._parent.SetState(n)}}},Tx=class extends Ji{constructor(e){super(e)}get Name(){return"walk"}Enter(e){const t=this._parent._animations.walk.action;if(e){const n=this._parent._animations[e.Name].action;if(t.enabled=!0,e.Name=="run"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e,t){if(this._parent.playerLife<=0)this._parent.SetState("death");else if(t._keys.forward||t._keys.backward){t._keys.shift&&this._parent.SetState("run");return}else this._parent.SetState("idle")}};class Ex extends Ji{constructor(e){super(e)}get Name(){return"run"}Enter(e){const t=this._parent._animations.run.action;if(e){const n=this._parent._animations[e.Name].action;if(t.enabled=!0,e.Name=="walk"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e,t){if(this._parent.playerLife<=0)this._parent.SetState("death");else if(t._keys.forward||t._keys.backward){t._keys.shift||this._parent.SetState("walk");return}else this._parent.SetState("idle")}}class Ax extends Ji{constructor(e){super(e)}get Name(){return"attack_1"}Enter(e){const t=this._parent._animations.attack_1.action;if(e){const n=this._parent._animations[e.Name].action;t.enabled=!0,t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1),t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e,t){this._parent.playerLife<=0?this._parent.SetState("death"):t._keys.space?this._parent.SetState("attack_1"):this._parent.SetState("idle")}}class Rx extends Ji{constructor(e){super(e)}get Name(){return"attack_2"}Enter(e){const t=this._parent._animations.attack_2.action;if(e){const n=this._parent._animations[e.Name].action;t.enabled=!0,t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1),t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e,t){this._parent.playerLife<=0?this._parent.SetState("death"):t._keys.space?this._parent.SetState("attack_2"):this._parent.SetState("idle")}}let Cx=class extends Ji{constructor(e){super(e)}get Name(){return"death"}Enter(e){const t=this._parent._animations.death.action;if(e){const n=this._parent._animations[e.Name].action;t.enabled=!0,t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1),t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e,t){this._parent.SetState("death")}};class Px{constructor(e){this._params=e,this._camera=e.camera,this._currentPosition=new T,this._currentLookat=new T}_CalculateIdealOffset(){const e=new T(-5,20,-30);return e.applyQuaternion(this._params.target.rotation),e.add(this._params.target.position),e}_CalculateIdealLookat(){const e=new T(0,10,50);return e.applyQuaternion(this._params.target.rotation),e.add(this._params.target.position),e}Update(e){const t=this._CalculateIdealOffset(),n=this._CalculateIdealLookat(),i=1-Math.pow(.001,e);this._currentPosition.lerp(t,i),this._currentLookat.lerp(n,i),this._camera.position.copy(this._currentPosition),this._camera.lookAt(this._currentLookat)}}class Lx{constructor(e){this._params=e,this._stars=[],this._lastSpawnTime=0,this._spawnInterval=12,this._maxstars=5,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t)}_LoadModels(){const e=new Yi;this._lastSpawnTime=Date.now(),e.load("./models/scene_objects/star.glb",t=>{t.scene.traverse(c=>{c.castShadow=!0});const n=t.scene;n.scale.set(3,3,3);let i=new T,s=!1;const a=new ze(230,50,150),o=new Le({color:65280,wireframe:!0,visible:!1}),l=new ye(a,o);for(l.position.set(0,25,-130),this._params.scene.add(l),this._worldBoundingBoxes.push(l);!s;){i.x=Math.random()*200-100,i.y=1,i.z=Math.random()*200-100,s=!0;for(const c of this._worldBoundingBoxes)if(new bt().setFromObject(c).containsPoint(i)){s=!1;break}}n.position.set(i.x,i.y,i.z),this._params.scene.add(n),this._stars.push(n)})}Update(e){Date.now()-this._lastSpawnTime>this._spawnInterval*1e3&&this._stars.length{t.rotation.y+=1*e})}get stars(){return this._stars}set stars(e){this._stars=e}}class Ix{constructor(e){this._params=e,this._hearts=[],this._lastSpawnTime=0,this._spawnInterval=18,this._maxHearts=5,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t)}_LoadModels(){const e=new Yi;this._lastSpawnTime=Date.now(),e.load("./models/scene_objects/heart.glb",t=>{t.scene.traverse(c=>{c.castShadow=!0});const n=t.scene;n.scale.set(5,5,5);let i=new T,s=!1;const a=new ze(230,50,150),o=new Le({color:65280,wireframe:!0,visible:!1}),l=new ye(a,o);for(l.position.set(0,25,-130),this._params.scene.add(l),this._worldBoundingBoxes.push(l);!s;){i.x=Math.random()*200-100,i.y=4,i.z=Math.random()*200-100,s=!0;for(const c of this._worldBoundingBoxes)if(new bt().setFromObject(c).containsPoint(i)){s=!1;break}}n.position.set(i.x,i.y,i.z),this._params.scene.add(n),this._hearts.push(n)})}Update(e){Date.now()-this._lastSpawnTime>this._spawnInterval*1e3&&this._hearts.length{t.rotation.y+=1*e})}get hearts(){return this._hearts}set hearts(e){this._hearts=e}}class Dx{constructor(e){this._params=e,this._swords=[],this._lastSpawnTime=0,this._spawnInterval=20,this._maxSwords=5,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t)}_LoadModels(){const e=new Yi;this._lastSpawnTime=Date.now(),e.load("./models/scene_objects/sword.glb",t=>{t.scene.traverse(c=>{c.castShadow=!0});const n=t.scene;n.scale.set(20,20,20);let i=new T,s=!1;const a=new ze(230,50,150),o=new Le({color:65280,wireframe:!0,visible:!1}),l=new ye(a,o);for(l.position.set(0,25,-130),this._params.scene.add(l),this._worldBoundingBoxes.push(l);!s;){i.x=Math.random()*200-100,i.y=4,i.z=Math.random()*200-100,s=!0;for(const c of this._worldBoundingBoxes)if(new bt().setFromObject(c).containsPoint(i)){s=!1;break}}n.position.set(i.x,i.y,i.z),n.rotation.x=Math.PI/4,this._params.scene.add(n),this._swords.push(n)})}Update(e){Date.now()-this._lastSpawnTime>this._spawnInterval*1e3&&this._swords.length{t.rotation.z+=1*e})}get swords(){return this._swords}set swords(e){this._swords=e}}class Ux{constructor(e){this._params=e,this._mobs=[],this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t);this._playerPosition=this._params.playerPosition,this._mobAttackDistance=6,this._mobAttackTime=this._params.mobAttackTime,this._lastSpawnTime=0,this._minNumberOfMobs=12,this._LoadModels()}get mobs(){return this._mobs}get mobAttackDistance(){return this._mobAttackDistance}get mobAttackTime(){return this._mobAttackTime}_LoadModels(){const e=new Yi;this._mobPositions=[],this._mobPositions.push(new T(0,1,-20)),this._mobPositions.push(new T(0,1,110)),this._mobPositions.push(new T(-50,1,30)),this._mobPositions.push(new T(50,1,30)),this._mobPositions.push(new T(80,1,130)),this._mobPositions.push(new T(-80,1,130)),this._mobPositions.push(new T(-150,1,100)),this._mobPositions.push(new T(150,1,100)),this._mobPositions.push(new T(-110,1,50)),this._mobPositions.push(new T(110,1,50)),this._mobPositions.push(new T(-120,1,0)),this._mobPositions.push(new T(120,1,0));const t=this._mobPositions.length;for(let c=0;c{i.scene.traverse(h=>{h.castShadow=!0});const s=i.scene;s.scale.set(4,4,4),s.position.set(t.x,t.y,t.z),this._params.scene.add(s),n.mob=s,n.position=s.position,n.rotation=s.rotation,n.velocity=new T(0,0,1);const a=new ko(s),o=a.clipAction(i.animations[6]),l=a.clipAction(i.animations[5]),c=a.clipAction(i.animations[0]),u=a.clipAction(i.animations[1]);o.play(),n.walk=o,n.run=l,n.attack=c,n.dead=u,n.currentAction=o,n.mixer=a,this._walkY=s.position.y-1,this._runY=s.position.y-1.2,this._mobs.push(n)})}update(e){if(Date.now()-this._lastSpawnTime>1e4&&this._mobs.lengthn.mixer))t.update(e);for(const t of this._mobs){const n=this._playerPosition.distanceTo(t.position);let i=!1;for(const s of this._worldBoundingBoxes)if(new bt().setFromObject(s).containsPoint(this._playerPosition)){i=!0;break}t.currentAction!==t.dead&&(n<40&&!i?this.moveMobTowardsPlayer(t):this.moveMobRandomly(t)),t.life<=0&&this.dead(t)}}moveMobTowardsPlayer(e){const t=e.position,n=e.velocity,i=this._playerPosition.distanceTo(t);let s=!1;for(const a of this._worldBoundingBoxes)if(new bt().setFromObject(a).containsPoint(t)){s=!0;break}if(i5e3&&(n.set(Math.random()<.5?1:-1*Math.random(),0,Math.random()<.5?1:-1*Math.random()).normalize().multiplyScalar(.05+Math.random()*.1),e.time=s);for(const l of this._worldBoundingBoxes)new bt().setFromObject(l).containsPoint(t)&&(n.set(-n.x,0,-n.z).normalize().multiplyScalar(.05+Math.random()*.1),e.time=s);t.add(n),t.y=this._walkY;const o=Math.atan2(n.x,n.z);e.mob.rotation.y=o}dead(e){e.deadFlag?new Date().getTime()-e.deadTime>1e4?(this._params.scene.remove(e.mob),this._mobs=this._mobs.filter(t=>t!==e)):e.currentAction.time>e.currentAction.getClip().duration-.1&&(e.currentAction.paused=!0):(e.currentAction.stop(),e.currentAction=e.dead,e.currentAction.play(),e.deadFlag=!0,e.deadTime=new Date().getTime())}}class Nx{constructor(e){this._params=e,this._animations={},this._velocity=new T,this._position=new T,this._previousPosition=new T,this._worldBoundingBoxes=[];for(const t of this._params.world.boundingBoxes)this._worldBoundingBoxes.push(t);this._playerPosition=this._params.playerPosition,this._monsterAttackRange={min:15,max:20},this._monsterAttackTime=this._params.monsterAttackTime,this._LoadModel(),this._timeLastWalk=0,this._timeLastIdle=0,this._timeLastAttack=0,this._timeLastRoar=0,this._monsterLife=100,this._monsterDamage=2,this._monsterLastHit=0,this._monsterState="roar",this._stateMachine=new Ox(this._animations,this.monsterAttackRange)}get monsterAttackRange(){return this._monsterAttackRange}get monsterAttackTime(){return this._monsterAttackTime}get monsterDamage(){return this._monsterDamage}set monsterDamage(e){this._monsterDamage=e}get monsterLife(){return this._monsterLife}set monsterLife(e){this._monsterLife=e}get monsterLastHit(){return this._monsterLastHit}set monsterLastHit(e){this._monsterLastHit=e}get monsterPosition(){return this._position}get monsterState(){return this._monsterState}_LoadModel(){const e=new Er;e.setPath("./models/monster/"),e.load("monster.fbx",o=>{o.scale.setScalar(.06),o.traverse(d=>{d.castShadow=!0}),o.position.set(0,0,-140),o.rotation.y=0,o.scale.set(.13,.13,.13);const c=new Ms().load("./models/monster/monster_texture.png");o.traverse(d=>{d.isMesh&&(d.material.map=c)}),this._target=o,this._params.scene.add(this._target),this._position=this._target.position,this._previousPosition=this._target.position,this._rotation=this._target.rotation,this._velocity=new T(0,0,0),this._mixer=new ko(this._target),this._manager=new Do,this._manager.onLoad=()=>{this._stateMachine.SetState("idle")};const u=(d,f)=>{const _=f.animations[0],g=this._mixer.clipAction(_);this._animations[d]={clip:_,action:g}},h=new Er(this._manager);h.setPath("./models/monster/"),h.load("walk.fbx",d=>{u("walk",d)}),h.load("idle.fbx",d=>{u("idle",d)}),h.load("roar.fbx",d=>{u("roar",d)}),h.load("attack.fbx",d=>{u("attack",d)}),h.load("death.fbx",d=>{u("death",d)})});const t=new ze(30,50,10),n=new Le({color:65280,wireframe:!0,visible:!1}),i=new ye(t,n);i.position.set(0,25,-70),this._params.scene.add(i),this._worldBoundingBoxes.push(i);const s=new ze(201,50,100),a=new Le({color:65280,wireframe:!0,visible:!1});this._insideTowers=new ye(s,a),this._insideTowers.position.set(1,25,-145),this._params.scene.add(this._insideTowers)}update(e){if(!this._stateMachine._currentState)return;const t=new bt().setFromObject(this._insideTowers);this._stateMachine.attackPlayer=t.containsPoint(this._playerPosition),this._stateMachine.playerDistance=this._playerPosition.distanceTo(this._position),this._stateMachine.monsterLife=this._monsterLife,this._stateMachine._currentState.Update(e),this._stateMachine._currentState.Name!="death"&&(t.containsPoint(this._playerPosition)?this.attackPlayer():this.moveMonsterRandomly(e)),this._mixer&&this._mixer.update(e)}moveMonsterRandomly(e){if(this._stateMachine._currentState.Name==="idle"&&Date.now()-this._timeLastIdle>5e3&&this._velocity.set(Math.random()<.5?1:-1*Math.random(),0,Math.random()<.5?1:-1*Math.random()).normalize().multiplyScalar(.6),this._stateMachine._currentState.Name==="walk"){for(const n of this._worldBoundingBoxes)if(new bt().setFromObject(n).containsPoint(this._position)){this._velocity.set(-this._velocity.x,0,-this._velocity.z).normalize().multiplyScalar(.6),this._position=this._previousPosition;break}this._position.add(this._velocity);const t=Math.atan2(this._velocity.x,this._velocity.z);this._rotation.y=t}}attackPlayer(){const e=this._playerPosition.distanceTo(this._position);if(ethis._monsterAttackRange.max){this._velocity.copy(this._playerPosition).sub(this._position).normalize().multiplyScalar(.6),this._position.add(this._velocity);const t=Math.atan2(this._playerPosition.x-this._position.x,this._playerPosition.z-this._position.z);this._rotation.y=t}else{const t=Math.atan2(this._playerPosition.x-this._position.x,this._playerPosition.z-this._position.z);this._rotation.y=t}}}class Fx{constructor(){this._states={},this._currentState=null}_AddState(e,t){this._states[e]=t}SetState(e){const t=this._currentState;if(t){if(t.Name==e)return;t.Exit()}const n=new this._states[e](this);this._currentState=n,n.Enter(t)}Update(e){this._currentState&&this._currentState.Update(e)}}class Ox extends Fx{constructor(e,t){super(),this._animations=e,this._monsterAttackRange=t,this._attackPlayer=!1,this._playerDistance=1e5,this._monsterLife=100,this._timeLastIdle=0,this._timeLastWalk=0,this._timeLastAttack=0,this._timeLastRoar=0,this._Init()}_Init(){this._AddState("idle",Bx),this._AddState("walk",kx),this._AddState("roar",zx),this._AddState("attack",Hx),this._AddState("death",Vx)}get attackPlayer(){return this._attackPlayer}set attackPlayer(e){this._attackPlayer=e}get playerDistance(){return this._playerDistance}set playerDistance(e){this._playerDistance=e}get monsterLife(){return this._monsterLife}set monsterLife(e){this._monsterLife=e}}class Es{constructor(e){this._parent=e}Enter(){}Exit(){}Update(){}}class Bx extends Es{constructor(e){super(e)}get Name(){return"idle"}Enter(e){const t=this._parent._animations.idle.action;if(e){const n=this._parent._animations[e.Name].action;t.time=0,t.enabled=!0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1),t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){this._parent._monsterLife<=0?(this._parent.SetState("death"),this._parent._monsterState="death"):this._parent._attackPlayer?this._parent._playerDistancethis._parent._monsterAttackRange.max?(this._parent._timeLastWalk=Date.now(),this._parent.SetState("walk"),this._parent._monsterState="walk"):(this._parent._timeLastAttack=Date.now(),this._parent.SetState("attack"),this._parent._monsterState="attack"):Date.now()-this._parent._timeLastIdle>5e3?(this._parent._timeLastWalk=Date.now(),this._parent.SetState("walk"),this._parent._monsterState="walk"):(this._parent.SetState("idle"),this._parent._monsterState="idle")}}class kx extends Es{constructor(e){super(e)}get Name(){return"walk"}Enter(e){const t=this._parent._animations.walk.action;if(e){const n=this._parent._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){this._parent._monsterLife<=0?(this._parent.SetState("death"),this._parent._monsterState="death"):this._parent._attackPlayer?this._parent._playerDistancethis._parent._monsterAttackRange.max?(this._parent._timeLastWalk=Date.now(),this._parent.SetState("walk"),this._parent._monsterState="walk"):(this._parent._timeLastAttack=Date.now(),this._parent.SetState("attack"),this._parent._monsterState="attack"):Date.now()-this._parent._timeLastWalk>5e3?(this._parent._timeLastIdle=Date.now(),this._parent.SetState("idle"),this._parent._monsterState="idle"):(this._parent.SetState("walk"),this._parent._monsterState="walk")}}class zx extends Es{constructor(e){super(e)}get Name(){return"roar"}Enter(e){const t=this._parent._animations.roar.action;if(e){const n=this._parent._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){this._parent._monsterLife<=0?(this._parent.SetState("death"),this._parent._monsterState="death"):this._parent._attackPlayer?Date.now()-this._parent._timeLastRoar>2500?this._parent._playerDistancethis._parent._monsterAttackRange.max?(this._parent._timeLastWalk=Date.now(),this._parent.SetState("walk"),this._parent._monsterState="walk"):(this._parent._timeLastAttack=Date.now(),this._parent.SetState("attack"),this._parent._monsterState="attack"):(this._parent.SetState("roar"),this._parent._monsterState="roar"):(this._parent._timeLastIdle=Date.now(),this._parent.SetState("idle"),this._parent._monsterState="idle")}}class Hx extends Es{constructor(e){super(e)}get Name(){return"attack"}Enter(e){const t=this._parent._animations.attack.action;if(e){const n=this._parent._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){this._parent._monsterLife<=0?(this._parent.SetState("death"),this._parent._monsterState="death"):this._parent._attackPlayer?Date.now()-this._parent._timeLastAttack>2500?(this._parent._timeLastRoar=Date.now(),this._parent.SetState("roar"),this._parent._monsterState="roar"):this._parent._playerDistancethis._parent._monsterAttackRange.max?(this._parent._timeLastWalk=Date.now(),this._parent.SetState("walk"),this._parent._monsterState="walk"):(this._parent.SetState("attack"),this._parent._monsterState="attack"):(this._parent._timeLastIdle=Date.now(),this._parent.SetState("idle"),this._parent._monsterState="idle")}}class Vx extends Es{constructor(e){super(e)}get Name(){return"death"}Enter(e){const t=this._parent._animations.death.action;if(e){const n=this._parent._animations[e.Name].action;if(t.enabled=!0,e.Name=="idle"){const i=t.getClip().duration/n.getClip().duration;t.time=n.time*i}else t.time=0,t.setEffectiveTimeScale(1),t.setEffectiveWeight(1);t.crossFadeFrom(n,.5,!0),t.play()}else t.play()}Exit(){}Update(e){this._parent._monsterLife<=0&&(this._parent.SetState("death"),this._parent._monsterState="death")}}class Gx{constructor(){this._Initialize()}_Initialize(){this._threejs=new q_({antialias:!0}),this._threejs.outputEncoding=void 0,this._threejs.shadowMap.enabled=!0,this._threejs.shadowMap.type=vc,this._threejs.setPixelRatio(window.devicePixelRatio),this._threejs.setSize(window.innerWidth,window.innerHeight),document.body.appendChild(this._threejs.domElement),window.addEventListener("resize",()=>{this._OnWindowResize()},!1);const e=60,t=1920/1080,n=1,i=1e3;this._camera=new Dt(e,t,n,i),this._camera.position.set(150,200,300),this._camera.lookAt(new T(-44,0,-100)),this._scene=new Y_,this._mixers=[],this._previousRAF=null,this._currentCollectedStars=0,this._currentHitFromMobs=0,this._currentHitFromMonster=0,this._lastAttackTime=0,this._gameOver=!1,this._gameOverTime=0,this._gameWin=!1,this._gameWinTime=0,this._blockGame=!1,this._blockGui=!1,this._difficulty="medium",this._mobAttackTime={easy:1e3,medium:500,hard:300},this._mobHitsToDamage={easy:4,medium:3,hard:2},this._monsterAttackTime={easy:1100,medium:600,hard:400},this._monsterHitsToDamage={easy:2,medium:1,hard:1},this._monsterDamageNormal={easy:2,medium:2,hard:3},this._monsterDamageTransformed={easy:1,medium:1,hard:2},this._bloodSpawnerParams={scene:this._scene,colors:[9052185,8850949,6032904],radius:{baseRadius:.1,randomRadius:.1},opacity:{baseOpacity:1,randomOpacity:0},transparency:!1,velocity:{baseVelocity:new T(-.05,-.15,-.05),randomVelocity:new T(.5,.8,.5),baseSign:new T(1,-1,1),randomSign:new T(!0,!1,!0),update:!1},expirationTime:{baseExpirationTime:5e3,randomExpirationTime:2e3},boxX:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!0},boxY:{baseMin:.1,baseMax:100,randomMin:0,randomMax:0,blockAll:!0,visible:!0},boxZ:{baseMin:-100,baseMax:100,randomMin:0,randomMax:0,blockAll:!1,visible:!0}},this._bloodSpawner=new zo(this._bloodSpawnerParams),this._LoadWorld(),this._LoadGUI(),this._LoadStars(),this._LoadHearts(),this._LoadSwords(),this._LoadPlayer(),this._LoadMobs(),this._LoadMonster(),this._RAF()}_LoadWorld(){this._world=new C0({scene:this._scene})}_LoadGUI(){this._gui=new B0({player:this._player})}_LoadPlayer(){const e={camera:this._camera,scene:this._scene,world:this._world,healthBar:this._gui._healthBar,powerBar:this._gui._powerBar,starCounter:this._gui._starCounter};this._player=new yx(e),this._thirdPersonCamera=new Px({camera:this._camera,target:this._player})}_LoadStars(){this._starsSpawner=new Lx({scene:this._scene,world:this._world})}_LoadHearts(){this._heartSpawner=new Ix({scene:this._scene,world:this._world})}_LoadSwords(){this._swordSpawner=new Dx({scene:this._scene,world:this._world})}_LoadMobs(){this._mobSpawner=new Ux({scene:this._scene,world:this._world,playerPosition:this._player.position,mobAttackTime:this._mobAttackTime[this._difficulty]})}_LoadMonster(){this._monsterSpawner=new Nx({scene:this._scene,world:this._world,playerPosition:this._player.position,monsterAttackTime:this._monsterAttackTime[this._difficulty]})}_OnWindowResize(){this._camera.aspect=window.innerWidth/window.innerHeight,this._camera.updateProjectionMatrix(),this._threejs.setSize(window.innerWidth,window.innerHeight)}_RAF(){requestAnimationFrame(e=>{this._previousRAF===null&&(this._previousRAF=e),this._RAF(),this._threejs.render(this._scene,this._camera),this._Step(e-this._previousRAF),this._previousRAF=e})}_Update(e){this._mixers&&!this._blockGame&&this._mixers.map(t=>t.update(e)),this._player&&!this._blockGame&&this._player.Update(e),this._starsSpawner&&!this._blockGame&&this._starsSpawner.Update(e),this._heartSpawner&&!this._blockGame&&this._heartSpawner.Update(e),this._swordSpawner&&!this._blockGame&&this._swordSpawner.Update(e),this._mobSpawner&&!this._blockGame&&this._mobSpawner.update(e),this._monsterSpawner&&!this._blockGame&&this._monsterSpawner.update(e),this._bloodSpawner&&!this._blockGame&&this._bloodSpawner.update(),this._world&&!this._blockGame&&this._world.update(e),this._gui&&!this._blockGui&&(this._gui.start.play?(this._blockGame&&(this._player.rotation=new pt(0,1,0,0)),this._blockGame=!1,this._gui.healthBar.show(),this._gui.powerBar.show(),this._gui.starCounter.show(),this._gui.monsterLifeBar.show(),this._gui.transformationTime.show()):this._blockGame=!0,this._gui.monsterLifeBar.update(),this._gui.transformationTime.update(this._player.transformed),this._gui.start.update(),this._difficulty=this._gui.start._difficulty,this._gui._monsterLifeBar.monsterLife=this._monsterSpawner.monsterLife,this._player.transformed?this._gui._transformationTime.time=Math.ceil((this._gui._transformationTime.time=this._player.transformationTime-(Date.now()-this._player.timeTransformed))/1e3):this._gui._transformationTime.time=Math.ceil(this._player.transformationTime/1e3)),this._blockGame||this._thirdPersonCamera.Update(e)}_GameOverWinHandler(){this._gui._healthBar.hearts.length===0&&!this._gameOver&&(this._gameOver=!0,this._gameOverTime=new Date().getTime(),this._gui._gameOver.show()),this._monsterSpawner.monsterState==="death"&&!this._gameWin&&(this._gameWin=!0,this._gameWinTime=new Date().getTime(),this._gui._gameWin.show()),(this._gameOver&&Date.now()-this._gameOverTime>2e3||this._gameWin&&Date.now()-this._gameWinTime>2e3)&&(this._blockGame=!0,this._blockGui=!0)}_CollectorHandler(){this._player.transformed||(this._stars=this._starsSpawner.stars,this._playerPosition=this._player.position,this._stars.map(e=>{e.position.distanceTo(this._playerPosition)<8&&(this._scene.remove(e),this._stars=this._stars.filter(t=>t!==e),this._starsSpawner.stars=this._stars,this._gui._starCounter.addStar())})),this._hearts=this._heartSpawner.hearts,this._playerPosition=this._player.position,this._hearts.map(e=>{e.position.distanceTo(this._playerPosition)<8&&(this._scene.remove(e),this._hearts=this._hearts.filter(t=>t!==e),this._heartSpawner.hearts=this._hearts,this._gui._healthBar.addHeart())}),this._swords=this._swordSpawner.swords,this._playerPosition=this._player.position,this._swords.map(e=>{e.position.distanceTo(this._playerPosition)<8&&(this._scene.remove(e),this._swords=this._swords.filter(t=>t!==e),this._swordSpawner.swords=this._swords,this._gui._powerBar.addSword())})}_MobAttackHandler(){this._mobs=this._mobSpawner.mobs,this._mobAttackDistance=this._mobSpawner.mobAttackDistance,this._mobAttackTime=this._mobSpawner.mobAttackTime,this._player.hitFlag=!1;for(const t of this._mobs)this._playerPosition.distanceTo(t.position)this._mobAttackTime&&!t.deadFlag&&(t.lastHit=new Date().getTime(),this._player.hitFlag=!0,this._player.hitDirection=t.position.clone().sub(this._playerPosition).normalize(),this._player.transformed?this._player.hitIntensity=.3:this._player.hitIntensity=1,this._currentHitFromMobs+=1);this._currentHitFromMobs===this._mobHitsToDamage[this._difficulty]&&(this._gui._healthBar.removeHeart(),this._currentHitFromMobs=0,this._bloodSpawner.create({x:this._player.position.x,y:this._player.position.y,z:this._player.position.z,width:5,height:5,depth:5},30));const e=this._player.damage;if(this._player._stateMachine._currentState&&(this._player._stateMachine._currentState.Name==="attack_1"||this._player._stateMachine._currentState.Name==="attack_2")&&Date.now()-this._lastAttackTime>1e3)for(const t of this._mobs){const n=this._playerPosition.distanceTo(t.position),i=this._player.rotation.y,s=Math.atan2(t.position.z-this._playerPosition.z,t.position.x-this._playerPosition.x),o=Math.abs(i-s)this._monsterAttackRange.min&&ethis._monsterAttackTime&&this._monsterSpawner._stateMachine._currentState.Name==="attack"&&(this._monsterSpawner.monsterLastHit=new Date().getTime(),this._currentHitFromMonster+=1,this._player.hitFlag=!0,this._player.hitDirection=this._monsterSpawner.monsterPosition.clone().sub(this._playerPosition).normalize(),this._player.transformed?this._player.hitIntensity=1:this._player.hitIntensity=3),this._currentHitFromMonster===this._monsterHitsToDamage[this._difficulty]){for(let t=0;t1e3&&e{new Gx}); diff --git a/index.html b/index.html index f44eefc..024d0b6 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ Kill the Monster - + diff --git a/models/monster/attack_1.fbx b/models/monster/attack.fbx similarity index 100% rename from models/monster/attack_1.fbx rename to models/monster/attack.fbx diff --git a/models/monster/attack_2.fbx b/models/monster/attack_2.fbx deleted file mode 100644 index 0cbba9f9f5d3b00324d54203798571ea24641a04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 226848 zcmeEv2UHWy_ckgbs3@W+VgpgIBBH3MkeNwDP*4OLSSdk}Dn+qlM?^*J9ecqpDn-cd z+OUhgi`YB%uHO#317r;`Z{YVG&-t_Gz)i9<_ujepnP+BaH<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