From 392847a6cb52f91ad6e75833238301e1dba6008e Mon Sep 17 00:00:00 2001 From: shan <47271333+shanimal08@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:05:40 +0200 Subject: [PATCH 1/5] fix(ui): add animation build sans long block animation (#1071) animation build without the error block holding things up thx to @mmrrnn for finding the issue in glApp the issue was the error (looong block) block lifecycle messing with the animation state manager moving on, so we just removed the 'errorBlock' logic for now - if you get to 20 of the blue blocks that's when an error block would've come up and messed everything up, so if you try stop mining now after 20 blue blocks it should actually stop --- public/assets/glApp.js | 26 +++++++++++----------- src-tauri/Cargo.toml | 50 +++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/public/assets/glApp.js b/public/assets/glApp.js index 217864c4b..d6ea45b12 100644 --- a/public/assets/glApp.js +++ b/public/assets/glApp.js @@ -2,11 +2,11 @@ var Gl=Object.defineProperty;var Vl=(i,e,t)=>e in i?Gl(i,e,{enumerable:!0,config * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const ya="169",ei={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ti={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Wl=0,qa=1,Xl=2,Ta=1,Yl=2,fn=3,In=0,Ft=1,_n=2,Dn=0,Si=1,Za=2,Ka=3,ja=4,ql=5,Xn=100,Zl=101,Kl=102,jl=103,$l=104,Jl=200,Ql=201,ec=202,tc=203,Os=204,Bs=205,nc=206,ic=207,rc=208,sc=209,ac=210,oc=211,lc=212,cc=213,uc=214,zs=0,Hs=1,ks=2,yi=3,Gs=4,Vs=5,Ws=6,Xs=7,ol=0,hc=1,dc=2,Un=0,fc=1,pc=2,mc=3,_c=4,gc=5,vc=6,xc=7,Aa=300,Ti=301,Ai=302,Ys=303,qs=304,Yr=306,Or=1e3,gn=1001,Zs=1002,wt=1003,Sc=1004,$i=1005,It=1006,es=1007,qn=1008,Mc=1008,Mn=1009,ll=1010,cl=1011,Gi=1012,ba=1013,jn=1014,tn=1015,Wi=1016,wa=1017,Ra=1018,bi=1020,ul=35902,hl=1021,dl=1022,kt=1023,fl=1024,pl=1025,Mi=1026,wi=1027,ml=1028,Ca=1029,_l=1030,Pa=1031,La=1033,Pr=33776,Lr=33777,Dr=33778,Ur=33779,Ks=35840,js=35841,$s=35842,Js=35843,Qs=36196,ea=37492,ta=37496,na=37808,ia=37809,ra=37810,sa=37811,aa=37812,oa=37813,la=37814,ca=37815,ua=37816,ha=37817,da=37818,fa=37819,pa=37820,ma=37821,Ir=36492,_a=36494,ga=36495,gl=36283,va=36284,xa=36285,Sa=36286,Ec=3200,yc=3201,Tc=0,Ac=1,Ln="",sn="srgb",Nn="srgb-linear",Da="display-p3",qr="display-p3-linear",Br="linear",nt="srgb",zr="rec709",Hr="p3",ni=7680,$a=519,bc=512,wc=513,Rc=514,vl=515,Cc=516,Pc=517,Lc=518,Dc=519,Ja=35044,Uc=35048,Qa="300 es",vn=2e3,kr=2001;class Jn{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 r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.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 r=n.slice(0);for(let s=0,o=r.length;s>8&255]+Mt[i>>16&255]+Mt[i>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]).toLowerCase()}function bt(i,e,t){return Math.max(e,Math.min(t,i))}function Ic(i,e){return(i%e+e)%e}function ns(i,e,t){return(1-t)*i+t*e}function Ui(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Pt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class De{constructor(e=0,t=0){De.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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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(bt(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),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Oe{constructor(e,t,n,r,s,o,a,l,c){Oe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,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,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],m=n[5],_=n[8],x=r[0],h=r[3],d=r[6],A=r[1],E=r[4],T=r[7],z=r[2],L=r[5],b=r[8];return s[0]=o*x+a*A+l*z,s[3]=o*h+a*E+l*L,s[6]=o*d+a*T+l*b,s[1]=c*x+u*A+f*z,s[4]=c*h+u*E+f*L,s[7]=c*d+u*T+f*b,s[2]=p*x+m*A+_*z,s[5]=p*h+m*E+_*L,s[8]=p*d+m*T+_*b,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],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,m=c*s-o*l,_=t*f+n*p+r*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=f*x,e[1]=(r*c-u*n)*x,e[2]=(a*n-r*o)*x,e[3]=p*x,e[4]=(u*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(n*l-c*t)*x,e[8]=(o*t-n*s)*x,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,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(is.makeScale(e,t)),this}rotate(e){return this.premultiply(is.makeRotation(-e)),this}translate(e,t){return this.premultiply(is.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 r=0;r<9;r++)if(t[r]!==n[r])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 is=new Oe;function xl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Vi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Nc(){const i=Vi("canvas");return i.style.display="block",i}const eo={};function Nr(i){i in eo||(eo[i]=!0,console.warn(i))}function Fc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Oc(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Bc(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const to=new Oe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),no=new Oe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ii={[Nn]:{transfer:Br,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[sn]:{transfer:nt,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[qr]:{transfer:Br,primaries:Hr,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(no),fromReference:i=>i.applyMatrix3(to)},[Da]:{transfer:nt,primaries:Hr,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(no),fromReference:i=>i.applyMatrix3(to).convertLinearToSRGB()}},zc=new Set([Nn,qr]),Ze={enabled:!0,_workingColorSpace:Nn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!zc.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=Ii[e].toReference,r=Ii[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return Ii[i].primaries},getTransfer:function(i){return i===Ln?Br:Ii[i].transfer},getLuminanceCoefficients:function(i,e=this._workingColorSpace){return i.fromArray(Ii[e].luminanceCoefficients)}};function Ei(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function rs(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ii;class Hc{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ii===void 0&&(ii=Vi("canvas")),ii.width=e.width,ii.height=e.height;const n=ii.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ii}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=Vi("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Aa)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Or:e.x=e.x-Math.floor(e.x);break;case gn:e.x=e.x<0?0:1;break;case Zs: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 Or:e.y=e.y-Math.floor(e.y);break;case gn:e.y=e.y<0?0:1;break;case Zs: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++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Aa;Tt.DEFAULT_ANISOTROPY=1;class lt{constructor(e=0,t=0,n=0,r=1){lt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}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,r){return this.x=e,this.y=t,this.z=n,this.w=r,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,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[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,r,s;const l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],m=l[5],_=l[9],x=l[2],h=l[6],d=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-x)<.01&&Math.abs(_-h)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+x)<.1&&Math.abs(_+h)<.1&&Math.abs(c+m+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,T=(m+1)/2,z=(d+1)/2,L=(u+p)/4,b=(f+x)/4,B=(_+h)/4;return E>T&&E>z?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=L/n,s=b/n):T>z?T<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),n=L/r,s=B/r):z<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(z),n=b/s,r=B/s),this.set(n,r,s,t),this}let A=Math.sqrt((h-_)*(h-_)+(f-x)*(f-x)+(p-u)*(p-u));return Math.abs(A)<.001&&(A=1),this.x=(h-_)/A,this.y=(f-x)/A,this.z=(p-u)/A,this.w=Math.acos((c+m+d-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 Vc extends Jn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new lt(0,0,e,t),this.scissorTest=!1,this.viewport=new lt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:It,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Tt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a=0?1:-1,E=1-d*d;if(E>Number.EPSILON){const z=Math.sqrt(E),L=Math.atan2(z,d*A);h=Math.sin(h*L)/z,a=Math.sin(a*L)/z}const T=a*A;if(l=l*h+p*T,c=c*h+m*T,u=u*h+_*T,f=f*h+x*T,h===1-a){const z=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=z,c*=z,u*=z,f*=z}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){const a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],m=s[o+2],_=s[o+3];return e[t]=a*_+u*f+l*m-c*p,e[t+1]=l*_+u*p+c*f-a*m,e[t+2]=c*_+u*m+a*p-l*f,e[t+3]=u*_-a*f-l*p-c*m,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,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,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),m=l(r/2),_=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f-p*m*_;break;case"YXZ":this._x=p*u*f+c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f+p*m*_;break;case"ZXY":this._x=p*u*f-c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f-p*m*_;break;case"ZYX":this._x=p*u*f-c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f+p*m*_;break;case"YZX":this._x=p*u*f+c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f-p*m*_;break;case"XZY":this._x=p*u*f-c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f+p*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(n>a&&n>f){const m=2*Math.sqrt(1+n-a-f);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>f){const m=2*Math.sqrt(1+a-n-f);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+f-n-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}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(bt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*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,r=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=o*f+this._w*p,this._x=n*f+this._x*p,this._y=r*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*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 U{constructor(e=0,t=0,n=0){U.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(io.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(io.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*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,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,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,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return as.copy(this).projectOnVector(e),this.sub(as)}reflect(e){return this.sub(as.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(bt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,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 as=new U,io=new qt;class Yi{constructor(e=new U(1/0,1/0,1/0),t=new U(-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,Kt),Kt.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(Ni),Qi.subVectors(this.max,Ni),ri.subVectors(e.a,Ni),si.subVectors(e.b,Ni),ai.subVectors(e.c,Ni),Tn.subVectors(si,ri),An.subVectors(ai,si),On.subVectors(ri,ai);let t=[0,-Tn.z,Tn.y,0,-An.z,An.y,0,-On.z,On.y,Tn.z,0,-Tn.x,An.z,0,-An.x,On.z,0,-On.x,-Tn.y,Tn.x,0,-An.y,An.x,0,-On.y,On.x,0];return!os(t,ri,si,ai,Qi)||(t=[1,0,0,0,1,0,0,0,1],!os(t,ri,si,ai,Qi))?!1:(er.crossVectors(Tn,An),t=[er.x,er.y,er.z],os(t,ri,si,ai,Qi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kt).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:(ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ln),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 ln=[new U,new U,new U,new U,new U,new U,new U,new U],Kt=new U,Ji=new Yi,ri=new U,si=new U,ai=new U,Tn=new U,An=new U,On=new U,Ni=new U,Qi=new U,er=new U,Bn=new U;function os(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){Bn.fromArray(i,s);const a=r.x*Math.abs(Bn.x)+r.y*Math.abs(Bn.y)+r.z*Math.abs(Bn.z),l=e.dot(Bn),c=t.dot(Bn),u=n.dot(Bn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Xc=new Yi,Fi=new U,ls=new U;class Zr{constructor(e=new U,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):Xc.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=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;Fi.subVectors(e,this.center);const t=Fi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Fi,r/n),this.radius+=r}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):(ls.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fi.copy(e.center).add(ls)),this.expandByPoint(Fi.copy(e.center).sub(ls))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const cn=new U,cs=new U,tr=new U,bn=new U,us=new U,nr=new U,hs=new U;class El{constructor(e=new U,t=new U(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,cn)),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=cn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cn.copy(this.origin).addScaledVector(this.direction,t),cn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){cs.copy(e).add(t).multiplyScalar(.5),tr.copy(t).sub(e).normalize(),bn.copy(this.origin).sub(cs);const s=e.distanceTo(t)*.5,o=-this.direction.dot(tr),a=bn.dot(this.direction),l=-bn.dot(tr),c=bn.lengthSq(),u=Math.abs(1-o*o);let f,p,m,_;if(u>0)if(f=o*l-a,p=o*a-l,_=s*u,f>=0)if(p>=-_)if(p<=_){const x=1/u;f*=x,p*=x,m=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;else p<=-_?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c):p<=_?(f=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(cs).addScaledVector(tr,p),m}intersectSphere(e,t){cn.subVectors(e.center,this.origin);const n=cn.dot(this.direction),r=cn.dot(cn)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,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,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,cn)!==null}intersectTriangle(e,t,n,r,s){us.subVectors(t,e),nr.subVectors(n,e),hs.crossVectors(us,nr);let o=this.direction.dot(hs),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;bn.subVectors(this.origin,e);const l=a*this.direction.dot(nr.crossVectors(bn,nr));if(l<0)return null;const c=a*this.direction.dot(us.cross(bn));if(c<0||l+c>o)return null;const u=-a*bn.dot(hs);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class rt{constructor(e,t,n,r,s,o,a,l,c,u,f,p,m,_,x,h){rt.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,r,s,o,a,l,c,u,f,p,m,_,x,h)}set(e,t,n,r,s,o,a,l,c,u,f,p,m,_,x,h){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=p,d[3]=m,d[7]=_,d[11]=x,d[15]=h,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 rt().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,r=1/oi.setFromMatrixColumn(e,0).length(),s=1/oi.setFromMatrixColumn(e,1).length(),o=1/oi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*f,_=a*u,x=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=m+_*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=_+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*f,_=c*u,x=c*f;t[0]=p+x*a,t[4]=_*a-m,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=m*a-_,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*f,_=c*u,x=c*f;t[0]=p-x*a,t[4]=-o*f,t[8]=_+m*a,t[1]=m+_*a,t[5]=o*u,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*u,m=o*f,_=a*u,x=a*f;t[0]=l*u,t[4]=_*c-m,t[8]=p*c+x,t[1]=l*f,t[5]=x*c+p,t[9]=m*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,_=a*l,x=a*c;t[0]=l*u,t[4]=x-p*f,t[8]=_*f+m,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*f+_,t[10]=p-x*f}else if(e.order==="XZY"){const p=o*l,m=o*c,_=a*l,x=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+x,t[5]=o*u,t[9]=m*f-_,t[2]=_*f-m,t[6]=a*u,t[10]=x*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Yc,e,qc)}lookAt(e,t,n){const r=this.elements;return zt.subVectors(e,t),zt.lengthSq()===0&&(zt.z=1),zt.normalize(),wn.crossVectors(n,zt),wn.lengthSq()===0&&(Math.abs(n.z)===1?zt.x+=1e-4:zt.z+=1e-4,zt.normalize(),wn.crossVectors(n,zt)),wn.normalize(),ir.crossVectors(zt,wn),r[0]=wn.x,r[4]=ir.x,r[8]=zt.x,r[1]=wn.y,r[5]=ir.y,r[9]=zt.y,r[2]=wn.z,r[6]=ir.z,r[10]=zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],m=n[13],_=n[2],x=n[6],h=n[10],d=n[14],A=n[3],E=n[7],T=n[11],z=n[15],L=r[0],b=r[4],B=r[8],ie=r[12],g=r[1],M=r[5],W=r[9],k=r[13],K=r[2],Q=r[6],X=r[10],J=r[14],V=r[3],fe=r[7],pe=r[11],ve=r[15];return s[0]=o*L+a*g+l*K+c*V,s[4]=o*b+a*M+l*Q+c*fe,s[8]=o*B+a*W+l*X+c*pe,s[12]=o*ie+a*k+l*J+c*ve,s[1]=u*L+f*g+p*K+m*V,s[5]=u*b+f*M+p*Q+m*fe,s[9]=u*B+f*W+p*X+m*pe,s[13]=u*ie+f*k+p*J+m*ve,s[2]=_*L+x*g+h*K+d*V,s[6]=_*b+x*M+h*Q+d*fe,s[10]=_*B+x*W+h*X+d*pe,s[14]=_*ie+x*k+h*J+d*ve,s[3]=A*L+E*g+T*K+z*V,s[7]=A*b+E*M+T*Q+z*fe,s[11]=A*B+E*W+T*X+z*pe,s[15]=A*ie+E*k+T*J+z*ve,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],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],m=e[14],_=e[3],x=e[7],h=e[11],d=e[15];return _*(+s*l*f-r*c*f-s*a*p+n*c*p+r*a*m-n*l*m)+x*(+t*l*m-t*c*p+s*o*p-r*o*m+r*c*u-s*l*u)+h*(+t*c*f-t*a*m-s*o*f+n*o*m+s*a*u-n*c*u)+d*(-r*a*u-t*l*f+t*a*p+r*o*f-n*o*p+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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],m=e[11],_=e[12],x=e[13],h=e[14],d=e[15],A=f*h*c-x*p*c+x*l*m-a*h*m-f*l*d+a*p*d,E=_*p*c-u*h*c-_*l*m+o*h*m+u*l*d-o*p*d,T=u*x*c-_*f*c+_*a*m-o*x*m-u*a*d+o*f*d,z=_*f*l-u*x*l-_*a*p+o*x*p+u*a*h-o*f*h,L=t*A+n*E+r*T+s*z;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/L;return e[0]=A*b,e[1]=(x*p*s-f*h*s-x*r*m+n*h*m+f*r*d-n*p*d)*b,e[2]=(a*h*s-x*l*s+x*r*c-n*h*c-a*r*d+n*l*d)*b,e[3]=(f*l*s-a*p*s-f*r*c+n*p*c+a*r*m-n*l*m)*b,e[4]=E*b,e[5]=(u*h*s-_*p*s+_*r*m-t*h*m-u*r*d+t*p*d)*b,e[6]=(_*l*s-o*h*s-_*r*c+t*h*c+o*r*d-t*l*d)*b,e[7]=(o*p*s-u*l*s+u*r*c-t*p*c-o*r*m+t*l*m)*b,e[8]=T*b,e[9]=(_*f*s-u*x*s-_*n*m+t*x*m+u*n*d-t*f*d)*b,e[10]=(o*x*s-_*a*s+_*n*c-t*x*c-o*n*d+t*a*d)*b,e[11]=(u*a*s-o*f*s-u*n*c+t*f*c+o*n*m-t*a*m)*b,e[12]=z*b,e[13]=(u*x*r-_*f*r+_*n*p-t*x*p-u*n*h+t*f*h)*b,e[14]=(_*a*r-o*x*r-_*n*l+t*x*l+o*n*h-t*a*h)*b,e[15]=(o*f*r-u*a*r+u*n*l-t*f*l-o*n*p+t*a*p)*b,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}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),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,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,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,m=s*u,_=s*f,x=o*u,h=o*f,d=a*f,A=l*c,E=l*u,T=l*f,z=n.x,L=n.y,b=n.z;return r[0]=(1-(x+d))*z,r[1]=(m+T)*z,r[2]=(_-E)*z,r[3]=0,r[4]=(m-T)*L,r[5]=(1-(p+d))*L,r[6]=(h+A)*L,r[7]=0,r[8]=(_+E)*b,r[9]=(h-A)*b,r[10]=(1-(p+x))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=oi.set(r[0],r[1],r[2]).length();const o=oi.set(r[4],r[5],r[6]).length(),a=oi.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],jt.copy(this);const c=1/s,u=1/o,f=1/a;return jt.elements[0]*=c,jt.elements[1]*=c,jt.elements[2]*=c,jt.elements[4]*=u,jt.elements[5]*=u,jt.elements[6]*=u,jt.elements[8]*=f,jt.elements[9]*=f,jt.elements[10]*=f,t.setFromRotationMatrix(jt),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,r,s,o,a=vn){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),f=(t+e)/(t-e),p=(n+r)/(n-r);let m,_;if(a===vn)m=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===kr)m=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=vn){const l=this.elements,c=1/(t-e),u=1/(n-r),f=1/(o-s),p=(t+e)*c,m=(n+r)*u;let _,x;if(a===vn)_=(o+s)*f,x=-2*f;else if(a===kr)_=s*f,x=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=x,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 r=0;r<16;r++)if(t[r]!==n[r])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 oi=new U,jt=new rt,Yc=new U(0,0,0),qc=new U(1,1,1),wn=new U,ir=new U,zt=new U,ro=new rt,so=new qt;class En{constructor(e=0,t=0,n=0,r=En.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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 r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(bt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-bt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),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 ro.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ro,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return so.setFromEuler(this),this.setFromQuaternion(so,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}}En.DEFAULT_ORDER="XYZ";class yl{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&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),_.length>0&&(n.nodes=_)}return n.object=r,n;function o(a){const l=[];for(const c in a){const u=a[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?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){$t.subVectors(r,t),hn.subVectors(n,t),fs.subVectors(e,t);const o=$t.dot($t),a=$t.dot(hn),l=$t.dot(fs),c=hn.dot(hn),u=hn.dot(fs),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const p=1/f,m=(c*l-a*u)*p,_=(o*u-a*l)*p;return s.set(1-m-_,_,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,dn)===null?!1:dn.x>=0&&dn.y>=0&&dn.x+dn.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,dn)===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,dn.x),l.addScaledVector(o,dn.y),l.addScaledVector(a,dn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return gs.setScalar(0),vs.setScalar(0),xs.setScalar(0),gs.fromBufferAttribute(e,t),vs.fromBufferAttribute(e,n),xs.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(gs,s.x),o.addScaledVector(vs,s.y),o.addScaledVector(xs,s.z),o}static isFrontFacing(e,t,n,r){return $t.subVectors(n,t),hn.subVectors(e,t),$t.cross(hn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 $t.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),$t.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return en.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return en.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return en.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return en.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return en.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let o,a;ui.subVectors(r,n),hi.subVectors(s,n),ps.subVectors(e,n);const l=ui.dot(ps),c=hi.dot(ps);if(l<=0&&c<=0)return t.copy(n);ms.subVectors(e,r);const u=ui.dot(ms),f=hi.dot(ms);if(u>=0&&f<=u)return t.copy(r);const p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(ui,o);_s.subVectors(e,s);const m=ui.dot(_s),_=hi.dot(_s);if(_>=0&&m<=_)return t.copy(s);const x=m*c-l*_;if(x<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(hi,a);const h=u*_-m*f;if(h<=0&&f-u>=0&&m-_>=0)return ho.subVectors(s,r),a=(f-u)/(f-u+(m-_)),t.copy(r).addScaledVector(ho,a);const d=1/(h+x+p);return o=x*d,a=p*d,t.copy(n).addScaledVector(ui,o).addScaledVector(hi,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Tl={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},Rn={h:0,s:0,l:0},sr={h:0,s:0,l:0};function Ss(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class we{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 r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ze.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ze.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ze.workingColorSpace){if(e=Ic(e,1),t=bt(t,0,1),n=bt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Ss(o,s,e+1/3),this.g=Ss(o,s,e),this.b=Ss(o,s,e-1/3)}return Ze.toWorkingColorSpace(this,r),this}setStyle(e,t=sn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))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(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sn){const n=Tl[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=Ei(e.r),this.g=Ei(e.g),this.b=Ei(e.b),this}copyLinearToSRGB(e){return this.r=rs(e.r),this.g=rs(e.g),this.b=rs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sn){return Ze.fromWorkingColorSpace(Et.copy(this),e),Math.round(bt(Et.r*255,0,255))*65536+Math.round(bt(Et.g*255,0,255))*256+Math.round(bt(Et.b*255,0,255))}getHexString(e=sn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ze.workingColorSpace){Ze.fromWorkingColorSpace(Et.copy(this),t);const n=Et.r,r=Et.g,s=Et.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.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!==Si&&(n.blending=this.blending),this.side!==In&&(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!==Os&&(n.blendSrc=this.blendSrc),this.blendDst!==Bs&&(n.blendDst=this.blendDst),this.blendEquation!==Xn&&(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!==yi&&(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!==$a&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ni&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ni&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ni&&(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 r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++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.")}}class Al extends qi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new we(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 En,this.combine=ol,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 dt=new U,ar=new De;class Gt{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=Ja,this.updateRanges=[],this.gpuType=tn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(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 r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let p=0,m=f.length;p0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(fo.copy(s).invert(),zn.copy(e.ray).applyMatrix4(fo),!(n.boundingBox!==null&&zn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,zn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,x=p.length;_t.far?null:{distance:c,point:dr.clone(),object:i}}function fr(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,lr),i.getVertexPosition(l,cr),i.getVertexPosition(c,ur);const u=eu(i,e,t,n,lr,cr,ur,mo);if(u){const f=new U;en.getBarycoord(mo,lr,cr,ur,f),r&&(u.uv=en.getInterpolatedAttribute(r,a,l,c,f,new De)),s&&(u.uv1=en.getInterpolatedAttribute(s,a,l,c,f,new De)),o&&(u.normal=en.getInterpolatedAttribute(o,a,l,c,f,new U),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new U,materialIndex:0};en.getNormal(lr,cr,ur,p.normal),u.face=p,u.barycoord=f}return u}class Zi extends rn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let p=0,m=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,r,o,2),_("x","z","y",1,-1,e,n,-t,r,o,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nn(c,3)),this.setAttribute("normal",new nn(u,3)),this.setAttribute("uv",new nn(f,2));function _(x,h,d,A,E,T,z,L,b,B,ie){const g=T/b,M=z/B,W=T/2,k=z/2,K=L/2,Q=b+1,X=B+1;let J=0,V=0;const fe=new U;for(let pe=0;pe0?1:-1,u.push(fe.x,fe.y,fe.z),f.push(We/b),f.push(1-pe/B),J+=1}}for(let pe=0;pe>8&255]+Mt[i>>16&255]+Mt[i>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]).toLowerCase()}function bt(i,e,t){return Math.max(e,Math.min(t,i))}function Ic(i,e){return(i%e+e)%e}function ns(i,e,t){return(1-t)*i+t*e}function Ui(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Pt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Le{constructor(e=0,t=0){Le.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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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(bt(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),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Oe{constructor(e,t,n,r,s,o,a,l,c){Oe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,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,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],m=n[5],_=n[8],x=r[0],h=r[3],d=r[6],A=r[1],E=r[4],T=r[7],z=r[2],L=r[5],b=r[8];return s[0]=o*x+a*A+l*z,s[3]=o*h+a*E+l*L,s[6]=o*d+a*T+l*b,s[1]=c*x+u*A+f*z,s[4]=c*h+u*E+f*L,s[7]=c*d+u*T+f*b,s[2]=p*x+m*A+_*z,s[5]=p*h+m*E+_*L,s[8]=p*d+m*T+_*b,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],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,m=c*s-o*l,_=t*f+n*p+r*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=f*x,e[1]=(r*c-u*n)*x,e[2]=(a*n-r*o)*x,e[3]=p*x,e[4]=(u*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(n*l-c*t)*x,e[8]=(o*t-n*s)*x,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,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(is.makeScale(e,t)),this}rotate(e){return this.premultiply(is.makeRotation(-e)),this}translate(e,t){return this.premultiply(is.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 r=0;r<9;r++)if(t[r]!==n[r])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 is=new Oe;function xl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Vi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Nc(){const i=Vi("canvas");return i.style.display="block",i}const eo={};function Nr(i){i in eo||(eo[i]=!0,console.warn(i))}function Fc(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Oc(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Bc(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const to=new Oe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),no=new Oe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ii={[Nn]:{transfer:Br,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[sn]:{transfer:nt,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[qr]:{transfer:Br,primaries:Hr,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(no),fromReference:i=>i.applyMatrix3(to)},[Da]:{transfer:nt,primaries:Hr,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(no),fromReference:i=>i.applyMatrix3(to).convertLinearToSRGB()}},zc=new Set([Nn,qr]),Ze={enabled:!0,_workingColorSpace:Nn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!zc.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=Ii[e].toReference,r=Ii[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return Ii[i].primaries},getTransfer:function(i){return i===Ln?Br:Ii[i].transfer},getLuminanceCoefficients:function(i,e=this._workingColorSpace){return i.fromArray(Ii[e].luminanceCoefficients)}};function Ei(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function rs(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ni;class Hc{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ni===void 0&&(ni=Vi("canvas")),ni.width=e.width,ni.height=e.height;const n=ni.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ni}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=Vi("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Aa)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Or:e.x=e.x-Math.floor(e.x);break;case gn:e.x=e.x<0?0:1;break;case Zs: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 Or:e.y=e.y-Math.floor(e.y);break;case gn:e.y=e.y<0?0:1;break;case Zs: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++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Aa;Tt.DEFAULT_ANISOTROPY=1;class lt{constructor(e=0,t=0,n=0,r=1){lt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}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,r){return this.x=e,this.y=t,this.z=n,this.w=r,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,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[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,r,s;const l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],m=l[5],_=l[9],x=l[2],h=l[6],d=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-x)<.01&&Math.abs(_-h)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+x)<.1&&Math.abs(_+h)<.1&&Math.abs(c+m+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,T=(m+1)/2,z=(d+1)/2,L=(u+p)/4,b=(f+x)/4,B=(_+h)/4;return E>T&&E>z?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=L/n,s=b/n):T>z?T<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),n=L/r,s=B/r):z<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(z),n=b/s,r=B/s),this.set(n,r,s,t),this}let A=Math.sqrt((h-_)*(h-_)+(f-x)*(f-x)+(p-u)*(p-u));return Math.abs(A)<.001&&(A=1),this.x=(h-_)/A,this.y=(f-x)/A,this.z=(p-u)/A,this.w=Math.acos((c+m+d-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 Vc extends $n{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new lt(0,0,e,t),this.scissorTest=!1,this.viewport=new lt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:It,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Tt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a=0?1:-1,E=1-d*d;if(E>Number.EPSILON){const z=Math.sqrt(E),L=Math.atan2(z,d*A);h=Math.sin(h*L)/z,a=Math.sin(a*L)/z}const T=a*A;if(l=l*h+p*T,c=c*h+m*T,u=u*h+_*T,f=f*h+x*T,h===1-a){const z=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=z,c*=z,u*=z,f*=z}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){const a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],m=s[o+2],_=s[o+3];return e[t]=a*_+u*f+l*m-c*p,e[t+1]=l*_+u*p+c*f-a*m,e[t+2]=c*_+u*m+a*p-l*f,e[t+3]=u*_-a*f-l*p-c*m,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,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,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),m=l(r/2),_=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f-p*m*_;break;case"YXZ":this._x=p*u*f+c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f+p*m*_;break;case"ZXY":this._x=p*u*f-c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f-p*m*_;break;case"ZYX":this._x=p*u*f-c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f+p*m*_;break;case"YZX":this._x=p*u*f+c*m*_,this._y=c*m*f+p*u*_,this._z=c*u*_-p*m*f,this._w=c*u*f-p*m*_;break;case"XZY":this._x=p*u*f-c*m*_,this._y=c*m*f-p*u*_,this._z=c*u*_+p*m*f,this._w=c*u*f+p*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(n>a&&n>f){const m=2*Math.sqrt(1+n-a-f);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>f){const m=2*Math.sqrt(1+a-n-f);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+f-n-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}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(bt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*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,r=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=o*f+this._w*p,this._x=n*f+this._x*p,this._y=r*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*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 U{constructor(e=0,t=0,n=0){U.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(io.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(io.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*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,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,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,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return as.copy(this).projectOnVector(e),this.sub(as)}reflect(e){return this.sub(as.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(bt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,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 as=new U,io=new qt;class Yi{constructor(e=new U(1/0,1/0,1/0),t=new U(-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,Kt),Kt.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(Ni),Qi.subVectors(this.max,Ni),ii.subVectors(e.a,Ni),ri.subVectors(e.b,Ni),si.subVectors(e.c,Ni),Tn.subVectors(ri,ii),An.subVectors(si,ri),On.subVectors(ii,si);let t=[0,-Tn.z,Tn.y,0,-An.z,An.y,0,-On.z,On.y,Tn.z,0,-Tn.x,An.z,0,-An.x,On.z,0,-On.x,-Tn.y,Tn.x,0,-An.y,An.x,0,-On.y,On.x,0];return!os(t,ii,ri,si,Qi)||(t=[1,0,0,0,1,0,0,0,1],!os(t,ii,ri,si,Qi))?!1:(er.crossVectors(Tn,An),t=[er.x,er.y,er.z],os(t,ii,ri,si,Qi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kt).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:(ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ln),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 ln=[new U,new U,new U,new U,new U,new U,new U,new U],Kt=new U,Ji=new Yi,ii=new U,ri=new U,si=new U,Tn=new U,An=new U,On=new U,Ni=new U,Qi=new U,er=new U,Bn=new U;function os(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){Bn.fromArray(i,s);const a=r.x*Math.abs(Bn.x)+r.y*Math.abs(Bn.y)+r.z*Math.abs(Bn.z),l=e.dot(Bn),c=t.dot(Bn),u=n.dot(Bn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Xc=new Yi,Fi=new U,ls=new U;class Zr{constructor(e=new U,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):Xc.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=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;Fi.subVectors(e,this.center);const t=Fi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Fi,r/n),this.radius+=r}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):(ls.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fi.copy(e.center).add(ls)),this.expandByPoint(Fi.copy(e.center).sub(ls))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const cn=new U,cs=new U,tr=new U,bn=new U,us=new U,nr=new U,hs=new U;class El{constructor(e=new U,t=new U(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,cn)),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=cn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cn.copy(this.origin).addScaledVector(this.direction,t),cn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){cs.copy(e).add(t).multiplyScalar(.5),tr.copy(t).sub(e).normalize(),bn.copy(this.origin).sub(cs);const s=e.distanceTo(t)*.5,o=-this.direction.dot(tr),a=bn.dot(this.direction),l=-bn.dot(tr),c=bn.lengthSq(),u=Math.abs(1-o*o);let f,p,m,_;if(u>0)if(f=o*l-a,p=o*a-l,_=s*u,f>=0)if(p>=-_)if(p<=_){const x=1/u;f*=x,p*=x,m=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;else p<=-_?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c):p<=_?(f=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),m=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),m=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(cs).addScaledVector(tr,p),m}intersectSphere(e,t){cn.subVectors(e.center,this.origin);const n=cn.dot(this.direction),r=cn.dot(cn)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,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,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,cn)!==null}intersectTriangle(e,t,n,r,s){us.subVectors(t,e),nr.subVectors(n,e),hs.crossVectors(us,nr);let o=this.direction.dot(hs),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;bn.subVectors(this.origin,e);const l=a*this.direction.dot(nr.crossVectors(bn,nr));if(l<0)return null;const c=a*this.direction.dot(us.cross(bn));if(c<0||l+c>o)return null;const u=-a*bn.dot(hs);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class rt{constructor(e,t,n,r,s,o,a,l,c,u,f,p,m,_,x,h){rt.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,r,s,o,a,l,c,u,f,p,m,_,x,h)}set(e,t,n,r,s,o,a,l,c,u,f,p,m,_,x,h){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=p,d[3]=m,d[7]=_,d[11]=x,d[15]=h,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 rt().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,r=1/ai.setFromMatrixColumn(e,0).length(),s=1/ai.setFromMatrixColumn(e,1).length(),o=1/ai.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*f,_=a*u,x=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=m+_*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=_+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*f,_=c*u,x=c*f;t[0]=p+x*a,t[4]=_*a-m,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=m*a-_,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*f,_=c*u,x=c*f;t[0]=p-x*a,t[4]=-o*f,t[8]=_+m*a,t[1]=m+_*a,t[5]=o*u,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*u,m=o*f,_=a*u,x=a*f;t[0]=l*u,t[4]=_*c-m,t[8]=p*c+x,t[1]=l*f,t[5]=x*c+p,t[9]=m*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,_=a*l,x=a*c;t[0]=l*u,t[4]=x-p*f,t[8]=_*f+m,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*f+_,t[10]=p-x*f}else if(e.order==="XZY"){const p=o*l,m=o*c,_=a*l,x=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+x,t[5]=o*u,t[9]=m*f-_,t[2]=_*f-m,t[6]=a*u,t[10]=x*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Yc,e,qc)}lookAt(e,t,n){const r=this.elements;return zt.subVectors(e,t),zt.lengthSq()===0&&(zt.z=1),zt.normalize(),wn.crossVectors(n,zt),wn.lengthSq()===0&&(Math.abs(n.z)===1?zt.x+=1e-4:zt.z+=1e-4,zt.normalize(),wn.crossVectors(n,zt)),wn.normalize(),ir.crossVectors(zt,wn),r[0]=wn.x,r[4]=ir.x,r[8]=zt.x,r[1]=wn.y,r[5]=ir.y,r[9]=zt.y,r[2]=wn.z,r[6]=ir.z,r[10]=zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],m=n[13],_=n[2],x=n[6],h=n[10],d=n[14],A=n[3],E=n[7],T=n[11],z=n[15],L=r[0],b=r[4],B=r[8],ie=r[12],g=r[1],M=r[5],V=r[9],H=r[13],K=r[2],Q=r[6],W=r[10],J=r[14],G=r[3],fe=r[7],pe=r[11],ve=r[15];return s[0]=o*L+a*g+l*K+c*G,s[4]=o*b+a*M+l*Q+c*fe,s[8]=o*B+a*V+l*W+c*pe,s[12]=o*ie+a*H+l*J+c*ve,s[1]=u*L+f*g+p*K+m*G,s[5]=u*b+f*M+p*Q+m*fe,s[9]=u*B+f*V+p*W+m*pe,s[13]=u*ie+f*H+p*J+m*ve,s[2]=_*L+x*g+h*K+d*G,s[6]=_*b+x*M+h*Q+d*fe,s[10]=_*B+x*V+h*W+d*pe,s[14]=_*ie+x*H+h*J+d*ve,s[3]=A*L+E*g+T*K+z*G,s[7]=A*b+E*M+T*Q+z*fe,s[11]=A*B+E*V+T*W+z*pe,s[15]=A*ie+E*H+T*J+z*ve,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],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],m=e[14],_=e[3],x=e[7],h=e[11],d=e[15];return _*(+s*l*f-r*c*f-s*a*p+n*c*p+r*a*m-n*l*m)+x*(+t*l*m-t*c*p+s*o*p-r*o*m+r*c*u-s*l*u)+h*(+t*c*f-t*a*m-s*o*f+n*o*m+s*a*u-n*c*u)+d*(-r*a*u-t*l*f+t*a*p+r*o*f-n*o*p+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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],m=e[11],_=e[12],x=e[13],h=e[14],d=e[15],A=f*h*c-x*p*c+x*l*m-a*h*m-f*l*d+a*p*d,E=_*p*c-u*h*c-_*l*m+o*h*m+u*l*d-o*p*d,T=u*x*c-_*f*c+_*a*m-o*x*m-u*a*d+o*f*d,z=_*f*l-u*x*l-_*a*p+o*x*p+u*a*h-o*f*h,L=t*A+n*E+r*T+s*z;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/L;return e[0]=A*b,e[1]=(x*p*s-f*h*s-x*r*m+n*h*m+f*r*d-n*p*d)*b,e[2]=(a*h*s-x*l*s+x*r*c-n*h*c-a*r*d+n*l*d)*b,e[3]=(f*l*s-a*p*s-f*r*c+n*p*c+a*r*m-n*l*m)*b,e[4]=E*b,e[5]=(u*h*s-_*p*s+_*r*m-t*h*m-u*r*d+t*p*d)*b,e[6]=(_*l*s-o*h*s-_*r*c+t*h*c+o*r*d-t*l*d)*b,e[7]=(o*p*s-u*l*s+u*r*c-t*p*c-o*r*m+t*l*m)*b,e[8]=T*b,e[9]=(_*f*s-u*x*s-_*n*m+t*x*m+u*n*d-t*f*d)*b,e[10]=(o*x*s-_*a*s+_*n*c-t*x*c-o*n*d+t*a*d)*b,e[11]=(u*a*s-o*f*s-u*n*c+t*f*c+o*n*m-t*a*m)*b,e[12]=z*b,e[13]=(u*x*r-_*f*r+_*n*p-t*x*p-u*n*h+t*f*h)*b,e[14]=(_*a*r-o*x*r-_*n*l+t*x*l+o*n*h-t*a*h)*b,e[15]=(o*f*r-u*a*r+u*n*l-t*f*l-o*n*p+t*a*p)*b,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}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),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,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,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,m=s*u,_=s*f,x=o*u,h=o*f,d=a*f,A=l*c,E=l*u,T=l*f,z=n.x,L=n.y,b=n.z;return r[0]=(1-(x+d))*z,r[1]=(m+T)*z,r[2]=(_-E)*z,r[3]=0,r[4]=(m-T)*L,r[5]=(1-(p+d))*L,r[6]=(h+A)*L,r[7]=0,r[8]=(_+E)*b,r[9]=(h-A)*b,r[10]=(1-(p+x))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=ai.set(r[0],r[1],r[2]).length();const o=ai.set(r[4],r[5],r[6]).length(),a=ai.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],jt.copy(this);const c=1/s,u=1/o,f=1/a;return jt.elements[0]*=c,jt.elements[1]*=c,jt.elements[2]*=c,jt.elements[4]*=u,jt.elements[5]*=u,jt.elements[6]*=u,jt.elements[8]*=f,jt.elements[9]*=f,jt.elements[10]*=f,t.setFromRotationMatrix(jt),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,r,s,o,a=vn){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),f=(t+e)/(t-e),p=(n+r)/(n-r);let m,_;if(a===vn)m=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===kr)m=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=vn){const l=this.elements,c=1/(t-e),u=1/(n-r),f=1/(o-s),p=(t+e)*c,m=(n+r)*u;let _,x;if(a===vn)_=(o+s)*f,x=-2*f;else if(a===kr)_=s*f,x=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=x,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 r=0;r<16;r++)if(t[r]!==n[r])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 ai=new U,jt=new rt,Yc=new U(0,0,0),qc=new U(1,1,1),wn=new U,ir=new U,zt=new U,ro=new rt,so=new qt;class En{constructor(e=0,t=0,n=0,r=En.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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 r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(bt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-bt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),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 ro.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ro,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return so.setFromEuler(this),this.setFromQuaternion(so,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}}En.DEFAULT_ORDER="XYZ";class yl{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&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),_.length>0&&(n.nodes=_)}return n.object=r,n;function o(a){const l=[];for(const c in a){const u=a[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?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){$t.subVectors(r,t),hn.subVectors(n,t),fs.subVectors(e,t);const o=$t.dot($t),a=$t.dot(hn),l=$t.dot(fs),c=hn.dot(hn),u=hn.dot(fs),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const p=1/f,m=(c*l-a*u)*p,_=(o*u-a*l)*p;return s.set(1-m-_,_,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,dn)===null?!1:dn.x>=0&&dn.y>=0&&dn.x+dn.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,dn)===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,dn.x),l.addScaledVector(o,dn.y),l.addScaledVector(a,dn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return gs.setScalar(0),vs.setScalar(0),xs.setScalar(0),gs.fromBufferAttribute(e,t),vs.fromBufferAttribute(e,n),xs.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(gs,s.x),o.addScaledVector(vs,s.y),o.addScaledVector(xs,s.z),o}static isFrontFacing(e,t,n,r){return $t.subVectors(n,t),hn.subVectors(e,t),$t.cross(hn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 $t.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),$t.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return en.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return en.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return en.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return en.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return en.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let o,a;ci.subVectors(r,n),ui.subVectors(s,n),ps.subVectors(e,n);const l=ci.dot(ps),c=ui.dot(ps);if(l<=0&&c<=0)return t.copy(n);ms.subVectors(e,r);const u=ci.dot(ms),f=ui.dot(ms);if(u>=0&&f<=u)return t.copy(r);const p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(ci,o);_s.subVectors(e,s);const m=ci.dot(_s),_=ui.dot(_s);if(_>=0&&m<=_)return t.copy(s);const x=m*c-l*_;if(x<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(ui,a);const h=u*_-m*f;if(h<=0&&f-u>=0&&m-_>=0)return ho.subVectors(s,r),a=(f-u)/(f-u+(m-_)),t.copy(r).addScaledVector(ho,a);const d=1/(h+x+p);return o=x*d,a=p*d,t.copy(n).addScaledVector(ci,o).addScaledVector(ui,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Tl={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},Rn={h:0,s:0,l:0},sr={h:0,s:0,l:0};function Ss(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class we{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 r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ze.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ze.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ze.workingColorSpace){if(e=Ic(e,1),t=bt(t,0,1),n=bt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Ss(o,s,e+1/3),this.g=Ss(o,s,e),this.b=Ss(o,s,e-1/3)}return Ze.toWorkingColorSpace(this,r),this}setStyle(e,t=sn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))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(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sn){const n=Tl[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=Ei(e.r),this.g=Ei(e.g),this.b=Ei(e.b),this}copyLinearToSRGB(e){return this.r=rs(e.r),this.g=rs(e.g),this.b=rs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sn){return Ze.fromWorkingColorSpace(Et.copy(this),e),Math.round(bt(Et.r*255,0,255))*65536+Math.round(bt(Et.g*255,0,255))*256+Math.round(bt(Et.b*255,0,255))}getHexString(e=sn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ze.workingColorSpace){Ze.fromWorkingColorSpace(Et.copy(this),t);const n=Et.r,r=Et.g,s=Et.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.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!==Si&&(n.blending=this.blending),this.side!==In&&(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!==Os&&(n.blendSrc=this.blendSrc),this.blendDst!==Bs&&(n.blendDst=this.blendDst),this.blendEquation!==Xn&&(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!==yi&&(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!==$a&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ti&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ti&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ti&&(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 r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++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.")}}class Al extends qi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new we(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 En,this.combine=ol,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 dt=new U,ar=new Le;class Gt{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=Ja,this.updateRanges=[],this.gpuType=tn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(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 r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let p=0,m=f.length;p0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(fo.copy(s).invert(),zn.copy(e.ray).applyMatrix4(fo),!(n.boundingBox!==null&&zn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,zn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,x=p.length;_t.far?null:{distance:c,point:dr.clone(),object:i}}function fr(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,lr),i.getVertexPosition(l,cr),i.getVertexPosition(c,ur);const u=eu(i,e,t,n,lr,cr,ur,mo);if(u){const f=new U;en.getBarycoord(mo,lr,cr,ur,f),r&&(u.uv=en.getInterpolatedAttribute(r,a,l,c,f,new Le)),s&&(u.uv1=en.getInterpolatedAttribute(s,a,l,c,f,new Le)),o&&(u.normal=en.getInterpolatedAttribute(o,a,l,c,f,new U),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new U,materialIndex:0};en.getNormal(lr,cr,ur,p.normal),u.face=p,u.barycoord=f}return u}class Zi extends rn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let p=0,m=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,r,o,2),_("x","z","y",1,-1,e,n,-t,r,o,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nn(c,3)),this.setAttribute("normal",new nn(u,3)),this.setAttribute("uv",new nn(f,2));function _(x,h,d,A,E,T,z,L,b,B,ie){const g=T/b,M=z/B,V=T/2,H=z/2,K=L/2,Q=b+1,W=B+1;let J=0,G=0;const fe=new U;for(let pe=0;pe0?1:-1,u.push(fe.x,fe.y,fe.z),f.push(We/b),f.push(1-pe/B),J+=1}}for(let pe=0;pe0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ua extends ft{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt,this.coordinateSystem=vn}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 Cn=new U,_o=new De,go=new De;class Qt extends Ua{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,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=Ma*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ts*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ma*2*Math.atan(Math.tan(ts*.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){Cn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Cn.x,Cn.y).multiplyScalar(-e/Cn.z),Cn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Cn.x,Cn.y).multiplyScalar(-e/Cn.z)}getViewSize(e,t){return this.getViewBounds(e,_o,go),t.subVectors(go,_o)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ts*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,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 fi=-90,pi=1;class ru extends ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Qt(fi,pi,e,t);r.layers=this.layers,this.add(r);const s=new Qt(fi,pi,e,t);s.layers=this.layers,this.add(s);const o=new Qt(fi,pi,e,t);o.layers=this.layers,this.add(o);const a=new Qt(fi,pi,e,t);a.layers=this.layers,this.add(a);const l=new Qt(fi,pi,e,t);l.layers=this.layers,this.add(l);const c=new Qt(fi,pi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===kr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const x=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,o),e.setRenderTarget(n,2,r),e.render(t,a),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=x,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(f,p,m),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Cl extends Tt{constructor(e,t,n,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ti,super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class su extends $n{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Cl(r,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:It}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 yt extends qi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=nu,this.fragmentShader=iu,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=Ri(e.uniforms),this.uniformsGroups=tu(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 r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ua extends ft{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt,this.coordinateSystem=vn}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 Cn=new U,_o=new Le,go=new Le;class Qt extends Ua{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,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=Ma*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ts*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ma*2*Math.atan(Math.tan(ts*.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){Cn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Cn.x,Cn.y).multiplyScalar(-e/Cn.z),Cn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Cn.x,Cn.y).multiplyScalar(-e/Cn.z)}getViewSize(e,t){return this.getViewBounds(e,_o,go),t.subVectors(go,_o)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ts*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,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 di=-90,fi=1;class ru extends ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Qt(di,fi,e,t);r.layers=this.layers,this.add(r);const s=new Qt(di,fi,e,t);s.layers=this.layers,this.add(s);const o=new Qt(di,fi,e,t);o.layers=this.layers,this.add(o);const a=new Qt(di,fi,e,t);a.layers=this.layers,this.add(a);const l=new Qt(di,fi,e,t);l.layers=this.layers,this.add(l);const c=new Qt(di,fi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===kr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const x=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,o),e.setRenderTarget(n,2,r),e.render(t,a),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=x,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(f,p,m),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class Cl extends Tt{constructor(e,t,n,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ti,super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class su extends jn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Cl(r,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:It}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; @@ -3584,7 +3584,7 @@ void main() { #include #include #include -}`,Fe={alphahash_fragment:cu,alphahash_pars_fragment:uu,alphamap_fragment:hu,alphamap_pars_fragment:du,alphatest_fragment:fu,alphatest_pars_fragment:pu,aomap_fragment:mu,aomap_pars_fragment:_u,batching_pars_vertex:gu,batching_vertex:vu,begin_vertex:xu,beginnormal_vertex:Su,bsdfs:Mu,iridescence_fragment:Eu,bumpmap_pars_fragment:yu,clipping_planes_fragment:Tu,clipping_planes_pars_fragment:Au,clipping_planes_pars_vertex:bu,clipping_planes_vertex:wu,color_fragment:Ru,color_pars_fragment:Cu,color_pars_vertex:Pu,color_vertex:Lu,common:Du,cube_uv_reflection_fragment:Uu,defaultnormal_vertex:Iu,displacementmap_pars_vertex:Nu,displacementmap_vertex:Fu,emissivemap_fragment:Ou,emissivemap_pars_fragment:Bu,colorspace_fragment:zu,colorspace_pars_fragment:Hu,envmap_fragment:ku,envmap_common_pars_fragment:Gu,envmap_pars_fragment:Vu,envmap_pars_vertex:Wu,envmap_physical_pars_fragment:th,envmap_vertex:Xu,fog_vertex:Yu,fog_pars_vertex:qu,fog_fragment:Zu,fog_pars_fragment:Ku,gradientmap_pars_fragment:ju,lightmap_pars_fragment:$u,lights_lambert_fragment:Ju,lights_lambert_pars_fragment:Qu,lights_pars_begin:eh,lights_toon_fragment:nh,lights_toon_pars_fragment:ih,lights_phong_fragment:rh,lights_phong_pars_fragment:sh,lights_physical_fragment:ah,lights_physical_pars_fragment:oh,lights_fragment_begin:lh,lights_fragment_maps:ch,lights_fragment_end:uh,logdepthbuf_fragment:hh,logdepthbuf_pars_fragment:dh,logdepthbuf_pars_vertex:fh,logdepthbuf_vertex:ph,map_fragment:mh,map_pars_fragment:_h,map_particle_fragment:gh,map_particle_pars_fragment:vh,metalnessmap_fragment:xh,metalnessmap_pars_fragment:Sh,morphinstance_vertex:Mh,morphcolor_vertex:Eh,morphnormal_vertex:yh,morphtarget_pars_vertex:Th,morphtarget_vertex:Ah,normal_fragment_begin:bh,normal_fragment_maps:wh,normal_pars_fragment:Rh,normal_pars_vertex:Ch,normal_vertex:Ph,normalmap_pars_fragment:Lh,clearcoat_normal_fragment_begin:Dh,clearcoat_normal_fragment_maps:Uh,clearcoat_pars_fragment:Ih,iridescence_pars_fragment:Nh,opaque_fragment:Fh,packing:Oh,premultiplied_alpha_fragment:Bh,project_vertex:zh,dithering_fragment:Hh,dithering_pars_fragment:kh,roughnessmap_fragment:Gh,roughnessmap_pars_fragment:Vh,shadowmap_pars_fragment:Wh,shadowmap_pars_vertex:Xh,shadowmap_vertex:Yh,shadowmask_pars_fragment:qh,skinbase_vertex:Zh,skinning_pars_vertex:Kh,skinning_vertex:jh,skinnormal_vertex:$h,specularmap_fragment:Jh,specularmap_pars_fragment:Qh,tonemapping_fragment:ed,tonemapping_pars_fragment:td,transmission_fragment:nd,transmission_pars_fragment:id,uv_pars_fragment:rd,uv_pars_vertex:sd,uv_vertex:ad,worldpos_vertex:od,background_vert:ld,background_frag:cd,backgroundCube_vert:ud,backgroundCube_frag:hd,cube_vert:dd,cube_frag:fd,depth_vert:pd,depth_frag:md,distanceRGBA_vert:_d,distanceRGBA_frag:gd,equirect_vert:vd,equirect_frag:xd,linedashed_vert:Sd,linedashed_frag:Md,meshbasic_vert:Ed,meshbasic_frag:yd,meshlambert_vert:Td,meshlambert_frag:Ad,meshmatcap_vert:bd,meshmatcap_frag:wd,meshnormal_vert:Rd,meshnormal_frag:Cd,meshphong_vert:Pd,meshphong_frag:Ld,meshphysical_vert:Dd,meshphysical_frag:Ud,meshtoon_vert:Id,meshtoon_frag:Nd,points_vert:Fd,points_frag:Od,shadow_vert:Bd,shadow_frag:zd,sprite_vert:Hd,sprite_frag:kd},ae={common:{diffuse:{value:new we(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oe}},envmap:{envMap:{value:null},envMapRotation:{value:new Oe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Oe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oe},normalScale:{value:new De(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new we(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 we(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0},uvTransform:{value:new Oe}},sprite:{diffuse:{value:new we(16777215)},opacity:{value:1},center:{value:new De(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}}},an={basic:{uniforms:At([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.fog]),vertexShader:Fe.meshbasic_vert,fragmentShader:Fe.meshbasic_frag},lambert:{uniforms:At([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new we(0)}}]),vertexShader:Fe.meshlambert_vert,fragmentShader:Fe.meshlambert_frag},phong:{uniforms:At([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new we(0)},specular:{value:new we(1118481)},shininess:{value:30}}]),vertexShader:Fe.meshphong_vert,fragmentShader:Fe.meshphong_frag},standard:{uniforms:At([ae.common,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.roughnessmap,ae.metalnessmap,ae.fog,ae.lights,{emissive:{value:new we(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag},toon:{uniforms:At([ae.common,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.gradientmap,ae.fog,ae.lights,{emissive:{value:new we(0)}}]),vertexShader:Fe.meshtoon_vert,fragmentShader:Fe.meshtoon_frag},matcap:{uniforms:At([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,{matcap:{value:null}}]),vertexShader:Fe.meshmatcap_vert,fragmentShader:Fe.meshmatcap_frag},points:{uniforms:At([ae.points,ae.fog]),vertexShader:Fe.points_vert,fragmentShader:Fe.points_frag},dashed:{uniforms:At([ae.common,ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fe.linedashed_vert,fragmentShader:Fe.linedashed_frag},depth:{uniforms:At([ae.common,ae.displacementmap]),vertexShader:Fe.depth_vert,fragmentShader:Fe.depth_frag},normal:{uniforms:At([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,{opacity:{value:1}}]),vertexShader:Fe.meshnormal_vert,fragmentShader:Fe.meshnormal_frag},sprite:{uniforms:At([ae.sprite,ae.fog]),vertexShader:Fe.sprite_vert,fragmentShader:Fe.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fe.background_vert,fragmentShader:Fe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Oe}},vertexShader:Fe.backgroundCube_vert,fragmentShader:Fe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fe.cube_vert,fragmentShader:Fe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fe.equirect_vert,fragmentShader:Fe.equirect_frag},distanceRGBA:{uniforms:At([ae.common,ae.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fe.distanceRGBA_vert,fragmentShader:Fe.distanceRGBA_frag},shadow:{uniforms:At([ae.lights,ae.fog,{color:{value:new we(0)},opacity:{value:1}}]),vertexShader:Fe.shadow_vert,fragmentShader:Fe.shadow_frag}};an.physical={uniforms:At([an.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oe},clearcoatNormalScale:{value:new De(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oe},sheen:{value:0},sheenColor:{value:new we(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oe},transmissionSamplerSize:{value:new De},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oe},attenuationDistance:{value:0},attenuationColor:{value:new we(0)},specularColor:{value:new we(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oe},anisotropyVector:{value:new De},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oe}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag};const mr={r:0,b:0,g:0},kn=new En,Gd=new rt;function Vd(i,e,t,n,r,s,o){const a=new we(0);let l=s===!0?0:1,c,u,f=null,p=0,m=null;function _(A){let E=A.isScene===!0?A.background:null;return E&&E.isTexture&&(E=(A.backgroundBlurriness>0?t:e).get(E)),E}function x(A){let E=!1;const T=_(A);T===null?d(a,l):T&&T.isColor&&(d(T,1),E=!0);const z=i.xr.getEnvironmentBlendMode();z==="additive"?n.buffers.color.setClear(0,0,0,1,o):z==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function h(A,E){const T=_(E);T&&(T.isCubeTexture||T.mapping===Yr)?(u===void 0&&(u=new Nt(new Zi(1,1,1),new yt({name:"BackgroundCubeMaterial",uniforms:Ri(an.backgroundCube.uniforms),vertexShader:an.backgroundCube.vertexShader,fragmentShader:an.backgroundCube.fragmentShader,side:Ft,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(z,L,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),kn.copy(E.backgroundRotation),kn.x*=-1,kn.y*=-1,kn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(kn.y*=-1,kn.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Gd.makeRotationFromEuler(kn)),u.material.toneMapped=Ze.getTransfer(T.colorSpace)!==nt,(f!==T||p!==T.version||m!==i.toneMapping)&&(u.material.needsUpdate=!0,f=T,p=T.version,m=i.toneMapping),u.layers.enableAll(),A.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new Nt(new Ci(2,2),new yt({name:"BackgroundMaterial",uniforms:Ri(an.background.uniforms),vertexShader:an.background.vertexShader,fragmentShader:an.background.fragmentShader,side:In,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=Ze.getTransfer(T.colorSpace)!==nt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(f!==T||p!==T.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,f=T,p=T.version,m=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function d(A,E){A.getRGB(mr,Rl(i)),n.buffers.color.setClear(mr.r,mr.g,mr.b,E,o)}return{getClearColor:function(){return a},setClearColor:function(A,E=1){a.set(A),l=E,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,d(a,l)},render:x,addToRenderList:h}}function Wd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null);let s=r,o=!1;function a(g,M,W,k,K){let Q=!1;const X=f(k,W,M);s!==X&&(s=X,c(s.object)),Q=m(g,k,W,K),Q&&_(g,k,W,K),K!==null&&e.update(K,i.ELEMENT_ARRAY_BUFFER),(Q||o)&&(o=!1,T(g,M,W,k),K!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(K).buffer))}function l(){return i.createVertexArray()}function c(g){return i.bindVertexArray(g)}function u(g){return i.deleteVertexArray(g)}function f(g,M,W){const k=W.wireframe===!0;let K=n[g.id];K===void 0&&(K={},n[g.id]=K);let Q=K[M.id];Q===void 0&&(Q={},K[M.id]=Q);let X=Q[k];return X===void 0&&(X=p(l()),Q[k]=X),X}function p(g){const M=[],W=[],k=[];for(let K=0;K=0){const pe=K[V];let ve=Q[V];if(ve===void 0&&(V==="instanceMatrix"&&g.instanceMatrix&&(ve=g.instanceMatrix),V==="instanceColor"&&g.instanceColor&&(ve=g.instanceColor)),pe===void 0||pe.attribute!==ve||ve&&pe.data!==ve.data)return!0;X++}return s.attributesNum!==X||s.index!==k}function _(g,M,W,k){const K={},Q=M.attributes;let X=0;const J=W.getAttributes();for(const V in J)if(J[V].location>=0){let pe=Q[V];pe===void 0&&(V==="instanceMatrix"&&g.instanceMatrix&&(pe=g.instanceMatrix),V==="instanceColor"&&g.instanceColor&&(pe=g.instanceColor));const ve={};ve.attribute=pe,pe&&pe.data&&(ve.data=pe.data),K[V]=ve,X++}s.attributes=K,s.attributesNum=X,s.index=k}function x(){const g=s.newAttributes;for(let M=0,W=g.length;M=0){let fe=K[J];if(fe===void 0&&(J==="instanceMatrix"&&g.instanceMatrix&&(fe=g.instanceMatrix),J==="instanceColor"&&g.instanceColor&&(fe=g.instanceColor)),fe!==void 0){const pe=fe.normalized,ve=fe.itemSize,We=e.get(fe);if(We===void 0)continue;const Ye=We.buffer,Y=We.type,te=We.bytesPerElement,_e=Y===i.INT||Y===i.UNSIGNED_INT||fe.gpuType===ba;if(fe.isInterleavedBufferAttribute){const me=fe.data,Ne=me.stride,be=fe.offset;if(me.isInstancedInterleavedBuffer){for(let He=0;He0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.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 f=t.logarithmicDepthBuffer===!0,p=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const b=e.get("EXT_clip_control");b.clipControlEXT(b.LOWER_LEFT_EXT,b.ZERO_TO_ONE_EXT)}const m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),A=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),T=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),z=_>0,L=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:m,maxVertexTextures:_,maxTextureSize:x,maxCubemapSize:h,maxAttributes:d,maxVertexUniforms:A,maxVaryings:E,maxFragmentUniforms:T,vertexTextures:z,maxSamples:L}}function qd(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new Vn,a=new Oe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const m=f.length!==0||p||n!==0||r;return r=p,n=f.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,m){const _=f.clippingPlanes,x=f.clipIntersection,h=f.clipShadows,d=i.get(f);if(!r||_===null||_.length===0||s&&!h)s?u(null):c();else{const A=s?0:n,E=A*4;let T=d.clippingState||null;l.value=T,T=u(_,p,E,m);for(let z=0;z!==E;++z)T[z]=t[z];d.clippingState=T,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,m,_){const x=f!==null?f.length:0;let h=null;if(x!==0){if(h=l.value,_!==!0||h===null){const d=m+x*4,A=p.matrixWorldInverse;a.getNormalMatrix(A),(h===null||h.length0){const c=new su(l.height);return c.fromEquirectangularTexture(i,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Na extends Ua{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=r+t,l=r-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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,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 xi=4,vo=[.125,.215,.35,.446,.526,.582],Yn=20,Ts=new Na,xo=new we;let As=null,bs=0,ws=0,Rs=!1;const Wn=(1+Math.sqrt(5))/2,mi=1/Wn,So=[new U(-Wn,mi,0),new U(Wn,mi,0),new U(-mi,0,Wn),new U(mi,0,Wn),new U(0,Wn,-mi),new U(0,Wn,mi),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)];class Mo{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,r=100){As=this._renderer.getRenderTarget(),bs=this._renderer.getActiveCubeFace(),ws=this._renderer.getActiveMipmapLevel(),Rs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,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=To(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=yo(),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?E:0,E,E),u.setRenderTarget(r),x&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=p,u.autoClear=f,e.background=h}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Ti||e.mapping===Ai;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=To()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=yo());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Nt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;_r(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Ts)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sYn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${Yn}`);const d=[];let A=0;for(let b=0;bE-xi?r-E+xi:0),L=4*(this._cubeSize-T);_r(t,z,L,3*T,2*T),l.setRenderTarget(t),l.render(f,Ts)}}function Kd(i){const e=[],t=[],n=[];let r=i;const s=i-xi+1+vo.length;for(let o=0;oi-xi?l=vo[o-i+xi-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],m=6,_=6,x=3,h=2,d=1,A=new Float32Array(x*_*m),E=new Float32Array(h*_*m),T=new Float32Array(d*_*m);for(let L=0;L2?0:-1,ie=[b,B,0,b+2/3,B,0,b+2/3,B+1,0,b,B,0,b+2/3,B+1,0,b,B+1,0];A.set(ie,x*_*L),E.set(p,h*_*L);const g=[L,L,L,L,L,L];T.set(g,d*_*L)}const z=new rn;z.setAttribute("position",new Gt(A,x)),z.setAttribute("uv",new Gt(E,h)),z.setAttribute("faceIndex",new Gt(T,d)),e.push(z),r>xi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Eo(i,e,t){const n=new $n(i,e,t);return n.texture.mapping=Yr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function _r(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function jd(i,e,t){const n=new Float32Array(Yn),r=new U(0,1,0);return new yt({name:"SphericalGaussianBlur",defines:{n:Yn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Fa(),fragmentShader:` +}`,Fe={alphahash_fragment:cu,alphahash_pars_fragment:uu,alphamap_fragment:hu,alphamap_pars_fragment:du,alphatest_fragment:fu,alphatest_pars_fragment:pu,aomap_fragment:mu,aomap_pars_fragment:_u,batching_pars_vertex:gu,batching_vertex:vu,begin_vertex:xu,beginnormal_vertex:Su,bsdfs:Mu,iridescence_fragment:Eu,bumpmap_pars_fragment:yu,clipping_planes_fragment:Tu,clipping_planes_pars_fragment:Au,clipping_planes_pars_vertex:bu,clipping_planes_vertex:wu,color_fragment:Ru,color_pars_fragment:Cu,color_pars_vertex:Pu,color_vertex:Lu,common:Du,cube_uv_reflection_fragment:Uu,defaultnormal_vertex:Iu,displacementmap_pars_vertex:Nu,displacementmap_vertex:Fu,emissivemap_fragment:Ou,emissivemap_pars_fragment:Bu,colorspace_fragment:zu,colorspace_pars_fragment:Hu,envmap_fragment:ku,envmap_common_pars_fragment:Gu,envmap_pars_fragment:Vu,envmap_pars_vertex:Wu,envmap_physical_pars_fragment:th,envmap_vertex:Xu,fog_vertex:Yu,fog_pars_vertex:qu,fog_fragment:Zu,fog_pars_fragment:Ku,gradientmap_pars_fragment:ju,lightmap_pars_fragment:$u,lights_lambert_fragment:Ju,lights_lambert_pars_fragment:Qu,lights_pars_begin:eh,lights_toon_fragment:nh,lights_toon_pars_fragment:ih,lights_phong_fragment:rh,lights_phong_pars_fragment:sh,lights_physical_fragment:ah,lights_physical_pars_fragment:oh,lights_fragment_begin:lh,lights_fragment_maps:ch,lights_fragment_end:uh,logdepthbuf_fragment:hh,logdepthbuf_pars_fragment:dh,logdepthbuf_pars_vertex:fh,logdepthbuf_vertex:ph,map_fragment:mh,map_pars_fragment:_h,map_particle_fragment:gh,map_particle_pars_fragment:vh,metalnessmap_fragment:xh,metalnessmap_pars_fragment:Sh,morphinstance_vertex:Mh,morphcolor_vertex:Eh,morphnormal_vertex:yh,morphtarget_pars_vertex:Th,morphtarget_vertex:Ah,normal_fragment_begin:bh,normal_fragment_maps:wh,normal_pars_fragment:Rh,normal_pars_vertex:Ch,normal_vertex:Ph,normalmap_pars_fragment:Lh,clearcoat_normal_fragment_begin:Dh,clearcoat_normal_fragment_maps:Uh,clearcoat_pars_fragment:Ih,iridescence_pars_fragment:Nh,opaque_fragment:Fh,packing:Oh,premultiplied_alpha_fragment:Bh,project_vertex:zh,dithering_fragment:Hh,dithering_pars_fragment:kh,roughnessmap_fragment:Gh,roughnessmap_pars_fragment:Vh,shadowmap_pars_fragment:Wh,shadowmap_pars_vertex:Xh,shadowmap_vertex:Yh,shadowmask_pars_fragment:qh,skinbase_vertex:Zh,skinning_pars_vertex:Kh,skinning_vertex:jh,skinnormal_vertex:$h,specularmap_fragment:Jh,specularmap_pars_fragment:Qh,tonemapping_fragment:ed,tonemapping_pars_fragment:td,transmission_fragment:nd,transmission_pars_fragment:id,uv_pars_fragment:rd,uv_pars_vertex:sd,uv_vertex:ad,worldpos_vertex:od,background_vert:ld,background_frag:cd,backgroundCube_vert:ud,backgroundCube_frag:hd,cube_vert:dd,cube_frag:fd,depth_vert:pd,depth_frag:md,distanceRGBA_vert:_d,distanceRGBA_frag:gd,equirect_vert:vd,equirect_frag:xd,linedashed_vert:Sd,linedashed_frag:Md,meshbasic_vert:Ed,meshbasic_frag:yd,meshlambert_vert:Td,meshlambert_frag:Ad,meshmatcap_vert:bd,meshmatcap_frag:wd,meshnormal_vert:Rd,meshnormal_frag:Cd,meshphong_vert:Pd,meshphong_frag:Ld,meshphysical_vert:Dd,meshphysical_frag:Ud,meshtoon_vert:Id,meshtoon_frag:Nd,points_vert:Fd,points_frag:Od,shadow_vert:Bd,shadow_frag:zd,sprite_vert:Hd,sprite_frag:kd},ae={common:{diffuse:{value:new we(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oe}},envmap:{envMap:{value:null},envMapRotation:{value:new Oe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Oe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oe},normalScale:{value:new Le(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new we(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 we(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0},uvTransform:{value:new Oe}},sprite:{diffuse:{value:new we(16777215)},opacity:{value:1},center:{value:new Le(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}}},an={basic:{uniforms:At([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.fog]),vertexShader:Fe.meshbasic_vert,fragmentShader:Fe.meshbasic_frag},lambert:{uniforms:At([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new we(0)}}]),vertexShader:Fe.meshlambert_vert,fragmentShader:Fe.meshlambert_frag},phong:{uniforms:At([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new we(0)},specular:{value:new we(1118481)},shininess:{value:30}}]),vertexShader:Fe.meshphong_vert,fragmentShader:Fe.meshphong_frag},standard:{uniforms:At([ae.common,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.roughnessmap,ae.metalnessmap,ae.fog,ae.lights,{emissive:{value:new we(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag},toon:{uniforms:At([ae.common,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.gradientmap,ae.fog,ae.lights,{emissive:{value:new we(0)}}]),vertexShader:Fe.meshtoon_vert,fragmentShader:Fe.meshtoon_frag},matcap:{uniforms:At([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,{matcap:{value:null}}]),vertexShader:Fe.meshmatcap_vert,fragmentShader:Fe.meshmatcap_frag},points:{uniforms:At([ae.points,ae.fog]),vertexShader:Fe.points_vert,fragmentShader:Fe.points_frag},dashed:{uniforms:At([ae.common,ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fe.linedashed_vert,fragmentShader:Fe.linedashed_frag},depth:{uniforms:At([ae.common,ae.displacementmap]),vertexShader:Fe.depth_vert,fragmentShader:Fe.depth_frag},normal:{uniforms:At([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,{opacity:{value:1}}]),vertexShader:Fe.meshnormal_vert,fragmentShader:Fe.meshnormal_frag},sprite:{uniforms:At([ae.sprite,ae.fog]),vertexShader:Fe.sprite_vert,fragmentShader:Fe.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fe.background_vert,fragmentShader:Fe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Oe}},vertexShader:Fe.backgroundCube_vert,fragmentShader:Fe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fe.cube_vert,fragmentShader:Fe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fe.equirect_vert,fragmentShader:Fe.equirect_frag},distanceRGBA:{uniforms:At([ae.common,ae.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fe.distanceRGBA_vert,fragmentShader:Fe.distanceRGBA_frag},shadow:{uniforms:At([ae.lights,ae.fog,{color:{value:new we(0)},opacity:{value:1}}]),vertexShader:Fe.shadow_vert,fragmentShader:Fe.shadow_frag}};an.physical={uniforms:At([an.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oe},clearcoatNormalScale:{value:new Le(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oe},sheen:{value:0},sheenColor:{value:new we(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oe},transmissionSamplerSize:{value:new Le},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oe},attenuationDistance:{value:0},attenuationColor:{value:new we(0)},specularColor:{value:new we(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oe},anisotropyVector:{value:new Le},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oe}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag};const mr={r:0,b:0,g:0},kn=new En,Gd=new rt;function Vd(i,e,t,n,r,s,o){const a=new we(0);let l=s===!0?0:1,c,u,f=null,p=0,m=null;function _(A){let E=A.isScene===!0?A.background:null;return E&&E.isTexture&&(E=(A.backgroundBlurriness>0?t:e).get(E)),E}function x(A){let E=!1;const T=_(A);T===null?d(a,l):T&&T.isColor&&(d(T,1),E=!0);const z=i.xr.getEnvironmentBlendMode();z==="additive"?n.buffers.color.setClear(0,0,0,1,o):z==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function h(A,E){const T=_(E);T&&(T.isCubeTexture||T.mapping===Yr)?(u===void 0&&(u=new Nt(new Zi(1,1,1),new yt({name:"BackgroundCubeMaterial",uniforms:Ri(an.backgroundCube.uniforms),vertexShader:an.backgroundCube.vertexShader,fragmentShader:an.backgroundCube.fragmentShader,side:Ft,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(z,L,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),kn.copy(E.backgroundRotation),kn.x*=-1,kn.y*=-1,kn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(kn.y*=-1,kn.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Gd.makeRotationFromEuler(kn)),u.material.toneMapped=Ze.getTransfer(T.colorSpace)!==nt,(f!==T||p!==T.version||m!==i.toneMapping)&&(u.material.needsUpdate=!0,f=T,p=T.version,m=i.toneMapping),u.layers.enableAll(),A.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new Nt(new Ci(2,2),new yt({name:"BackgroundMaterial",uniforms:Ri(an.background.uniforms),vertexShader:an.background.vertexShader,fragmentShader:an.background.fragmentShader,side:In,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=Ze.getTransfer(T.colorSpace)!==nt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(f!==T||p!==T.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,f=T,p=T.version,m=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function d(A,E){A.getRGB(mr,Rl(i)),n.buffers.color.setClear(mr.r,mr.g,mr.b,E,o)}return{getClearColor:function(){return a},setClearColor:function(A,E=1){a.set(A),l=E,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,d(a,l)},render:x,addToRenderList:h}}function Wd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null);let s=r,o=!1;function a(g,M,V,H,K){let Q=!1;const W=f(H,V,M);s!==W&&(s=W,c(s.object)),Q=m(g,H,V,K),Q&&_(g,H,V,K),K!==null&&e.update(K,i.ELEMENT_ARRAY_BUFFER),(Q||o)&&(o=!1,T(g,M,V,H),K!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(K).buffer))}function l(){return i.createVertexArray()}function c(g){return i.bindVertexArray(g)}function u(g){return i.deleteVertexArray(g)}function f(g,M,V){const H=V.wireframe===!0;let K=n[g.id];K===void 0&&(K={},n[g.id]=K);let Q=K[M.id];Q===void 0&&(Q={},K[M.id]=Q);let W=Q[H];return W===void 0&&(W=p(l()),Q[H]=W),W}function p(g){const M=[],V=[],H=[];for(let K=0;K=0){const pe=K[G];let ve=Q[G];if(ve===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(ve=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(ve=g.instanceColor)),pe===void 0||pe.attribute!==ve||ve&&pe.data!==ve.data)return!0;W++}return s.attributesNum!==W||s.index!==H}function _(g,M,V,H){const K={},Q=M.attributes;let W=0;const J=V.getAttributes();for(const G in J)if(J[G].location>=0){let pe=Q[G];pe===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(pe=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(pe=g.instanceColor));const ve={};ve.attribute=pe,pe&&pe.data&&(ve.data=pe.data),K[G]=ve,W++}s.attributes=K,s.attributesNum=W,s.index=H}function x(){const g=s.newAttributes;for(let M=0,V=g.length;M=0){let fe=K[J];if(fe===void 0&&(J==="instanceMatrix"&&g.instanceMatrix&&(fe=g.instanceMatrix),J==="instanceColor"&&g.instanceColor&&(fe=g.instanceColor)),fe!==void 0){const pe=fe.normalized,ve=fe.itemSize,We=e.get(fe);if(We===void 0)continue;const Ye=We.buffer,Y=We.type,te=We.bytesPerElement,_e=Y===i.INT||Y===i.UNSIGNED_INT||fe.gpuType===ba;if(fe.isInterleavedBufferAttribute){const me=fe.data,Ne=me.stride,be=fe.offset;if(me.isInstancedInterleavedBuffer){for(let He=0;He0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.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 f=t.logarithmicDepthBuffer===!0,p=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const b=e.get("EXT_clip_control");b.clipControlEXT(b.LOWER_LEFT_EXT,b.ZERO_TO_ONE_EXT)}const m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),A=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),T=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),z=_>0,L=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:m,maxVertexTextures:_,maxTextureSize:x,maxCubemapSize:h,maxAttributes:d,maxVertexUniforms:A,maxVaryings:E,maxFragmentUniforms:T,vertexTextures:z,maxSamples:L}}function qd(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new Vn,a=new Oe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const m=f.length!==0||p||n!==0||r;return r=p,n=f.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,m){const _=f.clippingPlanes,x=f.clipIntersection,h=f.clipShadows,d=i.get(f);if(!r||_===null||_.length===0||s&&!h)s?u(null):c();else{const A=s?0:n,E=A*4;let T=d.clippingState||null;l.value=T,T=u(_,p,E,m);for(let z=0;z!==E;++z)T[z]=t[z];d.clippingState=T,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,m,_){const x=f!==null?f.length:0;let h=null;if(x!==0){if(h=l.value,_!==!0||h===null){const d=m+x*4,A=p.matrixWorldInverse;a.getNormalMatrix(A),(h===null||h.length0){const c=new su(l.height);return c.fromEquirectangularTexture(i,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Na extends Ua{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=r+t,l=r-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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,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 vi=4,vo=[.125,.215,.35,.446,.526,.582],Yn=20,Ts=new Na,xo=new we;let As=null,bs=0,ws=0,Rs=!1;const Wn=(1+Math.sqrt(5))/2,pi=1/Wn,So=[new U(-Wn,pi,0),new U(Wn,pi,0),new U(-pi,0,Wn),new U(pi,0,Wn),new U(0,Wn,-pi),new U(0,Wn,pi),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)];class Mo{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,r=100){As=this._renderer.getRenderTarget(),bs=this._renderer.getActiveCubeFace(),ws=this._renderer.getActiveMipmapLevel(),Rs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,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=To(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=yo(),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?E:0,E,E),u.setRenderTarget(r),x&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=p,u.autoClear=f,e.background=h}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Ti||e.mapping===Ai;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=To()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=yo());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Nt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;_r(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Ts)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sYn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${Yn}`);const d=[];let A=0;for(let b=0;bE-vi?r-E+vi:0),L=4*(this._cubeSize-T);_r(t,z,L,3*T,2*T),l.setRenderTarget(t),l.render(f,Ts)}}function Kd(i){const e=[],t=[],n=[];let r=i;const s=i-vi+1+vo.length;for(let o=0;oi-vi?l=vo[o-i+vi-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],m=6,_=6,x=3,h=2,d=1,A=new Float32Array(x*_*m),E=new Float32Array(h*_*m),T=new Float32Array(d*_*m);for(let L=0;L2?0:-1,ie=[b,B,0,b+2/3,B,0,b+2/3,B+1,0,b,B,0,b+2/3,B+1,0,b,B+1,0];A.set(ie,x*_*L),E.set(p,h*_*L);const g=[L,L,L,L,L,L];T.set(g,d*_*L)}const z=new rn;z.setAttribute("position",new Gt(A,x)),z.setAttribute("uv",new Gt(E,h)),z.setAttribute("faceIndex",new Gt(T,d)),e.push(z),r>vi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Eo(i,e,t){const n=new jn(i,e,t);return n.texture.mapping=Yr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function _r(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function jd(i,e,t){const n=new Float32Array(Yn),r=new U(0,1,0);return new yt({name:"SphericalGaussianBlur",defines:{n:Yn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Fa(),fragmentShader:` precision mediump float; precision mediump int; @@ -3734,7 +3734,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function $d(i){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ys||l===qs,u=l===Ti||l===Ai;if(c||u){let f=e.get(a);const p=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return t===null&&(t=new Mo(i)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const m=a.image;return c&&m&&m.height>0||u&&m&&r(m)?(t===null&&(t=new Mo(i)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(L=Math.ceil(z/e.maxTextureSize),z=e.maxTextureSize);const b=new Float32Array(z*L*4*f),B=new Ml(b,z,L,f);B.type=tn,B.needsUpdate=!0;const ie=T*4;for(let M=0;M0)return i;const r=e*t;let s=bo[r];if(s===void 0&&(s=new Float32Array(r),bo[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function pt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0||u&&m&&r(m)?(t===null&&(t=new Mo(i)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(L=Math.ceil(z/e.maxTextureSize),z=e.maxTextureSize);const b=new Float32Array(z*L*4*f),B=new Ml(b,z,L,f);B.type=tn,B.needsUpdate=!0;const ie=T*4;for(let M=0;M0)return i;const r=e*t;let s=bo[r];if(s===void 0&&(s=new Float32Array(r),bo[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function pt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t":" "} ${a}: ${t[o]}`)}return n.join(` `)}function Jf(i){const e=Ze.getPrimaries(Ze.workingColorSpace),t=Ze.getPrimaries(i);let n;switch(e===t?n="":e===Hr&&t===zr?n="LinearDisplayP3ToLinearSRGB":e===zr&&t===Hr&&(n="LinearSRGBToLinearDisplayP3"),i){case Nn:case qr:return[n,"LinearTransferOETF"];case sn:case Da:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function Uo(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` @@ -3777,14 +3777,14 @@ void main() { `)+` `+h,d=["#define varying in",t.glslVersion===Qa?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Qa?"":"#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(` `)+` -`+d);const E=A+h+o,T=A+d+a,z=Do(r,r.VERTEX_SHADER,E),L=Do(r,r.FRAGMENT_SHADER,T);r.attachShader(x,z),r.attachShader(x,L),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function b(M){if(i.debug.checkShaderErrors){const W=r.getProgramInfoLog(x).trim(),k=r.getShaderInfoLog(z).trim(),K=r.getShaderInfoLog(L).trim();let Q=!0,X=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(Q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,x,z,L);else{const J=Uo(r,z,"vertex"),V=Uo(r,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+` +`+d);const E=A+h+o,T=A+d+a,z=Do(r,r.VERTEX_SHADER,E),L=Do(r,r.FRAGMENT_SHADER,T);r.attachShader(x,z),r.attachShader(x,L),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function b(M){if(i.debug.checkShaderErrors){const V=r.getProgramInfoLog(x).trim(),H=r.getShaderInfoLog(z).trim(),K=r.getShaderInfoLog(L).trim();let Q=!0,W=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(Q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,x,z,L);else{const J=Uo(r,z,"vertex"),G=Uo(r,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+` Material Name: `+M.name+` Material Type: `+M.type+` -Program Info Log: `+W+` +Program Info Log: `+V+` `+J+` -`+V)}else W!==""?console.warn("THREE.WebGLProgram: Program Info Log:",W):(k===""||K==="")&&(X=!1);X&&(M.diagnostics={runnable:Q,programLog:W,vertexShader:{log:k,prefix:h},fragmentShader:{log:K,prefix:d}})}r.deleteShader(z),r.deleteShader(L),B=new Fr(r,x),ie=rp(r,x)}let B;this.getUniforms=function(){return B===void 0&&b(this),B};let ie;this.getAttributes=function(){return ie===void 0&&b(this),ie};let g=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=r.getProgramParameter(x,Kf)),g},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jf++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=z,this.fragmentShader=L,this}let _p=0;class gp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new vp(e),t.set(e,n)),n}}class vp{constructor(e){this.id=_p++,this.code=e,this.usedTimes=0}}function xp(i,e,t,n,r,s,o){const a=new yl,l=new gp,c=new Set,u=[],f=r.logarithmicDepthBuffer,p=r.reverseDepthBuffer,m=r.vertexTextures;let _=r.precision;const x={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 h(g){return c.add(g),g===0?"uv":`uv${g}`}function d(g,M,W,k,K){const Q=k.fog,X=K.geometry,J=g.isMeshStandardMaterial?k.environment:null,V=(g.isMeshStandardMaterial?t:e).get(g.envMap||J),fe=V&&V.mapping===Yr?V.image.height:null,pe=x[g.type];g.precision!==null&&(_=r.getMaxPrecision(g.precision),_!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",_,"instead."));const ve=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,We=ve!==void 0?ve.length:0;let Ye=0;X.morphAttributes.position!==void 0&&(Ye=1),X.morphAttributes.normal!==void 0&&(Ye=2),X.morphAttributes.color!==void 0&&(Ye=3);let Y,te,_e,me;if(pe){const Ct=an[pe];Y=Ct.vertexShader,te=Ct.fragmentShader}else Y=g.vertexShader,te=g.fragmentShader,l.update(g),_e=l.getVertexShaderID(g),me=l.getFragmentShaderID(g);const Ne=i.getRenderTarget(),be=K.isInstancedMesh===!0,He=K.isBatchedMesh===!0,Ke=!!g.map,Ge=!!g.matcap,R=!!V,vt=!!g.aoMap,Be=!!g.lightMap,Ve=!!g.bumpMap,Re=!!g.normalMap,Qe=!!g.displacementMap,Ce=!!g.emissiveMap,y=!!g.metalnessMap,v=!!g.roughnessMap,I=g.anisotropy>0,Z=g.clearcoat>0,ee=g.dispersion>0,q=g.iridescence>0,xe=g.sheen>0,oe=g.transmission>0,w=I&&!!g.anisotropyMap,re=Z&&!!g.clearcoatMap,j=Z&&!!g.clearcoatNormalMap,se=Z&&!!g.clearcoatRoughnessMap,Me=q&&!!g.iridescenceMap,Te=q&&!!g.iridescenceThicknessMap,ue=xe&&!!g.sheenColorMap,ze=xe&&!!g.sheenRoughnessMap,Ae=!!g.specularMap,ke=!!g.specularColorMap,C=!!g.specularIntensityMap,he=oe&&!!g.transmissionMap,G=oe&&!!g.thicknessMap,$=!!g.gradientMap,le=!!g.alphaMap,de=g.alphaTest>0,Xe=!!g.alphaHash,ht=!!g.extensions;let Rt=Un;g.toneMapped&&(Ne===null||Ne.isXRRenderTarget===!0)&&(Rt=i.toneMapping);const qe={shaderID:pe,shaderType:g.type,shaderName:g.name,vertexShader:Y,fragmentShader:te,defines:g.defines,customVertexShaderID:_e,customFragmentShaderID:me,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:_,batching:He,batchingColor:He&&K._colorsTexture!==null,instancing:be,instancingColor:be&&K.instanceColor!==null,instancingMorph:be&&K.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Ne===null?i.outputColorSpace:Ne.isXRRenderTarget===!0?Ne.texture.colorSpace:Nn,alphaToCoverage:!!g.alphaToCoverage,map:Ke,matcap:Ge,envMap:R,envMapMode:R&&V.mapping,envMapCubeUVHeight:fe,aoMap:vt,lightMap:Be,bumpMap:Ve,normalMap:Re,displacementMap:m&&Qe,emissiveMap:Ce,normalMapObjectSpace:Re&&g.normalMapType===Ac,normalMapTangentSpace:Re&&g.normalMapType===Tc,metalnessMap:y,roughnessMap:v,anisotropy:I,anisotropyMap:w,clearcoat:Z,clearcoatMap:re,clearcoatNormalMap:j,clearcoatRoughnessMap:se,dispersion:ee,iridescence:q,iridescenceMap:Me,iridescenceThicknessMap:Te,sheen:xe,sheenColorMap:ue,sheenRoughnessMap:ze,specularMap:Ae,specularColorMap:ke,specularIntensityMap:C,transmission:oe,transmissionMap:he,thicknessMap:G,gradientMap:$,opaque:g.transparent===!1&&g.blending===Si&&g.alphaToCoverage===!1,alphaMap:le,alphaTest:de,alphaHash:Xe,combine:g.combine,mapUv:Ke&&h(g.map.channel),aoMapUv:vt&&h(g.aoMap.channel),lightMapUv:Be&&h(g.lightMap.channel),bumpMapUv:Ve&&h(g.bumpMap.channel),normalMapUv:Re&&h(g.normalMap.channel),displacementMapUv:Qe&&h(g.displacementMap.channel),emissiveMapUv:Ce&&h(g.emissiveMap.channel),metalnessMapUv:y&&h(g.metalnessMap.channel),roughnessMapUv:v&&h(g.roughnessMap.channel),anisotropyMapUv:w&&h(g.anisotropyMap.channel),clearcoatMapUv:re&&h(g.clearcoatMap.channel),clearcoatNormalMapUv:j&&h(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:se&&h(g.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&h(g.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&h(g.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&h(g.sheenColorMap.channel),sheenRoughnessMapUv:ze&&h(g.sheenRoughnessMap.channel),specularMapUv:Ae&&h(g.specularMap.channel),specularColorMapUv:ke&&h(g.specularColorMap.channel),specularIntensityMapUv:C&&h(g.specularIntensityMap.channel),transmissionMapUv:he&&h(g.transmissionMap.channel),thicknessMapUv:G&&h(g.thicknessMap.channel),alphaMapUv:le&&h(g.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Re||I),vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:K.isPoints===!0&&!!X.attributes.uv&&(Ke||le),fog:!!Q,useFog:g.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:g.flatShading===!0,sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:K.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:We,morphTextureStride:Ye,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:g.dithering,shadowMapEnabled:i.shadowMap.enabled&&W.length>0,shadowMapType:i.shadowMap.type,toneMapping:Rt,decodeVideoTexture:Ke&&g.map.isVideoTexture===!0&&Ze.getTransfer(g.map.colorSpace)===nt,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===_n,flipSided:g.side===Ft,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:ht&&g.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&g.extensions.multiDraw===!0||He)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return qe.vertexUv1s=c.has(1),qe.vertexUv2s=c.has(2),qe.vertexUv3s=c.has(3),c.clear(),qe}function A(g){const M=[];if(g.shaderID?M.push(g.shaderID):(M.push(g.customVertexShaderID),M.push(g.customFragmentShaderID)),g.defines!==void 0)for(const W in g.defines)M.push(W),M.push(g.defines[W]);return g.isRawShaderMaterial===!1&&(E(M,g),T(M,g),M.push(i.outputColorSpace)),M.push(g.customProgramCacheKey),M.join()}function E(g,M){g.push(M.precision),g.push(M.outputColorSpace),g.push(M.envMapMode),g.push(M.envMapCubeUVHeight),g.push(M.mapUv),g.push(M.alphaMapUv),g.push(M.lightMapUv),g.push(M.aoMapUv),g.push(M.bumpMapUv),g.push(M.normalMapUv),g.push(M.displacementMapUv),g.push(M.emissiveMapUv),g.push(M.metalnessMapUv),g.push(M.roughnessMapUv),g.push(M.anisotropyMapUv),g.push(M.clearcoatMapUv),g.push(M.clearcoatNormalMapUv),g.push(M.clearcoatRoughnessMapUv),g.push(M.iridescenceMapUv),g.push(M.iridescenceThicknessMapUv),g.push(M.sheenColorMapUv),g.push(M.sheenRoughnessMapUv),g.push(M.specularMapUv),g.push(M.specularColorMapUv),g.push(M.specularIntensityMapUv),g.push(M.transmissionMapUv),g.push(M.thicknessMapUv),g.push(M.combine),g.push(M.fogExp2),g.push(M.sizeAttenuation),g.push(M.morphTargetsCount),g.push(M.morphAttributeCount),g.push(M.numDirLights),g.push(M.numPointLights),g.push(M.numSpotLights),g.push(M.numSpotLightMaps),g.push(M.numHemiLights),g.push(M.numRectAreaLights),g.push(M.numDirLightShadows),g.push(M.numPointLightShadows),g.push(M.numSpotLightShadows),g.push(M.numSpotLightShadowsWithMaps),g.push(M.numLightProbes),g.push(M.shadowMapType),g.push(M.toneMapping),g.push(M.numClippingPlanes),g.push(M.numClipIntersection),g.push(M.depthPacking)}function T(g,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),g.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.reverseDepthBuffer&&a.enable(4),M.skinning&&a.enable(5),M.morphTargets&&a.enable(6),M.morphNormals&&a.enable(7),M.morphColors&&a.enable(8),M.premultipliedAlpha&&a.enable(9),M.shadowMapEnabled&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.transmission&&a.enable(15),M.sheen&&a.enable(16),M.opaque&&a.enable(17),M.pointsUvs&&a.enable(18),M.decodeVideoTexture&&a.enable(19),M.alphaToCoverage&&a.enable(20),g.push(a.mask)}function z(g){const M=x[g.type];let W;if(M){const k=an[M];W=Gr.clone(k.uniforms)}else W=g.uniforms;return W}function L(g,M){let W;for(let k=0,K=u.length;k0?n.push(d):m.transparent===!0?r.push(d):t.push(d)}function l(f,p,m,_,x,h){const d=o(f,p,m,_,x,h);m.transmission>0?n.unshift(d):m.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,p){t.length>1&&t.sort(f||Mp),n.length>1&&n.sort(p||Bo),r.length>1&&r.sort(p||Bo)}function u(){for(let f=e,p=i.length;f=s.length?(o=new zo,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function yp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new we};break;case"SpotLight":t={position:new U,direction:new U,color:new we,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new we,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new we,groundColor:new we};break;case"RectAreaLight":t={color:new we,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function Tp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Ap=0;function bp(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function wp(i){const e=new yp,t=Tp(),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 U);const r=new U,s=new rt,o=new rt;function a(c){let u=0,f=0,p=0;for(let ie=0;ie<9;ie++)n.probe[ie].set(0,0,0);let m=0,_=0,x=0,h=0,d=0,A=0,E=0,T=0,z=0,L=0,b=0;c.sort(bp);for(let ie=0,g=c.length;ie0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ae.LTC_FLOAT_1,n.rectAreaLTC2=ae.LTC_FLOAT_2):(n.rectAreaLTC1=ae.LTC_HALF_1,n.rectAreaLTC2=ae.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=p;const B=n.hash;(B.directionalLength!==m||B.pointLength!==_||B.spotLength!==x||B.rectAreaLength!==h||B.hemiLength!==d||B.numDirectionalShadows!==A||B.numPointShadows!==E||B.numSpotShadows!==T||B.numSpotMaps!==z||B.numLightProbes!==b)&&(n.directional.length=m,n.spot.length=x,n.rectArea.length=h,n.point.length=_,n.hemi.length=d,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=T+z-L,n.spotLightMap.length=z,n.numSpotLightShadowsWithMaps=L,n.numLightProbes=b,B.directionalLength=m,B.pointLength=_,B.spotLength=x,B.rectAreaLength=h,B.hemiLength=d,B.numDirectionalShadows=A,B.numPointShadows=E,B.numSpotShadows=T,B.numSpotMaps=z,B.numLightProbes=b,n.version=Ap++)}function l(c,u){let f=0,p=0,m=0,_=0,x=0;const h=u.matrixWorldInverse;for(let d=0,A=c.length;d=o.length?(a=new Ho(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class Cp extends qi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ec,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 Pp extends qi{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 Lp=`void main() { +`+G)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(H===""||K==="")&&(W=!1);W&&(M.diagnostics={runnable:Q,programLog:V,vertexShader:{log:H,prefix:h},fragmentShader:{log:K,prefix:d}})}r.deleteShader(z),r.deleteShader(L),B=new Fr(r,x),ie=rp(r,x)}let B;this.getUniforms=function(){return B===void 0&&b(this),B};let ie;this.getAttributes=function(){return ie===void 0&&b(this),ie};let g=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=r.getProgramParameter(x,Kf)),g},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jf++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=z,this.fragmentShader=L,this}let _p=0;class gp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new vp(e),t.set(e,n)),n}}class vp{constructor(e){this.id=_p++,this.code=e,this.usedTimes=0}}function xp(i,e,t,n,r,s,o){const a=new yl,l=new gp,c=new Set,u=[],f=r.logarithmicDepthBuffer,p=r.reverseDepthBuffer,m=r.vertexTextures;let _=r.precision;const x={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 h(g){return c.add(g),g===0?"uv":`uv${g}`}function d(g,M,V,H,K){const Q=H.fog,W=K.geometry,J=g.isMeshStandardMaterial?H.environment:null,G=(g.isMeshStandardMaterial?t:e).get(g.envMap||J),fe=G&&G.mapping===Yr?G.image.height:null,pe=x[g.type];g.precision!==null&&(_=r.getMaxPrecision(g.precision),_!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",_,"instead."));const ve=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,We=ve!==void 0?ve.length:0;let Ye=0;W.morphAttributes.position!==void 0&&(Ye=1),W.morphAttributes.normal!==void 0&&(Ye=2),W.morphAttributes.color!==void 0&&(Ye=3);let Y,te,_e,me;if(pe){const Ct=an[pe];Y=Ct.vertexShader,te=Ct.fragmentShader}else Y=g.vertexShader,te=g.fragmentShader,l.update(g),_e=l.getVertexShaderID(g),me=l.getFragmentShaderID(g);const Ne=i.getRenderTarget(),be=K.isInstancedMesh===!0,He=K.isBatchedMesh===!0,Ke=!!g.map,Ge=!!g.matcap,R=!!G,vt=!!g.aoMap,Be=!!g.lightMap,Ve=!!g.bumpMap,Re=!!g.normalMap,Qe=!!g.displacementMap,Ce=!!g.emissiveMap,y=!!g.metalnessMap,v=!!g.roughnessMap,I=g.anisotropy>0,Z=g.clearcoat>0,ee=g.dispersion>0,q=g.iridescence>0,xe=g.sheen>0,oe=g.transmission>0,w=I&&!!g.anisotropyMap,re=Z&&!!g.clearcoatMap,j=Z&&!!g.clearcoatNormalMap,se=Z&&!!g.clearcoatRoughnessMap,Me=q&&!!g.iridescenceMap,Te=q&&!!g.iridescenceThicknessMap,ue=xe&&!!g.sheenColorMap,ze=xe&&!!g.sheenRoughnessMap,Ae=!!g.specularMap,ke=!!g.specularColorMap,C=!!g.specularIntensityMap,he=oe&&!!g.transmissionMap,k=oe&&!!g.thicknessMap,$=!!g.gradientMap,le=!!g.alphaMap,de=g.alphaTest>0,Xe=!!g.alphaHash,ht=!!g.extensions;let Rt=Un;g.toneMapped&&(Ne===null||Ne.isXRRenderTarget===!0)&&(Rt=i.toneMapping);const qe={shaderID:pe,shaderType:g.type,shaderName:g.name,vertexShader:Y,fragmentShader:te,defines:g.defines,customVertexShaderID:_e,customFragmentShaderID:me,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:_,batching:He,batchingColor:He&&K._colorsTexture!==null,instancing:be,instancingColor:be&&K.instanceColor!==null,instancingMorph:be&&K.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Ne===null?i.outputColorSpace:Ne.isXRRenderTarget===!0?Ne.texture.colorSpace:Nn,alphaToCoverage:!!g.alphaToCoverage,map:Ke,matcap:Ge,envMap:R,envMapMode:R&&G.mapping,envMapCubeUVHeight:fe,aoMap:vt,lightMap:Be,bumpMap:Ve,normalMap:Re,displacementMap:m&&Qe,emissiveMap:Ce,normalMapObjectSpace:Re&&g.normalMapType===Ac,normalMapTangentSpace:Re&&g.normalMapType===Tc,metalnessMap:y,roughnessMap:v,anisotropy:I,anisotropyMap:w,clearcoat:Z,clearcoatMap:re,clearcoatNormalMap:j,clearcoatRoughnessMap:se,dispersion:ee,iridescence:q,iridescenceMap:Me,iridescenceThicknessMap:Te,sheen:xe,sheenColorMap:ue,sheenRoughnessMap:ze,specularMap:Ae,specularColorMap:ke,specularIntensityMap:C,transmission:oe,transmissionMap:he,thicknessMap:k,gradientMap:$,opaque:g.transparent===!1&&g.blending===Si&&g.alphaToCoverage===!1,alphaMap:le,alphaTest:de,alphaHash:Xe,combine:g.combine,mapUv:Ke&&h(g.map.channel),aoMapUv:vt&&h(g.aoMap.channel),lightMapUv:Be&&h(g.lightMap.channel),bumpMapUv:Ve&&h(g.bumpMap.channel),normalMapUv:Re&&h(g.normalMap.channel),displacementMapUv:Qe&&h(g.displacementMap.channel),emissiveMapUv:Ce&&h(g.emissiveMap.channel),metalnessMapUv:y&&h(g.metalnessMap.channel),roughnessMapUv:v&&h(g.roughnessMap.channel),anisotropyMapUv:w&&h(g.anisotropyMap.channel),clearcoatMapUv:re&&h(g.clearcoatMap.channel),clearcoatNormalMapUv:j&&h(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:se&&h(g.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&h(g.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&h(g.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&h(g.sheenColorMap.channel),sheenRoughnessMapUv:ze&&h(g.sheenRoughnessMap.channel),specularMapUv:Ae&&h(g.specularMap.channel),specularColorMapUv:ke&&h(g.specularColorMap.channel),specularIntensityMapUv:C&&h(g.specularIntensityMap.channel),transmissionMapUv:he&&h(g.transmissionMap.channel),thicknessMapUv:k&&h(g.thicknessMap.channel),alphaMapUv:le&&h(g.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(Re||I),vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:K.isPoints===!0&&!!W.attributes.uv&&(Ke||le),fog:!!Q,useFog:g.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:g.flatShading===!0,sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:K.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:We,morphTextureStride:Ye,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:g.dithering,shadowMapEnabled:i.shadowMap.enabled&&V.length>0,shadowMapType:i.shadowMap.type,toneMapping:Rt,decodeVideoTexture:Ke&&g.map.isVideoTexture===!0&&Ze.getTransfer(g.map.colorSpace)===nt,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===_n,flipSided:g.side===Ft,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:ht&&g.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&g.extensions.multiDraw===!0||He)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return qe.vertexUv1s=c.has(1),qe.vertexUv2s=c.has(2),qe.vertexUv3s=c.has(3),c.clear(),qe}function A(g){const M=[];if(g.shaderID?M.push(g.shaderID):(M.push(g.customVertexShaderID),M.push(g.customFragmentShaderID)),g.defines!==void 0)for(const V in g.defines)M.push(V),M.push(g.defines[V]);return g.isRawShaderMaterial===!1&&(E(M,g),T(M,g),M.push(i.outputColorSpace)),M.push(g.customProgramCacheKey),M.join()}function E(g,M){g.push(M.precision),g.push(M.outputColorSpace),g.push(M.envMapMode),g.push(M.envMapCubeUVHeight),g.push(M.mapUv),g.push(M.alphaMapUv),g.push(M.lightMapUv),g.push(M.aoMapUv),g.push(M.bumpMapUv),g.push(M.normalMapUv),g.push(M.displacementMapUv),g.push(M.emissiveMapUv),g.push(M.metalnessMapUv),g.push(M.roughnessMapUv),g.push(M.anisotropyMapUv),g.push(M.clearcoatMapUv),g.push(M.clearcoatNormalMapUv),g.push(M.clearcoatRoughnessMapUv),g.push(M.iridescenceMapUv),g.push(M.iridescenceThicknessMapUv),g.push(M.sheenColorMapUv),g.push(M.sheenRoughnessMapUv),g.push(M.specularMapUv),g.push(M.specularColorMapUv),g.push(M.specularIntensityMapUv),g.push(M.transmissionMapUv),g.push(M.thicknessMapUv),g.push(M.combine),g.push(M.fogExp2),g.push(M.sizeAttenuation),g.push(M.morphTargetsCount),g.push(M.morphAttributeCount),g.push(M.numDirLights),g.push(M.numPointLights),g.push(M.numSpotLights),g.push(M.numSpotLightMaps),g.push(M.numHemiLights),g.push(M.numRectAreaLights),g.push(M.numDirLightShadows),g.push(M.numPointLightShadows),g.push(M.numSpotLightShadows),g.push(M.numSpotLightShadowsWithMaps),g.push(M.numLightProbes),g.push(M.shadowMapType),g.push(M.toneMapping),g.push(M.numClippingPlanes),g.push(M.numClipIntersection),g.push(M.depthPacking)}function T(g,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),g.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.reverseDepthBuffer&&a.enable(4),M.skinning&&a.enable(5),M.morphTargets&&a.enable(6),M.morphNormals&&a.enable(7),M.morphColors&&a.enable(8),M.premultipliedAlpha&&a.enable(9),M.shadowMapEnabled&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.transmission&&a.enable(15),M.sheen&&a.enable(16),M.opaque&&a.enable(17),M.pointsUvs&&a.enable(18),M.decodeVideoTexture&&a.enable(19),M.alphaToCoverage&&a.enable(20),g.push(a.mask)}function z(g){const M=x[g.type];let V;if(M){const H=an[M];V=Gr.clone(H.uniforms)}else V=g.uniforms;return V}function L(g,M){let V;for(let H=0,K=u.length;H0?n.push(d):m.transparent===!0?r.push(d):t.push(d)}function l(f,p,m,_,x,h){const d=o(f,p,m,_,x,h);m.transmission>0?n.unshift(d):m.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,p){t.length>1&&t.sort(f||Mp),n.length>1&&n.sort(p||Bo),r.length>1&&r.sort(p||Bo)}function u(){for(let f=e,p=i.length;f=s.length?(o=new zo,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function yp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new we};break;case"SpotLight":t={position:new U,direction:new U,color:new we,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new we,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new we,groundColor:new we};break;case"RectAreaLight":t={color:new we,position:new U,halfWidth:new U,halfHeight:new U};break}return i[e.id]=t,t}}}function Tp(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Ap=0;function bp(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function wp(i){const e=new yp,t=Tp(),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 U);const r=new U,s=new rt,o=new rt;function a(c){let u=0,f=0,p=0;for(let ie=0;ie<9;ie++)n.probe[ie].set(0,0,0);let m=0,_=0,x=0,h=0,d=0,A=0,E=0,T=0,z=0,L=0,b=0;c.sort(bp);for(let ie=0,g=c.length;ie0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ae.LTC_FLOAT_1,n.rectAreaLTC2=ae.LTC_FLOAT_2):(n.rectAreaLTC1=ae.LTC_HALF_1,n.rectAreaLTC2=ae.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=p;const B=n.hash;(B.directionalLength!==m||B.pointLength!==_||B.spotLength!==x||B.rectAreaLength!==h||B.hemiLength!==d||B.numDirectionalShadows!==A||B.numPointShadows!==E||B.numSpotShadows!==T||B.numSpotMaps!==z||B.numLightProbes!==b)&&(n.directional.length=m,n.spot.length=x,n.rectArea.length=h,n.point.length=_,n.hemi.length=d,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=T+z-L,n.spotLightMap.length=z,n.numSpotLightShadowsWithMaps=L,n.numLightProbes=b,B.directionalLength=m,B.pointLength=_,B.spotLength=x,B.rectAreaLength=h,B.hemiLength=d,B.numDirectionalShadows=A,B.numPointShadows=E,B.numSpotShadows=T,B.numSpotMaps=z,B.numLightProbes=b,n.version=Ap++)}function l(c,u){let f=0,p=0,m=0,_=0,x=0;const h=u.matrixWorldInverse;for(let d=0,A=c.length;d=o.length?(a=new Ho(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class Cp extends qi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ec,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 Pp extends qi{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 Lp=`void main() { gl_Position = vec4( position, 1.0 ); }`,Dp=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3812,7 +3812,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Up(i,e,t){let n=new Ia;const r=new De,s=new De,o=new lt,a=new Cp({depthPacking:yc}),l=new Pp,c={},u=t.maxTextureSize,f={[In]:Ft,[Ft]:In,[_n]:_n},p=new yt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new De},radius:{value:4}},vertexShader:Lp,fragmentShader:Dp}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const _=new rn;_.setAttribute("position",new Gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Nt(_,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ta;let d=this.type;this.render=function(L,b,B){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||L.length===0)return;const ie=i.getRenderTarget(),g=i.getActiveCubeFace(),M=i.getActiveMipmapLevel(),W=i.state;W.setBlending(Dn),W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const k=d!==fn&&this.type===fn,K=d===fn&&this.type!==fn;for(let Q=0,X=L.length;Qu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/fe.x),r.x=s.x*fe.x,V.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/fe.y),r.y=s.y*fe.y,V.mapSize.y=s.y)),V.map===null||k===!0||K===!0){const ve=this.type!==fn?{minFilter:wt,magFilter:wt}:{};V.map!==null&&V.map.dispose(),V.map=new $n(r.x,r.y,ve),V.map.texture.name=J.name+".shadowMap",V.camera.updateProjectionMatrix()}i.setRenderTarget(V.map),i.clear();const pe=V.getViewportCount();for(let ve=0;ve0||b.map&&b.alphaTest>0){const W=g.uuid,k=b.uuid;let K=c[W];K===void 0&&(K={},c[W]=K);let Q=K[k];Q===void 0&&(Q=g.clone(),K[k]=Q,b.addEventListener("dispose",z)),g=Q}if(g.visible=b.visible,g.wireframe=b.wireframe,ie===fn?g.side=b.shadowSide!==null?b.shadowSide:b.side:g.side=b.shadowSide!==null?b.shadowSide:f[b.side],g.alphaMap=b.alphaMap,g.alphaTest=b.alphaTest,g.map=b.map,g.clipShadows=b.clipShadows,g.clippingPlanes=b.clippingPlanes,g.clipIntersection=b.clipIntersection,g.displacementMap=b.displacementMap,g.displacementScale=b.displacementScale,g.displacementBias=b.displacementBias,g.wireframeLinewidth=b.wireframeLinewidth,g.linewidth=b.linewidth,B.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const W=i.properties.get(g);W.light=B}return g}function T(L,b,B,ie,g){if(L.visible===!1)return;if(L.layers.test(b.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&g===fn)&&(!L.frustumCulled||n.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,L.matrixWorld);const k=e.update(L),K=L.material;if(Array.isArray(K)){const Q=k.groups;for(let X=0,J=Q.length;X=1):J.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),Q=X>=2);let V=null,fe={};const pe=i.getParameter(i.SCISSOR_BOX),ve=i.getParameter(i.VIEWPORT),We=new lt().fromArray(pe),Ye=new lt().fromArray(ve);function Y(C,he,G,$){const le=new Uint8Array(4),de=i.createTexture();i.bindTexture(C,de),i.texParameteri(C,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(C,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Xe=0;Xe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new De,u=new WeakMap;let f;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(y,v){return m?new OffscreenCanvas(y,v):Vi("canvas")}function x(y,v,I){let Z=1;const ee=Ce(y);if((ee.width>I||ee.height>I)&&(Z=I/Math.max(ee.width,ee.height)),Z<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const q=Math.floor(Z*ee.width),xe=Math.floor(Z*ee.height);f===void 0&&(f=_(q,xe));const oe=v?_(q,xe):f;return oe.width=q,oe.height=xe,oe.getContext("2d").drawImage(y,0,0,q,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ee.width+"x"+ee.height+") to ("+q+"x"+xe+")."),oe}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ee.width+"x"+ee.height+")."),y;return y}function h(y){return y.generateMipmaps&&y.minFilter!==wt&&y.minFilter!==It}function d(y){i.generateMipmap(y)}function A(y,v,I,Z,ee=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let q=v;if(v===i.RED&&(I===i.FLOAT&&(q=i.R32F),I===i.HALF_FLOAT&&(q=i.R16F),I===i.UNSIGNED_BYTE&&(q=i.R8)),v===i.RED_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.R8UI),I===i.UNSIGNED_SHORT&&(q=i.R16UI),I===i.UNSIGNED_INT&&(q=i.R32UI),I===i.BYTE&&(q=i.R8I),I===i.SHORT&&(q=i.R16I),I===i.INT&&(q=i.R32I)),v===i.RG&&(I===i.FLOAT&&(q=i.RG32F),I===i.HALF_FLOAT&&(q=i.RG16F),I===i.UNSIGNED_BYTE&&(q=i.RG8)),v===i.RG_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RG8UI),I===i.UNSIGNED_SHORT&&(q=i.RG16UI),I===i.UNSIGNED_INT&&(q=i.RG32UI),I===i.BYTE&&(q=i.RG8I),I===i.SHORT&&(q=i.RG16I),I===i.INT&&(q=i.RG32I)),v===i.RGB_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RGB8UI),I===i.UNSIGNED_SHORT&&(q=i.RGB16UI),I===i.UNSIGNED_INT&&(q=i.RGB32UI),I===i.BYTE&&(q=i.RGB8I),I===i.SHORT&&(q=i.RGB16I),I===i.INT&&(q=i.RGB32I)),v===i.RGBA_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),I===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),I===i.UNSIGNED_INT&&(q=i.RGBA32UI),I===i.BYTE&&(q=i.RGBA8I),I===i.SHORT&&(q=i.RGBA16I),I===i.INT&&(q=i.RGBA32I)),v===i.RGB&&I===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),v===i.RGBA){const xe=ee?Br:Ze.getTransfer(Z);I===i.FLOAT&&(q=i.RGBA32F),I===i.HALF_FLOAT&&(q=i.RGBA16F),I===i.UNSIGNED_BYTE&&(q=xe===nt?i.SRGB8_ALPHA8:i.RGBA8),I===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),I===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function E(y,v){let I;return y?v===null||v===jn||v===bi?I=i.DEPTH24_STENCIL8:v===tn?I=i.DEPTH32F_STENCIL8:v===Gi&&(I=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===jn||v===bi?I=i.DEPTH_COMPONENT24:v===tn?I=i.DEPTH_COMPONENT32F:v===Gi&&(I=i.DEPTH_COMPONENT16),I}function T(y,v){return h(y)===!0||y.isFramebufferTexture&&y.minFilter!==wt&&y.minFilter!==It?Math.log2(Math.max(v.width,v.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?v.mipmaps.length:1}function z(y){const v=y.target;v.removeEventListener("dispose",z),b(v),v.isVideoTexture&&u.delete(v)}function L(y){const v=y.target;v.removeEventListener("dispose",L),ie(v)}function b(y){const v=n.get(y);if(v.__webglInit===void 0)return;const I=y.source,Z=p.get(I);if(Z){const ee=Z[v.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&B(y),Object.keys(Z).length===0&&p.delete(I)}n.remove(y)}function B(y){const v=n.get(y);i.deleteTexture(v.__webglTexture);const I=y.source,Z=p.get(I);delete Z[v.__cacheKey],o.memory.textures--}function ie(y){const v=n.get(y);if(y.depthTexture&&y.depthTexture.dispose(),y.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(v.__webglFramebuffer[Z]))for(let ee=0;ee=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),g+=1,y}function k(y){const v=[];return v.push(y.wrapS),v.push(y.wrapT),v.push(y.wrapR||0),v.push(y.magFilter),v.push(y.minFilter),v.push(y.anisotropy),v.push(y.internalFormat),v.push(y.format),v.push(y.type),v.push(y.generateMipmaps),v.push(y.premultiplyAlpha),v.push(y.flipY),v.push(y.unpackAlignment),v.push(y.colorSpace),v.join()}function K(y,v){const I=n.get(y);if(y.isVideoTexture&&Re(y),y.isRenderTargetTexture===!1&&y.version>0&&I.__version!==y.version){const Z=y.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{Ye(I,y,v);return}}t.bindTexture(i.TEXTURE_2D,I.__webglTexture,i.TEXTURE0+v)}function Q(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Ye(I,y,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,I.__webglTexture,i.TEXTURE0+v)}function X(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Ye(I,y,v);return}t.bindTexture(i.TEXTURE_3D,I.__webglTexture,i.TEXTURE0+v)}function J(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Y(I,y,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,I.__webglTexture,i.TEXTURE0+v)}const V={[Or]:i.REPEAT,[gn]:i.CLAMP_TO_EDGE,[Zs]:i.MIRRORED_REPEAT},fe={[wt]:i.NEAREST,[Sc]:i.NEAREST_MIPMAP_NEAREST,[$i]:i.NEAREST_MIPMAP_LINEAR,[It]:i.LINEAR,[es]:i.LINEAR_MIPMAP_NEAREST,[qn]:i.LINEAR_MIPMAP_LINEAR},pe={[bc]:i.NEVER,[Dc]:i.ALWAYS,[wc]:i.LESS,[vl]:i.LEQUAL,[Rc]:i.EQUAL,[Lc]:i.GEQUAL,[Cc]:i.GREATER,[Pc]:i.NOTEQUAL};function ve(y,v){if(v.type===tn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===It||v.magFilter===es||v.magFilter===$i||v.magFilter===qn||v.minFilter===It||v.minFilter===es||v.minFilter===$i||v.minFilter===qn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,V[v.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,V[v.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,V[v.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,fe[v.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,fe[v.minFilter]),v.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,pe[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===wt||v.minFilter!==$i&&v.minFilter!==qn||v.type===tn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const I=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,I.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function We(y,v){let I=!1;y.__webglInit===void 0&&(y.__webglInit=!0,v.addEventListener("dispose",z));const Z=v.source;let ee=p.get(Z);ee===void 0&&(ee={},p.set(Z,ee));const q=k(v);if(q!==y.__cacheKey){ee[q]===void 0&&(ee[q]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,I=!0),ee[q].usedTimes++;const xe=ee[y.__cacheKey];xe!==void 0&&(ee[y.__cacheKey].usedTimes--,xe.usedTimes===0&&B(v)),y.__cacheKey=q,y.__webglTexture=ee[q].texture}return I}function Ye(y,v,I){let Z=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Z=i.TEXTURE_3D);const ee=We(y,v),q=v.source;t.bindTexture(Z,y.__webglTexture,i.TEXTURE0+I);const xe=n.get(q);if(q.version!==xe.__version||ee===!0){t.activeTexture(i.TEXTURE0+I);const oe=Ze.getPrimaries(Ze.workingColorSpace),w=v.colorSpace===Ln?null:Ze.getPrimaries(v.colorSpace),re=v.colorSpace===Ln||oe===w?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,re);let j=x(v.image,!1,r.maxTextureSize);j=Qe(v,j);const se=s.convert(v.format,v.colorSpace),Me=s.convert(v.type);let Te=A(v.internalFormat,se,Me,v.colorSpace,v.isVideoTexture);ve(Z,v);let ue;const ze=v.mipmaps,Ae=v.isVideoTexture!==!0,ke=xe.__version===void 0||ee===!0,C=q.dataReady,he=T(v,j);if(v.isDepthTexture)Te=E(v.format===wi,v.type),ke&&(Ae?t.texStorage2D(i.TEXTURE_2D,1,Te,j.width,j.height):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,se,Me,null));else if(v.isDataTexture)if(ze.length>0){Ae&&ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,ze[0].width,ze[0].height);for(let G=0,$=ze.length;G<$;G++)ue=ze[G],Ae?C&&t.texSubImage2D(i.TEXTURE_2D,G,0,0,ue.width,ue.height,se,Me,ue.data):t.texImage2D(i.TEXTURE_2D,G,Te,ue.width,ue.height,0,se,Me,ue.data);v.generateMipmaps=!1}else Ae?(ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,j.width,j.height),C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,j.width,j.height,se,Me,j.data)):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,se,Me,j.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ae&&ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,he,Te,ze[0].width,ze[0].height,j.depth);for(let G=0,$=ze.length;G<$;G++)if(ue=ze[G],v.format!==kt)if(se!==null)if(Ae){if(C)if(v.layerUpdates.size>0){const le=ko(ue.width,ue.height,v.format,v.type);for(const de of v.layerUpdates){const Xe=ue.data.subarray(de*le/ue.data.BYTES_PER_ELEMENT,(de+1)*le/ue.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,de,ue.width,ue.height,1,se,Xe,0,0)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,0,ue.width,ue.height,j.depth,se,ue.data,0,0)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,G,Te,ue.width,ue.height,j.depth,0,ue.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ae?C&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,0,ue.width,ue.height,j.depth,se,Me,ue.data):t.texImage3D(i.TEXTURE_2D_ARRAY,G,Te,ue.width,ue.height,j.depth,0,se,Me,ue.data)}else{Ae&&ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,ze[0].width,ze[0].height);for(let G=0,$=ze.length;G<$;G++)ue=ze[G],v.format!==kt?se!==null?Ae?C&&t.compressedTexSubImage2D(i.TEXTURE_2D,G,0,0,ue.width,ue.height,se,ue.data):t.compressedTexImage2D(i.TEXTURE_2D,G,Te,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ae?C&&t.texSubImage2D(i.TEXTURE_2D,G,0,0,ue.width,ue.height,se,Me,ue.data):t.texImage2D(i.TEXTURE_2D,G,Te,ue.width,ue.height,0,se,Me,ue.data)}else if(v.isDataArrayTexture)if(Ae){if(ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,he,Te,j.width,j.height,j.depth),C)if(v.layerUpdates.size>0){const G=ko(j.width,j.height,v.format,v.type);for(const $ of v.layerUpdates){const le=j.data.subarray($*G/j.data.BYTES_PER_ELEMENT,($+1)*G/j.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,$,j.width,j.height,1,se,Me,le)}v.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,se,Me,j.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Te,j.width,j.height,j.depth,0,se,Me,j.data);else if(v.isData3DTexture)Ae?(ke&&t.texStorage3D(i.TEXTURE_3D,he,Te,j.width,j.height,j.depth),C&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,se,Me,j.data)):t.texImage3D(i.TEXTURE_3D,0,Te,j.width,j.height,j.depth,0,se,Me,j.data);else if(v.isFramebufferTexture){if(ke)if(Ae)t.texStorage2D(i.TEXTURE_2D,he,Te,j.width,j.height);else{let G=j.width,$=j.height;for(let le=0;le>=1,$>>=1}}else if(ze.length>0){if(Ae&&ke){const G=Ce(ze[0]);t.texStorage2D(i.TEXTURE_2D,he,Te,G.width,G.height)}for(let G=0,$=ze.length;G<$;G++)ue=ze[G],Ae?C&&t.texSubImage2D(i.TEXTURE_2D,G,0,0,se,Me,ue):t.texImage2D(i.TEXTURE_2D,G,Te,se,Me,ue);v.generateMipmaps=!1}else if(Ae){if(ke){const G=Ce(j);t.texStorage2D(i.TEXTURE_2D,he,Te,G.width,G.height)}C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,se,Me,j)}else t.texImage2D(i.TEXTURE_2D,0,Te,se,Me,j);h(v)&&d(Z),xe.__version=q.version,v.onUpdate&&v.onUpdate(v)}y.__version=v.version}function Y(y,v,I){if(v.image.length!==6)return;const Z=We(y,v),ee=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,y.__webglTexture,i.TEXTURE0+I);const q=n.get(ee);if(ee.version!==q.__version||Z===!0){t.activeTexture(i.TEXTURE0+I);const xe=Ze.getPrimaries(Ze.workingColorSpace),oe=v.colorSpace===Ln?null:Ze.getPrimaries(v.colorSpace),w=v.colorSpace===Ln||xe===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,w);const re=v.isCompressedTexture||v.image[0].isCompressedTexture,j=v.image[0]&&v.image[0].isDataTexture,se=[];for(let $=0;$<6;$++)!re&&!j?se[$]=x(v.image[$],!0,r.maxCubemapSize):se[$]=j?v.image[$].image:v.image[$],se[$]=Qe(v,se[$]);const Me=se[0],Te=s.convert(v.format,v.colorSpace),ue=s.convert(v.type),ze=A(v.internalFormat,Te,ue,v.colorSpace),Ae=v.isVideoTexture!==!0,ke=q.__version===void 0||Z===!0,C=ee.dataReady;let he=T(v,Me);ve(i.TEXTURE_CUBE_MAP,v);let G;if(re){Ae&&ke&&t.texStorage2D(i.TEXTURE_CUBE_MAP,he,ze,Me.width,Me.height);for(let $=0;$<6;$++){G=se[$].mipmaps;for(let le=0;le0&&he++;const $=Ce(se[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,he,ze,$.width,$.height)}for(let $=0;$<6;$++)if(j){Ae?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,se[$].width,se[$].height,Te,ue,se[$].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,ze,se[$].width,se[$].height,0,Te,ue,se[$].data);for(let le=0;le>q),se=Math.max(1,v.height>>q);ee===i.TEXTURE_3D||ee===i.TEXTURE_2D_ARRAY?t.texImage3D(ee,q,w,j,se,v.depth,0,xe,oe,null):t.texImage2D(ee,q,w,j,se,0,xe,oe,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),Ve(v)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,ee,n.get(I).__webglTexture,0,Be(v)):(ee===i.TEXTURE_2D||ee>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,ee,n.get(I).__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function _e(y,v,I){if(i.bindRenderbuffer(i.RENDERBUFFER,y),v.depthBuffer){const Z=v.depthTexture,ee=Z&&Z.isDepthTexture?Z.type:null,q=E(v.stencilBuffer,ee),xe=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=Be(v);Ve(v)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,oe,q,v.width,v.height):I?i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,q,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,q,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,xe,i.RENDERBUFFER,y)}else{const Z=v.textures;for(let ee=0;ee{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,Z.removeEventListener("dispose",ee)};Z.addEventListener("dispose",ee),v.__depthDisposeCallback=ee}v.__boundDepthTexture=Z}if(y.depthTexture&&!v.__autoAllocateDepthBuffer){if(I)throw new Error("target.depthTexture not supported in Cube render targets");me(v.__webglFramebuffer,y)}else if(I){v.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[Z]),v.__webglDepthbuffer[Z]===void 0)v.__webglDepthbuffer[Z]=i.createRenderbuffer(),_e(v.__webglDepthbuffer[Z],y,!1);else{const ee=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer[Z];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,ee,i.RENDERBUFFER,q)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),_e(v.__webglDepthbuffer,y,!1);else{const Z=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ee=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ee),i.framebufferRenderbuffer(i.FRAMEBUFFER,Z,i.RENDERBUFFER,ee)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(y,v,I){const Z=n.get(y);v!==void 0&&te(Z.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),I!==void 0&&Ne(y)}function He(y){const v=y.texture,I=n.get(y),Z=n.get(v);y.addEventListener("dispose",L);const ee=y.textures,q=y.isWebGLCubeRenderTarget===!0,xe=ee.length>1;if(xe||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=v.version,o.memory.textures++),q){I.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0){I.__webglFramebuffer[oe]=[];for(let w=0;w0){I.__webglFramebuffer=[];for(let oe=0;oe0&&Ve(y)===!1){I.__webglMultisampledFramebuffer=i.createFramebuffer(),I.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let oe=0;oe0)for(let w=0;w0)for(let w=0;w0){if(Ve(y)===!1){const v=y.textures,I=y.width,Z=y.height;let ee=i.COLOR_BUFFER_BIT;const q=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,xe=n.get(y),oe=v.length>1;if(oe)for(let w=0;w0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Re(y){const v=o.render.frame;u.get(y)!==v&&(u.set(y,v),y.update())}function Qe(y,v){const I=y.colorSpace,Z=y.format,ee=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||I!==Nn&&I!==Ln&&(Ze.getTransfer(I)===nt?(Z!==kt||ee!==Mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",I)),v}function Ce(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=M,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=X,this.setTextureCube=J,this.rebindTextures=be,this.setupRenderTarget=He,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=vt,this.setupDepthRenderbuffer=Ne,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Ve}function Bp(i,e){function t(n,r=Ln){let s;const o=Ze.getTransfer(r);if(n===Mn)return i.UNSIGNED_BYTE;if(n===wa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ra)return i.UNSIGNED_SHORT_5_5_5_1;if(n===ul)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ll)return i.BYTE;if(n===cl)return i.SHORT;if(n===Gi)return i.UNSIGNED_SHORT;if(n===ba)return i.INT;if(n===jn)return i.UNSIGNED_INT;if(n===tn)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===hl)return i.ALPHA;if(n===dl)return i.RGB;if(n===kt)return i.RGBA;if(n===fl)return i.LUMINANCE;if(n===pl)return i.LUMINANCE_ALPHA;if(n===Mi)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===ml)return i.RED;if(n===Ca)return i.RED_INTEGER;if(n===_l)return i.RG;if(n===Pa)return i.RG_INTEGER;if(n===La)return i.RGBA_INTEGER;if(n===Pr||n===Lr||n===Dr||n===Ur)if(o===nt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Pr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Dr)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===Pr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Dr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ks||n===js||n===$s||n===Js)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ks)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===js)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$s)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Js)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qs||n===ea||n===ta)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Qs||n===ea)return o===nt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ta)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===na||n===ia||n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ua||n===ha||n===da||n===fa||n===pa||n===ma)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===na)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ia)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ra)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===sa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===aa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===oa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===la)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ca)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ua)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ha)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===da)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===fa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ma)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ir||n===_a||n===ga)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ir)return o===nt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===_a)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ga)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===gl||n===va||n===xa||n===Sa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ir)return s.COMPRESSED_RED_RGTC1_EXT;if(n===va)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Sa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===bi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class zp extends Qt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class vr extends ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Hp={type:"move"};class Ps{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vr,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 vr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),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 r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const h=t.getJointPose(x,n),d=this._getHandJoint(c,x);h!==null&&(d.matrix.fromArray(h.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=h.radius),d.visible=h!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),m=.02,_=.005;c.inputState.pinching&&p>m+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-_&&(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));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Hp)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new vr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const kp=` +}`;function Up(i,e,t){let n=new Ia;const r=new Le,s=new Le,o=new lt,a=new Cp({depthPacking:yc}),l=new Pp,c={},u=t.maxTextureSize,f={[In]:Ft,[Ft]:In,[_n]:_n},p=new yt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Le},radius:{value:4}},vertexShader:Lp,fragmentShader:Dp}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const _=new rn;_.setAttribute("position",new Gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Nt(_,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ta;let d=this.type;this.render=function(L,b,B){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||L.length===0)return;const ie=i.getRenderTarget(),g=i.getActiveCubeFace(),M=i.getActiveMipmapLevel(),V=i.state;V.setBlending(Dn),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const H=d!==fn&&this.type===fn,K=d===fn&&this.type!==fn;for(let Q=0,W=L.length;Qu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/fe.x),r.x=s.x*fe.x,G.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/fe.y),r.y=s.y*fe.y,G.mapSize.y=s.y)),G.map===null||H===!0||K===!0){const ve=this.type!==fn?{minFilter:wt,magFilter:wt}:{};G.map!==null&&G.map.dispose(),G.map=new jn(r.x,r.y,ve),G.map.texture.name=J.name+".shadowMap",G.camera.updateProjectionMatrix()}i.setRenderTarget(G.map),i.clear();const pe=G.getViewportCount();for(let ve=0;ve0||b.map&&b.alphaTest>0){const V=g.uuid,H=b.uuid;let K=c[V];K===void 0&&(K={},c[V]=K);let Q=K[H];Q===void 0&&(Q=g.clone(),K[H]=Q,b.addEventListener("dispose",z)),g=Q}if(g.visible=b.visible,g.wireframe=b.wireframe,ie===fn?g.side=b.shadowSide!==null?b.shadowSide:b.side:g.side=b.shadowSide!==null?b.shadowSide:f[b.side],g.alphaMap=b.alphaMap,g.alphaTest=b.alphaTest,g.map=b.map,g.clipShadows=b.clipShadows,g.clippingPlanes=b.clippingPlanes,g.clipIntersection=b.clipIntersection,g.displacementMap=b.displacementMap,g.displacementScale=b.displacementScale,g.displacementBias=b.displacementBias,g.wireframeLinewidth=b.wireframeLinewidth,g.linewidth=b.linewidth,B.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const V=i.properties.get(g);V.light=B}return g}function T(L,b,B,ie,g){if(L.visible===!1)return;if(L.layers.test(b.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&g===fn)&&(!L.frustumCulled||n.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,L.matrixWorld);const H=e.update(L),K=L.material;if(Array.isArray(K)){const Q=H.groups;for(let W=0,J=Q.length;W=1):J.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),Q=W>=2);let G=null,fe={};const pe=i.getParameter(i.SCISSOR_BOX),ve=i.getParameter(i.VIEWPORT),We=new lt().fromArray(pe),Ye=new lt().fromArray(ve);function Y(C,he,k,$){const le=new Uint8Array(4),de=i.createTexture();i.bindTexture(C,de),i.texParameteri(C,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(C,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Xe=0;Xe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Le,u=new WeakMap;let f;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(y,v){return m?new OffscreenCanvas(y,v):Vi("canvas")}function x(y,v,I){let Z=1;const ee=Ce(y);if((ee.width>I||ee.height>I)&&(Z=I/Math.max(ee.width,ee.height)),Z<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const q=Math.floor(Z*ee.width),xe=Math.floor(Z*ee.height);f===void 0&&(f=_(q,xe));const oe=v?_(q,xe):f;return oe.width=q,oe.height=xe,oe.getContext("2d").drawImage(y,0,0,q,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ee.width+"x"+ee.height+") to ("+q+"x"+xe+")."),oe}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ee.width+"x"+ee.height+")."),y;return y}function h(y){return y.generateMipmaps&&y.minFilter!==wt&&y.minFilter!==It}function d(y){i.generateMipmap(y)}function A(y,v,I,Z,ee=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let q=v;if(v===i.RED&&(I===i.FLOAT&&(q=i.R32F),I===i.HALF_FLOAT&&(q=i.R16F),I===i.UNSIGNED_BYTE&&(q=i.R8)),v===i.RED_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.R8UI),I===i.UNSIGNED_SHORT&&(q=i.R16UI),I===i.UNSIGNED_INT&&(q=i.R32UI),I===i.BYTE&&(q=i.R8I),I===i.SHORT&&(q=i.R16I),I===i.INT&&(q=i.R32I)),v===i.RG&&(I===i.FLOAT&&(q=i.RG32F),I===i.HALF_FLOAT&&(q=i.RG16F),I===i.UNSIGNED_BYTE&&(q=i.RG8)),v===i.RG_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RG8UI),I===i.UNSIGNED_SHORT&&(q=i.RG16UI),I===i.UNSIGNED_INT&&(q=i.RG32UI),I===i.BYTE&&(q=i.RG8I),I===i.SHORT&&(q=i.RG16I),I===i.INT&&(q=i.RG32I)),v===i.RGB_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RGB8UI),I===i.UNSIGNED_SHORT&&(q=i.RGB16UI),I===i.UNSIGNED_INT&&(q=i.RGB32UI),I===i.BYTE&&(q=i.RGB8I),I===i.SHORT&&(q=i.RGB16I),I===i.INT&&(q=i.RGB32I)),v===i.RGBA_INTEGER&&(I===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),I===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),I===i.UNSIGNED_INT&&(q=i.RGBA32UI),I===i.BYTE&&(q=i.RGBA8I),I===i.SHORT&&(q=i.RGBA16I),I===i.INT&&(q=i.RGBA32I)),v===i.RGB&&I===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),v===i.RGBA){const xe=ee?Br:Ze.getTransfer(Z);I===i.FLOAT&&(q=i.RGBA32F),I===i.HALF_FLOAT&&(q=i.RGBA16F),I===i.UNSIGNED_BYTE&&(q=xe===nt?i.SRGB8_ALPHA8:i.RGBA8),I===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),I===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function E(y,v){let I;return y?v===null||v===Kn||v===bi?I=i.DEPTH24_STENCIL8:v===tn?I=i.DEPTH32F_STENCIL8:v===Gi&&(I=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===Kn||v===bi?I=i.DEPTH_COMPONENT24:v===tn?I=i.DEPTH_COMPONENT32F:v===Gi&&(I=i.DEPTH_COMPONENT16),I}function T(y,v){return h(y)===!0||y.isFramebufferTexture&&y.minFilter!==wt&&y.minFilter!==It?Math.log2(Math.max(v.width,v.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?v.mipmaps.length:1}function z(y){const v=y.target;v.removeEventListener("dispose",z),b(v),v.isVideoTexture&&u.delete(v)}function L(y){const v=y.target;v.removeEventListener("dispose",L),ie(v)}function b(y){const v=n.get(y);if(v.__webglInit===void 0)return;const I=y.source,Z=p.get(I);if(Z){const ee=Z[v.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&B(y),Object.keys(Z).length===0&&p.delete(I)}n.remove(y)}function B(y){const v=n.get(y);i.deleteTexture(v.__webglTexture);const I=y.source,Z=p.get(I);delete Z[v.__cacheKey],o.memory.textures--}function ie(y){const v=n.get(y);if(y.depthTexture&&y.depthTexture.dispose(),y.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(v.__webglFramebuffer[Z]))for(let ee=0;ee=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),g+=1,y}function H(y){const v=[];return v.push(y.wrapS),v.push(y.wrapT),v.push(y.wrapR||0),v.push(y.magFilter),v.push(y.minFilter),v.push(y.anisotropy),v.push(y.internalFormat),v.push(y.format),v.push(y.type),v.push(y.generateMipmaps),v.push(y.premultiplyAlpha),v.push(y.flipY),v.push(y.unpackAlignment),v.push(y.colorSpace),v.join()}function K(y,v){const I=n.get(y);if(y.isVideoTexture&&Re(y),y.isRenderTargetTexture===!1&&y.version>0&&I.__version!==y.version){const Z=y.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{Ye(I,y,v);return}}t.bindTexture(i.TEXTURE_2D,I.__webglTexture,i.TEXTURE0+v)}function Q(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Ye(I,y,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,I.__webglTexture,i.TEXTURE0+v)}function W(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Ye(I,y,v);return}t.bindTexture(i.TEXTURE_3D,I.__webglTexture,i.TEXTURE0+v)}function J(y,v){const I=n.get(y);if(y.version>0&&I.__version!==y.version){Y(I,y,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,I.__webglTexture,i.TEXTURE0+v)}const G={[Or]:i.REPEAT,[gn]:i.CLAMP_TO_EDGE,[Zs]:i.MIRRORED_REPEAT},fe={[wt]:i.NEAREST,[Sc]:i.NEAREST_MIPMAP_NEAREST,[$i]:i.NEAREST_MIPMAP_LINEAR,[It]:i.LINEAR,[es]:i.LINEAR_MIPMAP_NEAREST,[qn]:i.LINEAR_MIPMAP_LINEAR},pe={[bc]:i.NEVER,[Dc]:i.ALWAYS,[wc]:i.LESS,[vl]:i.LEQUAL,[Rc]:i.EQUAL,[Lc]:i.GEQUAL,[Cc]:i.GREATER,[Pc]:i.NOTEQUAL};function ve(y,v){if(v.type===tn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===It||v.magFilter===es||v.magFilter===$i||v.magFilter===qn||v.minFilter===It||v.minFilter===es||v.minFilter===$i||v.minFilter===qn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,G[v.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,G[v.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,G[v.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,fe[v.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,fe[v.minFilter]),v.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,pe[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===wt||v.minFilter!==$i&&v.minFilter!==qn||v.type===tn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const I=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,I.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function We(y,v){let I=!1;y.__webglInit===void 0&&(y.__webglInit=!0,v.addEventListener("dispose",z));const Z=v.source;let ee=p.get(Z);ee===void 0&&(ee={},p.set(Z,ee));const q=H(v);if(q!==y.__cacheKey){ee[q]===void 0&&(ee[q]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,I=!0),ee[q].usedTimes++;const xe=ee[y.__cacheKey];xe!==void 0&&(ee[y.__cacheKey].usedTimes--,xe.usedTimes===0&&B(v)),y.__cacheKey=q,y.__webglTexture=ee[q].texture}return I}function Ye(y,v,I){let Z=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Z=i.TEXTURE_3D);const ee=We(y,v),q=v.source;t.bindTexture(Z,y.__webglTexture,i.TEXTURE0+I);const xe=n.get(q);if(q.version!==xe.__version||ee===!0){t.activeTexture(i.TEXTURE0+I);const oe=Ze.getPrimaries(Ze.workingColorSpace),w=v.colorSpace===Ln?null:Ze.getPrimaries(v.colorSpace),re=v.colorSpace===Ln||oe===w?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,re);let j=x(v.image,!1,r.maxTextureSize);j=Qe(v,j);const se=s.convert(v.format,v.colorSpace),Me=s.convert(v.type);let Te=A(v.internalFormat,se,Me,v.colorSpace,v.isVideoTexture);ve(Z,v);let ue;const ze=v.mipmaps,Ae=v.isVideoTexture!==!0,ke=xe.__version===void 0||ee===!0,C=q.dataReady,he=T(v,j);if(v.isDepthTexture)Te=E(v.format===wi,v.type),ke&&(Ae?t.texStorage2D(i.TEXTURE_2D,1,Te,j.width,j.height):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,se,Me,null));else if(v.isDataTexture)if(ze.length>0){Ae&&ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,ze[0].width,ze[0].height);for(let k=0,$=ze.length;k<$;k++)ue=ze[k],Ae?C&&t.texSubImage2D(i.TEXTURE_2D,k,0,0,ue.width,ue.height,se,Me,ue.data):t.texImage2D(i.TEXTURE_2D,k,Te,ue.width,ue.height,0,se,Me,ue.data);v.generateMipmaps=!1}else Ae?(ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,j.width,j.height),C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,j.width,j.height,se,Me,j.data)):t.texImage2D(i.TEXTURE_2D,0,Te,j.width,j.height,0,se,Me,j.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ae&&ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,he,Te,ze[0].width,ze[0].height,j.depth);for(let k=0,$=ze.length;k<$;k++)if(ue=ze[k],v.format!==kt)if(se!==null)if(Ae){if(C)if(v.layerUpdates.size>0){const le=ko(ue.width,ue.height,v.format,v.type);for(const de of v.layerUpdates){const Xe=ue.data.subarray(de*le/ue.data.BYTES_PER_ELEMENT,(de+1)*le/ue.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,k,0,0,de,ue.width,ue.height,1,se,Xe,0,0)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,k,0,0,0,ue.width,ue.height,j.depth,se,ue.data,0,0)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,k,Te,ue.width,ue.height,j.depth,0,ue.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ae?C&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,k,0,0,0,ue.width,ue.height,j.depth,se,Me,ue.data):t.texImage3D(i.TEXTURE_2D_ARRAY,k,Te,ue.width,ue.height,j.depth,0,se,Me,ue.data)}else{Ae&&ke&&t.texStorage2D(i.TEXTURE_2D,he,Te,ze[0].width,ze[0].height);for(let k=0,$=ze.length;k<$;k++)ue=ze[k],v.format!==kt?se!==null?Ae?C&&t.compressedTexSubImage2D(i.TEXTURE_2D,k,0,0,ue.width,ue.height,se,ue.data):t.compressedTexImage2D(i.TEXTURE_2D,k,Te,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ae?C&&t.texSubImage2D(i.TEXTURE_2D,k,0,0,ue.width,ue.height,se,Me,ue.data):t.texImage2D(i.TEXTURE_2D,k,Te,ue.width,ue.height,0,se,Me,ue.data)}else if(v.isDataArrayTexture)if(Ae){if(ke&&t.texStorage3D(i.TEXTURE_2D_ARRAY,he,Te,j.width,j.height,j.depth),C)if(v.layerUpdates.size>0){const k=ko(j.width,j.height,v.format,v.type);for(const $ of v.layerUpdates){const le=j.data.subarray($*k/j.data.BYTES_PER_ELEMENT,($+1)*k/j.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,$,j.width,j.height,1,se,Me,le)}v.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,se,Me,j.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Te,j.width,j.height,j.depth,0,se,Me,j.data);else if(v.isData3DTexture)Ae?(ke&&t.texStorage3D(i.TEXTURE_3D,he,Te,j.width,j.height,j.depth),C&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,se,Me,j.data)):t.texImage3D(i.TEXTURE_3D,0,Te,j.width,j.height,j.depth,0,se,Me,j.data);else if(v.isFramebufferTexture){if(ke)if(Ae)t.texStorage2D(i.TEXTURE_2D,he,Te,j.width,j.height);else{let k=j.width,$=j.height;for(let le=0;le>=1,$>>=1}}else if(ze.length>0){if(Ae&&ke){const k=Ce(ze[0]);t.texStorage2D(i.TEXTURE_2D,he,Te,k.width,k.height)}for(let k=0,$=ze.length;k<$;k++)ue=ze[k],Ae?C&&t.texSubImage2D(i.TEXTURE_2D,k,0,0,se,Me,ue):t.texImage2D(i.TEXTURE_2D,k,Te,se,Me,ue);v.generateMipmaps=!1}else if(Ae){if(ke){const k=Ce(j);t.texStorage2D(i.TEXTURE_2D,he,Te,k.width,k.height)}C&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,se,Me,j)}else t.texImage2D(i.TEXTURE_2D,0,Te,se,Me,j);h(v)&&d(Z),xe.__version=q.version,v.onUpdate&&v.onUpdate(v)}y.__version=v.version}function Y(y,v,I){if(v.image.length!==6)return;const Z=We(y,v),ee=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,y.__webglTexture,i.TEXTURE0+I);const q=n.get(ee);if(ee.version!==q.__version||Z===!0){t.activeTexture(i.TEXTURE0+I);const xe=Ze.getPrimaries(Ze.workingColorSpace),oe=v.colorSpace===Ln?null:Ze.getPrimaries(v.colorSpace),w=v.colorSpace===Ln||xe===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,w);const re=v.isCompressedTexture||v.image[0].isCompressedTexture,j=v.image[0]&&v.image[0].isDataTexture,se=[];for(let $=0;$<6;$++)!re&&!j?se[$]=x(v.image[$],!0,r.maxCubemapSize):se[$]=j?v.image[$].image:v.image[$],se[$]=Qe(v,se[$]);const Me=se[0],Te=s.convert(v.format,v.colorSpace),ue=s.convert(v.type),ze=A(v.internalFormat,Te,ue,v.colorSpace),Ae=v.isVideoTexture!==!0,ke=q.__version===void 0||Z===!0,C=ee.dataReady;let he=T(v,Me);ve(i.TEXTURE_CUBE_MAP,v);let k;if(re){Ae&&ke&&t.texStorage2D(i.TEXTURE_CUBE_MAP,he,ze,Me.width,Me.height);for(let $=0;$<6;$++){k=se[$].mipmaps;for(let le=0;le0&&he++;const $=Ce(se[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,he,ze,$.width,$.height)}for(let $=0;$<6;$++)if(j){Ae?C&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,se[$].width,se[$].height,Te,ue,se[$].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,ze,se[$].width,se[$].height,0,Te,ue,se[$].data);for(let le=0;le>q),se=Math.max(1,v.height>>q);ee===i.TEXTURE_3D||ee===i.TEXTURE_2D_ARRAY?t.texImage3D(ee,q,w,j,se,v.depth,0,xe,oe,null):t.texImage2D(ee,q,w,j,se,0,xe,oe,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),Ve(v)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,ee,n.get(I).__webglTexture,0,Be(v)):(ee===i.TEXTURE_2D||ee>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,ee,n.get(I).__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function _e(y,v,I){if(i.bindRenderbuffer(i.RENDERBUFFER,y),v.depthBuffer){const Z=v.depthTexture,ee=Z&&Z.isDepthTexture?Z.type:null,q=E(v.stencilBuffer,ee),xe=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=Be(v);Ve(v)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,oe,q,v.width,v.height):I?i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,q,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,q,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,xe,i.RENDERBUFFER,y)}else{const Z=v.textures;for(let ee=0;ee{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,Z.removeEventListener("dispose",ee)};Z.addEventListener("dispose",ee),v.__depthDisposeCallback=ee}v.__boundDepthTexture=Z}if(y.depthTexture&&!v.__autoAllocateDepthBuffer){if(I)throw new Error("target.depthTexture not supported in Cube render targets");me(v.__webglFramebuffer,y)}else if(I){v.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[Z]),v.__webglDepthbuffer[Z]===void 0)v.__webglDepthbuffer[Z]=i.createRenderbuffer(),_e(v.__webglDepthbuffer[Z],y,!1);else{const ee=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer[Z];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,ee,i.RENDERBUFFER,q)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),_e(v.__webglDepthbuffer,y,!1);else{const Z=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ee=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ee),i.framebufferRenderbuffer(i.FRAMEBUFFER,Z,i.RENDERBUFFER,ee)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(y,v,I){const Z=n.get(y);v!==void 0&&te(Z.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),I!==void 0&&Ne(y)}function He(y){const v=y.texture,I=n.get(y),Z=n.get(v);y.addEventListener("dispose",L);const ee=y.textures,q=y.isWebGLCubeRenderTarget===!0,xe=ee.length>1;if(xe||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=v.version,o.memory.textures++),q){I.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0){I.__webglFramebuffer[oe]=[];for(let w=0;w0){I.__webglFramebuffer=[];for(let oe=0;oe0&&Ve(y)===!1){I.__webglMultisampledFramebuffer=i.createFramebuffer(),I.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let oe=0;oe0)for(let w=0;w0)for(let w=0;w0){if(Ve(y)===!1){const v=y.textures,I=y.width,Z=y.height;let ee=i.COLOR_BUFFER_BIT;const q=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,xe=n.get(y),oe=v.length>1;if(oe)for(let w=0;w0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Re(y){const v=o.render.frame;u.get(y)!==v&&(u.set(y,v),y.update())}function Qe(y,v){const I=y.colorSpace,Z=y.format,ee=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||I!==Nn&&I!==Ln&&(Ze.getTransfer(I)===nt?(Z!==kt||ee!==Mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",I)),v}function Ce(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=M,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=W,this.setTextureCube=J,this.rebindTextures=be,this.setupRenderTarget=He,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=vt,this.setupDepthRenderbuffer=Ne,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Ve}function Bp(i,e){function t(n,r=Ln){let s;const o=Ze.getTransfer(r);if(n===Mn)return i.UNSIGNED_BYTE;if(n===wa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ra)return i.UNSIGNED_SHORT_5_5_5_1;if(n===ul)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ll)return i.BYTE;if(n===cl)return i.SHORT;if(n===Gi)return i.UNSIGNED_SHORT;if(n===ba)return i.INT;if(n===Kn)return i.UNSIGNED_INT;if(n===tn)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===hl)return i.ALPHA;if(n===dl)return i.RGB;if(n===kt)return i.RGBA;if(n===fl)return i.LUMINANCE;if(n===pl)return i.LUMINANCE_ALPHA;if(n===Mi)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===ml)return i.RED;if(n===Ca)return i.RED_INTEGER;if(n===_l)return i.RG;if(n===Pa)return i.RG_INTEGER;if(n===La)return i.RGBA_INTEGER;if(n===Pr||n===Lr||n===Dr||n===Ur)if(o===nt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Pr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Dr)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===Pr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Lr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Dr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ks||n===js||n===$s||n===Js)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ks)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===js)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$s)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Js)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qs||n===ea||n===ta)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Qs||n===ea)return o===nt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ta)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===na||n===ia||n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ua||n===ha||n===da||n===fa||n===pa||n===ma)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===na)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ia)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ra)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===sa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===aa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===oa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===la)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ca)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ua)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ha)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===da)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===fa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pa)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ma)return o===nt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ir||n===_a||n===ga)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ir)return o===nt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===_a)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ga)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===gl||n===va||n===xa||n===Sa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ir)return s.COMPRESSED_RED_RGTC1_EXT;if(n===va)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Sa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===bi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class zp extends Qt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class vr extends ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Hp={type:"move"};class Ps{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vr,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 vr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),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 r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const h=t.getJointPose(x,n),d=this._getHandJoint(c,x);h!==null&&(d.matrix.fromArray(h.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=h.radius),d.visible=h!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),m=.02,_=.005;c.inputState.pinching&&p>m+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-_&&(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));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Hp)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new vr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const kp=` void main() { gl_Position = vec4( position, 1.0 ); @@ -3836,13 +3836,13 @@ void main() { } -}`;class Vp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Tt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new yt({vertexShader:kp,fragmentShader:Gp,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Nt(new Ci(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Wp extends Jn{constructor(e,t){super();const n=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,p=null,m=null,_=null;const x=new Vp,h=t.getContextAttributes();let d=null,A=null;const E=[],T=[],z=new De;let L=null;const b=new Qt;b.layers.enable(1),b.viewport=new lt;const B=new Qt;B.layers.enable(2),B.viewport=new lt;const ie=[b,B],g=new zp;g.layers.enable(1),g.layers.enable(2);let M=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let te=E[Y];return te===void 0&&(te=new Ps,E[Y]=te),te.getTargetRaySpace()},this.getControllerGrip=function(Y){let te=E[Y];return te===void 0&&(te=new Ps,E[Y]=te),te.getGripSpace()},this.getHand=function(Y){let te=E[Y];return te===void 0&&(te=new Ps,E[Y]=te),te.getHandSpace()};function k(Y){const te=T.indexOf(Y.inputSource);if(te===-1)return;const _e=E[te];_e!==void 0&&(_e.update(Y.inputSource,Y.frame,c||o),_e.dispatchEvent({type:Y.type,data:Y.inputSource}))}function K(){r.removeEventListener("select",k),r.removeEventListener("selectstart",k),r.removeEventListener("selectend",k),r.removeEventListener("squeeze",k),r.removeEventListener("squeezestart",k),r.removeEventListener("squeezeend",k),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",Q);for(let Y=0;Y=0&&(T[me]=null,E[me].disconnect(_e))}for(let te=0;te=T.length){T.push(_e),me=be;break}else if(T[be]===null){T[be]=_e,me=be;break}if(me===-1)break}const Ne=E[me];Ne&&Ne.connect(_e)}}const X=new U,J=new U;function V(Y,te,_e){X.setFromMatrixPosition(te.matrixWorld),J.setFromMatrixPosition(_e.matrixWorld);const me=X.distanceTo(J),Ne=te.projectionMatrix.elements,be=_e.projectionMatrix.elements,He=Ne[14]/(Ne[10]-1),Ke=Ne[14]/(Ne[10]+1),Ge=(Ne[9]+1)/Ne[5],R=(Ne[9]-1)/Ne[5],vt=(Ne[8]-1)/Ne[0],Be=(be[8]+1)/be[0],Ve=He*vt,Re=He*Be,Qe=me/(-vt+Be),Ce=Qe*-vt;if(te.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Ce),Y.translateZ(Qe),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ne[10]===-1)Y.projectionMatrix.copy(te.projectionMatrix),Y.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const y=He+Qe,v=Ke+Qe,I=Ve-Ce,Z=Re+(me-Ce),ee=Ge*Ke/v*y,q=R*Ke/v*y;Y.projectionMatrix.makePerspective(I,Z,ee,q,y,v),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function fe(Y,te){te===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(te.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let te=Y.near,_e=Y.far;x.texture!==null&&(x.depthNear>0&&(te=x.depthNear),x.depthFar>0&&(_e=x.depthFar)),g.near=B.near=b.near=te,g.far=B.far=b.far=_e,(M!==g.near||W!==g.far)&&(r.updateRenderState({depthNear:g.near,depthFar:g.far}),M=g.near,W=g.far);const me=Y.parent,Ne=g.cameras;fe(g,me);for(let be=0;be0&&(h.alphaTest.value=d.alphaTest);const A=e.get(d),E=A.envMap,T=A.envMapRotation;E&&(h.envMap.value=E,Gn.copy(T),Gn.x*=-1,Gn.y*=-1,Gn.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Gn.y*=-1,Gn.z*=-1),h.envMapRotation.value.setFromMatrix4(Xp.makeRotationFromEuler(Gn)),h.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=d.reflectivity,h.ior.value=d.ior,h.refractionRatio.value=d.refractionRatio),d.lightMap&&(h.lightMap.value=d.lightMap,h.lightMapIntensity.value=d.lightMapIntensity,t(d.lightMap,h.lightMapTransform)),d.aoMap&&(h.aoMap.value=d.aoMap,h.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,h.aoMapTransform))}function o(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,d.map&&(h.map.value=d.map,t(d.map,h.mapTransform))}function a(h,d){h.dashSize.value=d.dashSize,h.totalSize.value=d.dashSize+d.gapSize,h.scale.value=d.scale}function l(h,d,A,E){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.size.value=d.size*A,h.scale.value=E*.5,d.map&&(h.map.value=d.map,t(d.map,h.uvTransform)),d.alphaMap&&(h.alphaMap.value=d.alphaMap,t(d.alphaMap,h.alphaMapTransform)),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest)}function c(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.rotation.value=d.rotation,d.map&&(h.map.value=d.map,t(d.map,h.mapTransform)),d.alphaMap&&(h.alphaMap.value=d.alphaMap,t(d.alphaMap,h.alphaMapTransform)),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest)}function u(h,d){h.specular.value.copy(d.specular),h.shininess.value=Math.max(d.shininess,1e-4)}function f(h,d){d.gradientMap&&(h.gradientMap.value=d.gradientMap)}function p(h,d){h.metalness.value=d.metalness,d.metalnessMap&&(h.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,h.metalnessMapTransform)),h.roughness.value=d.roughness,d.roughnessMap&&(h.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,h.roughnessMapTransform)),d.envMap&&(h.envMapIntensity.value=d.envMapIntensity)}function m(h,d,A){h.ior.value=d.ior,d.sheen>0&&(h.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),h.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(h.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,h.sheenColorMapTransform)),d.sheenRoughnessMap&&(h.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,h.sheenRoughnessMapTransform))),d.clearcoat>0&&(h.clearcoat.value=d.clearcoat,h.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(h.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,h.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(h.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Ft&&h.clearcoatNormalScale.value.negate())),d.dispersion>0&&(h.dispersion.value=d.dispersion),d.iridescence>0&&(h.iridescence.value=d.iridescence,h.iridescenceIOR.value=d.iridescenceIOR,h.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(h.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,h.iridescenceMapTransform)),d.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),d.transmission>0&&(h.transmission.value=d.transmission,h.transmissionSamplerMap.value=A.texture,h.transmissionSamplerSize.value.set(A.width,A.height),d.transmissionMap&&(h.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,h.transmissionMapTransform)),h.thickness.value=d.thickness,d.thicknessMap&&(h.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=d.attenuationDistance,h.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(h.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(h.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=d.specularIntensity,h.specularColor.value.copy(d.specularColor),d.specularColorMap&&(h.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,h.specularColorMapTransform)),d.specularIntensityMap&&(h.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,h.specularIntensityMapTransform))}function _(h,d){d.matcap&&(h.matcap.value=d.matcap)}function x(h,d){const A=e.get(d).light;h.referencePosition.value.setFromMatrixPosition(A.matrixWorld),h.nearDistance.value=A.shadow.camera.near,h.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function qp(i,e,t,n){let r={},s={},o=[];const a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,E){const T=E.program;n.uniformBlockBinding(A,T)}function c(A,E){let T=r[A.id];T===void 0&&(_(A),T=u(A),r[A.id]=T,A.addEventListener("dispose",h));const z=E.program;n.updateUBOMapping(A,z);const L=e.render.frame;s[A.id]!==L&&(p(A),s[A.id]=L)}function u(A){const E=f();A.__bindingPointIndex=E;const T=i.createBuffer(),z=A.__size,L=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,z,L),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,T),T}function f(){for(let A=0;A0&&(T+=z-L),A.__size=T,A.__cache={},this}function x(A){const E={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(E.boundary=4,E.storage=4):A.isVector2?(E.boundary=8,E.storage=8):A.isVector3||A.isColor?(E.boundary=16,E.storage=12):A.isVector4?(E.boundary=16,E.storage=16):A.isMatrix3?(E.boundary=48,E.storage=48):A.isMatrix4?(E.boundary=64,E.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),E}function h(A){const E=A.target;E.removeEventListener("dispose",h);const T=o.indexOf(E.__bindingPointIndex);o.splice(T,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function d(){for(const A in r)i.deleteBuffer(r[A]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}class Zp{constructor(e={}){const{canvas:t=Nc(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=o;const m=new Uint32Array(4),_=new Int32Array(4);let x=null,h=null;const d=[],A=[];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=sn,this.toneMapping=Un,this.toneMappingExposure=1;const E=this;let T=!1,z=0,L=0,b=null,B=-1,ie=null;const g=new lt,M=new lt;let W=null;const k=new we(0);let K=0,Q=t.width,X=t.height,J=1,V=null,fe=null;const pe=new lt(0,0,Q,X),ve=new lt(0,0,Q,X);let We=!1;const Ye=new Ia;let Y=!1,te=!1;const _e=new rt,me=new rt,Ne=new U,be=new lt,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function Ge(){return b===null?J:1}let R=n;function vt(S,P){return t.getContext(S,P)}try{const S={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ya}`),t.addEventListener("webglcontextlost",$,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",de,!1),R===null){const P="webgl2";if(R=vt(P,S),R===null)throw vt(P)?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 Be,Ve,Re,Qe,Ce,y,v,I,Z,ee,q,xe,oe,w,re,j,se,Me,Te,ue,ze,Ae,ke,C;function he(){Be=new Jd(R),Be.init(),Ae=new Bp(R,Be),Ve=new Yd(R,Be,e,Ae),Re=new Np(R),Ve.reverseDepthBuffer&&Re.buffers.depth.setReversed(!0),Qe=new tf(R),Ce=new Sp,y=new Op(R,Be,Re,Ce,Ve,Ae,Qe),v=new Zd(E),I=new $d(E),Z=new lu(R),ke=new Wd(R,Z),ee=new Qd(R,Z,Qe,ke),q=new rf(R,ee,Z,Qe),Te=new nf(R,Ve,y),j=new qd(Ce),xe=new xp(E,v,I,Be,Ve,ke,j),oe=new Yp(E,Ce),w=new Ep,re=new Rp(Be),Me=new Vd(E,v,I,Re,q,p,l),se=new Up(E,q,Ve),C=new qp(R,Qe,Ve,Re),ue=new Xd(R,Be,Qe),ze=new ef(R,Be,Qe),Qe.programs=xe.programs,E.capabilities=Ve,E.extensions=Be,E.properties=Ce,E.renderLists=w,E.shadowMap=se,E.state=Re,E.info=Qe}he();const G=new Wp(E,R);this.xr=G,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const S=Be.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=Be.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(S){S!==void 0&&(J=S,this.setSize(Q,X,!1))},this.getSize=function(S){return S.set(Q,X)},this.setSize=function(S,P,F=!0){if(G.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=S,X=P,t.width=Math.floor(S*J),t.height=Math.floor(P*J),F===!0&&(t.style.width=S+"px",t.style.height=P+"px"),this.setViewport(0,0,S,P)},this.getDrawingBufferSize=function(S){return S.set(Q*J,X*J).floor()},this.setDrawingBufferSize=function(S,P,F){Q=S,X=P,J=F,t.width=Math.floor(S*F),t.height=Math.floor(P*F),this.setViewport(0,0,S,P)},this.getCurrentViewport=function(S){return S.copy(g)},this.getViewport=function(S){return S.copy(pe)},this.setViewport=function(S,P,F,O){S.isVector4?pe.set(S.x,S.y,S.z,S.w):pe.set(S,P,F,O),Re.viewport(g.copy(pe).multiplyScalar(J).round())},this.getScissor=function(S){return S.copy(ve)},this.setScissor=function(S,P,F,O){S.isVector4?ve.set(S.x,S.y,S.z,S.w):ve.set(S,P,F,O),Re.scissor(M.copy(ve).multiplyScalar(J).round())},this.getScissorTest=function(){return We},this.setScissorTest=function(S){Re.setScissorTest(We=S)},this.setOpaqueSort=function(S){V=S},this.setTransparentSort=function(S){fe=S},this.getClearColor=function(S){return S.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor.apply(Me,arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha.apply(Me,arguments)},this.clear=function(S=!0,P=!0,F=!0){let O=0;if(S){let D=!1;if(b!==null){const ne=b.texture.format;D=ne===La||ne===Pa||ne===Ca}if(D){const ne=b.texture.type,ce=ne===Mn||ne===jn||ne===Gi||ne===bi||ne===wa||ne===Ra,ge=Me.getClearColor(),Se=Me.getClearAlpha(),Pe=ge.r,Ue=ge.g,Ee=ge.b;ce?(m[0]=Pe,m[1]=Ue,m[2]=Ee,m[3]=Se,R.clearBufferuiv(R.COLOR,0,m)):(_[0]=Pe,_[1]=Ue,_[2]=Ee,_[3]=Se,R.clearBufferiv(R.COLOR,0,_))}else O|=R.COLOR_BUFFER_BIT}P&&(O|=R.DEPTH_BUFFER_BIT,R.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),F&&(O|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(O)},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",$,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",de,!1),w.dispose(),re.dispose(),Ce.dispose(),v.dispose(),I.dispose(),q.dispose(),ke.dispose(),C.dispose(),xe.dispose(),G.dispose(),G.removeEventListener("sessionstart",za),G.removeEventListener("sessionend",Ha),Fn.stop()};function $(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const S=Qe.autoReset,P=se.enabled,F=se.autoUpdate,O=se.needsUpdate,D=se.type;he(),Qe.autoReset=S,se.enabled=P,se.autoUpdate=F,se.needsUpdate=O,se.type=D}function de(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function Xe(S){const P=S.target;P.removeEventListener("dispose",Xe),ht(P)}function ht(S){Rt(S),Ce.remove(S)}function Rt(S){const P=Ce.get(S).programs;P!==void 0&&(P.forEach(function(F){xe.releaseProgram(F)}),S.isShaderMaterial&&xe.releaseShaderCache(S))}this.renderBufferDirect=function(S,P,F,O,D,ne){P===null&&(P=He);const ce=D.isMesh&&D.matrixWorld.determinant()<0,ge=Bl(S,P,F,O,D);Re.setMaterial(O,ce);let Se=F.index,Pe=1;if(O.wireframe===!0){if(Se=ee.getWireframeAttribute(F),Se===void 0)return;Pe=2}const Ue=F.drawRange,Ee=F.attributes.position;let Je=Ue.start*Pe,tt=(Ue.start+Ue.count)*Pe;ne!==null&&(Je=Math.max(Je,ne.start*Pe),tt=Math.min(tt,(ne.start+ne.count)*Pe)),Se!==null?(Je=Math.max(Je,0),tt=Math.min(tt,Se.count)):Ee!=null&&(Je=Math.max(Je,0),tt=Math.min(tt,Ee.count));const st=tt-Je;if(st<0||st===1/0)return;ke.setup(D,O,ge,F,Se);let Ot,je=ue;if(Se!==null&&(Ot=Z.get(Se),je=ze,je.setIndex(Ot)),D.isMesh)O.wireframe===!0?(Re.setLineWidth(O.wireframeLinewidth*Ge()),je.setMode(R.LINES)):je.setMode(R.TRIANGLES);else if(D.isLine){let ye=O.linewidth;ye===void 0&&(ye=1),Re.setLineWidth(ye*Ge()),D.isLineSegments?je.setMode(R.LINES):D.isLineLoop?je.setMode(R.LINE_LOOP):je.setMode(R.LINE_STRIP)}else D.isPoints?je.setMode(R.POINTS):D.isSprite&&je.setMode(R.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)je.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(Be.get("WEBGL_multi_draw"))je.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{const ye=D._multiDrawStarts,xt=D._multiDrawCounts,$e=D._multiDrawCount,Zt=Se?Z.get(Se).bytesPerElement:1,Qn=Ce.get(O).currentProgram.getUniforms();for(let Bt=0;Bt<$e;Bt++)Qn.setValue(R,"_gl_DrawID",Bt),je.render(ye[Bt]/Zt,xt[Bt])}else if(D.isInstancedMesh)je.renderInstances(Je,st,D.count);else if(F.isInstancedBufferGeometry){const ye=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,xt=Math.min(F.instanceCount,ye);je.renderInstances(Je,st,xt)}else je.render(Je,st)};function qe(S,P,F){S.transparent===!0&&S.side===_n&&S.forceSinglePass===!1?(S.side=Ft,S.needsUpdate=!0,ji(S,P,F),S.side=In,S.needsUpdate=!0,ji(S,P,F),S.side=_n):ji(S,P,F)}this.compile=function(S,P,F=null){F===null&&(F=S),h=re.get(F),h.init(P),A.push(h),F.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(h.pushLight(D),D.castShadow&&h.pushShadow(D))}),S!==F&&S.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(h.pushLight(D),D.castShadow&&h.pushShadow(D))}),h.setupLights();const O=new Set;return S.traverse(function(D){if(!(D.isMesh||D.isPoints||D.isLine||D.isSprite))return;const ne=D.material;if(ne)if(Array.isArray(ne))for(let ce=0;ce{function ne(){if(O.forEach(function(ce){Ce.get(ce).currentProgram.isReady()&&O.delete(ce)}),O.size===0){D(S);return}setTimeout(ne,10)}Be.get("KHR_parallel_shader_compile")!==null?ne():setTimeout(ne,10)})};let Ct=null;function on(S){Ct&&Ct(S)}function za(){Fn.stop()}function Ha(){Fn.start()}const Fn=new Pl;Fn.setAnimationLoop(on),typeof self<"u"&&Fn.setContext(self),this.setAnimationLoop=function(S){Ct=S,G.setAnimationLoop(S),S===null?Fn.stop():Fn.start()},G.addEventListener("sessionstart",za),G.addEventListener("sessionend",Ha),this.render=function(S,P){if(P!==void 0&&P.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),P.parent===null&&P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.enabled===!0&&G.isPresenting===!0&&(G.cameraAutoUpdate===!0&&G.updateCamera(P),P=G.getCamera()),S.isScene===!0&&S.onBeforeRender(E,S,P,b),h=re.get(S,A.length),h.init(P),A.push(h),me.multiplyMatrices(P.projectionMatrix,P.matrixWorldInverse),Ye.setFromProjectionMatrix(me),te=this.localClippingEnabled,Y=j.init(this.clippingPlanes,te),x=w.get(S,d.length),x.init(),d.push(x),G.enabled===!0&&G.isPresenting===!0){const ne=E.xr.getDepthSensingMesh();ne!==null&&jr(ne,P,-1/0,E.sortObjects)}jr(S,P,0,E.sortObjects),x.finish(),E.sortObjects===!0&&x.sort(V,fe),Ke=G.enabled===!1||G.isPresenting===!1||G.hasDepthSensing()===!1,Ke&&Me.addToRenderList(x,S),this.info.render.frame++,Y===!0&&j.beginShadows();const F=h.state.shadowsArray;se.render(F,S,P),Y===!0&&j.endShadows(),this.info.autoReset===!0&&this.info.reset();const O=x.opaque,D=x.transmissive;if(h.setupLights(),P.isArrayCamera){const ne=P.cameras;if(D.length>0)for(let ce=0,ge=ne.length;ce0&&Ga(O,D,S,P),Ke&&Me.render(S),ka(x,S,P);b!==null&&(y.updateMultisampleRenderTarget(b),y.updateRenderTargetMipmap(b)),S.isScene===!0&&S.onAfterRender(E,S,P),ke.resetDefaultState(),B=-1,ie=null,A.pop(),A.length>0?(h=A[A.length-1],Y===!0&&j.setGlobalState(E.clippingPlanes,h.state.camera)):h=null,d.pop(),d.length>0?x=d[d.length-1]:x=null};function jr(S,P,F,O){if(S.visible===!1)return;if(S.layers.test(P.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(P);else if(S.isLight)h.pushLight(S),S.castShadow&&h.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Ye.intersectsSprite(S)){O&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(me);const ce=q.update(S),ge=S.material;ge.visible&&x.push(S,ce,ge,F,be.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Ye.intersectsObject(S))){const ce=q.update(S),ge=S.material;if(O&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),be.copy(S.boundingSphere.center)):(ce.boundingSphere===null&&ce.computeBoundingSphere(),be.copy(ce.boundingSphere.center)),be.applyMatrix4(S.matrixWorld).applyMatrix4(me)),Array.isArray(ge)){const Se=ce.groups;for(let Pe=0,Ue=Se.length;Pe0&&Ki(D,P,F),ne.length>0&&Ki(ne,P,F),ce.length>0&&Ki(ce,P,F),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function Ga(S,P,F,O){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;h.state.transmissionRenderTarget[O.id]===void 0&&(h.state.transmissionRenderTarget[O.id]=new $n(1,1,{generateMipmaps:!0,type:Be.has("EXT_color_buffer_half_float")||Be.has("EXT_color_buffer_float")?Wi:Mn,minFilter:qn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ze.workingColorSpace}));const ne=h.state.transmissionRenderTarget[O.id],ce=O.viewport||g;ne.setSize(ce.z,ce.w);const ge=E.getRenderTarget();E.setRenderTarget(ne),E.getClearColor(k),K=E.getClearAlpha(),K<1&&E.setClearColor(16777215,.5),E.clear(),Ke&&Me.render(F);const Se=E.toneMapping;E.toneMapping=Un;const Pe=O.viewport;if(O.viewport!==void 0&&(O.viewport=void 0),h.setupLightsView(O),Y===!0&&j.setGlobalState(E.clippingPlanes,O),Ki(S,F,O),y.updateMultisampleRenderTarget(ne),y.updateRenderTargetMipmap(ne),Be.has("WEBGL_multisampled_render_to_texture")===!1){let Ue=!1;for(let Ee=0,Je=P.length;Ee0),Ee=!!F.morphAttributes.position,Je=!!F.morphAttributes.normal,tt=!!F.morphAttributes.color;let st=Un;O.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(st=E.toneMapping);const Ot=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,je=Ot!==void 0?Ot.length:0,ye=Ce.get(O),xt=h.state.lights;if(Y===!0&&(te===!0||S!==ie)){const Vt=S===ie&&O.id===B;j.setState(O,S,Vt)}let $e=!1;O.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==xt.state.version||ye.outputColorSpace!==ge||D.isBatchedMesh&&ye.batching===!1||!D.isBatchedMesh&&ye.batching===!0||D.isBatchedMesh&&ye.batchingColor===!0&&D.colorTexture===null||D.isBatchedMesh&&ye.batchingColor===!1&&D.colorTexture!==null||D.isInstancedMesh&&ye.instancing===!1||!D.isInstancedMesh&&ye.instancing===!0||D.isSkinnedMesh&&ye.skinning===!1||!D.isSkinnedMesh&&ye.skinning===!0||D.isInstancedMesh&&ye.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&ye.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&ye.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&ye.instancingMorph===!1&&D.morphTexture!==null||ye.envMap!==Se||O.fog===!0&&ye.fog!==ne||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==j.numPlanes||ye.numIntersection!==j.numIntersection)||ye.vertexAlphas!==Pe||ye.vertexTangents!==Ue||ye.morphTargets!==Ee||ye.morphNormals!==Je||ye.morphColors!==tt||ye.toneMapping!==st||ye.morphTargetsCount!==je)&&($e=!0):($e=!0,ye.__version=O.version);let Zt=ye.currentProgram;$e===!0&&(Zt=ji(O,P,D));let Qn=!1,Bt=!1,$r=!1;const ct=Zt.getUniforms(),yn=ye.uniforms;if(Re.useProgram(Zt.program)&&(Qn=!0,Bt=!0,$r=!0),O.id!==B&&(B=O.id,Bt=!0),Qn||ie!==S){Ve.reverseDepthBuffer?(_e.copy(S.projectionMatrix),Oc(_e),Bc(_e),ct.setValue(R,"projectionMatrix",_e)):ct.setValue(R,"projectionMatrix",S.projectionMatrix),ct.setValue(R,"viewMatrix",S.matrixWorldInverse);const Vt=ct.map.cameraPosition;Vt!==void 0&&Vt.setValue(R,Ne.setFromMatrixPosition(S.matrixWorld)),Ve.logarithmicDepthBuffer&&ct.setValue(R,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(O.isMeshPhongMaterial||O.isMeshToonMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial)&&ct.setValue(R,"isOrthographic",S.isOrthographicCamera===!0),ie!==S&&(ie=S,Bt=!0,$r=!0)}if(D.isSkinnedMesh){ct.setOptional(R,D,"bindMatrix"),ct.setOptional(R,D,"bindMatrixInverse");const Vt=D.skeleton;Vt&&(Vt.boneTexture===null&&Vt.computeBoneTexture(),ct.setValue(R,"boneTexture",Vt.boneTexture,y))}D.isBatchedMesh&&(ct.setOptional(R,D,"batchingTexture"),ct.setValue(R,"batchingTexture",D._matricesTexture,y),ct.setOptional(R,D,"batchingIdTexture"),ct.setValue(R,"batchingIdTexture",D._indirectTexture,y),ct.setOptional(R,D,"batchingColorTexture"),D._colorsTexture!==null&&ct.setValue(R,"batchingColorTexture",D._colorsTexture,y));const Jr=F.morphAttributes;if((Jr.position!==void 0||Jr.normal!==void 0||Jr.color!==void 0)&&Te.update(D,F,Zt),(Bt||ye.receiveShadow!==D.receiveShadow)&&(ye.receiveShadow=D.receiveShadow,ct.setValue(R,"receiveShadow",D.receiveShadow)),O.isMeshGouraudMaterial&&O.envMap!==null&&(yn.envMap.value=Se,yn.flipEnvMap.value=Se.isCubeTexture&&Se.isRenderTargetTexture===!1?-1:1),O.isMeshStandardMaterial&&O.envMap===null&&P.environment!==null&&(yn.envMapIntensity.value=P.environmentIntensity),Bt&&(ct.setValue(R,"toneMappingExposure",E.toneMappingExposure),ye.needsLights&&zl(yn,$r),ne&&O.fog===!0&&oe.refreshFogUniforms(yn,ne),oe.refreshMaterialUniforms(yn,O,J,X,h.state.transmissionRenderTarget[S.id]),Fr.upload(R,Wa(ye),yn,y)),O.isShaderMaterial&&O.uniformsNeedUpdate===!0&&(Fr.upload(R,Wa(ye),yn,y),O.uniformsNeedUpdate=!1),O.isSpriteMaterial&&ct.setValue(R,"center",D.center),ct.setValue(R,"modelViewMatrix",D.modelViewMatrix),ct.setValue(R,"normalMatrix",D.normalMatrix),ct.setValue(R,"modelMatrix",D.matrixWorld),O.isShaderMaterial||O.isRawShaderMaterial){const Vt=O.uniformsGroups;for(let Qr=0,kl=Vt.length;Qr0&&y.useMultisampledRTT(S)===!1?D=Ce.get(S).__webglMultisampledFramebuffer:Array.isArray(Ue)?D=Ue[F]:D=Ue,g.copy(S.viewport),M.copy(S.scissor),W=S.scissorTest}else g.copy(pe).multiplyScalar(J).floor(),M.copy(ve).multiplyScalar(J).floor(),W=We;if(Re.bindFramebuffer(R.FRAMEBUFFER,D)&&O&&Re.drawBuffers(S,D),Re.viewport(g),Re.scissor(M),Re.setScissorTest(W),ne){const Se=Ce.get(S.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+P,Se.__webglTexture,F)}else if(ce){const Se=Ce.get(S.texture),Pe=P||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Se.__webglTexture,F||0,Pe)}B=-1},this.readRenderTargetPixels=function(S,P,F,O,D,ne,ce){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(ge=ge[ce]),ge){Re.bindFramebuffer(R.FRAMEBUFFER,ge);try{const Se=S.texture,Pe=Se.format,Ue=Se.type;if(!Ve.textureFormatReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ve.textureTypeReadable(Ue)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P>=0&&P<=S.width-O&&F>=0&&F<=S.height-D&&R.readPixels(P,F,O,D,Ae.convert(Pe),Ae.convert(Ue),ne)}finally{const Se=b!==null?Ce.get(b).__webglFramebuffer:null;Re.bindFramebuffer(R.FRAMEBUFFER,Se)}}},this.readRenderTargetPixelsAsync=async function(S,P,F,O,D,ne,ce){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(ge=ge[ce]),ge){const Se=S.texture,Pe=Se.format,Ue=Se.type;if(!Ve.textureFormatReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ve.textureTypeReadable(Ue))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(P>=0&&P<=S.width-O&&F>=0&&F<=S.height-D){Re.bindFramebuffer(R.FRAMEBUFFER,ge);const Ee=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Ee),R.bufferData(R.PIXEL_PACK_BUFFER,ne.byteLength,R.STREAM_READ),R.readPixels(P,F,O,D,Ae.convert(Pe),Ae.convert(Ue),0);const Je=b!==null?Ce.get(b).__webglFramebuffer:null;Re.bindFramebuffer(R.FRAMEBUFFER,Je);const tt=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Fc(R,tt,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Ee),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ne),R.deleteBuffer(Ee),R.deleteSync(tt),ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(S,P=null,F=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),P=arguments[0]||null,S=arguments[1]);const O=Math.pow(2,-F),D=Math.floor(S.image.width*O),ne=Math.floor(S.image.height*O),ce=P!==null?P.x:0,ge=P!==null?P.y:0;y.setTexture2D(S,0),R.copyTexSubImage2D(R.TEXTURE_2D,F,0,0,ce,ge,D,ne),Re.unbindTexture()},this.copyTextureToTexture=function(S,P,F=null,O=null,D=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyTextureToTexture function signature has changed."),O=arguments[0]||null,S=arguments[1],P=arguments[2],D=arguments[3]||0,F=null);let ne,ce,ge,Se,Pe,Ue;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,ge=F.min.x,Se=F.min.y):(ne=S.image.width,ce=S.image.height,ge=0,Se=0),O!==null?(Pe=O.x,Ue=O.y):(Pe=0,Ue=0);const Ee=Ae.convert(P.format),Je=Ae.convert(P.type);y.setTexture2D(P,0),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,P.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,P.unpackAlignment);const tt=R.getParameter(R.UNPACK_ROW_LENGTH),st=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Ot=R.getParameter(R.UNPACK_SKIP_PIXELS),je=R.getParameter(R.UNPACK_SKIP_ROWS),ye=R.getParameter(R.UNPACK_SKIP_IMAGES),xt=S.isCompressedTexture?S.mipmaps[D]:S.image;R.pixelStorei(R.UNPACK_ROW_LENGTH,xt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,xt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,ge),R.pixelStorei(R.UNPACK_SKIP_ROWS,Se),S.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,D,Pe,Ue,ne,ce,Ee,Je,xt.data):S.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,D,Pe,Ue,xt.width,xt.height,Ee,xt.data):R.texSubImage2D(R.TEXTURE_2D,D,Pe,Ue,ne,ce,Ee,Je,xt),R.pixelStorei(R.UNPACK_ROW_LENGTH,tt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,st),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ot),R.pixelStorei(R.UNPACK_SKIP_ROWS,je),R.pixelStorei(R.UNPACK_SKIP_IMAGES,ye),D===0&&P.generateMipmaps&&R.generateMipmap(R.TEXTURE_2D),Re.unbindTexture()},this.copyTextureToTexture3D=function(S,P,F=null,O=null,D=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),F=arguments[0]||null,O=arguments[1]||null,S=arguments[2],P=arguments[3],D=arguments[4]||0);let ne,ce,ge,Se,Pe,Ue,Ee,Je,tt;const st=S.isCompressedTexture?S.mipmaps[D]:S.image;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,ge=F.max.z-F.min.z,Se=F.min.x,Pe=F.min.y,Ue=F.min.z):(ne=st.width,ce=st.height,ge=st.depth,Se=0,Pe=0,Ue=0),O!==null?(Ee=O.x,Je=O.y,tt=O.z):(Ee=0,Je=0,tt=0);const Ot=Ae.convert(P.format),je=Ae.convert(P.type);let ye;if(P.isData3DTexture)y.setTexture3D(P,0),ye=R.TEXTURE_3D;else if(P.isDataArrayTexture||P.isCompressedArrayTexture)y.setTexture2DArray(P,0),ye=R.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,P.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,P.unpackAlignment);const xt=R.getParameter(R.UNPACK_ROW_LENGTH),$e=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Zt=R.getParameter(R.UNPACK_SKIP_PIXELS),Qn=R.getParameter(R.UNPACK_SKIP_ROWS),Bt=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,st.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,st.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Se),R.pixelStorei(R.UNPACK_SKIP_ROWS,Pe),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ue),S.isDataTexture||S.isData3DTexture?R.texSubImage3D(ye,D,Ee,Je,tt,ne,ce,ge,Ot,je,st.data):P.isCompressedArrayTexture?R.compressedTexSubImage3D(ye,D,Ee,Je,tt,ne,ce,ge,Ot,st.data):R.texSubImage3D(ye,D,Ee,Je,tt,ne,ce,ge,Ot,je,st),R.pixelStorei(R.UNPACK_ROW_LENGTH,xt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,$e),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Zt),R.pixelStorei(R.UNPACK_SKIP_ROWS,Qn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Bt),D===0&&P.generateMipmaps&&R.generateMipmap(ye),Re.unbindTexture()},this.initRenderTarget=function(S){Ce.get(S).__webglFramebuffer===void 0&&y.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?y.setTextureCube(S,0):S.isData3DTexture?y.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?y.setTexture2DArray(S,0):y.setTexture2D(S,0),Re.unbindTexture()},this.resetState=function(){z=0,L=0,b=null,Re.reset(),ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Da?"display-p3":"srgb",t.unpackColorSpace=Ze.workingColorSpace===qr?"display-p3":"srgb"}}class Kp extends ft{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 En,this.environmentIntensity=1,this.environmentRotation=new En,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 Go extends Tt{constructor(e=null,t=1,n=1,r,s,o,a,l,c=wt,u=wt,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Vr extends Gt{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}class Fl extends qi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new we(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Wr=new U,Xr=new U,Vo=new rt,zi=new El,xr=new Zr,Ls=new U,Wo=new U;class jp extends ft{constructor(e=new rn,t=new Fl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sn)return;Ls.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Ls);if(!(le.far))return{distance:l,point:Wo.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const Xo=new U,Yo=new U;class $p extends jp{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 r=0,s=t.count;r[...n].reduce((r,[s,o])=>(r[s]=o===""?!0:o,r),{}))(new URLSearchParams(window.location.search));this.override(t)}}override(e){for(const t in e)if(this[t]!==void 0){const n=e[t].toString();typeof this[t]=="boolean"?this[t]=!(n==="0"||n===!1):typeof this[t]=="number"?this[t]=parseFloat(n):typeof this[t]=="string"&&(this[t]=n)}}}const ot=new om;function lm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ol={exports:{}};(function(i){(function(e){function t(){this._listeners=[],this.dispatchCount=0}var n=t.prototype;n.add=a,n.addOnce=l,n.remove=c,n.dispatch=u;var r="Callback function is missing!",s=Array.prototype.slice;function o(f){f.sort(function(p,m){return p=p.p,m=m.p,mp?-1:0})}function a(f,p,m,_){if(!f)throw r;m=m||0;for(var x=this._listeners,h,d,A,E=x.length;E--;)if(h=x[E],h.f===f&&h.c===p)return!1;typeof m=="function"&&(d=m,m=_,A=4),x.unshift({f,c:p,p:m,r:d||f,a:s.call(arguments,A||3),j:0}),o(x)}function l(f,p,m,_){if(!f)throw r;var x=this,h=function(){return x.remove.call(x,f,p),f.apply(p,s.call(arguments,0))};_=s.call(arguments,0),_.length===1&&_.push(e),_.splice(2,0,h),a.apply(x,_)}function c(f,p){if(!f)return this._listeners.length=0,!0;for(var m=this._listeners,_,x=m.length;x--;)if(_=m[x],_.f===f&&(!p||_.c===p))return _.j=0,m.splice(x,1),!0;return!1}function u(f){f=s.call(arguments,0),this.dispatchCount++;for(var p=this.dispatchCount,m=this._listeners,_,x,h=m.length;h--;)if(_=m[h],_&&_.jMath.hypot(i,e);class um{constructor(e=0,t=0,n=0){this.id=e,this.row=t,this.col=n,this.distance=$o(t,n),this.MAX_DISTANCE=$o(Yt,Yt),this.priority=this.MAX_DISTANCE-this.distance,this.ringIndex=Math.floor(this.distance),this.isMain=t===0&&n===0,this.isBorder=Math.abs(t)===2||Math.abs(n)===2,this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0,this.neighbours=null,this.reachableNeighbours=null,this.prioritySortedReachableNeighbours=null,this.randomDelay=Math.random()*.5+(this.MAX_DISTANCE-this.priority)*.5}init(){this.reachableNeighbours=this.neighbours.filter(e=>e.row===this.row||e.col===this.col),this._sortPriorityNeighbours()}_sortPriorityNeighbours(){this.prioritySortedReachableNeighbours=[...this.reachableNeighbours].sort((e,t)=>e.priority-t.priority)}shuffleReachableNeighbours(){for(let e=this.reachableNeighbours.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[this.reachableNeighbours[e],this.reachableNeighbours[t]]=[this.reachableNeighbours[t],this.reachableNeighbours[e]]}this._sortPriorityNeighbours()}preUpdate(e){this.activeRatio=0}reset(){this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0}update(e){}}const Ut=5,pn=Ut+2,Yt=Math.floor(Ut/2),Xt=Ut*Ut,hm=pn*pn;class dm{constructor(){N(this,"tiles",[]);N(this,"mainTile",null)}init(){this.tiles=Array.from({length:Ut},(e,t)=>Array.from({length:Ut},(n,r)=>{const s=t-Yt,o=r-Yt;return new um(t*Ut+r,s,o)})),this.tiles.forEach((e,t)=>e.forEach((n,r)=>{n.neighbours=this._getNeighbouringTiles(t-Yt,r-Yt),n.init()})),this.mainTile=this.getTile(0,0)}getTile(e,t){var n;return((n=this.tiles[e+Yt])==null?void 0:n[t+Yt])||null}getRandomFreeTile(){const e=this.tiles.flat().filter(t=>!t.isOccupied);return e.length?e[Math.floor(Math.random()*e.length)]:null}_getNeighbouringTiles(e,t){return[-1,0,1].flatMap(n=>[-1,0,1].map(r=>n===0&&r===0?null:this.getTile(e+n,t+r)).filter(Boolean))}reset(){this.tiles.flat().forEach(e=>e.reset())}preUpdate(e){this.tiles.flat().forEach(t=>t.preUpdate(e))}update(e){this.tiles.flat().forEach(t=>t.update(e))}}const Jt=new dm;class fm{constructor(){N(this,"time",0);N(this,"deltaTime",0);N(this,"width",0);N(this,"height",0);N(this,"viewportWidth",0);N(this,"viewportHeight",0);N(this,"cameraZoom",1);N(this,"cameraOffsetX",0);N(this,"cameraOffsetY",0);N(this,"renderer",null);N(this,"scene",null);N(this,"camera",null);N(this,"postprocessing",null);N(this,"resolution",new De);N(this,"viewportResolution",new De);N(this,"canvas",null);N(this,"isPaused",!1);N(this,"showVisual",ot.SHOW_BLOCK);N(this,"sharedUniforms",{u_time:{value:0},u_deltaTime:{value:1},u_resolution:{value:this.resolution},u_viewportResolution:{value:this.viewportResolution},u_bgColor1:{value:new we},u_bgColor2:{value:new we}});N(this,"loadList",[]);N(this,"animationSpeed",1);N(this,"bgColor1","#212121");N(this,"bgColor2","#212121");N(this,"neutralColor","#040723");N(this,"successColor","#c9eb00");N(this,"mainColor","#813bf5");N(this,"failColor","#fe2c3f");N(this,"particlesOpacity",.75);N(this,"particlesSize",.01);N(this,"particlesColor","#505050");N(this,"goboIntensity",.7);N(this,"activeBlocksCount",0);N(this,"maxFreeBlocksCount",Xt-5);N(this,"lightPositionX",-2);N(this,"lightPositionY",6);N(this,"lightPositionZ",-4);N(this,"lightCameraHelperSignal",new xn);N(this,"lightCameraUpdateSignal",new xn);N(this,"lightCameraSize",4.5);N(this,"lightCameraBias",.005);N(this,"lightCameraNear",3);N(this,"lightCameraFar",16);N(this,"errorBlock",null);N(this,"errorBlockMaxLifeCycle",4);N(this,"minSpawnedBlocksForTheErrorBlock",this.maxFreeBlocksCount-2)}}const H=new fm;class pm{constructor(){N(this,"list",[]);N(this,"loadedCount",0);N(this,"onLoadCallback",null)}loadBuf(e,t){this.list.push(async()=>{try{const r=await(await fetch(e)).arrayBuffer(),s=new Uint32Array(r,0,1)[0],o=JSON.parse(new TextDecoder().decode(new Uint8Array(r,4,s))),{vertexCount:a,indexCount:l,attributes:c}=o;let u=4+s;const f=new rn,p={};c.forEach(m=>{const{id:_,componentSize:x,storageType:h,needsPack:d,packedComponents:A}=m,E=_==="indices"?l:a,T=window[h],z=new T(r,u,E*x),L=T.BYTES_PER_ELEMENT;let b;d?b=this._packAttribute(z,E,x,A,h):(p[_]=u,b=z),_==="indices"?f.setIndex(new Gt(b,1)):f.setAttribute(_,new Gt(b,x)),u+=E*x*L}),t&&t(f),this._onLoad()}catch(n){console.error("Error loading buffer:",n)}})}_packAttribute(e,t,n,r,s){const o=r.length,a=s.indexOf("Int")===0,l=1<{new tm().load(e,n=>{n.minFilter=Mc,n.magFilter=It,n.generateMipmaps=!0,n.anisotropy=H.renderer.capabilities.getMaxAnisotropy(),n.flipY=!0,t&&t(n),this._onLoad()},void 0,n=>console.error("Error loading texture:",n))})}start(e){this.loadedCount=0,this.onLoadCallback=e,this.list.forEach(t=>t())}_onLoad(){this.loadedCount++,this.loadedCount===this.list.length&&(this.list=[],this.onLoadCallback&&this.onLoadCallback())}}const Sn=new pm,Jo={type:"change"},Us={type:"start"},Qo={type:"end"};class mm extends Jn{constructor(e,t){super(),t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=Math.PI*.2,this.maxPolarAngle=Math.PI*.45,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.15,this.enableZoom=!1,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=.5,this.enablePan=!1,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ei.ROTATE,MIDDLE:ei.DOLLY,RIGHT:ei.PAN},this.touches={ONE:ti.ROTATE,TWO:ti.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.scale=1,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(w){w.addEventListener("keydown",y),this._domElementKeyEvents=w},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.scale=1,n.object.updateProjectionMatrix(),n.dispatchEvent(Jo),n.update(),s=r.NONE},this.update=function(){const w=new U,re=new qt().setFromUnitVectors(e.up,new U(0,1,0)),j=re.clone().invert(),se=new U,Me=new qt,Te=2*Math.PI;return function(){const ze=n.object.position;w.copy(ze).sub(n.target),w.applyQuaternion(re),a.setFromVector3(w),n.autoRotate&&s===r.NONE&&B(L()),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let Ae=n.minAzimuthAngle,ke=n.maxAzimuthAngle;isFinite(Ae)&&isFinite(ke)&&(Ae<-Math.PI?Ae+=Te:Ae>Math.PI&&(Ae-=Te),ke<-Math.PI?ke+=Te:ke>Math.PI&&(ke-=Te),Ae<=ke?a.theta=Math.max(Ae,Math.min(ke,a.theta)):a.theta=a.theta>(Ae+ke)/2?Math.max(Ae,a.theta):Math.min(ke,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe();let C=n.enableDamping?(n.scale-1)*n.dampingFactor+1:n.scale;return a.radius*=C,a.radius=Math.max(n.minDistance,Math.min(n.maxDistance,a.radius)),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),w.setFromSpherical(a),w.applyQuaternion(j),ze.copy(n.target).add(w),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),n.scale=n.scale/C,u||se.distanceToSquared(n.object.position)>o||8*(1-Me.dot(n.object.quaternion))>o?(n.dispatchEvent(Jo),se.copy(n.object.position),Me.copy(n.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",Z),n.domElement.removeEventListener("pointerdown",R),n.domElement.removeEventListener("pointercancel",Ve),n.domElement.removeEventListener("wheel",Ce),n.domElement.removeEventListener("pointermove",vt),n.domElement.removeEventListener("pointerup",Be),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",y)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,a=new jo,l=new jo,c=new U;let u=!1;const f=new De,p=new De,m=new De,_=new De,x=new De,h=new De,d=new De,A=new De,E=new De,T=[],z={};function L(){return 2*Math.PI/60/60*n.autoRotateSpeed}function b(){return Math.pow(.95,n.zoomSpeed)}function B(w){l.theta-=w}function ie(w){l.phi-=w}const g=function(){const w=new U;return function(j,se){w.setFromMatrixColumn(se,0),w.multiplyScalar(-j),c.add(w)}}(),M=function(){const w=new U;return function(j,se){n.screenSpacePanning===!0?w.setFromMatrixColumn(se,1):(w.setFromMatrixColumn(se,0),w.crossVectors(n.object.up,w)),w.multiplyScalar(j),c.add(w)}}(),W=function(){const w=new U;return function(j,se){const Me=n.domElement;if(n.object.isPerspectiveCamera){const Te=n.object.position;w.copy(Te).sub(n.target);let ue=w.length();ue*=Math.tan(n.object.fov/2*Math.PI/180),g(2*j*ue/Me.clientHeight,n.object.matrix),M(2*se*ue/Me.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(g(j*(n.object.right-n.object.left)/n.object.zoom/Me.clientWidth,n.object.matrix),M(se*(n.object.top-n.object.bottom)/n.object.zoom/Me.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function k(w){n.object.isPerspectiveCamera?n.scale/=w:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*w)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(w){n.object.isPerspectiveCamera?n.scale*=w:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/w)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Q(w){f.set(w.clientX,w.clientY)}function X(w){d.set(w.clientX,w.clientY)}function J(w){_.set(w.clientX,w.clientY)}function V(w){p.set(w.clientX,w.clientY),m.subVectors(p,f).multiplyScalar(n.rotateSpeed);const re=n.domElement;B(2*Math.PI*m.x/re.clientHeight),ie(2*Math.PI*m.y/re.clientHeight),f.copy(p),n.update()}function fe(w){A.set(w.clientX,w.clientY),E.subVectors(A,d),E.y>0?k(b()):E.y<0&&K(b()),d.copy(A),n.update()}function pe(w){x.set(w.clientX,w.clientY),h.subVectors(x,_).multiplyScalar(n.panSpeed),W(h.x,h.y),_.copy(x),n.update()}function ve(w){w.deltaY<0?K(b()):w.deltaY>0&&k(b()),n.update()}function We(w){let re=!1;switch(w.code){case n.keys.UP:W(0,n.keyPanSpeed),re=!0;break;case n.keys.BOTTOM:W(0,-n.keyPanSpeed),re=!0;break;case n.keys.LEFT:W(n.keyPanSpeed,0),re=!0;break;case n.keys.RIGHT:W(-n.keyPanSpeed,0),re=!0;break}re&&(w.preventDefault(),n.update())}function Ye(){if(T.length===1)f.set(T[0].pageX,T[0].pageY);else{const w=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);f.set(w,re)}}function Y(){if(T.length===1)_.set(T[0].pageX,T[0].pageY);else{const w=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);_.set(w,re)}}function te(){const w=T[0].pageX-T[1].pageX,re=T[0].pageY-T[1].pageY,j=Math.sqrt(w*w+re*re);d.set(0,j)}function _e(){n.enableZoom&&te(),n.enablePan&&Y()}function me(){n.enableZoom&&te(),n.enableRotate&&Ye()}function Ne(w){if(T.length==1)p.set(w.pageX,w.pageY);else{const j=oe(w),se=.5*(w.pageX+j.x),Me=.5*(w.pageY+j.y);p.set(se,Me)}m.subVectors(p,f).multiplyScalar(n.rotateSpeed);const re=n.domElement;B(2*Math.PI*m.x/re.clientHeight),ie(2*Math.PI*m.y/re.clientHeight),f.copy(p)}function be(w){if(T.length===1)x.set(w.pageX,w.pageY);else{const re=oe(w),j=.5*(w.pageX+re.x),se=.5*(w.pageY+re.y);x.set(j,se)}h.subVectors(x,_).multiplyScalar(n.panSpeed),W(h.x,h.y),_.copy(x)}function He(w){const re=oe(w),j=w.pageX-re.x,se=w.pageY-re.y,Me=Math.sqrt(j*j+se*se);A.set(0,Me),E.set(0,Math.pow(A.y/d.y,n.zoomSpeed)),k(E.y),d.copy(A)}function Ke(w){n.enableZoom&&He(w),n.enablePan&&be(w)}function Ge(w){n.enableZoom&&He(w),n.enableRotate&&Ne(w)}function R(w){n.enabled!==!1&&(T.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",vt),n.domElement.addEventListener("pointerup",Be)),ee(w),w.pointerType==="touch"?v(w):Re(w))}function vt(w){n.enabled!==!1&&(w.pointerType==="touch"?I(w):Qe(w))}function Be(w){q(w),T.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",vt),n.domElement.removeEventListener("pointerup",Be)),n.dispatchEvent(Qo),s=r.NONE}function Ve(w){q(w)}function Re(w){let re;switch(w.button){case 0:re=n.mouseButtons.LEFT;break;case 1:re=n.mouseButtons.MIDDLE;break;case 2:re=n.mouseButtons.RIGHT;break;default:re=-1}switch(re){case ei.DOLLY:if(n.enableZoom===!1)return;X(w),s=r.DOLLY;break;case ei.ROTATE:if(w.ctrlKey||w.metaKey||w.shiftKey){if(n.enablePan===!1)return;J(w),s=r.PAN}else{if(n.enableRotate===!1)return;Q(w),s=r.ROTATE}break;case ei.PAN:if(w.ctrlKey||w.metaKey||w.shiftKey){if(n.enableRotate===!1)return;Q(w),s=r.ROTATE}else{if(n.enablePan===!1)return;J(w),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Us)}function Qe(w){if(n.enabled!==!1)switch(s){case r.ROTATE:if(n.enableRotate===!1)return;V(w);break;case r.DOLLY:if(n.enableZoom===!1)return;fe(w);break;case r.PAN:if(n.enablePan===!1)return;pe(w);break}}function Ce(w){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(n.dispatchEvent(Us),ve(w),n.dispatchEvent(Qo))}function y(w){n.enabled===!1||n.enablePan===!1||We(w)}function v(w){switch(xe(w),T.length){case 1:switch(n.touches.ONE){case ti.ROTATE:if(n.enableRotate===!1)return;Ye(),s=r.TOUCH_ROTATE;break;case ti.PAN:if(n.enablePan===!1)return;Y(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case ti.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;_e(),s=r.TOUCH_DOLLY_PAN;break;case ti.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Us)}function I(w){switch(xe(w),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ne(w),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;be(w),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ke(w),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ge(w),n.update();break;default:s=r.NONE}}function Z(w){n.enabled}function ee(w){T.push(w)}function q(w){delete z[w.pointerId];for(let re=0;re=0&&(T[me]=null,E[me].disconnect(_e))}for(let te=0;te=T.length){T.push(_e),me=be;break}else if(T[be]===null){T[be]=_e,me=be;break}if(me===-1)break}const Ne=E[me];Ne&&Ne.connect(_e)}}const W=new U,J=new U;function G(Y,te,_e){W.setFromMatrixPosition(te.matrixWorld),J.setFromMatrixPosition(_e.matrixWorld);const me=W.distanceTo(J),Ne=te.projectionMatrix.elements,be=_e.projectionMatrix.elements,He=Ne[14]/(Ne[10]-1),Ke=Ne[14]/(Ne[10]+1),Ge=(Ne[9]+1)/Ne[5],R=(Ne[9]-1)/Ne[5],vt=(Ne[8]-1)/Ne[0],Be=(be[8]+1)/be[0],Ve=He*vt,Re=He*Be,Qe=me/(-vt+Be),Ce=Qe*-vt;if(te.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Ce),Y.translateZ(Qe),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ne[10]===-1)Y.projectionMatrix.copy(te.projectionMatrix),Y.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const y=He+Qe,v=Ke+Qe,I=Ve-Ce,Z=Re+(me-Ce),ee=Ge*Ke/v*y,q=R*Ke/v*y;Y.projectionMatrix.makePerspective(I,Z,ee,q,y,v),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function fe(Y,te){te===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(te.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;let te=Y.near,_e=Y.far;x.texture!==null&&(x.depthNear>0&&(te=x.depthNear),x.depthFar>0&&(_e=x.depthFar)),g.near=B.near=b.near=te,g.far=B.far=b.far=_e,(M!==g.near||V!==g.far)&&(r.updateRenderState({depthNear:g.near,depthFar:g.far}),M=g.near,V=g.far);const me=Y.parent,Ne=g.cameras;fe(g,me);for(let be=0;be0&&(h.alphaTest.value=d.alphaTest);const A=e.get(d),E=A.envMap,T=A.envMapRotation;E&&(h.envMap.value=E,Gn.copy(T),Gn.x*=-1,Gn.y*=-1,Gn.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Gn.y*=-1,Gn.z*=-1),h.envMapRotation.value.setFromMatrix4(Xp.makeRotationFromEuler(Gn)),h.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=d.reflectivity,h.ior.value=d.ior,h.refractionRatio.value=d.refractionRatio),d.lightMap&&(h.lightMap.value=d.lightMap,h.lightMapIntensity.value=d.lightMapIntensity,t(d.lightMap,h.lightMapTransform)),d.aoMap&&(h.aoMap.value=d.aoMap,h.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,h.aoMapTransform))}function o(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,d.map&&(h.map.value=d.map,t(d.map,h.mapTransform))}function a(h,d){h.dashSize.value=d.dashSize,h.totalSize.value=d.dashSize+d.gapSize,h.scale.value=d.scale}function l(h,d,A,E){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.size.value=d.size*A,h.scale.value=E*.5,d.map&&(h.map.value=d.map,t(d.map,h.uvTransform)),d.alphaMap&&(h.alphaMap.value=d.alphaMap,t(d.alphaMap,h.alphaMapTransform)),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest)}function c(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.rotation.value=d.rotation,d.map&&(h.map.value=d.map,t(d.map,h.mapTransform)),d.alphaMap&&(h.alphaMap.value=d.alphaMap,t(d.alphaMap,h.alphaMapTransform)),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest)}function u(h,d){h.specular.value.copy(d.specular),h.shininess.value=Math.max(d.shininess,1e-4)}function f(h,d){d.gradientMap&&(h.gradientMap.value=d.gradientMap)}function p(h,d){h.metalness.value=d.metalness,d.metalnessMap&&(h.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,h.metalnessMapTransform)),h.roughness.value=d.roughness,d.roughnessMap&&(h.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,h.roughnessMapTransform)),d.envMap&&(h.envMapIntensity.value=d.envMapIntensity)}function m(h,d,A){h.ior.value=d.ior,d.sheen>0&&(h.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),h.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(h.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,h.sheenColorMapTransform)),d.sheenRoughnessMap&&(h.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,h.sheenRoughnessMapTransform))),d.clearcoat>0&&(h.clearcoat.value=d.clearcoat,h.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(h.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,h.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(h.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Ft&&h.clearcoatNormalScale.value.negate())),d.dispersion>0&&(h.dispersion.value=d.dispersion),d.iridescence>0&&(h.iridescence.value=d.iridescence,h.iridescenceIOR.value=d.iridescenceIOR,h.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(h.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,h.iridescenceMapTransform)),d.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),d.transmission>0&&(h.transmission.value=d.transmission,h.transmissionSamplerMap.value=A.texture,h.transmissionSamplerSize.value.set(A.width,A.height),d.transmissionMap&&(h.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,h.transmissionMapTransform)),h.thickness.value=d.thickness,d.thicknessMap&&(h.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=d.attenuationDistance,h.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(h.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(h.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=d.specularIntensity,h.specularColor.value.copy(d.specularColor),d.specularColorMap&&(h.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,h.specularColorMapTransform)),d.specularIntensityMap&&(h.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,h.specularIntensityMapTransform))}function _(h,d){d.matcap&&(h.matcap.value=d.matcap)}function x(h,d){const A=e.get(d).light;h.referencePosition.value.setFromMatrixPosition(A.matrixWorld),h.nearDistance.value=A.shadow.camera.near,h.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function qp(i,e,t,n){let r={},s={},o=[];const a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,E){const T=E.program;n.uniformBlockBinding(A,T)}function c(A,E){let T=r[A.id];T===void 0&&(_(A),T=u(A),r[A.id]=T,A.addEventListener("dispose",h));const z=E.program;n.updateUBOMapping(A,z);const L=e.render.frame;s[A.id]!==L&&(p(A),s[A.id]=L)}function u(A){const E=f();A.__bindingPointIndex=E;const T=i.createBuffer(),z=A.__size,L=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,z,L),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,T),T}function f(){for(let A=0;A0&&(T+=z-L),A.__size=T,A.__cache={},this}function x(A){const E={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(E.boundary=4,E.storage=4):A.isVector2?(E.boundary=8,E.storage=8):A.isVector3||A.isColor?(E.boundary=16,E.storage=12):A.isVector4?(E.boundary=16,E.storage=16):A.isMatrix3?(E.boundary=48,E.storage=48):A.isMatrix4?(E.boundary=64,E.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),E}function h(A){const E=A.target;E.removeEventListener("dispose",h);const T=o.indexOf(E.__bindingPointIndex);o.splice(T,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function d(){for(const A in r)i.deleteBuffer(r[A]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}class Zp{constructor(e={}){const{canvas:t=Nc(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=o;const m=new Uint32Array(4),_=new Int32Array(4);let x=null,h=null;const d=[],A=[];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=sn,this.toneMapping=Un,this.toneMappingExposure=1;const E=this;let T=!1,z=0,L=0,b=null,B=-1,ie=null;const g=new lt,M=new lt;let V=null;const H=new we(0);let K=0,Q=t.width,W=t.height,J=1,G=null,fe=null;const pe=new lt(0,0,Q,W),ve=new lt(0,0,Q,W);let We=!1;const Ye=new Ia;let Y=!1,te=!1;const _e=new rt,me=new rt,Ne=new U,be=new lt,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function Ge(){return b===null?J:1}let R=n;function vt(S,P){return t.getContext(S,P)}try{const S={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ya}`),t.addEventListener("webglcontextlost",$,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",de,!1),R===null){const P="webgl2";if(R=vt(P,S),R===null)throw vt(P)?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 Be,Ve,Re,Qe,Ce,y,v,I,Z,ee,q,xe,oe,w,re,j,se,Me,Te,ue,ze,Ae,ke,C;function he(){Be=new Jd(R),Be.init(),Ae=new Bp(R,Be),Ve=new Yd(R,Be,e,Ae),Re=new Np(R),Ve.reverseDepthBuffer&&Re.buffers.depth.setReversed(!0),Qe=new tf(R),Ce=new Sp,y=new Op(R,Be,Re,Ce,Ve,Ae,Qe),v=new Zd(E),I=new $d(E),Z=new lu(R),ke=new Wd(R,Z),ee=new Qd(R,Z,Qe,ke),q=new rf(R,ee,Z,Qe),Te=new nf(R,Ve,y),j=new qd(Ce),xe=new xp(E,v,I,Be,Ve,ke,j),oe=new Yp(E,Ce),w=new Ep,re=new Rp(Be),Me=new Vd(E,v,I,Re,q,p,l),se=new Up(E,q,Ve),C=new qp(R,Qe,Ve,Re),ue=new Xd(R,Be,Qe),ze=new ef(R,Be,Qe),Qe.programs=xe.programs,E.capabilities=Ve,E.extensions=Be,E.properties=Ce,E.renderLists=w,E.shadowMap=se,E.state=Re,E.info=Qe}he();const k=new Wp(E,R);this.xr=k,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const S=Be.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=Be.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(S){S!==void 0&&(J=S,this.setSize(Q,W,!1))},this.getSize=function(S){return S.set(Q,W)},this.setSize=function(S,P,F=!0){if(k.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=S,W=P,t.width=Math.floor(S*J),t.height=Math.floor(P*J),F===!0&&(t.style.width=S+"px",t.style.height=P+"px"),this.setViewport(0,0,S,P)},this.getDrawingBufferSize=function(S){return S.set(Q*J,W*J).floor()},this.setDrawingBufferSize=function(S,P,F){Q=S,W=P,J=F,t.width=Math.floor(S*F),t.height=Math.floor(P*F),this.setViewport(0,0,S,P)},this.getCurrentViewport=function(S){return S.copy(g)},this.getViewport=function(S){return S.copy(pe)},this.setViewport=function(S,P,F,O){S.isVector4?pe.set(S.x,S.y,S.z,S.w):pe.set(S,P,F,O),Re.viewport(g.copy(pe).multiplyScalar(J).round())},this.getScissor=function(S){return S.copy(ve)},this.setScissor=function(S,P,F,O){S.isVector4?ve.set(S.x,S.y,S.z,S.w):ve.set(S,P,F,O),Re.scissor(M.copy(ve).multiplyScalar(J).round())},this.getScissorTest=function(){return We},this.setScissorTest=function(S){Re.setScissorTest(We=S)},this.setOpaqueSort=function(S){G=S},this.setTransparentSort=function(S){fe=S},this.getClearColor=function(S){return S.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor.apply(Me,arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha.apply(Me,arguments)},this.clear=function(S=!0,P=!0,F=!0){let O=0;if(S){let D=!1;if(b!==null){const ne=b.texture.format;D=ne===La||ne===Pa||ne===Ca}if(D){const ne=b.texture.type,ce=ne===Mn||ne===Kn||ne===Gi||ne===bi||ne===wa||ne===Ra,ge=Me.getClearColor(),Se=Me.getClearAlpha(),Pe=ge.r,De=ge.g,Ee=ge.b;ce?(m[0]=Pe,m[1]=De,m[2]=Ee,m[3]=Se,R.clearBufferuiv(R.COLOR,0,m)):(_[0]=Pe,_[1]=De,_[2]=Ee,_[3]=Se,R.clearBufferiv(R.COLOR,0,_))}else O|=R.COLOR_BUFFER_BIT}P&&(O|=R.DEPTH_BUFFER_BIT,R.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),F&&(O|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(O)},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",$,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",de,!1),w.dispose(),re.dispose(),Ce.dispose(),v.dispose(),I.dispose(),q.dispose(),ke.dispose(),C.dispose(),xe.dispose(),k.dispose(),k.removeEventListener("sessionstart",za),k.removeEventListener("sessionend",Ha),Fn.stop()};function $(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const S=Qe.autoReset,P=se.enabled,F=se.autoUpdate,O=se.needsUpdate,D=se.type;he(),Qe.autoReset=S,se.enabled=P,se.autoUpdate=F,se.needsUpdate=O,se.type=D}function de(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function Xe(S){const P=S.target;P.removeEventListener("dispose",Xe),ht(P)}function ht(S){Rt(S),Ce.remove(S)}function Rt(S){const P=Ce.get(S).programs;P!==void 0&&(P.forEach(function(F){xe.releaseProgram(F)}),S.isShaderMaterial&&xe.releaseShaderCache(S))}this.renderBufferDirect=function(S,P,F,O,D,ne){P===null&&(P=He);const ce=D.isMesh&&D.matrixWorld.determinant()<0,ge=Bl(S,P,F,O,D);Re.setMaterial(O,ce);let Se=F.index,Pe=1;if(O.wireframe===!0){if(Se=ee.getWireframeAttribute(F),Se===void 0)return;Pe=2}const De=F.drawRange,Ee=F.attributes.position;let Je=De.start*Pe,tt=(De.start+De.count)*Pe;ne!==null&&(Je=Math.max(Je,ne.start*Pe),tt=Math.min(tt,(ne.start+ne.count)*Pe)),Se!==null?(Je=Math.max(Je,0),tt=Math.min(tt,Se.count)):Ee!=null&&(Je=Math.max(Je,0),tt=Math.min(tt,Ee.count));const st=tt-Je;if(st<0||st===1/0)return;ke.setup(D,O,ge,F,Se);let Ot,je=ue;if(Se!==null&&(Ot=Z.get(Se),je=ze,je.setIndex(Ot)),D.isMesh)O.wireframe===!0?(Re.setLineWidth(O.wireframeLinewidth*Ge()),je.setMode(R.LINES)):je.setMode(R.TRIANGLES);else if(D.isLine){let ye=O.linewidth;ye===void 0&&(ye=1),Re.setLineWidth(ye*Ge()),D.isLineSegments?je.setMode(R.LINES):D.isLineLoop?je.setMode(R.LINE_LOOP):je.setMode(R.LINE_STRIP)}else D.isPoints?je.setMode(R.POINTS):D.isSprite&&je.setMode(R.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)je.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(Be.get("WEBGL_multi_draw"))je.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{const ye=D._multiDrawStarts,xt=D._multiDrawCounts,$e=D._multiDrawCount,Zt=Se?Z.get(Se).bytesPerElement:1,Jn=Ce.get(O).currentProgram.getUniforms();for(let Bt=0;Bt<$e;Bt++)Jn.setValue(R,"_gl_DrawID",Bt),je.render(ye[Bt]/Zt,xt[Bt])}else if(D.isInstancedMesh)je.renderInstances(Je,st,D.count);else if(F.isInstancedBufferGeometry){const ye=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,xt=Math.min(F.instanceCount,ye);je.renderInstances(Je,st,xt)}else je.render(Je,st)};function qe(S,P,F){S.transparent===!0&&S.side===_n&&S.forceSinglePass===!1?(S.side=Ft,S.needsUpdate=!0,ji(S,P,F),S.side=In,S.needsUpdate=!0,ji(S,P,F),S.side=_n):ji(S,P,F)}this.compile=function(S,P,F=null){F===null&&(F=S),h=re.get(F),h.init(P),A.push(h),F.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(h.pushLight(D),D.castShadow&&h.pushShadow(D))}),S!==F&&S.traverseVisible(function(D){D.isLight&&D.layers.test(P.layers)&&(h.pushLight(D),D.castShadow&&h.pushShadow(D))}),h.setupLights();const O=new Set;return S.traverse(function(D){if(!(D.isMesh||D.isPoints||D.isLine||D.isSprite))return;const ne=D.material;if(ne)if(Array.isArray(ne))for(let ce=0;ce{function ne(){if(O.forEach(function(ce){Ce.get(ce).currentProgram.isReady()&&O.delete(ce)}),O.size===0){D(S);return}setTimeout(ne,10)}Be.get("KHR_parallel_shader_compile")!==null?ne():setTimeout(ne,10)})};let Ct=null;function on(S){Ct&&Ct(S)}function za(){Fn.stop()}function Ha(){Fn.start()}const Fn=new Pl;Fn.setAnimationLoop(on),typeof self<"u"&&Fn.setContext(self),this.setAnimationLoop=function(S){Ct=S,k.setAnimationLoop(S),S===null?Fn.stop():Fn.start()},k.addEventListener("sessionstart",za),k.addEventListener("sessionend",Ha),this.render=function(S,P){if(P!==void 0&&P.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),P.parent===null&&P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),k.enabled===!0&&k.isPresenting===!0&&(k.cameraAutoUpdate===!0&&k.updateCamera(P),P=k.getCamera()),S.isScene===!0&&S.onBeforeRender(E,S,P,b),h=re.get(S,A.length),h.init(P),A.push(h),me.multiplyMatrices(P.projectionMatrix,P.matrixWorldInverse),Ye.setFromProjectionMatrix(me),te=this.localClippingEnabled,Y=j.init(this.clippingPlanes,te),x=w.get(S,d.length),x.init(),d.push(x),k.enabled===!0&&k.isPresenting===!0){const ne=E.xr.getDepthSensingMesh();ne!==null&&jr(ne,P,-1/0,E.sortObjects)}jr(S,P,0,E.sortObjects),x.finish(),E.sortObjects===!0&&x.sort(G,fe),Ke=k.enabled===!1||k.isPresenting===!1||k.hasDepthSensing()===!1,Ke&&Me.addToRenderList(x,S),this.info.render.frame++,Y===!0&&j.beginShadows();const F=h.state.shadowsArray;se.render(F,S,P),Y===!0&&j.endShadows(),this.info.autoReset===!0&&this.info.reset();const O=x.opaque,D=x.transmissive;if(h.setupLights(),P.isArrayCamera){const ne=P.cameras;if(D.length>0)for(let ce=0,ge=ne.length;ce0&&Ga(O,D,S,P),Ke&&Me.render(S),ka(x,S,P);b!==null&&(y.updateMultisampleRenderTarget(b),y.updateRenderTargetMipmap(b)),S.isScene===!0&&S.onAfterRender(E,S,P),ke.resetDefaultState(),B=-1,ie=null,A.pop(),A.length>0?(h=A[A.length-1],Y===!0&&j.setGlobalState(E.clippingPlanes,h.state.camera)):h=null,d.pop(),d.length>0?x=d[d.length-1]:x=null};function jr(S,P,F,O){if(S.visible===!1)return;if(S.layers.test(P.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(P);else if(S.isLight)h.pushLight(S),S.castShadow&&h.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Ye.intersectsSprite(S)){O&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(me);const ce=q.update(S),ge=S.material;ge.visible&&x.push(S,ce,ge,F,be.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Ye.intersectsObject(S))){const ce=q.update(S),ge=S.material;if(O&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),be.copy(S.boundingSphere.center)):(ce.boundingSphere===null&&ce.computeBoundingSphere(),be.copy(ce.boundingSphere.center)),be.applyMatrix4(S.matrixWorld).applyMatrix4(me)),Array.isArray(ge)){const Se=ce.groups;for(let Pe=0,De=Se.length;Pe0&&Ki(D,P,F),ne.length>0&&Ki(ne,P,F),ce.length>0&&Ki(ce,P,F),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function Ga(S,P,F,O){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;h.state.transmissionRenderTarget[O.id]===void 0&&(h.state.transmissionRenderTarget[O.id]=new jn(1,1,{generateMipmaps:!0,type:Be.has("EXT_color_buffer_half_float")||Be.has("EXT_color_buffer_float")?Wi:Mn,minFilter:qn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ze.workingColorSpace}));const ne=h.state.transmissionRenderTarget[O.id],ce=O.viewport||g;ne.setSize(ce.z,ce.w);const ge=E.getRenderTarget();E.setRenderTarget(ne),E.getClearColor(H),K=E.getClearAlpha(),K<1&&E.setClearColor(16777215,.5),E.clear(),Ke&&Me.render(F);const Se=E.toneMapping;E.toneMapping=Un;const Pe=O.viewport;if(O.viewport!==void 0&&(O.viewport=void 0),h.setupLightsView(O),Y===!0&&j.setGlobalState(E.clippingPlanes,O),Ki(S,F,O),y.updateMultisampleRenderTarget(ne),y.updateRenderTargetMipmap(ne),Be.has("WEBGL_multisampled_render_to_texture")===!1){let De=!1;for(let Ee=0,Je=P.length;Ee0),Ee=!!F.morphAttributes.position,Je=!!F.morphAttributes.normal,tt=!!F.morphAttributes.color;let st=Un;O.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(st=E.toneMapping);const Ot=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,je=Ot!==void 0?Ot.length:0,ye=Ce.get(O),xt=h.state.lights;if(Y===!0&&(te===!0||S!==ie)){const Vt=S===ie&&O.id===B;j.setState(O,S,Vt)}let $e=!1;O.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==xt.state.version||ye.outputColorSpace!==ge||D.isBatchedMesh&&ye.batching===!1||!D.isBatchedMesh&&ye.batching===!0||D.isBatchedMesh&&ye.batchingColor===!0&&D.colorTexture===null||D.isBatchedMesh&&ye.batchingColor===!1&&D.colorTexture!==null||D.isInstancedMesh&&ye.instancing===!1||!D.isInstancedMesh&&ye.instancing===!0||D.isSkinnedMesh&&ye.skinning===!1||!D.isSkinnedMesh&&ye.skinning===!0||D.isInstancedMesh&&ye.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&ye.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&ye.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&ye.instancingMorph===!1&&D.morphTexture!==null||ye.envMap!==Se||O.fog===!0&&ye.fog!==ne||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==j.numPlanes||ye.numIntersection!==j.numIntersection)||ye.vertexAlphas!==Pe||ye.vertexTangents!==De||ye.morphTargets!==Ee||ye.morphNormals!==Je||ye.morphColors!==tt||ye.toneMapping!==st||ye.morphTargetsCount!==je)&&($e=!0):($e=!0,ye.__version=O.version);let Zt=ye.currentProgram;$e===!0&&(Zt=ji(O,P,D));let Jn=!1,Bt=!1,$r=!1;const ct=Zt.getUniforms(),yn=ye.uniforms;if(Re.useProgram(Zt.program)&&(Jn=!0,Bt=!0,$r=!0),O.id!==B&&(B=O.id,Bt=!0),Jn||ie!==S){Ve.reverseDepthBuffer?(_e.copy(S.projectionMatrix),Oc(_e),Bc(_e),ct.setValue(R,"projectionMatrix",_e)):ct.setValue(R,"projectionMatrix",S.projectionMatrix),ct.setValue(R,"viewMatrix",S.matrixWorldInverse);const Vt=ct.map.cameraPosition;Vt!==void 0&&Vt.setValue(R,Ne.setFromMatrixPosition(S.matrixWorld)),Ve.logarithmicDepthBuffer&&ct.setValue(R,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(O.isMeshPhongMaterial||O.isMeshToonMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial)&&ct.setValue(R,"isOrthographic",S.isOrthographicCamera===!0),ie!==S&&(ie=S,Bt=!0,$r=!0)}if(D.isSkinnedMesh){ct.setOptional(R,D,"bindMatrix"),ct.setOptional(R,D,"bindMatrixInverse");const Vt=D.skeleton;Vt&&(Vt.boneTexture===null&&Vt.computeBoneTexture(),ct.setValue(R,"boneTexture",Vt.boneTexture,y))}D.isBatchedMesh&&(ct.setOptional(R,D,"batchingTexture"),ct.setValue(R,"batchingTexture",D._matricesTexture,y),ct.setOptional(R,D,"batchingIdTexture"),ct.setValue(R,"batchingIdTexture",D._indirectTexture,y),ct.setOptional(R,D,"batchingColorTexture"),D._colorsTexture!==null&&ct.setValue(R,"batchingColorTexture",D._colorsTexture,y));const Jr=F.morphAttributes;if((Jr.position!==void 0||Jr.normal!==void 0||Jr.color!==void 0)&&Te.update(D,F,Zt),(Bt||ye.receiveShadow!==D.receiveShadow)&&(ye.receiveShadow=D.receiveShadow,ct.setValue(R,"receiveShadow",D.receiveShadow)),O.isMeshGouraudMaterial&&O.envMap!==null&&(yn.envMap.value=Se,yn.flipEnvMap.value=Se.isCubeTexture&&Se.isRenderTargetTexture===!1?-1:1),O.isMeshStandardMaterial&&O.envMap===null&&P.environment!==null&&(yn.envMapIntensity.value=P.environmentIntensity),Bt&&(ct.setValue(R,"toneMappingExposure",E.toneMappingExposure),ye.needsLights&&zl(yn,$r),ne&&O.fog===!0&&oe.refreshFogUniforms(yn,ne),oe.refreshMaterialUniforms(yn,O,J,W,h.state.transmissionRenderTarget[S.id]),Fr.upload(R,Wa(ye),yn,y)),O.isShaderMaterial&&O.uniformsNeedUpdate===!0&&(Fr.upload(R,Wa(ye),yn,y),O.uniformsNeedUpdate=!1),O.isSpriteMaterial&&ct.setValue(R,"center",D.center),ct.setValue(R,"modelViewMatrix",D.modelViewMatrix),ct.setValue(R,"normalMatrix",D.normalMatrix),ct.setValue(R,"modelMatrix",D.matrixWorld),O.isShaderMaterial||O.isRawShaderMaterial){const Vt=O.uniformsGroups;for(let Qr=0,kl=Vt.length;Qr0&&y.useMultisampledRTT(S)===!1?D=Ce.get(S).__webglMultisampledFramebuffer:Array.isArray(De)?D=De[F]:D=De,g.copy(S.viewport),M.copy(S.scissor),V=S.scissorTest}else g.copy(pe).multiplyScalar(J).floor(),M.copy(ve).multiplyScalar(J).floor(),V=We;if(Re.bindFramebuffer(R.FRAMEBUFFER,D)&&O&&Re.drawBuffers(S,D),Re.viewport(g),Re.scissor(M),Re.setScissorTest(V),ne){const Se=Ce.get(S.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+P,Se.__webglTexture,F)}else if(ce){const Se=Ce.get(S.texture),Pe=P||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Se.__webglTexture,F||0,Pe)}B=-1},this.readRenderTargetPixels=function(S,P,F,O,D,ne,ce){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(ge=ge[ce]),ge){Re.bindFramebuffer(R.FRAMEBUFFER,ge);try{const Se=S.texture,Pe=Se.format,De=Se.type;if(!Ve.textureFormatReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ve.textureTypeReadable(De)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P>=0&&P<=S.width-O&&F>=0&&F<=S.height-D&&R.readPixels(P,F,O,D,Ae.convert(Pe),Ae.convert(De),ne)}finally{const Se=b!==null?Ce.get(b).__webglFramebuffer:null;Re.bindFramebuffer(R.FRAMEBUFFER,Se)}}},this.readRenderTargetPixelsAsync=async function(S,P,F,O,D,ne,ce){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ce!==void 0&&(ge=ge[ce]),ge){const Se=S.texture,Pe=Se.format,De=Se.type;if(!Ve.textureFormatReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ve.textureTypeReadable(De))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(P>=0&&P<=S.width-O&&F>=0&&F<=S.height-D){Re.bindFramebuffer(R.FRAMEBUFFER,ge);const Ee=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Ee),R.bufferData(R.PIXEL_PACK_BUFFER,ne.byteLength,R.STREAM_READ),R.readPixels(P,F,O,D,Ae.convert(Pe),Ae.convert(De),0);const Je=b!==null?Ce.get(b).__webglFramebuffer:null;Re.bindFramebuffer(R.FRAMEBUFFER,Je);const tt=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Fc(R,tt,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Ee),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ne),R.deleteBuffer(Ee),R.deleteSync(tt),ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(S,P=null,F=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),P=arguments[0]||null,S=arguments[1]);const O=Math.pow(2,-F),D=Math.floor(S.image.width*O),ne=Math.floor(S.image.height*O),ce=P!==null?P.x:0,ge=P!==null?P.y:0;y.setTexture2D(S,0),R.copyTexSubImage2D(R.TEXTURE_2D,F,0,0,ce,ge,D,ne),Re.unbindTexture()},this.copyTextureToTexture=function(S,P,F=null,O=null,D=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyTextureToTexture function signature has changed."),O=arguments[0]||null,S=arguments[1],P=arguments[2],D=arguments[3]||0,F=null);let ne,ce,ge,Se,Pe,De;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,ge=F.min.x,Se=F.min.y):(ne=S.image.width,ce=S.image.height,ge=0,Se=0),O!==null?(Pe=O.x,De=O.y):(Pe=0,De=0);const Ee=Ae.convert(P.format),Je=Ae.convert(P.type);y.setTexture2D(P,0),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,P.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,P.unpackAlignment);const tt=R.getParameter(R.UNPACK_ROW_LENGTH),st=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Ot=R.getParameter(R.UNPACK_SKIP_PIXELS),je=R.getParameter(R.UNPACK_SKIP_ROWS),ye=R.getParameter(R.UNPACK_SKIP_IMAGES),xt=S.isCompressedTexture?S.mipmaps[D]:S.image;R.pixelStorei(R.UNPACK_ROW_LENGTH,xt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,xt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,ge),R.pixelStorei(R.UNPACK_SKIP_ROWS,Se),S.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,D,Pe,De,ne,ce,Ee,Je,xt.data):S.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,D,Pe,De,xt.width,xt.height,Ee,xt.data):R.texSubImage2D(R.TEXTURE_2D,D,Pe,De,ne,ce,Ee,Je,xt),R.pixelStorei(R.UNPACK_ROW_LENGTH,tt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,st),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ot),R.pixelStorei(R.UNPACK_SKIP_ROWS,je),R.pixelStorei(R.UNPACK_SKIP_IMAGES,ye),D===0&&P.generateMipmaps&&R.generateMipmap(R.TEXTURE_2D),Re.unbindTexture()},this.copyTextureToTexture3D=function(S,P,F=null,O=null,D=0){S.isTexture!==!0&&(Nr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),F=arguments[0]||null,O=arguments[1]||null,S=arguments[2],P=arguments[3],D=arguments[4]||0);let ne,ce,ge,Se,Pe,De,Ee,Je,tt;const st=S.isCompressedTexture?S.mipmaps[D]:S.image;F!==null?(ne=F.max.x-F.min.x,ce=F.max.y-F.min.y,ge=F.max.z-F.min.z,Se=F.min.x,Pe=F.min.y,De=F.min.z):(ne=st.width,ce=st.height,ge=st.depth,Se=0,Pe=0,De=0),O!==null?(Ee=O.x,Je=O.y,tt=O.z):(Ee=0,Je=0,tt=0);const Ot=Ae.convert(P.format),je=Ae.convert(P.type);let ye;if(P.isData3DTexture)y.setTexture3D(P,0),ye=R.TEXTURE_3D;else if(P.isDataArrayTexture||P.isCompressedArrayTexture)y.setTexture2DArray(P,0),ye=R.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,P.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,P.unpackAlignment);const xt=R.getParameter(R.UNPACK_ROW_LENGTH),$e=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Zt=R.getParameter(R.UNPACK_SKIP_PIXELS),Jn=R.getParameter(R.UNPACK_SKIP_ROWS),Bt=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,st.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,st.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Se),R.pixelStorei(R.UNPACK_SKIP_ROWS,Pe),R.pixelStorei(R.UNPACK_SKIP_IMAGES,De),S.isDataTexture||S.isData3DTexture?R.texSubImage3D(ye,D,Ee,Je,tt,ne,ce,ge,Ot,je,st.data):P.isCompressedArrayTexture?R.compressedTexSubImage3D(ye,D,Ee,Je,tt,ne,ce,ge,Ot,st.data):R.texSubImage3D(ye,D,Ee,Je,tt,ne,ce,ge,Ot,je,st),R.pixelStorei(R.UNPACK_ROW_LENGTH,xt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,$e),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Zt),R.pixelStorei(R.UNPACK_SKIP_ROWS,Jn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Bt),D===0&&P.generateMipmaps&&R.generateMipmap(ye),Re.unbindTexture()},this.initRenderTarget=function(S){Ce.get(S).__webglFramebuffer===void 0&&y.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?y.setTextureCube(S,0):S.isData3DTexture?y.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?y.setTexture2DArray(S,0):y.setTexture2D(S,0),Re.unbindTexture()},this.resetState=function(){z=0,L=0,b=null,Re.reset(),ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Da?"display-p3":"srgb",t.unpackColorSpace=Ze.workingColorSpace===qr?"display-p3":"srgb"}}class Kp extends ft{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 En,this.environmentIntensity=1,this.environmentRotation=new En,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 Go extends Tt{constructor(e=null,t=1,n=1,r,s,o,a,l,c=wt,u=wt,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Vr extends Gt{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}class Fl extends qi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new we(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Wr=new U,Xr=new U,Vo=new rt,zi=new El,xr=new Zr,Ls=new U,Wo=new U;class jp extends ft{constructor(e=new rn,t=new Fl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sn)return;Ls.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Ls);if(!(le.far))return{distance:l,point:Wo.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const Xo=new U,Yo=new U;class $p extends jp{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 r=0,s=t.count;r[...n].reduce((r,[s,o])=>(r[s]=o===""?!0:o,r),{}))(new URLSearchParams(window.location.search));this.override(t)}}override(e){for(const t in e)if(this[t]!==void 0){const n=e[t].toString();typeof this[t]=="boolean"?this[t]=!(n==="0"||n===!1):typeof this[t]=="number"?this[t]=parseFloat(n):typeof this[t]=="string"&&(this[t]=n)}}}const ot=new om;function lm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ol={exports:{}};(function(i){(function(e){function t(){this._listeners=[],this.dispatchCount=0}var n=t.prototype;n.add=a,n.addOnce=l,n.remove=c,n.dispatch=u;var r="Callback function is missing!",s=Array.prototype.slice;function o(f){f.sort(function(p,m){return p=p.p,m=m.p,mp?-1:0})}function a(f,p,m,_){if(!f)throw r;m=m||0;for(var x=this._listeners,h,d,A,E=x.length;E--;)if(h=x[E],h.f===f&&h.c===p)return!1;typeof m=="function"&&(d=m,m=_,A=4),x.unshift({f,c:p,p:m,r:d||f,a:s.call(arguments,A||3),j:0}),o(x)}function l(f,p,m,_){if(!f)throw r;var x=this,h=function(){return x.remove.call(x,f,p),f.apply(p,s.call(arguments,0))};_=s.call(arguments,0),_.length===1&&_.push(e),_.splice(2,0,h),a.apply(x,_)}function c(f,p){if(!f)return this._listeners.length=0,!0;for(var m=this._listeners,_,x=m.length;x--;)if(_=m[x],_.f===f&&(!p||_.c===p))return _.j=0,m.splice(x,1),!0;return!1}function u(f){f=s.call(arguments,0),this.dispatchCount++;for(var p=this.dispatchCount,m=this._listeners,_,x,h=m.length;h--;)if(_=m[h],_&&_.jMath.hypot(i,e);class um{constructor(e=0,t=0,n=0){this.id=e,this.row=t,this.col=n,this.distance=$o(t,n),this.MAX_DISTANCE=$o(Yt,Yt),this.priority=this.MAX_DISTANCE-this.distance,this.ringIndex=Math.floor(this.distance),this.isMain=t===0&&n===0,this.isBorder=Math.abs(t)===2||Math.abs(n)===2,this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0,this.neighbours=null,this.reachableNeighbours=null,this.prioritySortedReachableNeighbours=null,this.randomDelay=Math.random()*.5+(this.MAX_DISTANCE-this.priority)*.5}init(){this.reachableNeighbours=this.neighbours.filter(e=>e.row===this.row||e.col===this.col),this._sortPriorityNeighbours()}_sortPriorityNeighbours(){this.prioritySortedReachableNeighbours=[...this.reachableNeighbours].sort((e,t)=>e.priority-t.priority)}shuffleReachableNeighbours(){for(let e=this.reachableNeighbours.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[this.reachableNeighbours[e],this.reachableNeighbours[t]]=[this.reachableNeighbours[t],this.reachableNeighbours[e]]}this._sortPriorityNeighbours()}preUpdate(e){this.activeRatio=0}reset(){this.isOccupied=!1,this.willBeOccupied=!1,this.activeRatio=0}update(e){}}const Ut=5,pn=Ut+2,Yt=Math.floor(Ut/2),Xt=Ut*Ut,hm=pn*pn;class dm{constructor(){N(this,"tiles",[]);N(this,"mainTile",null)}init(){this.tiles=Array.from({length:Ut},(e,t)=>Array.from({length:Ut},(n,r)=>{const s=t-Yt,o=r-Yt;return new um(t*Ut+r,s,o)})),this.tiles.forEach((e,t)=>e.forEach((n,r)=>{n.neighbours=this._getNeighbouringTiles(t-Yt,r-Yt),n.init()})),this.mainTile=this.getTile(0,0)}getTile(e,t){var n;return((n=this.tiles[e+Yt])==null?void 0:n[t+Yt])||null}getRandomFreeTile(){const e=this.tiles.flat().filter(t=>!t.isOccupied);return e.length?e[Math.floor(Math.random()*e.length)]:null}_getNeighbouringTiles(e,t){return[-1,0,1].flatMap(n=>[-1,0,1].map(r=>n===0&&r===0?null:this.getTile(e+n,t+r)).filter(Boolean))}reset(){this.tiles.flat().forEach(e=>e.reset())}preUpdate(e){this.tiles.flat().forEach(t=>t.preUpdate(e))}update(e){this.tiles.flat().forEach(t=>t.update(e))}}const Jt=new dm;class fm{constructor(){N(this,"time",0);N(this,"deltaTime",0);N(this,"width",0);N(this,"height",0);N(this,"viewportWidth",0);N(this,"viewportHeight",0);N(this,"cameraZoom",1);N(this,"cameraOffsetX",0);N(this,"cameraOffsetY",0);N(this,"renderer",null);N(this,"scene",null);N(this,"camera",null);N(this,"postprocessing",null);N(this,"resolution",new Le);N(this,"viewportResolution",new Le);N(this,"canvas",null);N(this,"isPaused",!1);N(this,"showVisual",ot.SHOW_BLOCK);N(this,"sharedUniforms",{u_time:{value:0},u_deltaTime:{value:1},u_resolution:{value:this.resolution},u_viewportResolution:{value:this.viewportResolution},u_bgColor1:{value:new we},u_bgColor2:{value:new we}});N(this,"loadList",[]);N(this,"animationSpeed",1.2);N(this,"bgColor1","#ffffff");N(this,"bgColor2","#d0d0d0");N(this,"neutralColor","#ffffff");N(this,"mainColor","#0096ff");N(this,"successColor","#00c881");N(this,"failColor","#ca0101");N(this,"particlesOpacity",.75);N(this,"particlesSize",.01);N(this,"particlesColor","#505050");N(this,"goboIntensity",.7);N(this,"activeBlocksCount",0);N(this,"maxFreeBlocksCount",Xt-5);N(this,"lightPositionX",-2);N(this,"lightPositionY",6);N(this,"lightPositionZ",-4);N(this,"lightCameraHelperSignal",new xn);N(this,"lightCameraUpdateSignal",new xn);N(this,"lightCameraSize",4.5);N(this,"lightCameraBias",.005);N(this,"lightCameraNear",3);N(this,"lightCameraFar",16);N(this,"errorBlock",null);N(this,"errorBlockMaxLifeCycle",4);N(this,"minSpawnedBlocksForTheErrorBlock",this.maxFreeBlocksCount-2)}}const X=new fm;class pm{constructor(){N(this,"list",[]);N(this,"loadedCount",0);N(this,"onLoadCallback",null)}loadBuf(e,t){this.list.push(async()=>{try{const r=await(await fetch(e)).arrayBuffer(),s=new Uint32Array(r,0,1)[0],o=JSON.parse(new TextDecoder().decode(new Uint8Array(r,4,s))),{vertexCount:a,indexCount:l,attributes:c}=o;let u=4+s;const f=new rn,p={};c.forEach(m=>{const{id:_,componentSize:x,storageType:h,needsPack:d,packedComponents:A}=m,E=_==="indices"?l:a,T=window[h],z=new T(r,u,E*x),L=T.BYTES_PER_ELEMENT;let b;d?b=this._packAttribute(z,E,x,A,h):(p[_]=u,b=z),_==="indices"?f.setIndex(new Gt(b,1)):f.setAttribute(_,new Gt(b,x)),u+=E*x*L}),t&&t(f),this._onLoad()}catch(n){console.error("Error loading buffer:",n)}})}_packAttribute(e,t,n,r,s){const o=r.length,a=s.indexOf("Int")===0,l=1<{new tm().load(e,n=>{n.minFilter=Mc,n.magFilter=It,n.generateMipmaps=!0,n.anisotropy=X.renderer.capabilities.getMaxAnisotropy(),n.flipY=!0,t&&t(n),this._onLoad()},void 0,n=>console.error("Error loading texture:",n))})}start(e){this.loadedCount=0,this.onLoadCallback=e,this.list.forEach(t=>t())}_onLoad(){this.loadedCount++,this.loadedCount===this.list.length&&(this.list=[],this.onLoadCallback&&this.onLoadCallback())}}const Sn=new pm,Jo={type:"change"},Us={type:"start"},Qo={type:"end"};class mm extends $n{constructor(e,t){super(),t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=Math.PI*.2,this.maxPolarAngle=Math.PI*.45,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.15,this.enableZoom=!1,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=.5,this.enablePan=!1,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Qn.ROTATE,MIDDLE:Qn.DOLLY,RIGHT:Qn.PAN},this.touches={ONE:ei.ROTATE,TWO:ei.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.scale=1,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(w){w.addEventListener("keydown",y),this._domElementKeyEvents=w},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.scale=1,n.object.updateProjectionMatrix(),n.dispatchEvent(Jo),n.update(),s=r.NONE},this.update=function(){const w=new U,re=new qt().setFromUnitVectors(e.up,new U(0,1,0)),j=re.clone().invert(),se=new U,Me=new qt,Te=2*Math.PI;return function(){const ze=n.object.position;w.copy(ze).sub(n.target),w.applyQuaternion(re),a.setFromVector3(w),n.autoRotate&&s===r.NONE&&B(L()),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let Ae=n.minAzimuthAngle,ke=n.maxAzimuthAngle;isFinite(Ae)&&isFinite(ke)&&(Ae<-Math.PI?Ae+=Te:Ae>Math.PI&&(Ae-=Te),ke<-Math.PI?ke+=Te:ke>Math.PI&&(ke-=Te),Ae<=ke?a.theta=Math.max(Ae,Math.min(ke,a.theta)):a.theta=a.theta>(Ae+ke)/2?Math.max(Ae,a.theta):Math.min(ke,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe();let C=n.enableDamping?(n.scale-1)*n.dampingFactor+1:n.scale;return a.radius*=C,a.radius=Math.max(n.minDistance,Math.min(n.maxDistance,a.radius)),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),w.setFromSpherical(a),w.applyQuaternion(j),ze.copy(n.target).add(w),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),n.scale=n.scale/C,u||se.distanceToSquared(n.object.position)>o||8*(1-Me.dot(n.object.quaternion))>o?(n.dispatchEvent(Jo),se.copy(n.object.position),Me.copy(n.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",Z),n.domElement.removeEventListener("pointerdown",R),n.domElement.removeEventListener("pointercancel",Ve),n.domElement.removeEventListener("wheel",Ce),n.domElement.removeEventListener("pointermove",vt),n.domElement.removeEventListener("pointerup",Be),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",y)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,a=new jo,l=new jo,c=new U;let u=!1;const f=new Le,p=new Le,m=new Le,_=new Le,x=new Le,h=new Le,d=new Le,A=new Le,E=new Le,T=[],z={};function L(){return 2*Math.PI/60/60*n.autoRotateSpeed}function b(){return Math.pow(.95,n.zoomSpeed)}function B(w){l.theta-=w}function ie(w){l.phi-=w}const g=function(){const w=new U;return function(j,se){w.setFromMatrixColumn(se,0),w.multiplyScalar(-j),c.add(w)}}(),M=function(){const w=new U;return function(j,se){n.screenSpacePanning===!0?w.setFromMatrixColumn(se,1):(w.setFromMatrixColumn(se,0),w.crossVectors(n.object.up,w)),w.multiplyScalar(j),c.add(w)}}(),V=function(){const w=new U;return function(j,se){const Me=n.domElement;if(n.object.isPerspectiveCamera){const Te=n.object.position;w.copy(Te).sub(n.target);let ue=w.length();ue*=Math.tan(n.object.fov/2*Math.PI/180),g(2*j*ue/Me.clientHeight,n.object.matrix),M(2*se*ue/Me.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(g(j*(n.object.right-n.object.left)/n.object.zoom/Me.clientWidth,n.object.matrix),M(se*(n.object.top-n.object.bottom)/n.object.zoom/Me.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function H(w){n.object.isPerspectiveCamera?n.scale/=w:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*w)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(w){n.object.isPerspectiveCamera?n.scale*=w:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/w)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Q(w){f.set(w.clientX,w.clientY)}function W(w){d.set(w.clientX,w.clientY)}function J(w){_.set(w.clientX,w.clientY)}function G(w){p.set(w.clientX,w.clientY),m.subVectors(p,f).multiplyScalar(n.rotateSpeed);const re=n.domElement;B(2*Math.PI*m.x/re.clientHeight),ie(2*Math.PI*m.y/re.clientHeight),f.copy(p),n.update()}function fe(w){A.set(w.clientX,w.clientY),E.subVectors(A,d),E.y>0?H(b()):E.y<0&&K(b()),d.copy(A),n.update()}function pe(w){x.set(w.clientX,w.clientY),h.subVectors(x,_).multiplyScalar(n.panSpeed),V(h.x,h.y),_.copy(x),n.update()}function ve(w){w.deltaY<0?K(b()):w.deltaY>0&&H(b()),n.update()}function We(w){let re=!1;switch(w.code){case n.keys.UP:V(0,n.keyPanSpeed),re=!0;break;case n.keys.BOTTOM:V(0,-n.keyPanSpeed),re=!0;break;case n.keys.LEFT:V(n.keyPanSpeed,0),re=!0;break;case n.keys.RIGHT:V(-n.keyPanSpeed,0),re=!0;break}re&&(w.preventDefault(),n.update())}function Ye(){if(T.length===1)f.set(T[0].pageX,T[0].pageY);else{const w=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);f.set(w,re)}}function Y(){if(T.length===1)_.set(T[0].pageX,T[0].pageY);else{const w=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);_.set(w,re)}}function te(){const w=T[0].pageX-T[1].pageX,re=T[0].pageY-T[1].pageY,j=Math.sqrt(w*w+re*re);d.set(0,j)}function _e(){n.enableZoom&&te(),n.enablePan&&Y()}function me(){n.enableZoom&&te(),n.enableRotate&&Ye()}function Ne(w){if(T.length==1)p.set(w.pageX,w.pageY);else{const j=oe(w),se=.5*(w.pageX+j.x),Me=.5*(w.pageY+j.y);p.set(se,Me)}m.subVectors(p,f).multiplyScalar(n.rotateSpeed);const re=n.domElement;B(2*Math.PI*m.x/re.clientHeight),ie(2*Math.PI*m.y/re.clientHeight),f.copy(p)}function be(w){if(T.length===1)x.set(w.pageX,w.pageY);else{const re=oe(w),j=.5*(w.pageX+re.x),se=.5*(w.pageY+re.y);x.set(j,se)}h.subVectors(x,_).multiplyScalar(n.panSpeed),V(h.x,h.y),_.copy(x)}function He(w){const re=oe(w),j=w.pageX-re.x,se=w.pageY-re.y,Me=Math.sqrt(j*j+se*se);A.set(0,Me),E.set(0,Math.pow(A.y/d.y,n.zoomSpeed)),H(E.y),d.copy(A)}function Ke(w){n.enableZoom&&He(w),n.enablePan&&be(w)}function Ge(w){n.enableZoom&&He(w),n.enableRotate&&Ne(w)}function R(w){n.enabled!==!1&&(T.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",vt),n.domElement.addEventListener("pointerup",Be)),ee(w),w.pointerType==="touch"?v(w):Re(w))}function vt(w){n.enabled!==!1&&(w.pointerType==="touch"?I(w):Qe(w))}function Be(w){q(w),T.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",vt),n.domElement.removeEventListener("pointerup",Be)),n.dispatchEvent(Qo),s=r.NONE}function Ve(w){q(w)}function Re(w){let re;switch(w.button){case 0:re=n.mouseButtons.LEFT;break;case 1:re=n.mouseButtons.MIDDLE;break;case 2:re=n.mouseButtons.RIGHT;break;default:re=-1}switch(re){case Qn.DOLLY:if(n.enableZoom===!1)return;W(w),s=r.DOLLY;break;case Qn.ROTATE:if(w.ctrlKey||w.metaKey||w.shiftKey){if(n.enablePan===!1)return;J(w),s=r.PAN}else{if(n.enableRotate===!1)return;Q(w),s=r.ROTATE}break;case Qn.PAN:if(w.ctrlKey||w.metaKey||w.shiftKey){if(n.enableRotate===!1)return;Q(w),s=r.ROTATE}else{if(n.enablePan===!1)return;J(w),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Us)}function Qe(w){if(n.enabled!==!1)switch(s){case r.ROTATE:if(n.enableRotate===!1)return;G(w);break;case r.DOLLY:if(n.enableZoom===!1)return;fe(w);break;case r.PAN:if(n.enablePan===!1)return;pe(w);break}}function Ce(w){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(n.dispatchEvent(Us),ve(w),n.dispatchEvent(Qo))}function y(w){n.enabled===!1||n.enablePan===!1||We(w)}function v(w){switch(xe(w),T.length){case 1:switch(n.touches.ONE){case ei.ROTATE:if(n.enableRotate===!1)return;Ye(),s=r.TOUCH_ROTATE;break;case ei.PAN:if(n.enablePan===!1)return;Y(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case ei.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;_e(),s=r.TOUCH_DOLLY_PAN;break;case ei.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Us)}function I(w){switch(xe(w),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ne(w),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;be(w),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ke(w),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ge(w),n.update();break;default:s=r.NONE}}function Z(w){n.enabled}function ee(w){T.push(w)}function q(w){delete z[w.pointerId];for(let re=0;re{e.generateMipmaps=!1,e.minFilter=e.magFilter=wt,e.wrapS=e.wrapT=Or,e.needsUpdate=!0,this.sharedUniforms.u_blueNoiseTexture.value=e,this.sharedUniforms.u_blueNoiseTexelSize.value=new De(1/this.TEXTURE_SIZE,1/this.TEXTURE_SIZE)}),Fe.getBlueNoise=_m}update(e){this.sharedUniforms.u_blueNoiseCoordOffset.value.set(Math.random(),Math.random())}}const Pi=new gm;class vm{constructor(){N(this,"PI",Math.PI)}clamp(e,t,n){return en?n:e}mix(e,t,n){return e+(t-e)*n}cUnMix(e,t,n){return this.clamp((n-e)/(t-e),0,1)}saturate(e){return this.clamp(e,0,1)}fit(e,t,n,r,s,o){return e=this.cUnMix(t,n,e),o&&(e=o(e)),r+e*(s-r)}}const Ie=new vm;class xm{quartInOut(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}sineOut(e){return Math.sin(e*Math.PI/2)}backIn(e){let t=1.70158;return e*e*((t+1)*e-t)}backOut(e,t=1.70158){return--e*e*((t+1)*e+t)+1}backInOut(e){let t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}}function Sm(i,e,t,n,r){if(i===0)return 0;if(i===1)return 1;function s(l,c,u,f,p){const m=3*(u-c),_=3*(f-u)-m;return(((p-c-m-_)*l+_)*l+m)*l+c}function o(l,c,u,f=1e-6){let p=0,m=1,_=l;for(;pt?this._updateStatusAndResult(e,t,n):this._updateStatus(e))}reset(){this._queueStatusUpdate(et.NOT_STARTED,it.NONE)}setStart(){this._queueStatusUpdate(et.STARTED)}setFree(){this._queueStatusUpdate(et.FREE)}setPause(){H.isPaused=!0}setResume(){H.isPaused=!1}setStop(){this._queueStatusUpdate(et.RESULT,it.STOP)}setComplete(){this._queueStatusUpdate(et.RESULT,it.COMPLETED,Zn.LEVEL_1)}setComplete2(){this._queueStatusUpdate(et.RESULT,it.COMPLETED,Zn.LEVEL_2)}setComplete3(){this._queueStatusUpdate(et.RESULT,it.COMPLETED,Zn.LEVEL_3)}setFail(){this._queueStatusUpdate(et.RESULT,it.FAILED)}setResultAnimation(){this._queueStatusUpdate(et.RESULT_ANIMATION)}setRestartAnimation(){this._queueStatusUpdate(et.RESTART_ANIMATION)}setRestart(){this.statusUpdateQueue.push(()=>{this._updateStatus(et.RESTART)&&this.gameEndedSignal.dispatch()})}}const Le=new Mm;class el{constructor(e){N(this,"id",-1);N(this,"isMoving",!1);N(this,"hasBeenSpawned",!1);N(this,"hasAnimationEnded",!1);N(this,"hasBeenEvaluated",!1);N(this,"currentTile",null);N(this,"targetTile",null);N(this,"moveAnimationRatio",0);N(this,"spawnAnimationRatio",0);N(this,"spawnAnimationRatioUnclamped",-Math.random());N(this,"easedAnimationRatio",0);N(this,"randomVector",{x:Math.random()-.5,y:Math.random()-.5});N(this,"lifeCycle",0);N(this,"easingFunction",null);N(this,"errorLifeCycle",0);N(this,"isErrorBlock",!1);N(this,"errorPreFallAnimationTime",0);N(this,"errorPreFallAnimationTimeScale",0);N(this,"errorFallAnimationTime",0);this.id=e,this.init()}init(){this._setNewEasingFunction()}_setNewEasingFunction(){const e=Math.random(),t=.25;this.easingFunction=n=>vi(Ie.fit(n,e*t,e*t+(1-t),0,1))}updateTile(){this.currentTile&&(this.currentTile.isOccupied=!0,this.currentTile.willBeOccupied=!1)}_findBestTile(e,t){return e.find(n=>n.isOccupied||n.willBeOccupied||n.isMain?!1:t||this.currentTile.priority>=n.priority)}moveToNextTile(e=!1,t=0){if(this.hasBeenEvaluated=!0,this.moveAnimationRatio=-t*(this.isErrorBlock?0:1),!this.currentTile)return;if(this.isErrorBlock){this.isMoving=!0,this.targetTile=this.currentTile;return}this.currentTile.shuffleReachableNeighbours();const n=e?this.currentTile.reachableNeighbours:this.currentTile.prioritySortedReachableNeighbours,r=this._findBestTile(n,e);r&&(!this.currentTile.isMain||Math.random()<=.8)?(this.targetTile=r,this.targetTile.willBeOccupied=!0,this.isMoving=!0):this.hasAnimationEnded=!0}resetAfterCycle(){var e;this.hasBeenEvaluated=!1,this.hasAnimationEnded=!1,this.moveAnimationRatio=0,this.easedAnimationRatio=0,this.isMoving=!1,this.lifeCycle++,this.isErrorBlock&&this.errorLifeCycle++,(e=this.currentTile)!=null&&e.isBorder&&!H.errorBlock&&Math.random()<.5&&H.activeBlocksCount>=H.minSpawnedBlocksForTheErrorBlock&&Le.isFree&&(H.errorBlock=this,this.isErrorBlock=!0),this._setNewEasingFunction(),this.updateTile()}reset(e=!1){var t;this.isErrorBlock&&(this.errorLifeCycle=0,this.isErrorBlock=!1,this.currentTile.reset(),(t=this.targetTile)==null||t.reset(),this.errorFallAnimationTime=0),this.id=e?this.id:-1,this.isMoving=!1,this.hasBeenSpawned=!1,this.hasAnimationEnded=!1,this.hasBeenEvaluated=!1,this.currentTile=null,this.targetTile=null,this.moveAnimationRatio=0,this.spawnAnimationRatio=0,this.spawnAnimationRatioUnclamped=-Math.random(),this.easedAnimationRatio=0,this.lifeCycle=0,this.errorPreFallAnimationTime=0,this.errorPreFallAnimationTimeScale=0,this.errorFallAnimationTime=0}_onMovementEnd(){this.moveAnimationRatio=1,this.currentTile&&(this.currentTile.isOccupied=!1),this.currentTile=this.targetTile,this.targetTile=null,this.hasAnimationEnded=!0,this.updateTile()}_updateSpawnAnimation(e){this.spawnAnimationRatioUnclamped+=.75*H.animationSpeed*e,this.spawnAnimationRatio=Math.max(0,Math.min(1,this.spawnAnimationRatioUnclamped)),this.spawnAnimationRatio===1&&(this.hasBeenSpawned=!0)}_updateMovement(e){(this.isMoving&&!this.hasAnimationEnded||Le.isResultAnimation)&&(this.moveAnimationRatio=Math.min(1,this.moveAnimationRatio+H.animationSpeed*e*(this.isErrorBlock?.7:1)),this.easedAnimationRatio=this.easingFunction(Math.max(0,this.moveAnimationRatio)),this.easedAnimationRatio===1&&(Le.isFree||Le.isResult)&&this._onMovementEnd())}_updateTileRatios(){const e=Math.max(0,Math.min(1,this.hasBeenSpawned?this.easedAnimationRatio:this.spawnAnimationRatio));this.currentTile&&(this.currentTile.activeRatio=this.hasBeenSpawned?this.targetTile?1-e:1:this.spawnAnimationRatio),this.targetTile&&(this.targetTile.activeRatio=e),this.isErrorBlock&&this.errorLifeCycle>=H.errorBlockMaxLifeCycle-1&&(this.currentTile.activeRatio=0,this.targetTile&&(this.targetTile.activeRatio=0))}update(e){this.hasBeenSpawned?this._updateMovement(e):this._updateSpawnAnimation(e),this.errorLifeCycle>=H.errorBlockMaxLifeCycle-1&&(this.errorFallAnimationTime=this.errorFallAnimationTime+3*H.animationSpeed*e),this.isErrorBlock&&(this.errorPreFallAnimationTimeScale=this.errorPreFallAnimationTimeScale+3*e,this.errorPreFallAnimationTimeScale=Math.min(20,this.errorPreFallAnimationTimeScale),this.errorPreFallAnimationTime=this.errorPreFallAnimationTime+this.errorPreFallAnimationTimeScale*e),this._updateTileRatios()}}class Em{constructor(){N(this,"currentAnimationStyle",null);N(this,"ratio",0);N(this,"duration",8);N(this,"towerRotationRatio",0);N(this,"floatingCoinsRatio",0);N(this,"floatingCubesRatio",0);N(this,"vortexCoinsRatio",0);N(this,"pushDownRatio",0);N(this,"successColorTowerRatio",0);N(this,"floatingCubesDisplacement",1);N(this,"completeAnimationEndedSignal",new xn)}init(){Le.stateSignal.add((e,t,n)=>{e===et.RESULT&&t===it.COMPLETED&&this.triggerNewAnimation(n)})}triggerNewAnimation(e){this.currentAnimationStyle=e}resetRatios(){this.ratio=0,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=0,this.vortexCoinsRatio=0,this.pushDownRatio=0,this.successColorTowerRatio=0,this.floatingCubesDisplacement=1,this.currentAnimationStyle=null}updateRatios1(){this.floatingCubesDisplacement=1,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=Ie.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.55,1,0,1)}updateRatios2(){this.floatingCubesDisplacement=1.5,this.floatingCoinsRatio=0,this.towerRotationRatio=Ie.fit(this.ratio,.1,.45,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.15,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.55,1,0,1)}updateRatios3(){this.floatingCubesDisplacement=2,this.towerRotationRatio=Ie.fit(this.ratio,.1,.5,0,1),this.floatingCoinsRatio=Ie.fit(this.ratio,.2,.51,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.6,1,0,1)}update(e){switch(this.ratio+=(this.currentAnimationStyle?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.currentAnimationStyle){case Zn.LEVEL_1:this.updateRatios1();break;case Zn.LEVEL_2:this.updateRatios2();break;case Zn.LEVEL_3:this.updateRatios3();break}this.ratio===1&&(this.completeAnimationEndedSignal.dispatch(),this.resetRatios())}}const Dt=new Em;class ym{constructor(){N(this,"isActive",!1);N(this,"ratio",0);N(this,"duration",4);N(this,"spawnRatio",0);N(this,"pushDownRatio",0);N(this,"stopAnimationEndedSignal",new xn)}init(){Le.stateSignal.add((e,t,n)=>{e===et.RESULT&&t===it.STOP&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.spawnRatio=Ie.fit(this.ratio,0,.25,0,2.5),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.ratio===1&&(this.stopAnimationEndedSignal.dispatch(),this.resetRatios())}}const mn=new ym;class Tm{constructor(){N(this,"isActive",!1);N(this,"ratio",0);N(this,"duration",4);N(this,"shakeRatio",0);N(this,"floatingCubesRatio",0);N(this,"spawnRatio",0);N(this,"pushDownRatio",0);N(this,"errorAnimationEndedSignal",new xn)}init(){Le.stateSignal.add((e,t,n)=>{e===et.RESULT&&t===it.FAILED&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.shakeRatio=0,this.floatingCubesRatio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.shakeRatio=Ie.fit(this.ratio,0,.3,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.35,.65,0,1),this.spawnRatio=Ie.fit(this.ratio,.3,.55,0,2.5),this.pushDownRatio=Ie.fit(this.ratio,.6,.8,0,1),this.ratio===1&&(this.errorAnimationEndedSignal.dispatch(),this.resetRatios())}}const St=new Tm;class Am{constructor(){N(this,"blocks",[]);N(this,"lastSpawnedBlock",null);N(this,"cycleIndex",0);N(this,"animationSpeedRatio",0);N(this,"firstStartAnimationRatio",0);N(this,"previousSuccessBlocksAnimationRatio",0);N(this,"isEndAnimationActive",!1);N(this,"wasSuccess",!1)}init(){Le.init(),Dt.init(),mn.init(),St.init(),Jt.init(),Dt.completeAnimationEndedSignal.add(()=>{Le.setRestart(),this._startNewCycle()}),mn.stopAnimationEndedSignal.add(()=>{Le.setRestart(),this._startNewCycle()}),St.errorAnimationEndedSignal.add(()=>{Le.setRestart(),this._startNewCycle()})}_spawnBlock(){this._shouldPreventSpawn()||(Le.isSuccessResult?this._spawnMultipleBlocks():this._spawnSingleBlock(),!(this.blocks.length===H.maxFreeBlocksCount&&Le.isFree)&&Le.spawnSignal.dispatch())}_shouldPreventSpawn(){return Le.isFailResult||Le.isStopped||this.blocks.length>=Xt||Jt.mainTile.isOccupied&&!Le.isSuccessResult}_spawnMultipleBlocks(){const e=Xt-H.activeBlocksCount;for(let t=0;t=H.errorBlockMaxLifeCycle?(H.errorBlock.reset(!0),Kn.resetBlockFromLogicBlock(H.errorBlock),e=H.errorBlock,H.errorBlock=null):this.blocks.lengthe.resetAfterCycle()),Le.endCycleSignal.dispatch(),this.cycleIndex++,this._spawnBlock(),this._calculatePaths()))}_calculatePaths(){var t;(t=this.lastSpawnedBlock)!=null&&t.hasBeenSpawned&&this.lastSpawnedBlock.moveToNextTile(Le.isFree,0);const e=this.cycleIndex%2===0?!0:H.activeBlocksCount{!n.hasBeenEvaluated&&n.hasBeenSpawned&&n.moveToNextTile(e,r*.2)})}reset(){this.blocks.forEach(t=>t.reset()),Kn.reset(),Jt.reset(),this.blocks=[],this.lastSpawnedBlock=null,this.cycleIndex=0,this.animationSpeedRatio=0,this.previousSuccessBlocksAnimationRatio=this.wasSuccess?1:0,this.isEndAnimationActive=!1;const e=ot.AUTO_RESTART&&[it.FAILED,it.COMPLETED].includes(Le.result);Le.reset(),this._startNewCycle(),e&&(Le.setStart(),Le.updateFlags())}_updateAnimationRatios(e){const{isResult:t}=Le;this.firstStartAnimationRatio=Ie.saturate(this.firstStartAnimationRatio+e*(H.showVisual?1:0)),this.animationSpeedRatio=Math.min(1,this.animationSpeedRatio+e*(t?1:0)),this.previousSuccessBlocksAnimationRatio=Ie.saturate(this.previousSuccessBlocksAnimationRatio-.25*e)}_checkCycleCompletion(){let e=!0;return this.lastSpawnedBlock&&(e=e&&this.lastSpawnedBlock.hasBeenSpawned),this.blocks.forEach(t=>{t.lifeCycle>0?e=e&&t.hasBeenEvaluated&&t.hasAnimationEnded:e=e&&t.spawnAnimationRatio===1}),e||Le.isResultAnimation||Le.isFailResult||Le.isStopped}update(e){if(this._updateAnimationRatios(e),Dt.update(e),mn.update(e),St.update(e),Le.hasNotStarted){this._startNewCycle();return}if(Le.isRestart){this.wasSuccess=Le.result===it.COMPLETED,this.reset();return}Le.isResultAnimation&&Le.setRestartAnimation(),Jt.preUpdate(e),this.lastSpawnedBlock&&this.lastSpawnedBlock.update(e),this.blocks.forEach(n=>n.update(e)),Jt.update(e),this._checkCycleCompletion()&&this._startNewCycle()}}const Lt=new Am,bm=Math.PI/2,_i=new U;class wm{constructor(){this.animation=0,this.boardDir=new De,this.boardPos=new De,this.pos=new U,this.orient=new qt,this.showRatio=0,this.spinPivot=new U,this.spinOrient=new qt,this.spinOrient2=new qt}reset(){this.animation=0,this.boardDir.set(0,0),this.boardPos.set(0,0),this.pos.set(0,0,0),this.orient.identity(),this.showRatio=0,this.spinPivot.set(0,0,0),this.spinOrient.identity()}update(e){this.pos.set(this.boardPos.x,0,-this.boardPos.y),this.spinPivot.set(this.boardDir.x*.5,-.5,-this.boardDir.y*.5),_i.set(-this.boardDir.y,0,-this.boardDir.x),this.spinOrient.setFromAxisAngle(_i,this.animation*bm)}addsFallAnimation(e){_i.set(this.boardDir.x,-e,-this.boardDir.y),this.pos.addScaledVector(_i,e),_i.set(this.boardDir.x*.5,0,-this.boardDir.y*.5),this.spinPivot.lerp(_i,Ie.saturate(e))}}var Tr=`#ifndef IS_BASE +}`;class gm{constructor(){N(this,"sharedUniforms",{u_blueNoiseTexture:{value:null},u_blueNoiseTexelSize:{value:null},u_blueNoiseCoordOffset:{value:new Le}});N(this,"TEXTURE_SIZE",128)}preInit(){Sn.loadTexture(ot.ASSETS_PATH+"textures/LDR_RGB1_0.png",e=>{e.generateMipmaps=!1,e.minFilter=e.magFilter=wt,e.wrapS=e.wrapT=Or,e.needsUpdate=!0,this.sharedUniforms.u_blueNoiseTexture.value=e,this.sharedUniforms.u_blueNoiseTexelSize.value=new Le(1/this.TEXTURE_SIZE,1/this.TEXTURE_SIZE)}),Fe.getBlueNoise=_m}update(e){this.sharedUniforms.u_blueNoiseCoordOffset.value.set(Math.random(),Math.random())}}const Pi=new gm;class vm{constructor(){N(this,"PI",Math.PI)}clamp(e,t,n){return en?n:e}mix(e,t,n){return e+(t-e)*n}cUnMix(e,t,n){return this.clamp((n-e)/(t-e),0,1)}saturate(e){return this.clamp(e,0,1)}fit(e,t,n,r,s,o){return e=this.cUnMix(t,n,e),o&&(e=o(e)),r+e*(s-r)}}const Ie=new vm;class xm{quartInOut(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}sineOut(e){return Math.sin(e*Math.PI/2)}backIn(e){let t=1.70158;return e*e*((t+1)*e-t)}backOut(e,t=1.70158){return--e*e*((t+1)*e+t)+1}backInOut(e){let t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}}function Sm(i,e,t,n,r){if(i===0)return 0;if(i===1)return 1;function s(l,c,u,f,p){const m=3*(u-c),_=3*(f-u)-m;return(((p-c-m-_)*l+_)*l+m)*l+c}function o(l,c,u,f=1e-6){let p=0,m=1,_=l;for(;pt?this._updateStatusAndResult(e,t,n):this._updateStatus(e))}reset(){this._queueStatusUpdate(et.NOT_STARTED,it.NONE)}setStart(){this._queueStatusUpdate(et.STARTED)}setFree(){this._queueStatusUpdate(et.FREE)}setPause(){X.isPaused=!0}setResume(){X.isPaused=!1}setStop(){this._queueStatusUpdate(et.RESULT,it.STOP)}setComplete(){this._queueStatusUpdate(et.RESULT,it.COMPLETED,Zn.LEVEL_1)}setComplete2(){this._queueStatusUpdate(et.RESULT,it.COMPLETED,Zn.LEVEL_2)}setComplete3(){this._queueStatusUpdate(et.RESULT,it.COMPLETED,Zn.LEVEL_3)}setFail(){this._queueStatusUpdate(et.RESULT,it.FAILED)}setResultAnimation(){this._queueStatusUpdate(et.RESULT_ANIMATION)}setRestartAnimation(){this._queueStatusUpdate(et.RESTART_ANIMATION)}setRestart(){this.statusUpdateQueue.push(()=>{this._updateStatus(et.RESTART)&&this.gameEndedSignal.dispatch()})}}const Ue=new Mm;class el{constructor(e){N(this,"id",-1);N(this,"isMoving",!1);N(this,"hasBeenSpawned",!1);N(this,"hasAnimationEnded",!1);N(this,"hasBeenEvaluated",!1);N(this,"currentTile",null);N(this,"targetTile",null);N(this,"moveAnimationRatio",0);N(this,"spawnAnimationRatio",0);N(this,"spawnAnimationRatioUnclamped",-Math.random());N(this,"easedAnimationRatio",0);N(this,"randomVector",{x:Math.random()-.5,y:Math.random()-.5});N(this,"lifeCycle",0);N(this,"easingFunction",null);N(this,"errorLifeCycle",0);N(this,"isErrorBlock",!1);N(this,"errorPreFallAnimationTime",0);N(this,"errorPreFallAnimationTimeScale",0);N(this,"errorFallAnimationTime",0);this.id=e,this.init()}init(){this._setNewEasingFunction()}_setNewEasingFunction(){const e=Math.random(),t=.25;this.easingFunction=n=>gi(Ie.fit(n,e*t,e*t+(1-t),0,1))}updateTile(){this.currentTile&&(this.currentTile.isOccupied=!0,this.currentTile.willBeOccupied=!1)}_findBestTile(e,t){return e.find(n=>n.isOccupied||n.willBeOccupied||n.isMain?!1:t||this.currentTile.priority>=n.priority)}moveToNextTile(e=!1,t=0){if(this.hasBeenEvaluated=!0,this.moveAnimationRatio=-t*(this.isErrorBlock?0:1),!this.currentTile)return;if(this.isErrorBlock){this.isMoving=!0,this.targetTile=this.currentTile;return}this.currentTile.shuffleReachableNeighbours();const n=e?this.currentTile.reachableNeighbours:this.currentTile.prioritySortedReachableNeighbours,r=this._findBestTile(n,e);r&&(!this.currentTile.isMain||Math.random()<=.8)?(this.targetTile=r,this.targetTile.willBeOccupied=!0,this.isMoving=!0):this.hasAnimationEnded=!0}resetAfterCycle(){this.hasBeenEvaluated=!1,this.hasAnimationEnded=!1,this.moveAnimationRatio=0,this.easedAnimationRatio=0,this.isMoving=!1,this.lifeCycle++,this._setNewEasingFunction(),this.updateTile()}reset(e=!1){var t;this.isErrorBlock&&(this.errorLifeCycle=0,this.isErrorBlock=!1,this.currentTile.reset(),(t=this.targetTile)==null||t.reset(),this.errorFallAnimationTime=0),this.id=e?this.id:-1,this.isMoving=!1,this.hasBeenSpawned=!1,this.hasAnimationEnded=!1,this.hasBeenEvaluated=!1,this.currentTile=null,this.targetTile=null,this.moveAnimationRatio=0,this.spawnAnimationRatio=0,this.spawnAnimationRatioUnclamped=-Math.random(),this.easedAnimationRatio=0,this.lifeCycle=0,this.errorPreFallAnimationTime=0,this.errorPreFallAnimationTimeScale=0,this.errorFallAnimationTime=0}_onMovementEnd(){this.moveAnimationRatio=1,this.currentTile&&(this.currentTile.isOccupied=!1),this.currentTile=this.targetTile,this.targetTile=null,this.hasAnimationEnded=!0,this.updateTile()}_updateSpawnAnimation(e){this.spawnAnimationRatioUnclamped+=.75*X.animationSpeed*e,this.spawnAnimationRatio=Math.max(0,Math.min(1,this.spawnAnimationRatioUnclamped)),this.spawnAnimationRatio===1&&(this.hasBeenSpawned=!0)}_updateMovement(e){(this.isMoving&&!this.hasAnimationEnded||Ue.isResultAnimation)&&(this.moveAnimationRatio=Math.min(1,this.moveAnimationRatio+X.animationSpeed*e*(this.isErrorBlock?.7:1)),this.easedAnimationRatio=this.easingFunction(Math.max(0,this.moveAnimationRatio)),this.easedAnimationRatio===1&&(Ue.isFree||Ue.isResult)&&this._onMovementEnd())}_updateTileRatios(){const e=Math.max(0,Math.min(1,this.hasBeenSpawned?this.easedAnimationRatio:this.spawnAnimationRatio));this.currentTile&&(this.currentTile.activeRatio=this.hasBeenSpawned?this.targetTile?1-e:1:this.spawnAnimationRatio),this.targetTile&&(this.targetTile.activeRatio=e),this.isErrorBlock&&this.errorLifeCycle>=X.errorBlockMaxLifeCycle-1&&(this.currentTile.activeRatio=0,this.targetTile&&(this.targetTile.activeRatio=0))}update(e){this.hasBeenSpawned?this._updateMovement(e):this._updateSpawnAnimation(e),this.errorLifeCycle>=X.errorBlockMaxLifeCycle-1&&(this.errorFallAnimationTime=this.errorFallAnimationTime+3*X.animationSpeed*e),this.isErrorBlock&&(this.errorPreFallAnimationTimeScale=this.errorPreFallAnimationTimeScale+3*e,this.errorPreFallAnimationTimeScale=Math.min(20,this.errorPreFallAnimationTimeScale),this.errorPreFallAnimationTime=this.errorPreFallAnimationTime+this.errorPreFallAnimationTimeScale*e),this._updateTileRatios()}}class Em{constructor(){N(this,"currentAnimationStyle",null);N(this,"ratio",0);N(this,"duration",8);N(this,"towerRotationRatio",0);N(this,"floatingCoinsRatio",0);N(this,"floatingCubesRatio",0);N(this,"vortexCoinsRatio",0);N(this,"pushDownRatio",0);N(this,"successColorTowerRatio",0);N(this,"floatingCubesDisplacement",1);N(this,"completeAnimationEndedSignal",new xn)}init(){Ue.stateSignal.add((e,t,n)=>{e===et.RESULT&&t===it.COMPLETED&&this.triggerNewAnimation(n)})}triggerNewAnimation(e){this.currentAnimationStyle=e}resetRatios(){this.ratio=0,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=0,this.vortexCoinsRatio=0,this.pushDownRatio=0,this.successColorTowerRatio=0,this.floatingCubesDisplacement=1,this.currentAnimationStyle=null}updateRatios1(){this.floatingCubesDisplacement=1,this.towerRotationRatio=0,this.floatingCoinsRatio=0,this.floatingCubesRatio=Ie.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.55,1,0,1)}updateRatios2(){this.floatingCubesDisplacement=1.5,this.floatingCoinsRatio=0,this.towerRotationRatio=Ie.fit(this.ratio,.1,.45,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.15,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.55,1,0,1)}updateRatios3(){this.floatingCubesDisplacement=2,this.towerRotationRatio=Ie.fit(this.ratio,.1,.5,0,1),this.floatingCoinsRatio=Ie.fit(this.ratio,.2,.51,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.2,.49,0,1.2),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.successColorTowerRatio=Ie.fit(this.ratio,.45,.7,0,1),this.vortexCoinsRatio=Ie.fit(this.ratio,.6,1,0,1)}update(e){switch(this.ratio+=(this.currentAnimationStyle?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.currentAnimationStyle){case Zn.LEVEL_1:this.updateRatios1();break;case Zn.LEVEL_2:this.updateRatios2();break;case Zn.LEVEL_3:this.updateRatios3();break}this.ratio===1&&(this.completeAnimationEndedSignal.dispatch(),this.resetRatios())}}const Dt=new Em;class ym{constructor(){N(this,"isActive",!1);N(this,"ratio",0);N(this,"duration",4);N(this,"spawnRatio",0);N(this,"pushDownRatio",0);N(this,"stopAnimationEndedSignal",new xn)}init(){Ue.stateSignal.add((e,t,n)=>{e===et.RESULT&&t===it.STOP&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.spawnRatio=Ie.fit(this.ratio,0,.25,0,2.5),this.pushDownRatio=Ie.fit(this.ratio,.45,.55,0,1),this.ratio===1&&(this.stopAnimationEndedSignal.dispatch(),this.resetRatios())}}const mn=new ym;class Tm{constructor(){N(this,"isActive",!1);N(this,"ratio",0);N(this,"duration",4);N(this,"shakeRatio",0);N(this,"floatingCubesRatio",0);N(this,"spawnRatio",0);N(this,"pushDownRatio",0);N(this,"errorAnimationEndedSignal",new xn)}init(){Ue.stateSignal.add((e,t,n)=>{e===et.RESULT&&t===it.FAILED&&(this.isActive=!0)})}resetRatios(){this.ratio=0,this.shakeRatio=0,this.floatingCubesRatio=0,this.pushDownRatio=0,this.spawnRatio=0,this.isActive=!1}update(e){this.ratio+=(this.isActive?1:0)*e/this.duration,this.ratio=Ie.clamp(this.ratio,0,1),this.shakeRatio=Ie.fit(this.ratio,0,.3,0,1),this.floatingCubesRatio=Ie.fit(this.ratio,.35,.65,0,1),this.spawnRatio=Ie.fit(this.ratio,.3,.55,0,2.5),this.pushDownRatio=Ie.fit(this.ratio,.6,.8,0,1),this.ratio===1&&(this.errorAnimationEndedSignal.dispatch(),this.resetRatios())}}const St=new Tm;class Am{constructor(){N(this,"blocks",[]);N(this,"lastSpawnedBlock",null);N(this,"cycleIndex",0);N(this,"animationSpeedRatio",0);N(this,"firstStartAnimationRatio",0);N(this,"previousSuccessBlocksAnimationRatio",0);N(this,"isEndAnimationActive",!1);N(this,"wasSuccess",!1)}init(){Ue.init(),Dt.init(),mn.init(),St.init(),Jt.init(),Dt.completeAnimationEndedSignal.add(()=>{Ue.setRestart(),this._startNewCycle()}),mn.stopAnimationEndedSignal.add(()=>{Ue.setRestart(),this._startNewCycle()}),St.errorAnimationEndedSignal.add(()=>{Ue.setRestart(),this._startNewCycle()})}_spawnBlock(){this._shouldPreventSpawn()||(Ue.isSuccessResult?this._spawnMultipleBlocks():this._spawnSingleBlock(),!(this.blocks.length===X.maxFreeBlocksCount&&Ue.isFree)&&Ue.spawnSignal.dispatch())}_shouldPreventSpawn(){return Ue.isFailResult||Ue.isStopped||this.blocks.length>=Xt||Jt.mainTile.isOccupied&&!Ue.isSuccessResult}_spawnMultipleBlocks(){const e=Xt-X.activeBlocksCount;for(let t=0;te.resetAfterCycle()),Ue.endCycleSignal.dispatch(),this.cycleIndex++,this._spawnBlock(),this._calculatePaths()))}_calculatePaths(){var t;(t=this.lastSpawnedBlock)!=null&&t.hasBeenSpawned&&this.lastSpawnedBlock.moveToNextTile(Ue.isFree,0);const e=this.cycleIndex%2===0?!0:X.activeBlocksCount{!n.hasBeenEvaluated&&n.hasBeenSpawned&&n.moveToNextTile(e,r*.2)})}reset(){this.blocks.forEach(t=>t.reset()),xi.reset(),Jt.reset(),this.blocks=[],this.lastSpawnedBlock=null,this.cycleIndex=0,this.animationSpeedRatio=0,this.previousSuccessBlocksAnimationRatio=this.wasSuccess?1:0,this.isEndAnimationActive=!1;const e=ot.AUTO_RESTART&&[it.FAILED,it.COMPLETED].includes(Ue.result);Ue.reset(),this._startNewCycle(),e&&(Ue.setStart(),Ue.updateFlags())}_updateAnimationRatios(e){const{isResult:t}=Ue;this.firstStartAnimationRatio=Ie.saturate(this.firstStartAnimationRatio+e*(X.showVisual?1:0)),this.animationSpeedRatio=Math.min(1,this.animationSpeedRatio+e*(t?1:0)),this.previousSuccessBlocksAnimationRatio=Ie.saturate(this.previousSuccessBlocksAnimationRatio-.25*e)}_checkCycleCompletion(){let e=!0;return this.lastSpawnedBlock&&(e=e&&this.lastSpawnedBlock.hasBeenSpawned),this.blocks.forEach(t=>{t.lifeCycle>0?e=e&&t.hasBeenEvaluated&&t.hasAnimationEnded:e=e&&t.spawnAnimationRatio===1}),e||Ue.isResultAnimation||Ue.isFailResult||Ue.isStopped}update(e){if(this._updateAnimationRatios(e),Dt.update(e),mn.update(e),St.update(e),Ue.hasNotStarted){this._startNewCycle();return}if(Ue.isRestart){this.wasSuccess=Ue.result===it.COMPLETED,this.reset();return}Ue.isResultAnimation&&Ue.setRestartAnimation(),Jt.preUpdate(e),this.lastSpawnedBlock&&this.lastSpawnedBlock.update(e),this.blocks.forEach(n=>n.update(e)),Jt.update(e),this._checkCycleCompletion()&&this._startNewCycle()}}const Lt=new Am,bm=Math.PI/2,mi=new U;class wm{constructor(){this.animation=0,this.boardDir=new Le,this.boardPos=new Le,this.pos=new U,this.orient=new qt,this.showRatio=0,this.spinPivot=new U,this.spinOrient=new qt,this.spinOrient2=new qt}reset(){this.animation=0,this.boardDir.set(0,0),this.boardPos.set(0,0),this.pos.set(0,0,0),this.orient.identity(),this.showRatio=0,this.spinPivot.set(0,0,0),this.spinOrient.identity()}update(e){this.pos.set(this.boardPos.x,0,-this.boardPos.y),this.spinPivot.set(this.boardDir.x*.5,-.5,-this.boardDir.y*.5),mi.set(-this.boardDir.y,0,-this.boardDir.x),this.spinOrient.setFromAxisAngle(mi,this.animation*bm)}addsFallAnimation(e){mi.set(this.boardDir.x,-e,-this.boardDir.y),this.pos.addScaledVector(mi,e),mi.set(this.boardDir.x*.5,0,-this.boardDir.y*.5),this.spinPivot.lerp(mi,Ie.saturate(e))}}var Tr=`#ifndef IS_BASE attribute vec3 instancePos; attribute vec4 instanceOrient; attribute float instanceShowRatio; @@ -4324,7 +4324,7 @@ void main() { float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; gl_FragColor = packDepthToRGBA( fragCoordZ ); -}`;const Hi=2*Xt,gt=new De,Ar=new De,gi=new U,il=new U,Is=new qt,rl=new qt,sl=new we,br=new we,Ns=new we,wr=new we,Pn=new we,Rr=new we;class Rm{constructor(){N(this,"container",new ft);N(this,"_baseMesh");N(this,"_blocksMesh");N(this,"_blockList",[]);N(this,"_blockRenderList",[]);N(this,"_blockUpdateRange",{start:0,count:0});N(this,"sharedUniforms",{u_lightPosition:{value:new U(-2,6,-4)},u_goboTexture:{value:null},u_goboIntensity:{value:0},u_infoTexture:{value:null},u_infoTextureLinear:{value:null},u_restartAnimationRatio:{value:0},u_endAnimationRatio:{value:0}});N(this,"successColorRatio",0);N(this,"infoTexture",null)}preload(){this._blockList=Array(Hi).fill().map(()=>new wm),this._blockRenderList=[...this._blockList],Sn.loadBuf(ot.ASSETS_PATH+"models/BASE.buf",e=>{this._onBaseBlocksLoaded(e)}),Sn.loadBuf(ot.ASSETS_PATH+"models/BOX.buf",e=>{this._onBoxLoaded(e)}),Sn.loadBuf(ot.ASSETS_PATH+"models/lose_animation.buf",e=>{const{position:t,orient:n}=e.attributes;this.animationTotalFrames=t.count/Xt,this.loseAnimationPositionArray=t.array,this.loseAnimationOrientArray=n.array}),Sn.loadTexture(ot.ASSETS_PATH+"textures/gobo.jpg",e=>{e.flipY=!1,e.needsUpdate=!0,this.sharedUniforms.u_goboTexture.value=e})}_onBaseBlocksLoaded(e){const t=new yt({uniforms:{...Gr.merge([ae.lights]),...H.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms,u_color:{value:new we(this.neutralColor)},u_blocksColor:{value:new we},u_yDisplacement:{value:0},u_prevSuccessColor:{value:new we(H.successColor).convertSRGBToLinear()},u_successColor:{value:new we(H.successColor).convertSRGBToLinear()},u_successAnimationRatio:{value:0}},vertexShader:Tr,fragmentShader:tl,lights:!0,transparent:!0});this._baseMesh=new Nt(e,t),this._baseMesh.receiveShadow=this._baseMesh.castShadow=!0,this._baseMesh.frustumCulled=!1,this._baseMesh.material.defines.IS_BASE=!0,this._baseMesh.customDepthMaterial=new yt({vertexShader:Tr,fragmentShader:nl,defines:{IS_DEPTH:!0,IS_BASE:!0}}),this.container.add(this._baseMesh)}_onBoxLoaded(e){const t=new Ba;t.index=e.index,Object.keys(e.attributes).forEach(s=>{t.setAttribute(s,e.attributes[s])}),t.instanceCount=Hi;const n=(s,o)=>{const a=new Float32Array(Hi*o);return t.setAttribute(s,new Vr(a,o).setUsage(Uc)),a};this._instancePosArray=n("instancePos",3),this._instanceOrientArray=n("instanceOrient",4),this._instanceShowRatioArray=n("instanceShowRatio",1),this._instanceSpinPivotArray=n("instanceSpinPivot",3),this._instanceSpinOrientArray=n("instanceSpinOrient",4),this._instanceColorArray=n("instanceColor",3),this._instanceIsActiveArray=n("instanceIsActive",1),this._instanceNextDirectionArray=n("instanceNextDirection",2);const r=new yt({uniforms:{...Gr.merge([ae.lights]),...H.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms},vertexShader:Tr,fragmentShader:tl,lights:!0});this._blocksMesh=new Nt(t,r),this._blocksMesh.frustumCulled=!1,this._blocksMesh.castShadow=this._blocksMesh.receiveShadow=!0,this._blocksMesh.customDepthMaterial=new yt({uniforms:{...this.sharedUniforms},vertexShader:Tr,fragmentShader:nl,defines:{IS_DEPTH:!0}}),this.container.add(this._blocksMesh)}_onLoseAnimationLoaded(e){const{position:t,orient:n}=e.attributes;this.animationTotalFrames=t.count/Xt,this.loseAnimationPositionArray=t.array,this.loseAnimationOrientArray=n.array}init(){this.directLight=new sm(16777215,1),this.directLight.castShadow=!0,this.directLight.shadow.camera.near=H.lightCameraNear,this.directLight.shadow.camera.far=H.lightCameraFar,this.directLight.shadow.camera.right=H.lightCameraSize,this.directLight.shadow.camera.left=-H.lightCameraSize,this.directLight.shadow.camera.top=H.lightCameraSize,this.directLight.shadow.camera.bottom=-H.lightCameraSize,this.directLight.shadow.bias=H.lightCameraBias,this.directLight.shadow.mapSize.width=768,this.directLight.shadow.mapSize.height=768,H.scene.add(this.directLight),H.scene.add(this.directLight.target),this.isShadowCameraHelperVisible=!1,this.shadowCameraHelper=new am(this.directLight.shadow.camera,1,"#ff0000"),H.lightCameraUpdateSignal.add(()=>{this.directLight.shadow.camera.updateProjectionMatrix(),this.shadowCameraHelper.update()}),H.lightCameraHelperSignal.add(()=>{this.isShadowCameraHelperVisible=!this.isShadowCameraHelperVisible,this.isShadowCameraHelperVisible?H.scene.add(this.shadowCameraHelper):H.scene.remove(this.shadowCameraHelper)}),this._assignFinalAnimationToTiles();let e=new Float32Array(hm*4);for(let t=0,n=0;t{e.forEach((n,r)=>{const s=t*Ut+r;n.loseAnimationPositionArray=new Float32Array(this.animationTotalFrames*3),n.loseAnimationOrientArray=new Float32Array(this.animationTotalFrames*4);for(let o=0;oe.reset())}resetBlockFromLogicBlock(e){this._blockList[e.id].reset()}_updateColors(e){sl.set(H.mainColor),br.set(H.successColor),Ns.set(H.failColor),wr.set(H.neutralColor),Pn.copy(sl),Le.result===it.FAILED&&St.floatingCubesRatio>0&&Pn.copy(Ns),Le.result===it.COMPLETED&&(this.successColorRatio=Math.min(1,this.successColorRatio+.5*e),Pn.lerp(br,this.successColorRatio)),Le.result!==it.COMPLETED&&Pn.lerp(wr,Ie.saturate(mn.pushDownRatio+St.pushDownRatio)),Pn.convertSRGBToLinear(),wr.convertSRGBToLinear(),br.convertSRGBToLinear();for(let n=0;na.id===n)[0],s=n0&&(a=Ie.saturate(.5*(1-Math.cos(14*r.errorFallAnimationTime)))),Rr.lerpColors(o,Ns,a),this._instanceColorArray.set([Rr.r,Rr.g,Rr.b],n*3)}else this._instanceColorArray.set([o.r,o.g,o.b],n*3);this._instanceIsActiveArray[n]=s?1:0}const t=this._baseMesh.material.uniforms;t.u_color.value.set(H.neutralColor).convertSRGBToLinear(),t.u_blocksColor.value.copy(Pn),t.u_successColor.value.copy(br),t.u_prevSuccessColor.value.set(H.neutralColor),t.u_prevSuccessColor.value.lerp(Pn.set(H.successColor),Lt.previousSuccessBlocksAnimationRatio),t.u_prevSuccessColor.value.convertSRGBToLinear()}_updateInfoTexture(){Jt.tiles.forEach(e=>{e.forEach(t=>{let n=t.id%Ut+1,s=((Math.floor(t.id/Ut)+1)*pn+n)*4,o=.5*Dt.floatingCubesRatio*Ie.fit(Dt.pushDownRatio,0,.1,1,0);o+=(St.floatingCubesRatio>0?1:0)*Ie.fit(St.pushDownRatio,0,.1,1,0),o+=mn.spawnRatio*Ie.fit(mn.pushDownRatio,0,.1,1,0),o=Math.min(1,o),this.infoTexture.image.data[s+0]=t.activeRatio*(1-o),this.infoTexture.image.data[s+1]=t.isOccupied||t.willBeOccupied?1:0,this.infoTexture.image.data[s+2]=t.isMain?1:0,this.infoTexture.image.data[s+3]=t.isBorder?1:0})}),this.infoTexture.needsUpdate=!0,this.infoTextureLinear.needsUpdate=!0}_updateFreeBlocks(e){if(Lt.lastSpawnedBlock){const t=this._blockList[Lt.lastSpawnedBlock.id];t.boardPos.set(Lt.lastSpawnedBlock.currentTile.row,Lt.lastSpawnedBlock.currentTile.col),t.showRatio=vi(Ie.saturate(Lt.lastSpawnedBlock.spawnAnimationRatioUnclamped))}Lt.blocks.forEach(t=>{const n=this._blockList[t.id];n&&(n.showRatio=vi(Ie.saturate(t.spawnAnimationRatioUnclamped)),n.boardPos.set(t.currentTile.row,t.currentTile.col),t.targetTile&&n.boardDir.set(t.targetTile.row-t.currentTile.row,t.targetTile.col-t.currentTile.col),n.animation=t.hasAnimationEnded?0:t.easedAnimationRatio)})}_updateAttributes(e){for(let n=0;n=Xt){const n=t-Xt,r=n%Ut-Yt,s=Math.floor(n/Ut)-Yt,o=Jt.getTile(s,r);if(!o.isOccupied){const a=Ie.saturate(mn.spawnRatio-o.randomDelay);o.activeRatio=a,e.showRatio=vi(a),e.boardPos.set(s,r)}}}_updateFailAnimation(e,t,n){if(e&&e.isErrorBlock&&e.errorLifeCycle>=H.errorBlockMaxLifeCycle-1){const r=e.currentTile,s=e.errorFallAnimationTime;t.boardPos.set(r.row,r.col),gt.set(r.row,r.col).normalize(),Math.abs(gt.x)>Math.abs(gt.y)?gt.set(Math.sign(gt.x),0):gt.set(0,Math.sign(gt.y)),t.boardDir.set(gt.x,gt.y),t.animation=Ie.fit(s*s,0,1,0,1),t.animation+=Math.max(0,s-.5),t.update(H.deltaTime),t.addsFallAnimation(Math.max(0,s-.5))}if(Le.result===it.FAILED){if(e){const r=e.currentTile;if(St.floatingCubesRatio>0){const s=Math.floor(St.floatingCubesRatio*this.animationTotalFrames),o=Math.min(s+1,this.animationTotalFrames-1),a=St.floatingCubesRatio*this.animationTotalFrames-s;gi.fromArray(r.loseAnimationPositionArray,s*3),il.fromArray(r.loseAnimationPositionArray,o*3),gi.lerp(il,a),gi.y*=.5,t.pos.set(gi.z,gi.y,-gi.x),Is.fromArray(r.loseAnimationOrientArray,s*4),rl.fromArray(r.loseAnimationOrientArray,o*4),Is.slerp(rl,a),t.orient.copy(Is)}if(St.shakeRatio>0){const s=Ie.fit(St.shakeRatio,0,1,0,1,Er.sineOut);if(gt.set(r.row,r.col),gt.normalize(),gt.multiplyScalar(.1*s),t.pos.x+=gt.x,t.pos.z-=gt.y,St.shakeRatio<1){const o=s*Ie.fit(St.shakeRatio,.5,.8,1,0);gt.set(e.randomVector.x,e.randomVector.y),gt.normalize(),gt.multiplyScalar(o),Ar.set(0,0),Ar.addScaledVector(gt,.08*o*Math.sin(o*80)),t.pos.x+=Ar.x,t.pos.z+=Ar.y}}}if(n>=Xt){const r=n-Xt,s=r%Ut-Yt,o=Math.floor(r/Ut)-Yt,a=Jt.getTile(o,s),l=Ie.saturate(St.spawnRatio-a.randomDelay);a.isOccupied||(a.activeRatio=l),t.showRatio=vi(l),t.boardPos.set(o,s)}}}_updateFloatAnimation(e,t,n){if(Le.result===it.COMPLETED&&e){const s=.1*e.currentTile.randomDelay,o=Dt.floatingCubesRatio-s;let a=Ie.fit(o,0,.5,0,1,l=>1-Math.pow(1-l,5));a=Ie.fit(o,.7,1,a,0,l=>Math.pow(l,5)),t.pos.y+=Dt.floatingCubesDisplacement*a}}update(e){this._updateFreeBlocks(e),this._updateColors(e);let t=0;for(let o=0;oc.id===o)[0];a.showRatio>0&&(this._blockRenderList[t++]=a),this._updateFailAnimation(l,a,o),this._updateStopAnimation(a,o),this._updateFloatAnimation(l,a,o)}this._updateInfoTexture(),this._updateAttributes(t);const n=Math.min(1,mn.pushDownRatio+St.pushDownRatio+Dt.pushDownRatio),r=Er.backOut(n,3),s=1-vi(Lt.firstStartAnimationRatio);this.container.position.y=-r-2*s,this.container.rotation.y=.5*Math.PI*s,this.container.rotation.y+=2*Math.PI*Er.quartInOut(Dt.towerRotationRatio),this._baseMesh.material.uniforms.u_yDisplacement.value=-r-5*s,this._baseMesh.material.uniforms.u_successAnimationRatio.value=Dt.successColorTowerRatio,this.sharedUniforms.u_endAnimationRatio.value=Math.min(1,Ie.fit(mn.spawnRatio,.5,2,0,1)+Ie.fit(St.spawnRatio,.5,2,0,1)+Ie.fit(Dt.ratio,0,.2,0,1)),this.sharedUniforms.u_restartAnimationRatio.value=n,this.sharedUniforms.u_goboIntensity.value=H.goboIntensity,this.sharedUniforms.u_lightPosition.value.set(H.lightPositionX,H.lightPositionY,H.lightPositionZ),this.directLight.position.copy(this.sharedUniforms.u_lightPosition.value),this.directLight.shadow.camera.near=H.lightCameraNear,this.directLight.shadow.camera.far=H.lightCameraFar,this.directLight.shadow.camera.right=H.lightCameraSize,this.directLight.shadow.camera.left=-H.lightCameraSize,this.directLight.shadow.camera.top=H.lightCameraSize,this.directLight.shadow.camera.bottom=-H.lightCameraSize,this.directLight.shadow.bias=H.lightCameraBias}}const Kn=new Rm;var al=`uniform float u_time; +}`;const Hi=2*Xt,gt=new Le,Ar=new Le,_i=new U,il=new U,Is=new qt,rl=new qt,sl=new we,br=new we,Ns=new we,wr=new we,Pn=new we,Rr=new we;class Rm{constructor(){N(this,"container",new ft);N(this,"_baseMesh");N(this,"_blocksMesh");N(this,"_blockList",[]);N(this,"_blockRenderList",[]);N(this,"_blockUpdateRange",{start:0,count:0});N(this,"sharedUniforms",{u_lightPosition:{value:new U(-2,6,-4)},u_goboTexture:{value:null},u_goboIntensity:{value:0},u_infoTexture:{value:null},u_infoTextureLinear:{value:null},u_restartAnimationRatio:{value:0},u_endAnimationRatio:{value:0}});N(this,"successColorRatio",0);N(this,"infoTexture",null)}preload(){this._blockList=Array(Hi).fill().map(()=>new wm),this._blockRenderList=[...this._blockList],Sn.loadBuf(ot.ASSETS_PATH+"models/BASE.buf",e=>{this._onBaseBlocksLoaded(e)}),Sn.loadBuf(ot.ASSETS_PATH+"models/BOX.buf",e=>{this._onBoxLoaded(e)}),Sn.loadBuf(ot.ASSETS_PATH+"models/lose_animation.buf",e=>{const{position:t,orient:n}=e.attributes;this.animationTotalFrames=t.count/Xt,this.loseAnimationPositionArray=t.array,this.loseAnimationOrientArray=n.array}),Sn.loadTexture(ot.ASSETS_PATH+"textures/gobo.jpg",e=>{e.flipY=!1,e.needsUpdate=!0,this.sharedUniforms.u_goboTexture.value=e})}_onBaseBlocksLoaded(e){const t=new yt({uniforms:{...Gr.merge([ae.lights]),...X.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms,u_color:{value:new we(this.neutralColor)},u_blocksColor:{value:new we},u_yDisplacement:{value:0},u_prevSuccessColor:{value:new we(X.successColor).convertSRGBToLinear()},u_successColor:{value:new we(X.successColor).convertSRGBToLinear()},u_successAnimationRatio:{value:0}},vertexShader:Tr,fragmentShader:tl,lights:!0,transparent:!0});this._baseMesh=new Nt(e,t),this._baseMesh.receiveShadow=this._baseMesh.castShadow=!0,this._baseMesh.frustumCulled=!1,this._baseMesh.material.defines.IS_BASE=!0,this._baseMesh.customDepthMaterial=new yt({vertexShader:Tr,fragmentShader:nl,defines:{IS_DEPTH:!0,IS_BASE:!0}}),this.container.add(this._baseMesh)}_onBoxLoaded(e){const t=new Ba;t.index=e.index,Object.keys(e.attributes).forEach(s=>{t.setAttribute(s,e.attributes[s])}),t.instanceCount=Hi;const n=(s,o)=>{const a=new Float32Array(Hi*o);return t.setAttribute(s,new Vr(a,o).setUsage(Uc)),a};this._instancePosArray=n("instancePos",3),this._instanceOrientArray=n("instanceOrient",4),this._instanceShowRatioArray=n("instanceShowRatio",1),this._instanceSpinPivotArray=n("instanceSpinPivot",3),this._instanceSpinOrientArray=n("instanceSpinOrient",4),this._instanceColorArray=n("instanceColor",3),this._instanceIsActiveArray=n("instanceIsActive",1),this._instanceNextDirectionArray=n("instanceNextDirection",2);const r=new yt({uniforms:{...Gr.merge([ae.lights]),...X.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms},vertexShader:Tr,fragmentShader:tl,lights:!0});this._blocksMesh=new Nt(t,r),this._blocksMesh.frustumCulled=!1,this._blocksMesh.castShadow=this._blocksMesh.receiveShadow=!0,this._blocksMesh.customDepthMaterial=new yt({uniforms:{...this.sharedUniforms},vertexShader:Tr,fragmentShader:nl,defines:{IS_DEPTH:!0}}),this.container.add(this._blocksMesh)}_onLoseAnimationLoaded(e){const{position:t,orient:n}=e.attributes;this.animationTotalFrames=t.count/Xt,this.loseAnimationPositionArray=t.array,this.loseAnimationOrientArray=n.array}init(){this.directLight=new sm(16777215,1),this.directLight.castShadow=!0,this.directLight.shadow.camera.near=X.lightCameraNear,this.directLight.shadow.camera.far=X.lightCameraFar,this.directLight.shadow.camera.right=X.lightCameraSize,this.directLight.shadow.camera.left=-X.lightCameraSize,this.directLight.shadow.camera.top=X.lightCameraSize,this.directLight.shadow.camera.bottom=-X.lightCameraSize,this.directLight.shadow.bias=X.lightCameraBias,this.directLight.shadow.mapSize.width=768,this.directLight.shadow.mapSize.height=768,X.scene.add(this.directLight),X.scene.add(this.directLight.target),this.isShadowCameraHelperVisible=!1,this.shadowCameraHelper=new am(this.directLight.shadow.camera,1,"#ff0000"),X.lightCameraUpdateSignal.add(()=>{this.directLight.shadow.camera.updateProjectionMatrix(),this.shadowCameraHelper.update()}),X.lightCameraHelperSignal.add(()=>{this.isShadowCameraHelperVisible=!this.isShadowCameraHelperVisible,this.isShadowCameraHelperVisible?X.scene.add(this.shadowCameraHelper):X.scene.remove(this.shadowCameraHelper)}),this._assignFinalAnimationToTiles();let e=new Float32Array(hm*4);for(let t=0,n=0;t{e.forEach((n,r)=>{const s=t*Ut+r;n.loseAnimationPositionArray=new Float32Array(this.animationTotalFrames*3),n.loseAnimationOrientArray=new Float32Array(this.animationTotalFrames*4);for(let o=0;oe.reset())}resetBlockFromLogicBlock(e){this._blockList[e.id].reset()}_updateColors(e){sl.set(X.mainColor),br.set(X.successColor),Ns.set(X.failColor),wr.set(X.neutralColor),Pn.copy(sl),Ue.result===it.FAILED&&St.floatingCubesRatio>0&&Pn.copy(Ns),Ue.result===it.COMPLETED&&(this.successColorRatio=Math.min(1,this.successColorRatio+.5*e),Pn.lerp(br,this.successColorRatio)),Ue.result!==it.COMPLETED&&Pn.lerp(wr,Ie.saturate(mn.pushDownRatio+St.pushDownRatio)),Pn.convertSRGBToLinear(),wr.convertSRGBToLinear(),br.convertSRGBToLinear();for(let n=0;na.id===n)[0],s=n0&&(a=Ie.saturate(.5*(1-Math.cos(14*r.errorFallAnimationTime)))),Rr.lerpColors(o,Ns,a),this._instanceColorArray.set([Rr.r,Rr.g,Rr.b],n*3)}else this._instanceColorArray.set([o.r,o.g,o.b],n*3);this._instanceIsActiveArray[n]=s?1:0}const t=this._baseMesh.material.uniforms;t.u_color.value.set(X.neutralColor).convertSRGBToLinear(),t.u_blocksColor.value.copy(Pn),t.u_successColor.value.copy(br),t.u_prevSuccessColor.value.set(X.neutralColor),t.u_prevSuccessColor.value.lerp(Pn.set(X.successColor),Lt.previousSuccessBlocksAnimationRatio),t.u_prevSuccessColor.value.convertSRGBToLinear()}_updateInfoTexture(){Jt.tiles.forEach(e=>{e.forEach(t=>{let n=t.id%Ut+1,s=((Math.floor(t.id/Ut)+1)*pn+n)*4,o=.5*Dt.floatingCubesRatio*Ie.fit(Dt.pushDownRatio,0,.1,1,0);o+=(St.floatingCubesRatio>0?1:0)*Ie.fit(St.pushDownRatio,0,.1,1,0),o+=mn.spawnRatio*Ie.fit(mn.pushDownRatio,0,.1,1,0),o=Math.min(1,o),this.infoTexture.image.data[s+0]=t.activeRatio*(1-o),this.infoTexture.image.data[s+1]=t.isOccupied||t.willBeOccupied?1:0,this.infoTexture.image.data[s+2]=t.isMain?1:0,this.infoTexture.image.data[s+3]=t.isBorder?1:0})}),this.infoTexture.needsUpdate=!0,this.infoTextureLinear.needsUpdate=!0}_updateFreeBlocks(e){if(Lt.lastSpawnedBlock){const t=this._blockList[Lt.lastSpawnedBlock.id];t.boardPos.set(Lt.lastSpawnedBlock.currentTile.row,Lt.lastSpawnedBlock.currentTile.col),t.showRatio=gi(Ie.saturate(Lt.lastSpawnedBlock.spawnAnimationRatioUnclamped))}Lt.blocks.forEach(t=>{const n=this._blockList[t.id];n&&(n.showRatio=gi(Ie.saturate(t.spawnAnimationRatioUnclamped)),n.boardPos.set(t.currentTile.row,t.currentTile.col),t.targetTile&&n.boardDir.set(t.targetTile.row-t.currentTile.row,t.targetTile.col-t.currentTile.col),n.animation=t.hasAnimationEnded?0:t.easedAnimationRatio)})}_updateAttributes(e){for(let n=0;n=Xt){const n=t-Xt,r=n%Ut-Yt,s=Math.floor(n/Ut)-Yt,o=Jt.getTile(s,r);if(!o.isOccupied){const a=Ie.saturate(mn.spawnRatio-o.randomDelay);o.activeRatio=a,e.showRatio=gi(a),e.boardPos.set(s,r)}}}_updateFailAnimation(e,t,n){if(e&&e.isErrorBlock&&e.errorLifeCycle>=X.errorBlockMaxLifeCycle-1){const r=e.currentTile,s=e.errorFallAnimationTime;t.boardPos.set(r.row,r.col),gt.set(r.row,r.col).normalize(),Math.abs(gt.x)>Math.abs(gt.y)?gt.set(Math.sign(gt.x),0):gt.set(0,Math.sign(gt.y)),t.boardDir.set(gt.x,gt.y),t.animation=Ie.fit(s*s,0,1,0,1),t.animation+=Math.max(0,s-.5),t.update(X.deltaTime),t.addsFallAnimation(Math.max(0,s-.5))}if(Ue.result===it.FAILED){if(e){const r=e.currentTile;if(St.floatingCubesRatio>0){const s=Math.floor(St.floatingCubesRatio*this.animationTotalFrames),o=Math.min(s+1,this.animationTotalFrames-1),a=St.floatingCubesRatio*this.animationTotalFrames-s;_i.fromArray(r.loseAnimationPositionArray,s*3),il.fromArray(r.loseAnimationPositionArray,o*3),_i.lerp(il,a),_i.y*=.5,t.pos.set(_i.z,_i.y,-_i.x),Is.fromArray(r.loseAnimationOrientArray,s*4),rl.fromArray(r.loseAnimationOrientArray,o*4),Is.slerp(rl,a),t.orient.copy(Is)}if(St.shakeRatio>0){const s=Ie.fit(St.shakeRatio,0,1,0,1,Er.sineOut);if(gt.set(r.row,r.col),gt.normalize(),gt.multiplyScalar(.1*s),t.pos.x+=gt.x,t.pos.z-=gt.y,St.shakeRatio<1){const o=s*Ie.fit(St.shakeRatio,.5,.8,1,0);gt.set(e.randomVector.x,e.randomVector.y),gt.normalize(),gt.multiplyScalar(o),Ar.set(0,0),Ar.addScaledVector(gt,.08*o*Math.sin(o*80)),t.pos.x+=Ar.x,t.pos.z+=Ar.y}}}if(n>=Xt){const r=n-Xt,s=r%Ut-Yt,o=Math.floor(r/Ut)-Yt,a=Jt.getTile(o,s),l=Ie.saturate(St.spawnRatio-a.randomDelay);a.isOccupied||(a.activeRatio=l),t.showRatio=gi(l),t.boardPos.set(o,s)}}}_updateFloatAnimation(e,t,n){if(Ue.result===it.COMPLETED&&e){const s=.1*e.currentTile.randomDelay,o=Dt.floatingCubesRatio-s;let a=Ie.fit(o,0,.5,0,1,l=>1-Math.pow(1-l,5));a=Ie.fit(o,.7,1,a,0,l=>Math.pow(l,5)),t.pos.y+=Dt.floatingCubesDisplacement*a}}update(e){this._updateFreeBlocks(e),this._updateColors(e);let t=0;for(let o=0;oc.id===o)[0];a.showRatio>0&&(this._blockRenderList[t++]=a),this._updateFailAnimation(l,a,o),this._updateStopAnimation(a,o),this._updateFloatAnimation(l,a,o)}this._updateInfoTexture(),this._updateAttributes(t);const n=Math.min(1,mn.pushDownRatio+St.pushDownRatio+Dt.pushDownRatio),r=Er.backOut(n,3),s=1-gi(Lt.firstStartAnimationRatio);this.container.position.y=-r-2*s,this.container.rotation.y=.5*Math.PI*s,this.container.rotation.y+=2*Math.PI*Er.quartInOut(Dt.towerRotationRatio),this._baseMesh.material.uniforms.u_yDisplacement.value=-r-5*s,this._baseMesh.material.uniforms.u_successAnimationRatio.value=Dt.successColorTowerRatio,this.sharedUniforms.u_endAnimationRatio.value=Math.min(1,Ie.fit(mn.spawnRatio,.5,2,0,1)+Ie.fit(St.spawnRatio,.5,2,0,1)+Ie.fit(Dt.ratio,0,.2,0,1)),this.sharedUniforms.u_restartAnimationRatio.value=n,this.sharedUniforms.u_goboIntensity.value=X.goboIntensity,this.sharedUniforms.u_lightPosition.value.set(X.lightPositionX,X.lightPositionY,X.lightPositionZ),this.directLight.position.copy(this.sharedUniforms.u_lightPosition.value),this.directLight.shadow.camera.near=X.lightCameraNear,this.directLight.shadow.camera.far=X.lightCameraFar,this.directLight.shadow.camera.right=X.lightCameraSize,this.directLight.shadow.camera.left=-X.lightCameraSize,this.directLight.shadow.camera.top=X.lightCameraSize,this.directLight.shadow.camera.bottom=-X.lightCameraSize,this.directLight.shadow.bias=X.lightCameraBias}}const xi=new Rm;var al=`uniform float u_time; uniform float u_ratio; uniform float u_isFloating; @@ -4570,7 +4570,7 @@ varying vec2 vHighPrecisionZW; void main() { float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; gl_FragColor = packDepthToRGBA( fragCoordZ ); -}`;class Lm{constructor(){N(this,"container",new ft);N(this,"coinMesh",null);N(this,"coinGeometry",null);N(this,"coinMaterial",null);N(this,"positionsArray",null);N(this,"orientArray",null);N(this,"curveuArray",null);N(this,"aoNArray",null);N(this,"aoPArray",null);N(this,"coinsCount",0);N(this,"animationRatio",0);N(this,"isFloating",!0);N(this,"sharedUniforms",{u_time:{value:0},u_ratio:{value:0},u_isFloating:{value:1}})}preload(){Sn.loadTexture(ot.ASSETS_PATH+"textures/matcap_gold.jpg",e=>{this.matcapTexture=e,this.matcapTexture.needsUpdate=!0}),Sn.loadBuf(ot.ASSETS_PATH+"models/COIN.buf",e=>{this.refGeometry=e}),Sn.loadBuf(ot.ASSETS_PATH+"models/COIN_PLACEMENT.buf",e=>{const{position:t,aoN:n,aoP:r,curveu:s,orient:o}=e.attributes;this.positionsArray=t.array,this.aoNArray=n.array,this.aoPArray=r.array,this.curveuArray=s.array,this.orientArray=o.array,this.coinsCount=t.count})}init(){this._setupGeometry(),this._setupMaterial(),this._setupMesh(),this.container.add(this.coinMesh)}_setupGeometry(){this.refGeometry.computeVertexNormals();const e=new Ba;e.index=this.refGeometry.index,Object.entries(this.refGeometry.attributes).forEach(([n,r])=>e.setAttribute(n,r)),this.randsArray=new Float32Array(this.coinsCount*3).map(()=>Math.random()*2-1),[["a_instancePosition",this.positionsArray,3],["a_instanceQuaternion",this.orientArray,4],["a_instanceCurveUV",this.curveuArray,1],["a_instanceAoN",this.aoNArray,3],["a_instanceAoP",this.aoPArray,3],["a_instanceRand",this.randsArray,3]].forEach(([n,r,s])=>{e.setAttribute(n,new Vr(r,s))}),this.coinGeometry=e}_setupMaterial(){this.coinMaterial=new yt({uniforms:{...Kn.sharedUniforms,...H.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms,...Gr.merge([ae.lights]),u_matcapTexture:{value:this.matcapTexture}},vertexShader:al,fragmentShader:Cm,lights:!0})}_setupMesh(){this.coinMesh=new Nt(this.coinGeometry,this.coinMaterial),this.coinMesh.frustumCulled=!1,this.coinMesh.castShadow=!0,this.coinMesh.receiveShadow=!0,this.coinMesh.customDepthMaterial=new yt({uniforms:{...this.sharedUniforms},vertexShader:al,fragmentShader:Pm,defines:{IS_DEPTH:!0}})}update(e){const t=Dt.vortexCoinsRatio===0;this.animationRatio=t?Dt.floatingCoinsRatio:Dt.vortexCoinsRatio,this.sharedUniforms.u_ratio.value=this.animationRatio,this.sharedUniforms.u_time.value+=e,this.sharedUniforms.u_isFloating.value=t?1:0,this.coinMesh.rotation.y=(this.isFloating?0:4)*this.animationRatio,this.coinMesh.visible=this.animationRatio>0&&this.animationRatio<1}}const Cr=new Lm;var Dm=`varying vec2 v_uv; +}`;class Lm{constructor(){N(this,"container",new ft);N(this,"coinMesh",null);N(this,"coinGeometry",null);N(this,"coinMaterial",null);N(this,"positionsArray",null);N(this,"orientArray",null);N(this,"curveuArray",null);N(this,"aoNArray",null);N(this,"aoPArray",null);N(this,"coinsCount",0);N(this,"animationRatio",0);N(this,"isFloating",!0);N(this,"sharedUniforms",{u_time:{value:0},u_ratio:{value:0},u_isFloating:{value:1}})}preload(){Sn.loadTexture(ot.ASSETS_PATH+"textures/matcap_gold.jpg",e=>{this.matcapTexture=e,this.matcapTexture.needsUpdate=!0}),Sn.loadBuf(ot.ASSETS_PATH+"models/COIN.buf",e=>{this.refGeometry=e}),Sn.loadBuf(ot.ASSETS_PATH+"models/COIN_PLACEMENT.buf",e=>{const{position:t,aoN:n,aoP:r,curveu:s,orient:o}=e.attributes;this.positionsArray=t.array,this.aoNArray=n.array,this.aoPArray=r.array,this.curveuArray=s.array,this.orientArray=o.array,this.coinsCount=t.count})}init(){this._setupGeometry(),this._setupMaterial(),this._setupMesh(),this.container.add(this.coinMesh)}_setupGeometry(){this.refGeometry.computeVertexNormals();const e=new Ba;e.index=this.refGeometry.index,Object.entries(this.refGeometry.attributes).forEach(([n,r])=>e.setAttribute(n,r)),this.randsArray=new Float32Array(this.coinsCount*3).map(()=>Math.random()*2-1),[["a_instancePosition",this.positionsArray,3],["a_instanceQuaternion",this.orientArray,4],["a_instanceCurveUV",this.curveuArray,1],["a_instanceAoN",this.aoNArray,3],["a_instanceAoP",this.aoPArray,3],["a_instanceRand",this.randsArray,3]].forEach(([n,r,s])=>{e.setAttribute(n,new Vr(r,s))}),this.coinGeometry=e}_setupMaterial(){this.coinMaterial=new yt({uniforms:{...xi.sharedUniforms,...X.sharedUniforms,...this.sharedUniforms,...Pi.sharedUniforms,...Gr.merge([ae.lights]),u_matcapTexture:{value:this.matcapTexture}},vertexShader:al,fragmentShader:Cm,lights:!0})}_setupMesh(){this.coinMesh=new Nt(this.coinGeometry,this.coinMaterial),this.coinMesh.frustumCulled=!1,this.coinMesh.castShadow=!0,this.coinMesh.receiveShadow=!0,this.coinMesh.customDepthMaterial=new yt({uniforms:{...this.sharedUniforms},vertexShader:al,fragmentShader:Pm,defines:{IS_DEPTH:!0}})}update(e){const t=Dt.vortexCoinsRatio===0;this.animationRatio=t?Dt.floatingCoinsRatio:Dt.vortexCoinsRatio,this.sharedUniforms.u_ratio.value=this.animationRatio,this.sharedUniforms.u_time.value+=e,this.sharedUniforms.u_isFloating.value=t?1:0,this.coinMesh.rotation.y=(this.isFloating?0:4)*this.animationRatio,this.coinMesh.visible=this.animationRatio>0&&this.animationRatio<1}}const Cr=new Lm;var Dm=`varying vec2 v_uv; void main() { gl_Position = vec4(position.xy, 1.0, 1.0); @@ -4736,4 +4736,4 @@ void main() { float alpha = 1.0 - dist; gl_FragColor = vec4(u_color, u_opacity * alpha * v_opacity); -}`;class Fm{constructor(){N(this,"container",new ft)}init(){const e=new yt({uniforms:Object.assign({u_resolution:H.sharedUniforms.u_resolution,u_bgColor1:H.sharedUniforms.u_bgColor1,u_bgColor2:H.sharedUniforms.u_bgColor2},Pi.sharedUniforms),vertexShader:Dm,fragmentShader:Um});this.mesh=new Nt(new Ci(2,2),e),this.mesh.renderOrder=1,this.container.add(this.mesh),this.initParticles()}initParticles(){const t=new Ci(1,1),n=new Ba;n.index=t.index,Object.keys(t.attributes).forEach(a=>{n.setAttribute(a,t.attributes[a])}),n.instanceCount=50;const r=new Float32Array(50*3),s=new Float32Array(50*3);for(let a=0;a<50;a++)r[a*3]=3*(Math.random()*2-1),r[a*3+1]=1*(Math.random()*2-1),r[a*3+2]=.5+.5*Math.random(),s[a*3]=Math.random(),s[a*3+1]=Math.random(),s[a*3+2]=Math.random();n.setAttribute("a_instancePosition",new Vr(r,3)),n.setAttribute("a_instanceRandom",new Vr(s,3));const o=new yt({vertexShader:Im,fragmentShader:Nm,uniforms:{u_time:H.sharedUniforms.u_time,u_resolution:H.sharedUniforms.u_resolution,u_size:{value:.01},u_color:{value:new we},u_opacity:{value:0}},transparent:!0});this.particles=new Nt(n,o),this.particles.renderOrder=2,this.particles.frustumCulled=!1,this.container.add(this.particles)}resize(){}update(e){this.particles.material.uniforms.u_size.value=H.particlesSize,this.particles.material.uniforms.u_color.value.set(H.particlesColor),this.particles.material.uniforms.u_opacity.value=H.particlesOpacity}}const Fs=new Fm;Ze.enabled=!1;class Om{preload(e,t){ot.override(e),ot.WEBGL_OPTS.canvas=H.canvas=e.canvas,H.orbitTarget=e.orbitTarget,Kn.preload(),Cr.preload(),Pi.preInit(),H.renderer=new Zp(ot.WEBGL_OPTS),Sn.start(t)}init(){H.renderer.shadowMap.enabled=!0,H.renderer.shadowMap.type=Ta,H.scene=new Kp,H.camera=new Na(-1,1,1,-1,1,60),H.scene.add(H.camera),H.camera.position.fromArray(ot.DEFAULT_POSITION),H.orbitCamera=H.camera.clone();let e=H.orbitControls=new mm(H.orbitCamera,H.orbitTarget);e.enableDamping=!0,e.target0.fromArray(ot.DEFAULT_LOOKAT_POSITION),e.reset(),Lt.init(),Kn.init(),Cr.init(),Fs.init(),H.scene.add(Kn.container),H.scene.add(Cr.container),H.scene.add(Fs.container)}setSize(e,t){H.viewportWidth=e,H.viewportHeight=t,H.viewportResolution.set(e,window.innerHeight);let n=e*ot.DPR,r=t*ot.DPR;if(ot.USE_PIXEL_LIMIT===!0&&n*r>ot.MAX_PIXEL_COUNT){let s=n/r;r=Math.sqrt(ot.MAX_PIXEL_COUNT/s),n=Math.ceil(r*s),r=Math.ceil(r)}H.width=n,H.height=r,H.resolution.set(n,r),H.camera.aspect=n/r,H.camera.updateProjectionMatrix(),H.renderer.setSize(n,r),H.canvas.style.width=`${e}px`,H.canvas.style.height=`${t}px`}render(e){H.isPaused&&(e*=0),H.time+=e,H.deltaTime=e,H.sharedUniforms.u_time.value=H.time,H.sharedUniforms.u_deltaTime.value=e;let t=H.sharedUniforms.u_bgColor1.value,n=H.sharedUniforms.u_bgColor2.value;t.set(H.bgColor1).convertSRGBToLinear(),n.set(H.bgColor2).convertSRGBToLinear();let r=H.viewportWidth,s=H.viewportHeight,o=H.cameraZoom*s/10,a=H.cameraOffsetX,l=H.cameraOffsetY;H.camera.zoom=o,H.camera.left=-r/2-a*r/o/2,H.camera.right=r/2-a*r/o/2,H.camera.top=s/2-l*s/o/2,H.camera.bottom=-s/2-l*s/o/2,H.camera.updateProjectionMatrix(),Pi.update(e),Lt.update(e);let c=H.camera;H.orbitControls.update(),H.orbitCamera.updateMatrix(),H.orbitCamera.matrix.decompose(c.position,c.quaternion,c.scale),c.matrix.compose(c.position,c.quaternion,c.scale),Kn.update(e),Cr.update(e),Fs.update(e),H.renderer.setClearColor(H.bgColor,1),H.renderer.render(H.scene,H.camera)}}let Di=new Om;Di.properties=H;Di.stateManager=Le;Di.STATUS=Le.STATUS;Di.RESULT=Le.RESULT;Di.setState=i=>{Le.set(i)};window[ot.APP_ID]=Di; +}`;class Fm{constructor(){N(this,"container",new ft)}init(){const e=new yt({uniforms:Object.assign({u_resolution:X.sharedUniforms.u_resolution,u_bgColor1:X.sharedUniforms.u_bgColor1,u_bgColor2:X.sharedUniforms.u_bgColor2},Pi.sharedUniforms),vertexShader:Dm,fragmentShader:Um});this.mesh=new Nt(new Ci(2,2),e),this.mesh.renderOrder=1,this.container.add(this.mesh),this.initParticles()}initParticles(){const t=new Ci(1,1),n=new Ba;n.index=t.index,Object.keys(t.attributes).forEach(a=>{n.setAttribute(a,t.attributes[a])}),n.instanceCount=50;const r=new Float32Array(50*3),s=new Float32Array(50*3);for(let a=0;a<50;a++)r[a*3]=3*(Math.random()*2-1),r[a*3+1]=1*(Math.random()*2-1),r[a*3+2]=.5+.5*Math.random(),s[a*3]=Math.random(),s[a*3+1]=Math.random(),s[a*3+2]=Math.random();n.setAttribute("a_instancePosition",new Vr(r,3)),n.setAttribute("a_instanceRandom",new Vr(s,3));const o=new yt({vertexShader:Im,fragmentShader:Nm,uniforms:{u_time:X.sharedUniforms.u_time,u_resolution:X.sharedUniforms.u_resolution,u_size:{value:.01},u_color:{value:new we},u_opacity:{value:0}},transparent:!0});this.particles=new Nt(n,o),this.particles.renderOrder=2,this.particles.frustumCulled=!1,this.container.add(this.particles)}resize(){}update(e){this.particles.material.uniforms.u_size.value=X.particlesSize,this.particles.material.uniforms.u_color.value.set(X.particlesColor),this.particles.material.uniforms.u_opacity.value=X.particlesOpacity}}const Fs=new Fm;Ze.enabled=!1;class Om{preload(e,t){ot.override(e),ot.WEBGL_OPTS.canvas=X.canvas=e.canvas,X.orbitTarget=e.orbitTarget,xi.preload(),Cr.preload(),Pi.preInit(),X.renderer=new Zp(ot.WEBGL_OPTS),Sn.start(t)}init(){X.renderer.shadowMap.enabled=!0,X.renderer.shadowMap.type=Ta,X.scene=new Kp,X.camera=new Na(-1,1,1,-1,1,60),X.scene.add(X.camera),X.camera.position.fromArray(ot.DEFAULT_POSITION),X.orbitCamera=X.camera.clone();let e=X.orbitControls=new mm(X.orbitCamera,X.orbitTarget);e.enableDamping=!0,e.target0.fromArray(ot.DEFAULT_LOOKAT_POSITION),e.reset(),Lt.init(),xi.init(),Cr.init(),Fs.init(),X.scene.add(xi.container),X.scene.add(Cr.container),X.scene.add(Fs.container)}setSize(e,t){X.viewportWidth=e,X.viewportHeight=t,X.viewportResolution.set(e,window.innerHeight);let n=e*ot.DPR,r=t*ot.DPR;if(ot.USE_PIXEL_LIMIT===!0&&n*r>ot.MAX_PIXEL_COUNT){let s=n/r;r=Math.sqrt(ot.MAX_PIXEL_COUNT/s),n=Math.ceil(r*s),r=Math.ceil(r)}X.width=n,X.height=r,X.resolution.set(n,r),X.camera.aspect=n/r,X.camera.updateProjectionMatrix(),X.renderer.setSize(n,r),X.canvas.style.width=`${e}px`,X.canvas.style.height=`${t}px`}render(e){X.isPaused&&(e*=0),X.time+=e,X.deltaTime=e,X.sharedUniforms.u_time.value=X.time,X.sharedUniforms.u_deltaTime.value=e;let t=X.sharedUniforms.u_bgColor1.value,n=X.sharedUniforms.u_bgColor2.value;t.set(X.bgColor1).convertSRGBToLinear(),n.set(X.bgColor2).convertSRGBToLinear();let r=X.viewportWidth,s=X.viewportHeight,o=X.cameraZoom*s/10,a=X.cameraOffsetX,l=X.cameraOffsetY;X.camera.zoom=o,X.camera.left=-r/2-a*r/o/2,X.camera.right=r/2-a*r/o/2,X.camera.top=s/2-l*s/o/2,X.camera.bottom=-s/2-l*s/o/2,X.camera.updateProjectionMatrix(),Pi.update(e),Lt.update(e);let c=X.camera;X.orbitControls.update(),X.orbitCamera.updateMatrix(),X.orbitCamera.matrix.decompose(c.position,c.quaternion,c.scale),c.matrix.compose(c.position,c.quaternion,c.scale),xi.update(e),Cr.update(e),Fs.update(e),X.renderer.setClearColor(X.bgColor,1),X.renderer.render(X.scene,X.camera)}}let Di=new Om;Di.properties=X;Di.stateManager=Ue;Di.STATUS=Ue.STATUS;Di.RESULT=Ue.RESULT;Di.setState=i=>{Ue.set(i)};window[ot.APP_ID]=Di; diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index b5b010828..53913db9f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -9,12 +9,12 @@ version = "0.6.16" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -tauri-build = {version = "1.5.5", features = ["isolation"]} +tauri-build = { version = "1.5.5", features = ["isolation"] } [dependencies] anyhow = "1" async-trait = "0.1.81" -async_zip = {version = "0.0.17", features = ["full"]} +async_zip = { version = "0.0.17", features = ["full"] } auto-launch = "0.5.0" base64 = "0.22.1" blake2 = "0.10" @@ -27,46 +27,46 @@ futures-lite = "2.3.0" futures-util = "0.3.30" human_format = "1.1.0" jsonwebtoken = "9.3.0" -keyring = {version = "3.0.5", features = [ +keyring = { version = "3.0.5", features = [ "windows-native", "apple-native", "linux-native", -]} -libsqlite3-sys = {version = "0.25.1", features = [ +] } +libsqlite3-sys = { version = "0.25.1", features = [ "bundled", -]}# Required for tari_wallet +] } # Required for tari_wallet log = "0.4.22" log4rs = "1.3.0" -minotari_node_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"} -minotari_wallet_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"} -nix = {version = "0.29.0", features = ["signal"]} +minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" } +minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" } +nix = { version = "0.29.0", features = ["signal"] } nvml-wrapper = "0.10.0" open = "5" phraze = "0.3.15" rand = "0.8.5" regex = "1.10.5" -reqwest = {version = "0.12.5", features = ["stream", "json", "multipart"]} +reqwest = { version = "0.12.5", features = ["stream", "json", "multipart"] } sanitize-filename = "0.5" semver = "1.0.23" -sentry = {version = "0.34.0", features = ["anyhow"]} +sentry = { version = "0.34.0", features = ["anyhow"] } sentry-tauri = "0.3.0" -serde = {version = "1", features = ["derive"]} +serde = { version = "1", features = ["derive"] } serde_json = "1" serde_yaml = "0.9.10" sha2 = "0.10.8" sys-locale = "0.3.1" sysinfo = "0.31.2" tar = "0.4.26" -tari_common = {git = "https://github.com/tari-project/tari.git", branch = "development"} -tari_common_types = {git = "https://github.com/tari-project/tari.git", branch = "development"} -tari_core = {git = "https://github.com/tari-project/tari.git", branch = "development", features = [ +tari_common = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_common_types = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_core = { git = "https://github.com/tari-project/tari.git", branch = "development", features = [ "transactions", -]} +] } tari_crypto = "0.21.0" -tari_key_manager = {git = "https://github.com/tari-project/tari.git", branch = "development"} -tari_shutdown = {git = "https://github.com/tari-project/tari.git", branch = "development"} +tari_key_manager = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_shutdown = { git = "https://github.com/tari-project/tari.git", branch = "development" } tari_utilities = "0.8.0" -tauri = {version = "1.8.0", features = [ +tauri = { version = "1.8.0", features = [ "window-unmaximize", "window-unminimize", "os-all", @@ -86,12 +86,12 @@ tauri = {version = "1.8.0", features = [ "icon-ico", "icon-png", "process-command-api", -]} -tauri-plugin-single-instance = {git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1"} +] } +tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" } thiserror = "1.0.26" -tokio = {version = "1", features = ["full"]} -tokio-util = {version = "0.7.11", features = ["compat"]} -xz2 = {version = "0.1.7", features = ["static"]}# static bind lzma +tokio = { version = "1", features = ["full"] } +tokio-util = { version = "0.7.11", features = ["compat"] } +xz2 = { version = "0.1.7", features = ["static"] } # static bind lzma zip = "2.2.0" [target.'cfg(windows)'.dependencies] @@ -100,7 +100,7 @@ winreg = "0.52.0" # needed for keymanager. TODO: Find a way of creating a keymanager without bundling sqlite chrono = "0.4.38" device_query = "2.1.0" -libsqlite3-sys = {version = "0.25.1", features = ["bundled"]} +libsqlite3-sys = { version = "0.25.1", features = ["bundled"] } log = "0.4.22" nvml-wrapper = "0.10.0" rand = "0.8.5" From aa69009a1cfb98dc5aae4e90d6b534363c168ceb Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 15 Nov 2024 16:23:15 +0200 Subject: [PATCH 2/5] chore: update p2pool --- src-tauri/binaries_versions_esmeralda.json | 2 +- src-tauri/binaries_versions_nextnet.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/binaries_versions_esmeralda.json b/src-tauri/binaries_versions_esmeralda.json index 12ed0beca..a7a67e8f2 100644 --- a/src-tauri/binaries_versions_esmeralda.json +++ b/src-tauri/binaries_versions_esmeralda.json @@ -4,7 +4,7 @@ "mmproxy": "=1.8.0-pre.0", "minotari_node": "=1.8.0-pre.0", "wallet": "=1.8.0-pre.0", - "sha-p2pool": "=0.7.13", + "sha-p2pool": "=0.7.15", "xtrgpuminer": "=0.1.17", "tor": "=13.5.7" } diff --git a/src-tauri/binaries_versions_nextnet.json b/src-tauri/binaries_versions_nextnet.json index 63103cae6..caac8265b 100644 --- a/src-tauri/binaries_versions_nextnet.json +++ b/src-tauri/binaries_versions_nextnet.json @@ -4,7 +4,7 @@ "mmproxy": "=1.8.0-rc.0", "minotari_node": "=1.8.0-rc.0", "wallet": "=1.8.0-rc.0", - "sha-p2pool": "=0.7.13", + "sha-p2pool": "=0.7.15", "xtrgpuminer": "=0.1.17", "tor": "=13.5.7" } From 9ebb238f6226c05ae60dc3411d8c19e7c4106d92 Mon Sep 17 00:00:00 2001 From: Brian Pearce Date: Fri, 15 Nov 2024 15:44:03 +0100 Subject: [PATCH 3/5] chore(release): v0.6.17 (#1072) Description --- Version bump --- package-lock.json | 4 ++-- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a937b7d50..2e8698e23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tari-universe", - "version": "0.6.14", + "version": "0.6.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tari-universe", - "version": "0.6.14", + "version": "0.6.17", "dependencies": { "@floating-ui/react": "^0.26.27", "@sentry/react": "^8.37.1", diff --git a/package.json b/package.json index 9aafcd546..1397f9982 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tari-universe", "private": true, - "version": "0.6.16", + "version": "0.6.17", "type": "module", "scripts": { "dev": "vite dev --mode development", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 092948add..b4f96ca9b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -6586,7 +6586,7 @@ dependencies = [ [[package]] name = "tari-universe" -version = "0.6.16" +version = "0.6.17" dependencies = [ "anyhow", "async-trait", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 53913db9f..4149c8162 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -4,7 +4,7 @@ description = "Tari Universe" edition = "2021" name = "tari-universe" repository = "https://github.com/tari-project/universe" -version = "0.6.16" +version = "0.6.17" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index db4eca5e1..f554814dc 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Tari Universe (Alpha)", - "version": "0.6.16" + "version": "0.6.17" }, "tauri": { "systemTray": { From 4acb7621acebf1b90b38315fce2446021473642c Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 15 Nov 2024 18:10:30 +0200 Subject: [PATCH 4/5] chore: autoupdate 0.6.17 --- .updater/latest.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.updater/latest.json b/.updater/latest.json index eed100ce5..6b08aa214 100644 --- a/.updater/latest.json +++ b/.updater/latest.json @@ -1,23 +1,23 @@ { - "version": "0.6.4", + "version": "0.6.17", "notes": "Tari Universe - See the assets to download this version and install", - "pub_date": "2024-11-07T20:53:46.621Z", + "pub_date": "2024-11-15T15:19:19.863Z", "platforms": { "linux-x86_64": { - "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFRqMEJBOHhvbVJzMTdtaTBBVkVzbmNLQTgzNDdrUVRPWmNSMUJ3RXVlSmk3dXo3ZVBNaEhoTUxuNmZpNmpYU2FDZFp4eXlMTWpQUzJWb2xBdllpN2dnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxMDExNTM3CWZpbGU6dGFyaS11bml2ZXJzZV8wLjYuNF9hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKWDNaUWZ3MnQzWHRWMm1LV1dSTERPb3B5eHNYb3hIbUJ0bDRxNzJPdGE4K0pOYmpXdWNQSTdOMThKQXpEN3dzRGQ3emxQbjNnN05pYTRnVW5FZU1LQ2c9PQo=", - "url": "https://github.com/tari-project/universe/releases/download/v0.6.4/tari-universe_0.6.4_amd64.AppImage.tar.gz" - }, - "windows-x86_64": { - "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFM5YVl1UHBDcldOUEpKbVVCVk9rRmJnbHpuOEpVTDl1QzNzdHpJTDlIN1ZZVjVZWHd2em9jZENGWlhvejc1aEVBM0VvRzJPcmVvMVlvOURKckVCdUFBPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxMDEyNDEwCWZpbGU6VGFyaSBVbml2ZXJzZV8wLjYuNF94NjRfZW4tVVMubXNpLnppcApuQ0xabVBINGkzVm5SZ1NON056R0VaUitCbHFsRXBmUXJyaFhtK1ZVcjJmL0lISGxuYnVDUHdJTENIZ0hmUkF5b1dSV1NnWkR3NTBWWmQ5ZkVHWS9Ddz09Cg==", - "url": "https://github.com/tari-project/universe/releases/download/v0.6.4/Tari.Universe_0.6.4_x64_en-US.msi.zip" + "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFN6bzUveUlhOG1ySFFiSC9EVmcxa1kvUnl0UllONWF3cjFDVzBtZExLbk9lM3Z2VlNPbFQ4RnJWTDI1QmduOFQwZXgrdVlBRTl6eEZtUFN4am5CTHcwPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxNjgyNzQ3CWZpbGU6dGFyaS11bml2ZXJzZV8wLjYuMTdfYW1kNjQuQXBwSW1hZ2UudGFyLmd6CmFsVzVkSnNEcEF0R2lVSktldXJCUS9maVpzd3pkdGJBUHBYQmZ0WDBLcWNCQVVod2gzQlNMZUY5YlVEMm9QaWVnYXhrRDRtM0V3eC9VQlVPM0M3bkRBPT0K", + "url": "https://github.com/tari-project/universe/releases/download/v0.6.17/tari-universe_0.6.17_amd64.AppImage.tar.gz" }, "darwin-aarch64": { - "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFYvcXl2cERSUVUrSzcvWkM1NC9rbzZhdm1vUm5scythNjA1YnRFTjlGVGpJNEtEVmdIL3NsTlVUajMyZWxqbGIyeERSaEVwMWdHYTlBRzNwQ3Y3bkFvPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxMDEyODE3CWZpbGU6VGFyaSBVbml2ZXJzZS5hcHAudGFyLmd6CjNVbkVhTzBlVWNKU0Q3VUROMnQyZ1VqNUhzUnNaQlhhbk5FNE1ZNktJcGJ6TnJyQzlNNzRyU0pFKyt2SkZXOXBINis2bzBML29uSTZWWUVOc3pCUERnPT0K", - "url": "https://github.com/tari-project/universe/releases/download/v0.6.4/Tari.Universe_universal.app.tar.gz" + "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFErbit3dTFSckNXRExOL0dnaGZtRDVXVzdPSnVPelVzVVFwcS90c2FYWHlPcVE0ZnBzWFhIZjVuVlhZOHR0Q1RJeWw5Rzc0dzZwYmVPNEIrdTJyb3dZPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxNjgzMzczCWZpbGU6VGFyaSBVbml2ZXJzZS5hcHAudGFyLmd6ClRNV3NGTmNVTmRpQjNkSXZuRnkvNjBZaHZtVGhwUDdxbVhpUG5KSFlpNmNlN09HR2YzZndJcktRL3NIWVZta3ZmZWtmSGpRTmZPZUprU281cHU3a0F3PT0K", + "url": "https://github.com/tari-project/universe/releases/download/v0.6.17/Tari.Universe_universal.app.tar.gz" }, "darwin-x86_64": { - "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFYvcXl2cERSUVUrSzcvWkM1NC9rbzZhdm1vUm5scythNjA1YnRFTjlGVGpJNEtEVmdIL3NsTlVUajMyZWxqbGIyeERSaEVwMWdHYTlBRzNwQ3Y3bkFvPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxMDEyODE3CWZpbGU6VGFyaSBVbml2ZXJzZS5hcHAudGFyLmd6CjNVbkVhTzBlVWNKU0Q3VUROMnQyZ1VqNUhzUnNaQlhhbk5FNE1ZNktJcGJ6TnJyQzlNNzRyU0pFKyt2SkZXOXBINis2bzBML29uSTZWWUVOc3pCUERnPT0K", - "url": "https://github.com/tari-project/universe/releases/download/v0.6.4/Tari.Universe_universal.app.tar.gz" + "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFErbit3dTFSckNXRExOL0dnaGZtRDVXVzdPSnVPelVzVVFwcS90c2FYWHlPcVE0ZnBzWFhIZjVuVlhZOHR0Q1RJeWw5Rzc0dzZwYmVPNEIrdTJyb3dZPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxNjgzMzczCWZpbGU6VGFyaSBVbml2ZXJzZS5hcHAudGFyLmd6ClRNV3NGTmNVTmRpQjNkSXZuRnkvNjBZaHZtVGhwUDdxbVhpUG5KSFlpNmNlN09HR2YzZndJcktRL3NIWVZta3ZmZWtmSGpRTmZPZUprU281cHU3a0F3PT0K", + "url": "https://github.com/tari-project/universe/releases/download/v0.6.17/Tari.Universe_universal.app.tar.gz" + }, + "windows-x86_64": { + "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVRbUtvKzlyYWhiOFJUc25wNXVoaUdXY0ZaNmVXckZXT282dHhUV2tOMnZ0Z28wZExmZjhSSDBmQk5GWnpWcXQrUHEydUE2OWx1alBzZ3lvQmRETHhBRnVvNWJjUHpCWFFJPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMxNjgzOTU1CWZpbGU6VGFyaSBVbml2ZXJzZV8wLjYuMTdfeDY0X2VuLVVTLm1zaS56aXAKWXNnL2QvbEtUVmhvc0pKWVNCRUlwbUJENWt4L2g1L0hrbkY0ZlM0eHdmbENZZ2N1QVcvRnZPdE1zcjRrZmpqNndaY1JMUFVjRmdwYzN0ZHNvR0p2Q1E9PQo=", + "url": "https://github.com/tari-project/universe/releases/download/v0.6.17/Tari.Universe_0.6.17_x64_en-US.msi.zip" } } } \ No newline at end of file From 1149c7dfe1097e15a0a09f8e35fb5c6dfa466b30 Mon Sep 17 00:00:00 2001 From: stringhandler Date: Sat, 16 Nov 2024 15:55:29 +0200 Subject: [PATCH 5/5] chore(release): v0.6.18 --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 52 +++++++++++----------- src-tauri/binaries_versions_esmeralda.json | 2 +- src-tauri/binaries_versions_nextnet.json | 2 +- src-tauri/tauri.conf.json | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 1397f9982..6de21bc01 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tari-universe", "private": true, - "version": "0.6.17", + "version": "0.6.18", "type": "module", "scripts": { "dev": "vite dev --mode development", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b4f96ca9b..035121ad6 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -6586,7 +6586,7 @@ dependencies = [ [[package]] name = "tari-universe" -version = "0.6.17" +version = "0.6.18" dependencies = [ "anyhow", "async-trait", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 4149c8162..0b33ae78f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -4,17 +4,17 @@ description = "Tari Universe" edition = "2021" name = "tari-universe" repository = "https://github.com/tari-project/universe" -version = "0.6.17" +version = "0.6.18" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -tauri-build = { version = "1.5.5", features = ["isolation"] } +tauri-build = {version = "1.5.5", features = ["isolation"]} [dependencies] anyhow = "1" async-trait = "0.1.81" -async_zip = { version = "0.0.17", features = ["full"] } +async_zip = {version = "0.0.17", features = ["full"]} auto-launch = "0.5.0" base64 = "0.22.1" blake2 = "0.10" @@ -27,46 +27,46 @@ futures-lite = "2.3.0" futures-util = "0.3.30" human_format = "1.1.0" jsonwebtoken = "9.3.0" -keyring = { version = "3.0.5", features = [ +keyring = {version = "3.0.5", features = [ "windows-native", "apple-native", "linux-native", -] } -libsqlite3-sys = { version = "0.25.1", features = [ +]} +libsqlite3-sys = {version = "0.25.1", features = [ "bundled", -] } # Required for tari_wallet +]}# Required for tari_wallet log = "0.4.22" log4rs = "1.3.0" -minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" } -minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" } -nix = { version = "0.29.0", features = ["signal"] } +minotari_node_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"} +minotari_wallet_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"} +nix = {version = "0.29.0", features = ["signal"]} nvml-wrapper = "0.10.0" open = "5" phraze = "0.3.15" rand = "0.8.5" regex = "1.10.5" -reqwest = { version = "0.12.5", features = ["stream", "json", "multipart"] } +reqwest = {version = "0.12.5", features = ["stream", "json", "multipart"]} sanitize-filename = "0.5" semver = "1.0.23" -sentry = { version = "0.34.0", features = ["anyhow"] } +sentry = {version = "0.34.0", features = ["anyhow"]} sentry-tauri = "0.3.0" -serde = { version = "1", features = ["derive"] } +serde = {version = "1", features = ["derive"]} serde_json = "1" serde_yaml = "0.9.10" sha2 = "0.10.8" sys-locale = "0.3.1" sysinfo = "0.31.2" tar = "0.4.26" -tari_common = { git = "https://github.com/tari-project/tari.git", branch = "development" } -tari_common_types = { git = "https://github.com/tari-project/tari.git", branch = "development" } -tari_core = { git = "https://github.com/tari-project/tari.git", branch = "development", features = [ +tari_common = {git = "https://github.com/tari-project/tari.git", branch = "development"} +tari_common_types = {git = "https://github.com/tari-project/tari.git", branch = "development"} +tari_core = {git = "https://github.com/tari-project/tari.git", branch = "development", features = [ "transactions", -] } +]} tari_crypto = "0.21.0" -tari_key_manager = { git = "https://github.com/tari-project/tari.git", branch = "development" } -tari_shutdown = { git = "https://github.com/tari-project/tari.git", branch = "development" } +tari_key_manager = {git = "https://github.com/tari-project/tari.git", branch = "development"} +tari_shutdown = {git = "https://github.com/tari-project/tari.git", branch = "development"} tari_utilities = "0.8.0" -tauri = { version = "1.8.0", features = [ +tauri = {version = "1.8.0", features = [ "window-unmaximize", "window-unminimize", "os-all", @@ -86,12 +86,12 @@ tauri = { version = "1.8.0", features = [ "icon-ico", "icon-png", "process-command-api", -] } -tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" } +]} +tauri-plugin-single-instance = {git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1"} thiserror = "1.0.26" -tokio = { version = "1", features = ["full"] } -tokio-util = { version = "0.7.11", features = ["compat"] } -xz2 = { version = "0.1.7", features = ["static"] } # static bind lzma +tokio = {version = "1", features = ["full"]} +tokio-util = {version = "0.7.11", features = ["compat"]} +xz2 = {version = "0.1.7", features = ["static"]}# static bind lzma zip = "2.2.0" [target.'cfg(windows)'.dependencies] @@ -100,7 +100,7 @@ winreg = "0.52.0" # needed for keymanager. TODO: Find a way of creating a keymanager without bundling sqlite chrono = "0.4.38" device_query = "2.1.0" -libsqlite3-sys = { version = "0.25.1", features = ["bundled"] } +libsqlite3-sys = {version = "0.25.1", features = ["bundled"]} log = "0.4.22" nvml-wrapper = "0.10.0" rand = "0.8.5" diff --git a/src-tauri/binaries_versions_esmeralda.json b/src-tauri/binaries_versions_esmeralda.json index a7a67e8f2..249bc3aac 100644 --- a/src-tauri/binaries_versions_esmeralda.json +++ b/src-tauri/binaries_versions_esmeralda.json @@ -4,7 +4,7 @@ "mmproxy": "=1.8.0-pre.0", "minotari_node": "=1.8.0-pre.0", "wallet": "=1.8.0-pre.0", - "sha-p2pool": "=0.7.15", + "sha-p2pool": "=0.8.0", "xtrgpuminer": "=0.1.17", "tor": "=13.5.7" } diff --git a/src-tauri/binaries_versions_nextnet.json b/src-tauri/binaries_versions_nextnet.json index caac8265b..bbebc7e23 100644 --- a/src-tauri/binaries_versions_nextnet.json +++ b/src-tauri/binaries_versions_nextnet.json @@ -4,7 +4,7 @@ "mmproxy": "=1.8.0-rc.0", "minotari_node": "=1.8.0-rc.0", "wallet": "=1.8.0-rc.0", - "sha-p2pool": "=0.7.15", + "sha-p2pool": "=0.8.0", "xtrgpuminer": "=0.1.17", "tor": "=13.5.7" } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f554814dc..c28967f2c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Tari Universe (Alpha)", - "version": "0.6.17" + "version": "0.6.18" }, "tauri": { "systemTray": {