gl-draw 0.4.9 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/objects/extrudePolygon/getWorkerGeometry.d.ts +15 -0
- package/dist/objects/extrudePolygon/index.d.ts +5 -11
- package/dist/objects/index.d.ts +2 -0
- package/dist/objects/index.js +2 -2
- package/dist/objects/index.module.js +2 -2
- package/dist/objects/line/getWorkerGeometry.d.ts +14 -0
- package/dist/objects/line/index.d.ts +3 -10
- package/dist/workers/extrudePolygon.js +1 -1
- package/dist/workers/line.js +9 -9
- package/package.json +1 -1
package/dist/workers/line.js
CHANGED
|
@@ -2,7 +2,7 @@ var mv=Object.defineProperty;var Vh=Object.getOwnPropertySymbols;var gv=Object.p
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2010-2021 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Gt="136",Vr={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Xh=0,yl=1,Yh=2,vv=3,_v=0,vl=1,Jh=2,ir=3,ri=0,at=1,si=2,_l=1,Mv=2,vn=0,rr=1,Ml=2,bl=3,wl=4,Zh=5,oi=100,$h=101,jh=102,Sl=103,Tl=104,Qh=200,Kh=201,ef=202,tf=203,El=204,Al=205,nf=206,rf=207,sf=208,of=209,af=210,lf=0,cf=1,uf=2,Po=3,hf=4,ff=5,df=6,pf=7,kr=0,mf=1,gf=2,_n=0,xf=1,yf=2,vf=3,_f=4,Mf=5,Io=300,ai=301,li=302,Wr=303,qr=304,sr=306,Xr=307,Yr=1e3,wt=1001,Jr=1002,lt=1003,Do=1004,bv=1004,Fo=1005,wv=1005,nt=1006,Ll=1007,Sv=1007,ci=1008,Tv=1008,rn=1009,bf=1010,wf=1011,or=1012,Sf=1013,Zr=1014,sn=1015,On=1016,Tf=1017,Ef=1018,Af=1019,ui=1020,Lf=1021,Hn=1022,ft=1023,Cf=1024,Rf=1025,Gn=1026,hi=1027,Pf=1028,If=1029,Df=1030,Ff=1031,Bf=1032,zf=1033,Cl=33776,Rl=33777,Pl=33778,Il=33779,Dl=35840,Fl=35841,Bl=35842,zl=35843,Nf=36196,Nl=37492,Ul=37496,Uf=37808,Of=37809,Hf=37810,Gf=37811,Vf=37812,kf=37813,Wf=37814,qf=37815,Xf=37816,Yf=37817,Jf=37818,Zf=37819,$f=37820,jf=37821,Qf=36492,Kf=37840,ed=37841,td=37842,nd=37843,id=37844,rd=37845,sd=37846,od=37847,ad=37848,ld=37849,cd=37850,ud=37851,hd=37852,fd=37853,dd=2200,pd=2201,md=2202,$r=2300,jr=2301,Bo=2302,fi=2400,di=2401,Qr=2402,zo=2500,Ol=2501,gd=0,Ev=1,Av=2,Vt=3e3,pi=3001,xd=3200,yd=3201,mi=0,vd=1,Lv=0,No=7680,Cv=7681,Rv=7682,Pv=7683,Iv=34055,Dv=34056,Fv=5386,Bv=512,zv=513,Nv=514,Uv=515,Ov=516,Hv=517,Gv=518,_d=519,ar=35044,lr=35048,Vv=35040,kv=35045,Wv=35049,qv=35041,Xv=35046,Yv=35050,Jv=35042,Zv="100",Hl="300 es";class Vn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const yt=[];for(let r=0;r<256;r++)yt[r]=(r<16?"0":"")+r.toString(16);let Kr=1234567;const kn=Math.PI/180,cr=180/Math.PI;function Pt(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(yt[r&255]+yt[r>>8&255]+yt[r>>16&255]+yt[r>>24&255]+"-"+yt[e&255]+yt[e>>8&255]+"-"+yt[e>>16&15|64]+yt[e>>24&255]+"-"+yt[t&63|128]+yt[t>>8&255]+"-"+yt[t>>16&255]+yt[t>>24&255]+yt[n&255]+yt[n>>8&255]+yt[n>>16&255]+yt[n>>24&255]).toUpperCase()}function vt(r,e,t){return Math.max(e,Math.min(t,r))}function Uo(r,e){return(r%e+e)%e}function Md(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function bd(r,e,t){return r!==e?(t-r)/(e-r):0}function ur(r,e,t){return(1-t)*r+t*e}function wd(r,e,t,n){return ur(r,e,1-Math.exp(-t*n))}function Sd(r,e=1){return e-Math.abs(Uo(r,e*2)-e)}function Td(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Ed(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Ad(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Ld(r,e){return r+Math.random()*(e-r)}function Cd(r){return r*(.5-Math.random())}function Rd(r){return r!==void 0&&(Kr=r%2147483647),Kr=Kr*16807%2147483647,(Kr-1)/2147483646}function Pd(r){return r*kn}function Id(r){return r*cr}function Oo(r){return(r&r-1)===0&&r!==0}function Gl(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Vl(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Dd(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),m=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*h,l*f,a*c);break;case"YZY":r.set(l*f,a*u,l*h,a*c);break;case"ZXZ":r.set(l*h,l*f,a*u,a*c);break;case"XZX":r.set(a*u,l*m,l*d,a*c);break;case"YXY":r.set(l*d,a*u,l*m,a*c);break;case"ZYZ":r.set(l*m,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}var $v=Object.freeze({__proto__:null,DEG2RAD:kn,RAD2DEG:cr,generateUUID:Pt,clamp:vt,euclideanModulo:Uo,mapLinear:Md,inverseLerp:bd,lerp:ur,damp:wd,pingpong:Sd,smoothstep:Td,smootherstep:Ed,randInt:Ad,randFloat:Ld,randFloatSpread:Cd,seededRandom:Rd,degToRad:Pd,radToDeg:Id,isPowerOfTwo:Oo,ceilPowerOfTwo:Gl,floorPowerOfTwo:Vl,setQuaternionFromProperEuler:Dd});class q{constructor(e=0,t=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,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}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,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}q.prototype.isVector2=!0;class mt{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,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,i=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],m=n[8],x=i[0],v=i[3],g=i[6],p=i[1],_=i[4],y=i[7],M=i[2],w=i[5],A=i[8];return s[0]=o*x+a*p+l*M,s[3]=o*v+a*_+l*w,s[6]=o*g+a*y+l*A,s[1]=c*x+u*p+h*M,s[4]=c*v+u*_+h*w,s[7]=c*g+u*y+h*A,s[2]=f*x+d*p+m*M,s[5]=f*v+d*_+m*w,s[8]=f*g+d*y+m*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],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+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,d=c*s-o*l,m=t*h+n*f+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=h*x,e[1]=(i*c-u*n)*x,e[2]=(a*n-i*o)*x,e[3]=f*x,e[4]=(u*t-i*l)*x,e[5]=(i*s-a*t)*x,e[6]=d*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,i,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,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],o=i[3],a=i[6],l=i[1],c=i[4],u=i[7];return i[0]=t*s+n*l,i[3]=t*o+n*c,i[6]=t*a+n*u,i[1]=-n*s+t*l,i[4]=-n*o+t*c,i[7]=-n*a+t*u,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}mt.prototype.isMatrix3=!0;function kl(r){if(r.length===0)return-1/0;let e=r[0];for(let t=1,n=r.length;t<n;++t)r[t]>e&&(e=r[t]);return e}const Fd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function gi(r,e){return new Fd[r](e)}function es(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}let xi;class yi{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xi===void 0&&(xi=es("canvas")),xi.width=e.width,xi.height=e.height;const n=xi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=xi}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")}}let Bd=0;class dt extends Vn{constructor(e=dt.DEFAULT_IMAGE,t=dt.DEFAULT_MAPPING,n=wt,i=wt,s=nt,o=ci,a=ft,l=rn,c=1,u=Vt){super(),Object.defineProperty(this,"id",{value:Bd++}),this.uuid=Pt(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new q(0,0),this.repeat=new q(1,1),this.center=new q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new mt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const i=this.image;if(i.uuid===void 0&&(i.uuid=Pt()),!t&&e.images[i.uuid]===void 0){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(Ho(i[o].image)):s.push(Ho(i[o]))}else s=Ho(i);e.images[i.uuid]={uuid:i.uuid,url:s}}n.image=i.uuid}return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Io)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Yr:e.x=e.x-Math.floor(e.x);break;case wt:e.x=e.x<0?0:1;break;case Jr: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 Yr:e.y=e.y-Math.floor(e.y);break;case wt:e.y=e.y<0?0:1;break;case Jr: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++}}dt.DEFAULT_IMAGE=void 0,dt.DEFAULT_MAPPING=Io,dt.prototype.isTexture=!0;function Ho(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?yi.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class We{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],m=l[9],x=l[2],v=l[6],g=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-x)<.01&&Math.abs(m-v)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+x)<.1&&Math.abs(m+v)<.1&&Math.abs(c+d+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,y=(d+1)/2,M=(g+1)/2,w=(u+f)/4,A=(h+x)/4,C=(m+v)/4;return _>y&&_>M?_<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(_),i=w/n,s=A/n):y>M?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=w/i,s=C/i):M<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(M),n=A/s,i=C/s),this.set(n,i,s,t),this}let p=Math.sqrt((v-m)*(v-m)+(h-x)*(h-x)+(f-u)*(f-u));return Math.abs(p)<.001&&(p=1),this.x=(v-m)/p,this.y=(h-x)/p,this.z=(f-u)/p,this.w=Math.acos((c+d+g-1)/2),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),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}}We.prototype.isVector4=!0;class zt extends Vn{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new We(0,0,e,t),this.scissorTest=!1,this.viewport=new We(0,0,e,t),this.texture=new dt(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:nt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=qh({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}zt.prototype.isWebGLRenderTarget=!0;class zd extends zt{constructor(e,t,n){super(e,t);const i=this.texture;this.texture=[];for(let s=0;s<n;s++)this.texture[s]=i.clone()}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}}zd.prototype.isWebGLMultipleRenderTargets=!0;class Go extends zt{constructor(e,t,n={}){super(e,t,n),this.samples=4,this.ignoreDepthForMultisampleCopy=n.ignoreDepth!==void 0?n.ignoreDepth:!0,this.useRenderToTexture=n.useRenderToTexture!==void 0?n.useRenderToTexture:!1,this.useRenderbuffer=this.useRenderToTexture===!1}copy(e){return super.copy.call(this,e),this.samples=e.samples,this.useRenderToTexture=e.useRenderToTexture,this.useRenderbuffer=e.useRenderbuffer,this}}Go.prototype.isWebGLMultisampleRenderTarget=!0;class St{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const f=s[o+0],d=s[o+1],m=s[o+2],x=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=d,e[t+2]=m,e[t+3]=x;return}if(h!==x||l!==f||c!==d||u!==m){let v=1-a;const g=l*f+c*d+u*m+h*x,p=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const M=Math.sqrt(_),w=Math.atan2(M,g*p);v=Math.sin(v*w)/M,a=Math.sin(a*w)/M}const y=a*p;if(l=l*v+f*y,c=c*v+d*y,u=u*v+m*y,h=h*v+x*y,v===1-a){const M=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=M,c*=M,u*=M,h*=M}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[o],f=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+u*h+l*d-c*f,e[t+1]=l*m+u*f+c*h-a*d,e[t+2]=c*m+u*d+a*f-l*h,e[t+3]=u*m-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(s/2),f=l(n/2),d=l(i/2),m=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"YXZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"ZXY":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"ZYX":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"YZX":this._x=f*u*h+c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h-f*d*m;break;case"XZY":this._x=f*u*h-c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h+f*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-i)*d}else if(n>a&&n>h){const d=2*Math.sqrt(1+n-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+c)/d}else if(a>h){const d=2*Math.sqrt(1+a-n-h);this._w=(s-c)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-a);this._w=(o-i)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(vt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+i*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=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}St.prototype.isQuaternion=!0;class S{constructor(e=0,t=0,n=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,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(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 e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Wl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Wl.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-s*i,h=l*i+s*n-o*t,f=-s*t-o*n-a*i;return this.x=c*l+f*-s+u*-a-h*-o,this.y=u*l+f*-o+h*-s-c*-a,this.z=h*l+f*-a+c*-o-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Vo.copy(this).projectOnVector(e),this.sub(Vo)}reflect(e){return this.sub(Vo.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(vt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}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,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),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()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-Wh(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}S.prototype.isVector3=!0;const Vo=new S,Wl=new St;class Nt{constructor(e=new S(1/0,1/0,1/0),t=new S(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.length;l<c;l+=3){const u=e[l],h=e[l+1],f=e[l+2];u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.count;l<c;l++){const u=e.getX(l),h=e.getY(l),f=e.getZ(l);u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=hr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);const t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),ko.copy(t.boundingBox),ko.applyMatrix4(e.matrixWorld),this.union(ko));const n=e.children;for(let i=0,s=n.length;i<s;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,hr),hr.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(fr),ts.subVectors(this.max,fr),vi.subVectors(e.a,fr),_i.subVectors(e.b,fr),Mi.subVectors(e.c,fr),Mn.subVectors(_i,vi),bn.subVectors(Mi,_i),Wn.subVectors(vi,Mi);let t=[0,-Mn.z,Mn.y,0,-bn.z,bn.y,0,-Wn.z,Wn.y,Mn.z,0,-Mn.x,bn.z,0,-bn.x,Wn.z,0,-Wn.x,-Mn.y,Mn.x,0,-bn.y,bn.x,0,-Wn.y,Wn.x,0];return!Wo(t,vi,_i,Mi,ts)||(t=[1,0,0,0,1,0,0,0,1],!Wo(t,vi,_i,Mi,ts))?!1:(ns.crossVectors(Mn,bn),t=[ns.x,ns.y,ns.z],Wo(t,vi,_i,Mi,ts))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return hr.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(hr).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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),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)}}Nt.prototype.isBox3=!0;const on=[new S,new S,new S,new S,new S,new S,new S,new S],hr=new S,ko=new Nt,vi=new S,_i=new S,Mi=new S,Mn=new S,bn=new S,Wn=new S,fr=new S,ts=new S,ns=new S,qn=new S;function Wo(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){qn.fromArray(r,s);const a=i.x*Math.abs(qn.x)+i.y*Math.abs(qn.y)+i.z*Math.abs(qn.z),l=e.dot(qn),c=t.dot(qn),u=n.dot(qn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Nd=new Nt,ql=new S,is=new S,qo=new S;class wn{constructor(e=new S,t=-1){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):Nd.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){qo.subVectors(e,this.center);const t=qo.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(qo.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return this.center.equals(e.center)===!0?is.set(0,0,1).multiplyScalar(e.radius):is.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(ql.copy(e.center).add(is)),this.expandByPoint(ql.copy(e.center).sub(is)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const an=new S,Xo=new S,rs=new S,Sn=new S,Yo=new S,ss=new S,Jo=new S;class Tn{constructor(e=new S,t=new S(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.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,an)),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.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=an.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(an.copy(this.direction).multiplyScalar(t).add(this.origin),an.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Xo.copy(e).add(t).multiplyScalar(.5),rs.copy(t).sub(e).normalize(),Sn.copy(this.origin).sub(Xo);const s=e.distanceTo(t)*.5,o=-this.direction.dot(rs),a=Sn.dot(this.direction),l=-Sn.dot(rs),c=Sn.lengthSq(),u=Math.abs(1-o*o);let h,f,d,m;if(u>0)if(h=o*l-a,f=o*a-l,m=s*u,h>=0)if(f>=-m)if(f<=m){const x=1/u;h*=x,f*=x,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-m?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=m?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(rs).multiplyScalar(f).add(Xo),d}intersectSphere(e,t){an.subVectors(e.center,this.origin);const n=an.dot(this.direction),i=an.dot(an)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return a<0&&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,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>i||((s>n||n!==n)&&(n=s),(o<i||i!==i)&&(i=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,an)!==null}intersectTriangle(e,t,n,i,s){Yo.subVectors(t,e),ss.subVectors(n,e),Jo.crossVectors(Yo,ss);let o=this.direction.dot(Jo),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Sn.subVectors(this.origin,e);const l=a*this.direction.dot(ss.crossVectors(Sn,ss));if(l<0)return null;const c=a*this.direction.dot(Yo.cross(Sn));if(c<0||l+c>o)return null;const u=-a*Sn.dot(Jo);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 pe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,o,a,l,c,u,h,f,d,m,x,v){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=f,g[3]=d,g[7]=m,g[11]=x,g[15]=v,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 pe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/bi.setFromMatrixColumn(e,0).length(),s=1/bi.setFromMatrixColumn(e,1).length(),o=1/bi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,d=o*h,m=a*u,x=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+m*c,t[5]=f-x*c,t[9]=-a*l,t[2]=x-f*c,t[6]=m+d*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,m=c*u,x=c*h;t[0]=f+x*a,t[4]=m*a-d,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-m,t[6]=x+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,m=c*u,x=c*h;t[0]=f-x*a,t[4]=-o*h,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*u,t[9]=x-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,d=o*h,m=a*u,x=a*h;t[0]=l*u,t[4]=m*c-d,t[8]=f*c+x,t[1]=l*h,t[5]=x*c+f,t[9]=d*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,d=o*c,m=a*l,x=a*c;t[0]=l*u,t[4]=x-f*h,t[8]=m*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=d*h+m,t[10]=f-x*h}else if(e.order==="XZY"){const f=o*l,d=o*c,m=a*l,x=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+x,t[5]=o*u,t[9]=d*h-m,t[2]=m*h-d,t[6]=a*u,t[10]=x*h+f}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(Ud,e,Od)}lookAt(e,t,n){const i=this.elements;return It.subVectors(e,t),It.lengthSq()===0&&(It.z=1),It.normalize(),En.crossVectors(n,It),En.lengthSq()===0&&(Math.abs(n.z)===1?It.x+=1e-4:It.z+=1e-4,It.normalize(),En.crossVectors(n,It)),En.normalize(),os.crossVectors(It,En),i[0]=En.x,i[4]=os.x,i[8]=It.x,i[1]=En.y,i[5]=os.y,i[9]=It.y,i[2]=En.z,i[6]=os.z,i[10]=It.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],m=n[2],x=n[6],v=n[10],g=n[14],p=n[3],_=n[7],y=n[11],M=n[15],w=i[0],A=i[4],C=i[8],N=i[12],z=i[1],I=i[5],b=i[9],T=i[13],B=i[2],R=i[6],F=i[10],U=i[14],Z=i[3],ee=i[7],V=i[11],W=i[15];return s[0]=o*w+a*z+l*B+c*Z,s[4]=o*A+a*I+l*R+c*ee,s[8]=o*C+a*b+l*F+c*V,s[12]=o*N+a*T+l*U+c*W,s[1]=u*w+h*z+f*B+d*Z,s[5]=u*A+h*I+f*R+d*ee,s[9]=u*C+h*b+f*F+d*V,s[13]=u*N+h*T+f*U+d*W,s[2]=m*w+x*z+v*B+g*Z,s[6]=m*A+x*I+v*R+g*ee,s[10]=m*C+x*b+v*F+g*V,s[14]=m*N+x*T+v*U+g*W,s[3]=p*w+_*z+y*B+M*Z,s[7]=p*A+_*I+y*R+M*ee,s[11]=p*C+_*b+y*F+M*V,s[15]=p*N+_*T+y*U+M*W,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],m=e[3],x=e[7],v=e[11],g=e[15];return m*(+s*l*h-i*c*h-s*a*f+n*c*f+i*a*d-n*l*d)+x*(+t*l*d-t*c*f+s*o*f-i*o*d+i*c*u-s*l*u)+v*(+t*c*h-t*a*d-s*o*h+n*o*d+s*a*u-n*c*u)+g*(-i*a*u-t*l*h+t*a*f+i*o*h-n*o*f+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],x=e[13],v=e[14],g=e[15],p=h*v*c-x*f*c+x*l*d-a*v*d-h*l*g+a*f*g,_=m*f*c-u*v*c-m*l*d+o*v*d+u*l*g-o*f*g,y=u*x*c-m*h*c+m*a*d-o*x*d-u*a*g+o*h*g,M=m*h*l-u*x*l-m*a*f+o*x*f+u*a*v-o*h*v,w=t*p+n*_+i*y+s*M;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/w;return e[0]=p*A,e[1]=(x*f*s-h*v*s-x*i*d+n*v*d+h*i*g-n*f*g)*A,e[2]=(a*v*s-x*l*s+x*i*c-n*v*c-a*i*g+n*l*g)*A,e[3]=(h*l*s-a*f*s-h*i*c+n*f*c+a*i*d-n*l*d)*A,e[4]=_*A,e[5]=(u*v*s-m*f*s+m*i*d-t*v*d-u*i*g+t*f*g)*A,e[6]=(m*l*s-o*v*s-m*i*c+t*v*c+o*i*g-t*l*g)*A,e[7]=(o*f*s-u*l*s+u*i*c-t*f*c-o*i*d+t*l*d)*A,e[8]=y*A,e[9]=(m*h*s-u*x*s-m*n*d+t*x*d+u*n*g-t*h*g)*A,e[10]=(o*x*s-m*a*s+m*n*c-t*x*c-o*n*g+t*a*g)*A,e[11]=(u*a*s-o*h*s-u*n*c+t*h*c+o*n*d-t*a*d)*A,e[12]=M*A,e[13]=(u*x*i-m*h*i+m*n*f-t*x*f-u*n*v+t*h*v)*A,e[14]=(m*a*i-o*x*i-m*n*l+t*x*l+o*n*v-t*a*v)*A,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*f+t*a*f)*A,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*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,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,d=s*u,m=s*h,x=o*u,v=o*h,g=a*h,p=l*c,_=l*u,y=l*h,M=n.x,w=n.y,A=n.z;return i[0]=(1-(x+g))*M,i[1]=(d+y)*M,i[2]=(m-_)*M,i[3]=0,i[4]=(d-y)*w,i[5]=(1-(f+g))*w,i[6]=(v+p)*w,i[7]=0,i[8]=(m+_)*A,i[9]=(v-p)*A,i[10]=(1-(f+x))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=bi.set(i[0],i[1],i[2]).length();const o=bi.set(i[4],i[5],i[6]).length(),a=bi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],kt.copy(this);const c=1/s,u=1/o,h=1/a;return kt.elements[0]*=c,kt.elements[1]*=c,kt.elements[2]*=c,kt.elements[4]*=u,kt.elements[5]*=u,kt.elements[6]*=u,kt.elements[8]*=h,kt.elements[9]*=h,kt.elements[10]*=h,t.setFromRotationMatrix(kt),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i),f=-(o+s)/(o-s),d=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,s,o){const a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(o-s),h=(t+e)*l,f=(n+i)*c,d=(o+s)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}pe.prototype.isMatrix4=!0;const bi=new S,kt=new pe,Ud=new S(0,0,0),Od=new S(1,1,1),En=new S,os=new S,It=new S,Xl=new pe,Yl=new St;class wi{constructor(e=0,t=0,n=0,i=wi.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(vt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-vt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(vt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-vt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(vt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-vt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),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 Xl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Xl,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Yl.setFromEuler(this),this.setFromQuaternion(Yl,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}toVector3(e){return e?e.set(this._x,this._y,this._z):new S(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}wi.prototype.isEuler=!0,wi.DefaultOrder="XYZ",wi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Zo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Hd=0;const Jl=new S,Si=new St,ln=new pe,as=new S,dr=new S,Gd=new S,Vd=new St,Zl=new S(1,0,0),$l=new S(0,1,0),jl=new S(0,0,1),kd={type:"added"},Ql={type:"removed"};class ke extends Vn{constructor(){super(),Object.defineProperty(this,"id",{value:Hd++}),this.uuid=Pt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ke.DefaultUp.clone();const e=new S,t=new wi,n=new St,i=new S(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new pe},normalMatrix:{value:new mt}}),this.matrix=new pe,this.matrixWorld=new pe,this.matrixAutoUpdate=ke.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Zo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Si.setFromAxisAngle(e,t),this.quaternion.multiply(Si),this}rotateOnWorldAxis(e,t){return Si.setFromAxisAngle(e,t),this.quaternion.premultiply(Si),this}rotateX(e){return this.rotateOnAxis(Zl,e)}rotateY(e){return this.rotateOnAxis($l,e)}rotateZ(e){return this.rotateOnAxis(jl,e)}translateOnAxis(e,t){return Jl.copy(e).applyQuaternion(this.quaternion),this.position.add(Jl.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Zl,e)}translateY(e){return this.translateOnAxis($l,e)}translateZ(e){return this.translateOnAxis(jl,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(ln.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?as.copy(e):as.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),dr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ln.lookAt(dr,as,this.up):ln.lookAt(as,dr,this.up),this.quaternion.setFromRotationMatrix(ln),i&&(ln.extractRotation(i.matrixWorld),Si.setFromRotationMatrix(ln),this.quaternion.premultiply(Si.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(kd)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ql)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(Ql)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),ln.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ln.multiply(e.parent.matrixWorld)),e.applyMatrix4(ln),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dr,e,Gd),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dr,Vd,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));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?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.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;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),d=o(e.animations);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d)}return n.object=i,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.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.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}ke.DefaultUp=new S(0,1,0),ke.DefaultMatrixAutoUpdate=!0,ke.prototype.isObject3D=!0;const Wt=new S,cn=new S,$o=new S,un=new S,Ti=new S,Ei=new S,Kl=new S,jo=new S,Qo=new S,Ko=new S;class ct{constructor(e=new S,t=new S,n=new S){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Wt.subVectors(e,t),i.cross(Wt);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Wt.subVectors(i,t),cn.subVectors(n,t),$o.subVectors(e,t);const o=Wt.dot(Wt),a=Wt.dot(cn),l=Wt.dot($o),c=cn.dot(cn),u=cn.dot($o),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const f=1/h,d=(c*l-a*u)*f,m=(o*u-a*l)*f;return s.set(1-d-m,m,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,un),un.x>=0&&un.y>=0&&un.x+un.y<=1}static getUV(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,un),l.set(0,0),l.addScaledVector(s,un.x),l.addScaledVector(o,un.y),l.addScaledVector(a,un.z),l}static isFrontFacing(e,t,n,i){return Wt.subVectors(n,t),cn.subVectors(e,t),Wt.cross(cn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Wt.subVectors(this.c,this.b),cn.subVectors(this.a,this.b),Wt.cross(cn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ct.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ct.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return ct.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return ct.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ct.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;Ti.subVectors(i,n),Ei.subVectors(s,n),jo.subVectors(e,n);const l=Ti.dot(jo),c=Ei.dot(jo);if(l<=0&&c<=0)return t.copy(n);Qo.subVectors(e,i);const u=Ti.dot(Qo),h=Ei.dot(Qo);if(u>=0&&h<=u)return t.copy(i);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Ti,o);Ko.subVectors(e,s);const d=Ti.dot(Ko),m=Ei.dot(Ko);if(m>=0&&d<=m)return t.copy(s);const x=d*c-l*m;if(x<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(n).addScaledVector(Ei,a);const v=u*m-d*h;if(v<=0&&h-u>=0&&d-m>=0)return Kl.subVectors(s,i),a=(h-u)/(h-u+(d-m)),t.copy(i).addScaledVector(Kl,a);const g=1/(v+x+f);return o=x*g,a=f*g,t.copy(n).addScaledVector(Ti,o).addScaledVector(Ei,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Wd=0;class _t extends Vn{constructor(){super(),Object.defineProperty(this,"id",{value:Wd++}),this.uuid=Pt(),this.name="",this.type="Material",this.fog=!0,this.blending=rr,this.side=ri,this.vertexColors=!1,this.opacity=1,this.format=ft,this.transparent=!1,this.blendSrc=El,this.blendDst=Al,this.blendEquation=oi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Po,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=_d,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=No,this.stencilZFail=No,this.stencilZPass=No,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}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: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===_l;continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,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&&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.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.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&&(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!==rr&&(n.blending=this.blending),this.side!==ri&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==ft&&(n.format=this.format),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&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&&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.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),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=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.format=e.format,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.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,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++}}_t.prototype.isMaterial=!0;const ec={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},qt={h:0,s:0,l:0},ls={h:0,s:0,l:0};function ea(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function ta(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function na(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}class le{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Uo(e,1),t=vt(t,0,1),n=vt(n,0,1),t===0)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=ea(s,i,e+1/3),this.g=ea(s,i,e),this.b=ea(s,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i;const s=n[1],o=n[2];switch(s){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const a=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,l,c)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],s=i.length;if(s===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=ec[e.toLowerCase()];return t!==void 0?this.setHex(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=ta(e.r),this.g=ta(e.g),this.b=ta(e.b),this}copyLinearToSRGB(e){return this.r=na(e.r),this.g=na(e.g),this.b=na(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,s=Math.max(t,n,i),o=Math.min(t,n,i);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const u=s-o;switch(l=c<=.5?u/(s+o):u/(2-s-o),s){case t:a=(n-i)/u+(n<i?6:0);break;case n:a=(i-t)/u+2;break;case i:a=(t-n)/u+4;break}a/=6}return e.h=a,e.s=l,e.l=c,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(qt),qt.h+=e,qt.s+=t,qt.l+=n,this.setHSL(qt.h,qt.s,qt.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(qt),e.getHSL(ls);const n=ur(qt.h,ls.h,t),i=ur(qt.s,ls.s,t),s=ur(qt.l,ls.l,t);return this.setHSL(n,i,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}le.NAMES=ec,le.prototype.isColor=!0,le.prototype.r=1,le.prototype.g=1,le.prototype.b=1;class An extends _t{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new le(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.combine=kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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.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}}An.prototype.isMeshBasicMaterial=!0;const Ye=new S,cs=new q;class ze{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=ar,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new le),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this}copyVector2sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new q),t[n++]=o.x,t[n++]=o.y}return this}copyVector3sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new S),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this}copyVector4sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new We),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)cs.fromBufferAttribute(this,t),cs.applyMatrix3(e),this.setXY(t,cs.x,cs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ye.fromBufferAttribute(this,t),Ye.applyMatrix3(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ye.x=this.getX(t),Ye.y=this.getY(t),Ye.z=this.getZ(t),Ye.applyMatrix4(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ye.x=this.getX(t),Ye.y=this.getY(t),Ye.z=this.getZ(t),Ye.applyNormalMatrix(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ye.x=this.getX(t),Ye.y=this.getY(t),Ye.z=this.getZ(t),Ye.transformDirection(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ar&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}ze.prototype.isBufferAttribute=!0;class qd extends null{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Xd extends null{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Yd extends null{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class Jd extends null{constructor(e,t,n){super(new Int16Array(e),t,n)}}class ia extends ze{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Zd extends null{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ra extends ze{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class $d extends ze{constructor(e,t,n){super(new Uint16Array(e),t,n)}}$d.prototype.isFloat16BufferAttribute=!0;class me extends ze{constructor(e,t,n){super(new Float32Array(e),t,n)}}class jd extends null{constructor(e,t,n){super(new Float64Array(e),t,n)}}let Qd=0;const Ut=new pe,sa=new ke,Ai=new S,Dt=new Nt,pr=new Nt,gt=new S;class ve extends Vn{constructor(){super(),Object.defineProperty(this,"id",{value:Qd++}),this.uuid=Pt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(kl(e)>65535?ra:ia)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new mt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ut.makeRotationFromQuaternion(e),this.applyMatrix4(Ut),this}rotateX(e){return Ut.makeRotationX(e),this.applyMatrix4(Ut),this}rotateY(e){return Ut.makeRotationY(e),this.applyMatrix4(Ut),this}rotateZ(e){return Ut.makeRotationZ(e),this.applyMatrix4(Ut),this}translate(e,t,n){return Ut.makeTranslation(e,t,n),this.applyMatrix4(Ut),this}scale(e,t,n){return Ut.makeScale(e,t,n),this.applyMatrix4(Ut),this}lookAt(e){return sa.lookAt(e),sa.updateMatrix(),this.applyMatrix4(sa.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ai).negate(),this.translate(Ai.x,Ai.y,Ai.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new me(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Nt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new S(-1/0,-1/0,-1/0),new S(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];Dt.setFromBufferAttribute(s),this.morphTargetsRelative?(gt.addVectors(this.boundingBox.min,Dt.min),this.boundingBox.expandByPoint(gt),gt.addVectors(this.boundingBox.max,Dt.max),this.boundingBox.expandByPoint(gt)):(this.boundingBox.expandByPoint(Dt.min),this.boundingBox.expandByPoint(Dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new wn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new S,1/0);return}if(e){const n=this.boundingSphere.center;if(Dt.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];pr.setFromBufferAttribute(a),this.morphTargetsRelative?(gt.addVectors(Dt.min,pr.min),Dt.expandByPoint(gt),gt.addVectors(Dt.max,pr.max),Dt.expandByPoint(gt)):(Dt.expandByPoint(pr.min),Dt.expandByPoint(pr.max))}Dt.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)gt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(gt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)gt.fromBufferAttribute(a,c),l&&(Ai.fromBufferAttribute(e,c),gt.add(Ai)),i=Math.max(i,n.distanceToSquared(gt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,o=t.uv.array,a=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new ze(new Float32Array(4*a),4));const l=t.tangent.array,c=[],u=[];for(let z=0;z<a;z++)c[z]=new S,u[z]=new S;const h=new S,f=new S,d=new S,m=new q,x=new q,v=new q,g=new S,p=new S;function _(z,I,b){h.fromArray(i,z*3),f.fromArray(i,I*3),d.fromArray(i,b*3),m.fromArray(o,z*2),x.fromArray(o,I*2),v.fromArray(o,b*2),f.sub(h),d.sub(h),x.sub(m),v.sub(m);const T=1/(x.x*v.y-v.x*x.y);!isFinite(T)||(g.copy(f).multiplyScalar(v.y).addScaledVector(d,-x.y).multiplyScalar(T),p.copy(d).multiplyScalar(x.x).addScaledVector(f,-v.x).multiplyScalar(T),c[z].add(g),c[I].add(g),c[b].add(g),u[z].add(p),u[I].add(p),u[b].add(p))}let y=this.groups;y.length===0&&(y=[{start:0,count:n.length}]);for(let z=0,I=y.length;z<I;++z){const b=y[z],T=b.start,B=b.count;for(let R=T,F=T+B;R<F;R+=3)_(n[R+0],n[R+1],n[R+2])}const M=new S,w=new S,A=new S,C=new S;function N(z){A.fromArray(s,z*3),C.copy(A);const I=c[z];M.copy(I),M.sub(A.multiplyScalar(A.dot(I))).normalize(),w.crossVectors(C,I);const T=w.dot(u[z])<0?-1:1;l[z*4]=M.x,l[z*4+1]=M.y,l[z*4+2]=M.z,l[z*4+3]=T}for(let z=0,I=y.length;z<I;++z){const b=y[z],T=b.start,B=b.count;for(let R=T,F=T+B;R<F;R+=3)N(n[R+0]),N(n[R+1]),N(n[R+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ze(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new S,s=new S,o=new S,a=new S,l=new S,c=new S,u=new S,h=new S;if(e)for(let f=0,d=e.count;f<d;f+=3){const m=e.getX(f+0),x=e.getX(f+1),v=e.getX(f+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,v),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,x),c.fromBufferAttribute(n,v),a.add(u),l.add(u),c.add(u),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(e.attributes[i]===void 0)continue;const o=n[i].array,a=e.attributes[i],l=a.array,c=a.itemSize*t,u=Math.min(l.length,o.length-c);for(let h=0,f=c;h<u;h++,f++)o[f]=l[h]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)gt.fromBufferAttribute(e,t),gt.normalize(),e.setXYZ(t,gt.x,gt.y,gt.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u);let d=0,m=0;for(let x=0,v=l.length;x<v;x++){a.isInterleavedBufferAttribute?d=l[x]*a.data.stride+a.offset:d=l[x]*u;for(let g=0;g<u;g++)f[m++]=c[d++]}return new ze(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ve,n=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,n);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=e(f,n);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const 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 i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}ve.prototype.isBufferGeometry=!0;const tc=new pe,Li=new Tn,oa=new wn,Ln=new S,Cn=new S,Rn=new S,aa=new S,la=new S,ca=new S,us=new S,hs=new S,fs=new S,ds=new q,ps=new q,ms=new q,ua=new S,gs=new S;class xt extends ke{constructor(e=new ve,t=new An){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),oa.copy(n.boundingSphere),oa.applyMatrix4(s),e.ray.intersectsSphere(oa)===!1)||(tc.copy(s).invert(),Li.copy(e.ray).applyMatrix4(tc),n.boundingBox!==null&&Li.intersectsBox(n.boundingBox)===!1))return;let o;if(n.isBufferGeometry){const a=n.index,l=n.attributes.position,c=n.morphAttributes.position,u=n.morphTargetsRelative,h=n.attributes.uv,f=n.attributes.uv2,d=n.groups,m=n.drawRange;if(a!==null)if(Array.isArray(i))for(let x=0,v=d.length;x<v;x++){const g=d[x],p=i[g.materialIndex],_=Math.max(g.start,m.start),y=Math.min(a.count,Math.min(g.start+g.count,m.start+m.count));for(let M=_,w=y;M<w;M+=3){const A=a.getX(M),C=a.getX(M+1),N=a.getX(M+2);o=xs(this,p,e,Li,l,c,u,h,f,A,C,N),o&&(o.faceIndex=Math.floor(M/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{const x=Math.max(0,m.start),v=Math.min(a.count,m.start+m.count);for(let g=x,p=v;g<p;g+=3){const _=a.getX(g),y=a.getX(g+1),M=a.getX(g+2);o=xs(this,i,e,Li,l,c,u,h,f,_,y,M),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}else if(l!==void 0)if(Array.isArray(i))for(let x=0,v=d.length;x<v;x++){const g=d[x],p=i[g.materialIndex],_=Math.max(g.start,m.start),y=Math.min(l.count,Math.min(g.start+g.count,m.start+m.count));for(let M=_,w=y;M<w;M+=3){const A=M,C=M+1,N=M+2;o=xs(this,p,e,Li,l,c,u,h,f,A,C,N),o&&(o.faceIndex=Math.floor(M/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{const x=Math.max(0,m.start),v=Math.min(l.count,m.start+m.count);for(let g=x,p=v;g<p;g+=3){const _=g,y=g+1,M=g+2;o=xs(this,i,e,Li,l,c,u,h,f,_,y,M),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}xt.prototype.isMesh=!0;function Kd(r,e,t,n,i,s,o,a){let l;if(e.side===at?l=n.intersectTriangle(o,s,i,!0,a):l=n.intersectTriangle(i,s,o,e.side!==si,a),l===null)return null;gs.copy(a),gs.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(gs);return c<t.near||c>t.far?null:{distance:c,point:gs.clone(),object:r}}function xs(r,e,t,n,i,s,o,a,l,c,u,h){Ln.fromBufferAttribute(i,c),Cn.fromBufferAttribute(i,u),Rn.fromBufferAttribute(i,h);const f=r.morphTargetInfluences;if(s&&f){us.set(0,0,0),hs.set(0,0,0),fs.set(0,0,0);for(let m=0,x=s.length;m<x;m++){const v=f[m],g=s[m];v!==0&&(aa.fromBufferAttribute(g,c),la.fromBufferAttribute(g,u),ca.fromBufferAttribute(g,h),o?(us.addScaledVector(aa,v),hs.addScaledVector(la,v),fs.addScaledVector(ca,v)):(us.addScaledVector(aa.sub(Ln),v),hs.addScaledVector(la.sub(Cn),v),fs.addScaledVector(ca.sub(Rn),v)))}Ln.add(us),Cn.add(hs),Rn.add(fs)}r.isSkinnedMesh&&(r.boneTransform(c,Ln),r.boneTransform(u,Cn),r.boneTransform(h,Rn));const d=Kd(r,e,t,n,Ln,Cn,Rn,ua);if(d){a&&(ds.fromBufferAttribute(a,c),ps.fromBufferAttribute(a,u),ms.fromBufferAttribute(a,h),d.uv=ct.getUV(ua,Ln,Cn,Rn,ds,ps,ms,new q)),l&&(ds.fromBufferAttribute(l,c),ps.fromBufferAttribute(l,u),ms.fromBufferAttribute(l,h),d.uv2=ct.getUV(ua,Ln,Cn,Rn,ds,ps,ms,new q));const m={a:c,b:u,c:h,normal:new S,materialIndex:0};ct.getNormal(Ln,Cn,Rn,m.normal),d.face=m}return d}class Xn extends ve{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let f=0,d=0;m("z","y","x",-1,-1,n,t,e,o,s,0),m("z","y","x",1,-1,n,t,-e,o,s,1),m("x","z","y",1,1,e,n,t,i,o,2),m("x","z","y",1,-1,e,n,-t,i,o,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new me(c,3)),this.setAttribute("normal",new me(u,3)),this.setAttribute("uv",new me(h,2));function m(x,v,g,p,_,y,M,w,A,C,N){const z=y/A,I=M/C,b=y/2,T=M/2,B=w/2,R=A+1,F=C+1;let U=0,Z=0;const ee=new S;for(let V=0;V<F;V++){const W=V*I-T;for(let ne=0;ne<R;ne++){const K=ne*z-b;ee[x]=K*p,ee[v]=W*_,ee[g]=B,c.push(ee.x,ee.y,ee.z),ee[x]=0,ee[v]=0,ee[g]=w>0?1:-1,u.push(ee.x,ee.y,ee.z),h.push(ne/A),h.push(1-V/C),U+=1}}for(let V=0;V<C;V++)for(let W=0;W<A;W++){const ne=f+W+R*V,K=f+W+R*(V+1),he=f+(W+1)+R*(V+1),be=f+(W+1)+R*V;l.push(ne,K,be),l.push(K,he,be),Z+=6}a.addGroup(d,Z,N),d+=Z,f+=U}}static fromJSON(e){return new Xn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ci(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Tt(r){const e={};for(let t=0;t<r.length;t++){const n=Ci(r[t]);for(const i in n)e[i]=n[i]}return e}const ep={clone:Ci,merge:Tt};var tp=`void main() {
|
|
5
|
+
*/const Gt="136",Vr={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Xh=0,yl=1,Yh=2,vv=3,_v=0,vl=1,Jh=2,ir=3,ri=0,at=1,si=2,_l=1,Mv=2,vn=0,rr=1,Ml=2,bl=3,wl=4,Zh=5,oi=100,$h=101,jh=102,Sl=103,Tl=104,Qh=200,Kh=201,ef=202,tf=203,El=204,Al=205,nf=206,rf=207,sf=208,of=209,af=210,lf=0,cf=1,uf=2,Po=3,hf=4,ff=5,df=6,pf=7,kr=0,mf=1,gf=2,_n=0,xf=1,yf=2,vf=3,_f=4,Mf=5,Io=300,ai=301,li=302,Wr=303,qr=304,sr=306,Xr=307,Yr=1e3,wt=1001,Jr=1002,lt=1003,Do=1004,bv=1004,Fo=1005,wv=1005,nt=1006,Ll=1007,Sv=1007,ci=1008,Tv=1008,rn=1009,bf=1010,wf=1011,or=1012,Sf=1013,Zr=1014,sn=1015,On=1016,Tf=1017,Ef=1018,Af=1019,ui=1020,Lf=1021,Hn=1022,ft=1023,Cf=1024,Rf=1025,Gn=1026,hi=1027,Pf=1028,If=1029,Df=1030,Ff=1031,Bf=1032,zf=1033,Cl=33776,Rl=33777,Pl=33778,Il=33779,Dl=35840,Fl=35841,Bl=35842,zl=35843,Nf=36196,Nl=37492,Ul=37496,Uf=37808,Of=37809,Hf=37810,Gf=37811,Vf=37812,kf=37813,Wf=37814,qf=37815,Xf=37816,Yf=37817,Jf=37818,Zf=37819,$f=37820,jf=37821,Qf=36492,Kf=37840,ed=37841,td=37842,nd=37843,id=37844,rd=37845,sd=37846,od=37847,ad=37848,ld=37849,cd=37850,ud=37851,hd=37852,fd=37853,dd=2200,pd=2201,md=2202,$r=2300,jr=2301,Bo=2302,fi=2400,di=2401,Qr=2402,zo=2500,Ol=2501,gd=0,Ev=1,Av=2,Vt=3e3,pi=3001,xd=3200,yd=3201,mi=0,vd=1,Lv=0,No=7680,Cv=7681,Rv=7682,Pv=7683,Iv=34055,Dv=34056,Fv=5386,Bv=512,zv=513,Nv=514,Uv=515,Ov=516,Hv=517,Gv=518,_d=519,ar=35044,lr=35048,Vv=35040,kv=35045,Wv=35049,qv=35041,Xv=35046,Yv=35050,Jv=35042,Zv="100",Hl="300 es";class Vn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const yt=[];for(let r=0;r<256;r++)yt[r]=(r<16?"0":"")+r.toString(16);let Kr=1234567;const kn=Math.PI/180,cr=180/Math.PI;function Pt(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(yt[r&255]+yt[r>>8&255]+yt[r>>16&255]+yt[r>>24&255]+"-"+yt[e&255]+yt[e>>8&255]+"-"+yt[e>>16&15|64]+yt[e>>24&255]+"-"+yt[t&63|128]+yt[t>>8&255]+"-"+yt[t>>16&255]+yt[t>>24&255]+yt[n&255]+yt[n>>8&255]+yt[n>>16&255]+yt[n>>24&255]).toUpperCase()}function vt(r,e,t){return Math.max(e,Math.min(t,r))}function Uo(r,e){return(r%e+e)%e}function Md(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function bd(r,e,t){return r!==e?(t-r)/(e-r):0}function ur(r,e,t){return(1-t)*r+t*e}function wd(r,e,t,n){return ur(r,e,1-Math.exp(-t*n))}function Sd(r,e=1){return e-Math.abs(Uo(r,e*2)-e)}function Td(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Ed(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Ad(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Ld(r,e){return r+Math.random()*(e-r)}function Cd(r){return r*(.5-Math.random())}function Rd(r){return r!==void 0&&(Kr=r%2147483647),Kr=Kr*16807%2147483647,(Kr-1)/2147483646}function Pd(r){return r*kn}function Id(r){return r*cr}function Oo(r){return(r&r-1)===0&&r!==0}function Gl(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Vl(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Dd(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),p=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*h,l*f,a*c);break;case"YZY":r.set(l*f,a*u,l*h,a*c);break;case"ZXZ":r.set(l*h,l*f,a*u,a*c);break;case"XZX":r.set(a*u,l*p,l*d,a*c);break;case"YXY":r.set(l*d,a*u,l*p,a*c);break;case"ZYZ":r.set(l*p,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}var $v=Object.freeze({__proto__:null,DEG2RAD:kn,RAD2DEG:cr,generateUUID:Pt,clamp:vt,euclideanModulo:Uo,mapLinear:Md,inverseLerp:bd,lerp:ur,damp:wd,pingpong:Sd,smoothstep:Td,smootherstep:Ed,randInt:Ad,randFloat:Ld,randFloatSpread:Cd,seededRandom:Rd,degToRad:Pd,radToDeg:Id,isPowerOfTwo:Oo,ceilPowerOfTwo:Gl,floorPowerOfTwo:Vl,setQuaternionFromProperEuler:Dd});class q{constructor(e=0,t=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,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}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,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}q.prototype.isVector2=!0;class mt{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,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,i=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],p=n[8],x=i[0],v=i[3],g=i[6],m=i[1],_=i[4],y=i[7],M=i[2],w=i[5],A=i[8];return s[0]=o*x+a*m+l*M,s[3]=o*v+a*_+l*w,s[6]=o*g+a*y+l*A,s[1]=c*x+u*m+h*M,s[4]=c*v+u*_+h*w,s[7]=c*g+u*y+h*A,s[2]=f*x+d*m+p*M,s[5]=f*v+d*_+p*w,s[8]=f*g+d*y+p*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],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+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,d=c*s-o*l,p=t*h+n*f+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/p;return e[0]=h*x,e[1]=(i*c-u*n)*x,e[2]=(a*n-i*o)*x,e[3]=f*x,e[4]=(u*t-i*l)*x,e[5]=(i*s-a*t)*x,e[6]=d*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,i,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,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],o=i[3],a=i[6],l=i[1],c=i[4],u=i[7];return i[0]=t*s+n*l,i[3]=t*o+n*c,i[6]=t*a+n*u,i[1]=-n*s+t*l,i[4]=-n*o+t*c,i[7]=-n*a+t*u,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}mt.prototype.isMatrix3=!0;function kl(r){if(r.length===0)return-1/0;let e=r[0];for(let t=1,n=r.length;t<n;++t)r[t]>e&&(e=r[t]);return e}const Fd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function gi(r,e){return new Fd[r](e)}function es(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}let xi;class yi{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xi===void 0&&(xi=es("canvas")),xi.width=e.width,xi.height=e.height;const n=xi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=xi}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")}}let Bd=0;class dt extends Vn{constructor(e=dt.DEFAULT_IMAGE,t=dt.DEFAULT_MAPPING,n=wt,i=wt,s=nt,o=ci,a=ft,l=rn,c=1,u=Vt){super(),Object.defineProperty(this,"id",{value:Bd++}),this.uuid=Pt(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new q(0,0),this.repeat=new q(1,1),this.center=new q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new mt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const i=this.image;if(i.uuid===void 0&&(i.uuid=Pt()),!t&&e.images[i.uuid]===void 0){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(Ho(i[o].image)):s.push(Ho(i[o]))}else s=Ho(i);e.images[i.uuid]={uuid:i.uuid,url:s}}n.image=i.uuid}return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Io)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Yr:e.x=e.x-Math.floor(e.x);break;case wt:e.x=e.x<0?0:1;break;case Jr: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 Yr:e.y=e.y-Math.floor(e.y);break;case wt:e.y=e.y<0?0:1;break;case Jr: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++}}dt.DEFAULT_IMAGE=void 0,dt.DEFAULT_MAPPING=Io,dt.prototype.isTexture=!0;function Ho(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?yi.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class We{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],p=l[9],x=l[2],v=l[6],g=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-x)<.01&&Math.abs(p-v)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+x)<.1&&Math.abs(p+v)<.1&&Math.abs(c+d+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,y=(d+1)/2,M=(g+1)/2,w=(u+f)/4,A=(h+x)/4,C=(p+v)/4;return _>y&&_>M?_<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(_),i=w/n,s=A/n):y>M?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=w/i,s=C/i):M<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(M),n=A/s,i=C/s),this.set(n,i,s,t),this}let m=Math.sqrt((v-p)*(v-p)+(h-x)*(h-x)+(f-u)*(f-u));return Math.abs(m)<.001&&(m=1),this.x=(v-p)/m,this.y=(h-x)/m,this.z=(f-u)/m,this.w=Math.acos((c+d+g-1)/2),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),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}}We.prototype.isVector4=!0;class zt extends Vn{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new We(0,0,e,t),this.scissorTest=!1,this.viewport=new We(0,0,e,t),this.texture=new dt(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:nt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=qh({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}zt.prototype.isWebGLRenderTarget=!0;class zd extends zt{constructor(e,t,n){super(e,t);const i=this.texture;this.texture=[];for(let s=0;s<n;s++)this.texture[s]=i.clone()}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}}zd.prototype.isWebGLMultipleRenderTargets=!0;class Go extends zt{constructor(e,t,n={}){super(e,t,n),this.samples=4,this.ignoreDepthForMultisampleCopy=n.ignoreDepth!==void 0?n.ignoreDepth:!0,this.useRenderToTexture=n.useRenderToTexture!==void 0?n.useRenderToTexture:!1,this.useRenderbuffer=this.useRenderToTexture===!1}copy(e){return super.copy.call(this,e),this.samples=e.samples,this.useRenderToTexture=e.useRenderToTexture,this.useRenderbuffer=e.useRenderbuffer,this}}Go.prototype.isWebGLMultisampleRenderTarget=!0;class St{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const f=s[o+0],d=s[o+1],p=s[o+2],x=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=d,e[t+2]=p,e[t+3]=x;return}if(h!==x||l!==f||c!==d||u!==p){let v=1-a;const g=l*f+c*d+u*p+h*x,m=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const M=Math.sqrt(_),w=Math.atan2(M,g*m);v=Math.sin(v*w)/M,a=Math.sin(a*w)/M}const y=a*m;if(l=l*v+f*y,c=c*v+d*y,u=u*v+p*y,h=h*v+x*y,v===1-a){const M=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=M,c*=M,u*=M,h*=M}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[o],f=s[o+1],d=s[o+2],p=s[o+3];return e[t]=a*p+u*h+l*d-c*f,e[t+1]=l*p+u*f+c*h-a*d,e[t+2]=c*p+u*d+a*f-l*h,e[t+3]=u*p-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(s/2),f=l(n/2),d=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h-f*d*p;break;case"YXZ":this._x=f*u*h+c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h+f*d*p;break;case"ZXY":this._x=f*u*h-c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h-f*d*p;break;case"ZYX":this._x=f*u*h-c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h+f*d*p;break;case"YZX":this._x=f*u*h+c*d*p,this._y=c*d*h+f*u*p,this._z=c*u*p-f*d*h,this._w=c*u*h-f*d*p;break;case"XZY":this._x=f*u*h-c*d*p,this._y=c*d*h-f*u*p,this._z=c*u*p+f*d*h,this._w=c*u*h+f*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-i)*d}else if(n>a&&n>h){const d=2*Math.sqrt(1+n-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+c)/d}else if(a>h){const d=2*Math.sqrt(1+a-n-h);this._w=(s-c)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-a);this._w=(o-i)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(vt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+i*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=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}St.prototype.isQuaternion=!0;class S{constructor(e=0,t=0,n=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,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(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 e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Wl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Wl.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-s*i,h=l*i+s*n-o*t,f=-s*t-o*n-a*i;return this.x=c*l+f*-s+u*-a-h*-o,this.y=u*l+f*-o+h*-s-c*-a,this.z=h*l+f*-a+c*-o-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Vo.copy(this).projectOnVector(e),this.sub(Vo)}reflect(e){return this.sub(Vo.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(vt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}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,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),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()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-Wh(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}S.prototype.isVector3=!0;const Vo=new S,Wl=new St;class Nt{constructor(e=new S(1/0,1/0,1/0),t=new S(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.length;l<c;l+=3){const u=e[l],h=e[l+1],f=e[l+2];u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.count;l<c;l++){const u=e.getX(l),h=e.getY(l),f=e.getZ(l);u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=hr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);const t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),ko.copy(t.boundingBox),ko.applyMatrix4(e.matrixWorld),this.union(ko));const n=e.children;for(let i=0,s=n.length;i<s;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,hr),hr.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(fr),ts.subVectors(this.max,fr),vi.subVectors(e.a,fr),_i.subVectors(e.b,fr),Mi.subVectors(e.c,fr),Mn.subVectors(_i,vi),bn.subVectors(Mi,_i),Wn.subVectors(vi,Mi);let t=[0,-Mn.z,Mn.y,0,-bn.z,bn.y,0,-Wn.z,Wn.y,Mn.z,0,-Mn.x,bn.z,0,-bn.x,Wn.z,0,-Wn.x,-Mn.y,Mn.x,0,-bn.y,bn.x,0,-Wn.y,Wn.x,0];return!Wo(t,vi,_i,Mi,ts)||(t=[1,0,0,0,1,0,0,0,1],!Wo(t,vi,_i,Mi,ts))?!1:(ns.crossVectors(Mn,bn),t=[ns.x,ns.y,ns.z],Wo(t,vi,_i,Mi,ts))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return hr.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(hr).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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),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)}}Nt.prototype.isBox3=!0;const on=[new S,new S,new S,new S,new S,new S,new S,new S],hr=new S,ko=new Nt,vi=new S,_i=new S,Mi=new S,Mn=new S,bn=new S,Wn=new S,fr=new S,ts=new S,ns=new S,qn=new S;function Wo(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){qn.fromArray(r,s);const a=i.x*Math.abs(qn.x)+i.y*Math.abs(qn.y)+i.z*Math.abs(qn.z),l=e.dot(qn),c=t.dot(qn),u=n.dot(qn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Nd=new Nt,ql=new S,is=new S,qo=new S;class wn{constructor(e=new S,t=-1){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):Nd.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){qo.subVectors(e,this.center);const t=qo.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(qo.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return this.center.equals(e.center)===!0?is.set(0,0,1).multiplyScalar(e.radius):is.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(ql.copy(e.center).add(is)),this.expandByPoint(ql.copy(e.center).sub(is)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const an=new S,Xo=new S,rs=new S,Sn=new S,Yo=new S,ss=new S,Jo=new S;class Tn{constructor(e=new S,t=new S(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.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,an)),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.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=an.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(an.copy(this.direction).multiplyScalar(t).add(this.origin),an.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Xo.copy(e).add(t).multiplyScalar(.5),rs.copy(t).sub(e).normalize(),Sn.copy(this.origin).sub(Xo);const s=e.distanceTo(t)*.5,o=-this.direction.dot(rs),a=Sn.dot(this.direction),l=-Sn.dot(rs),c=Sn.lengthSq(),u=Math.abs(1-o*o);let h,f,d,p;if(u>0)if(h=o*l-a,f=o*a-l,p=s*u,h>=0)if(f>=-p)if(f<=p){const x=1/u;h*=x,f*=x,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-p?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=p?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(rs).multiplyScalar(f).add(Xo),d}intersectSphere(e,t){an.subVectors(e.center,this.origin);const n=an.dot(this.direction),i=an.dot(an)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return a<0&&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,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>i||((s>n||n!==n)&&(n=s),(o<i||i!==i)&&(i=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,an)!==null}intersectTriangle(e,t,n,i,s){Yo.subVectors(t,e),ss.subVectors(n,e),Jo.crossVectors(Yo,ss);let o=this.direction.dot(Jo),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Sn.subVectors(this.origin,e);const l=a*this.direction.dot(ss.crossVectors(Sn,ss));if(l<0)return null;const c=a*this.direction.dot(Yo.cross(Sn));if(c<0||l+c>o)return null;const u=-a*Sn.dot(Jo);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 pe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,o,a,l,c,u,h,f,d,p,x,v){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=f,g[3]=d,g[7]=p,g[11]=x,g[15]=v,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 pe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/bi.setFromMatrixColumn(e,0).length(),s=1/bi.setFromMatrixColumn(e,1).length(),o=1/bi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,d=o*h,p=a*u,x=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+p*c,t[5]=f-x*c,t[9]=-a*l,t[2]=x-f*c,t[6]=p+d*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,p=c*u,x=c*h;t[0]=f+x*a,t[4]=p*a-d,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-p,t[6]=x+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,p=c*u,x=c*h;t[0]=f-x*a,t[4]=-o*h,t[8]=p+d*a,t[1]=d+p*a,t[5]=o*u,t[9]=x-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,d=o*h,p=a*u,x=a*h;t[0]=l*u,t[4]=p*c-d,t[8]=f*c+x,t[1]=l*h,t[5]=x*c+f,t[9]=d*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,d=o*c,p=a*l,x=a*c;t[0]=l*u,t[4]=x-f*h,t[8]=p*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=d*h+p,t[10]=f-x*h}else if(e.order==="XZY"){const f=o*l,d=o*c,p=a*l,x=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+x,t[5]=o*u,t[9]=d*h-p,t[2]=p*h-d,t[6]=a*u,t[10]=x*h+f}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(Ud,e,Od)}lookAt(e,t,n){const i=this.elements;return It.subVectors(e,t),It.lengthSq()===0&&(It.z=1),It.normalize(),En.crossVectors(n,It),En.lengthSq()===0&&(Math.abs(n.z)===1?It.x+=1e-4:It.z+=1e-4,It.normalize(),En.crossVectors(n,It)),En.normalize(),os.crossVectors(It,En),i[0]=En.x,i[4]=os.x,i[8]=It.x,i[1]=En.y,i[5]=os.y,i[9]=It.y,i[2]=En.z,i[6]=os.z,i[10]=It.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],p=n[2],x=n[6],v=n[10],g=n[14],m=n[3],_=n[7],y=n[11],M=n[15],w=i[0],A=i[4],C=i[8],N=i[12],z=i[1],I=i[5],b=i[9],T=i[13],B=i[2],R=i[6],F=i[10],U=i[14],Z=i[3],ee=i[7],V=i[11],W=i[15];return s[0]=o*w+a*z+l*B+c*Z,s[4]=o*A+a*I+l*R+c*ee,s[8]=o*C+a*b+l*F+c*V,s[12]=o*N+a*T+l*U+c*W,s[1]=u*w+h*z+f*B+d*Z,s[5]=u*A+h*I+f*R+d*ee,s[9]=u*C+h*b+f*F+d*V,s[13]=u*N+h*T+f*U+d*W,s[2]=p*w+x*z+v*B+g*Z,s[6]=p*A+x*I+v*R+g*ee,s[10]=p*C+x*b+v*F+g*V,s[14]=p*N+x*T+v*U+g*W,s[3]=m*w+_*z+y*B+M*Z,s[7]=m*A+_*I+y*R+M*ee,s[11]=m*C+_*b+y*F+M*V,s[15]=m*N+_*T+y*U+M*W,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],p=e[3],x=e[7],v=e[11],g=e[15];return p*(+s*l*h-i*c*h-s*a*f+n*c*f+i*a*d-n*l*d)+x*(+t*l*d-t*c*f+s*o*f-i*o*d+i*c*u-s*l*u)+v*(+t*c*h-t*a*d-s*o*h+n*o*d+s*a*u-n*c*u)+g*(-i*a*u-t*l*h+t*a*f+i*o*h-n*o*f+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],x=e[13],v=e[14],g=e[15],m=h*v*c-x*f*c+x*l*d-a*v*d-h*l*g+a*f*g,_=p*f*c-u*v*c-p*l*d+o*v*d+u*l*g-o*f*g,y=u*x*c-p*h*c+p*a*d-o*x*d-u*a*g+o*h*g,M=p*h*l-u*x*l-p*a*f+o*x*f+u*a*v-o*h*v,w=t*m+n*_+i*y+s*M;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/w;return e[0]=m*A,e[1]=(x*f*s-h*v*s-x*i*d+n*v*d+h*i*g-n*f*g)*A,e[2]=(a*v*s-x*l*s+x*i*c-n*v*c-a*i*g+n*l*g)*A,e[3]=(h*l*s-a*f*s-h*i*c+n*f*c+a*i*d-n*l*d)*A,e[4]=_*A,e[5]=(u*v*s-p*f*s+p*i*d-t*v*d-u*i*g+t*f*g)*A,e[6]=(p*l*s-o*v*s-p*i*c+t*v*c+o*i*g-t*l*g)*A,e[7]=(o*f*s-u*l*s+u*i*c-t*f*c-o*i*d+t*l*d)*A,e[8]=y*A,e[9]=(p*h*s-u*x*s-p*n*d+t*x*d+u*n*g-t*h*g)*A,e[10]=(o*x*s-p*a*s+p*n*c-t*x*c-o*n*g+t*a*g)*A,e[11]=(u*a*s-o*h*s-u*n*c+t*h*c+o*n*d-t*a*d)*A,e[12]=M*A,e[13]=(u*x*i-p*h*i+p*n*f-t*x*f-u*n*v+t*h*v)*A,e[14]=(p*a*i-o*x*i-p*n*l+t*x*l+o*n*v-t*a*v)*A,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*f+t*a*f)*A,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*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,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,d=s*u,p=s*h,x=o*u,v=o*h,g=a*h,m=l*c,_=l*u,y=l*h,M=n.x,w=n.y,A=n.z;return i[0]=(1-(x+g))*M,i[1]=(d+y)*M,i[2]=(p-_)*M,i[3]=0,i[4]=(d-y)*w,i[5]=(1-(f+g))*w,i[6]=(v+m)*w,i[7]=0,i[8]=(p+_)*A,i[9]=(v-m)*A,i[10]=(1-(f+x))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=bi.set(i[0],i[1],i[2]).length();const o=bi.set(i[4],i[5],i[6]).length(),a=bi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],kt.copy(this);const c=1/s,u=1/o,h=1/a;return kt.elements[0]*=c,kt.elements[1]*=c,kt.elements[2]*=c,kt.elements[4]*=u,kt.elements[5]*=u,kt.elements[6]*=u,kt.elements[8]*=h,kt.elements[9]*=h,kt.elements[10]*=h,t.setFromRotationMatrix(kt),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i),f=-(o+s)/(o-s),d=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,s,o){const a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(o-s),h=(t+e)*l,f=(n+i)*c,d=(o+s)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}pe.prototype.isMatrix4=!0;const bi=new S,kt=new pe,Ud=new S(0,0,0),Od=new S(1,1,1),En=new S,os=new S,It=new S,Xl=new pe,Yl=new St;class wi{constructor(e=0,t=0,n=0,i=wi.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(vt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-vt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(vt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-vt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(vt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-vt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),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 Xl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Xl,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Yl.setFromEuler(this),this.setFromQuaternion(Yl,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}toVector3(e){return e?e.set(this._x,this._y,this._z):new S(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}wi.prototype.isEuler=!0,wi.DefaultOrder="XYZ",wi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Zo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Hd=0;const Jl=new S,Si=new St,ln=new pe,as=new S,dr=new S,Gd=new S,Vd=new St,Zl=new S(1,0,0),$l=new S(0,1,0),jl=new S(0,0,1),kd={type:"added"},Ql={type:"removed"};class ke extends Vn{constructor(){super(),Object.defineProperty(this,"id",{value:Hd++}),this.uuid=Pt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ke.DefaultUp.clone();const e=new S,t=new wi,n=new St,i=new S(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new pe},normalMatrix:{value:new mt}}),this.matrix=new pe,this.matrixWorld=new pe,this.matrixAutoUpdate=ke.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Zo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Si.setFromAxisAngle(e,t),this.quaternion.multiply(Si),this}rotateOnWorldAxis(e,t){return Si.setFromAxisAngle(e,t),this.quaternion.premultiply(Si),this}rotateX(e){return this.rotateOnAxis(Zl,e)}rotateY(e){return this.rotateOnAxis($l,e)}rotateZ(e){return this.rotateOnAxis(jl,e)}translateOnAxis(e,t){return Jl.copy(e).applyQuaternion(this.quaternion),this.position.add(Jl.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Zl,e)}translateY(e){return this.translateOnAxis($l,e)}translateZ(e){return this.translateOnAxis(jl,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(ln.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?as.copy(e):as.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),dr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ln.lookAt(dr,as,this.up):ln.lookAt(as,dr,this.up),this.quaternion.setFromRotationMatrix(ln),i&&(ln.extractRotation(i.matrixWorld),Si.setFromRotationMatrix(ln),this.quaternion.premultiply(Si.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(kd)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ql)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(Ql)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),ln.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ln.multiply(e.parent.matrixWorld)),e.applyMatrix4(ln),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dr,e,Gd),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dr,Vd,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));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?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.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;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),d=o(e.animations);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d)}return n.object=i,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.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.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}ke.DefaultUp=new S(0,1,0),ke.DefaultMatrixAutoUpdate=!0,ke.prototype.isObject3D=!0;const Wt=new S,cn=new S,$o=new S,un=new S,Ti=new S,Ei=new S,Kl=new S,jo=new S,Qo=new S,Ko=new S;class ct{constructor(e=new S,t=new S,n=new S){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Wt.subVectors(e,t),i.cross(Wt);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Wt.subVectors(i,t),cn.subVectors(n,t),$o.subVectors(e,t);const o=Wt.dot(Wt),a=Wt.dot(cn),l=Wt.dot($o),c=cn.dot(cn),u=cn.dot($o),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const f=1/h,d=(c*l-a*u)*f,p=(o*u-a*l)*f;return s.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,un),un.x>=0&&un.y>=0&&un.x+un.y<=1}static getUV(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,un),l.set(0,0),l.addScaledVector(s,un.x),l.addScaledVector(o,un.y),l.addScaledVector(a,un.z),l}static isFrontFacing(e,t,n,i){return Wt.subVectors(n,t),cn.subVectors(e,t),Wt.cross(cn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Wt.subVectors(this.c,this.b),cn.subVectors(this.a,this.b),Wt.cross(cn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ct.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ct.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return ct.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return ct.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ct.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;Ti.subVectors(i,n),Ei.subVectors(s,n),jo.subVectors(e,n);const l=Ti.dot(jo),c=Ei.dot(jo);if(l<=0&&c<=0)return t.copy(n);Qo.subVectors(e,i);const u=Ti.dot(Qo),h=Ei.dot(Qo);if(u>=0&&h<=u)return t.copy(i);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Ti,o);Ko.subVectors(e,s);const d=Ti.dot(Ko),p=Ei.dot(Ko);if(p>=0&&d<=p)return t.copy(s);const x=d*c-l*p;if(x<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(n).addScaledVector(Ei,a);const v=u*p-d*h;if(v<=0&&h-u>=0&&d-p>=0)return Kl.subVectors(s,i),a=(h-u)/(h-u+(d-p)),t.copy(i).addScaledVector(Kl,a);const g=1/(v+x+f);return o=x*g,a=f*g,t.copy(n).addScaledVector(Ti,o).addScaledVector(Ei,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Wd=0;class _t extends Vn{constructor(){super(),Object.defineProperty(this,"id",{value:Wd++}),this.uuid=Pt(),this.name="",this.type="Material",this.fog=!0,this.blending=rr,this.side=ri,this.vertexColors=!1,this.opacity=1,this.format=ft,this.transparent=!1,this.blendSrc=El,this.blendDst=Al,this.blendEquation=oi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Po,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=_d,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=No,this.stencilZFail=No,this.stencilZPass=No,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}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: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===_l;continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,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&&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.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.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&&(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!==rr&&(n.blending=this.blending),this.side!==ri&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==ft&&(n.format=this.format),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&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&&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.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),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=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.format=e.format,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.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,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++}}_t.prototype.isMaterial=!0;const ec={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},qt={h:0,s:0,l:0},ls={h:0,s:0,l:0};function ea(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function ta(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function na(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}class le{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Uo(e,1),t=vt(t,0,1),n=vt(n,0,1),t===0)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=ea(s,i,e+1/3),this.g=ea(s,i,e),this.b=ea(s,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i;const s=n[1],o=n[2];switch(s){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const a=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,l,c)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],s=i.length;if(s===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=ec[e.toLowerCase()];return t!==void 0?this.setHex(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=ta(e.r),this.g=ta(e.g),this.b=ta(e.b),this}copyLinearToSRGB(e){return this.r=na(e.r),this.g=na(e.g),this.b=na(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,s=Math.max(t,n,i),o=Math.min(t,n,i);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const u=s-o;switch(l=c<=.5?u/(s+o):u/(2-s-o),s){case t:a=(n-i)/u+(n<i?6:0);break;case n:a=(i-t)/u+2;break;case i:a=(t-n)/u+4;break}a/=6}return e.h=a,e.s=l,e.l=c,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(qt),qt.h+=e,qt.s+=t,qt.l+=n,this.setHSL(qt.h,qt.s,qt.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(qt),e.getHSL(ls);const n=ur(qt.h,ls.h,t),i=ur(qt.s,ls.s,t),s=ur(qt.l,ls.l,t);return this.setHSL(n,i,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}le.NAMES=ec,le.prototype.isColor=!0,le.prototype.r=1,le.prototype.g=1,le.prototype.b=1;class An extends _t{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new le(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.combine=kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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.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}}An.prototype.isMeshBasicMaterial=!0;const Ye=new S,cs=new q;class ze{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=ar,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new le),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this}copyVector2sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new q),t[n++]=o.x,t[n++]=o.y}return this}copyVector3sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new S),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this}copyVector4sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new We),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)cs.fromBufferAttribute(this,t),cs.applyMatrix3(e),this.setXY(t,cs.x,cs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ye.fromBufferAttribute(this,t),Ye.applyMatrix3(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ye.x=this.getX(t),Ye.y=this.getY(t),Ye.z=this.getZ(t),Ye.applyMatrix4(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ye.x=this.getX(t),Ye.y=this.getY(t),Ye.z=this.getZ(t),Ye.applyNormalMatrix(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ye.x=this.getX(t),Ye.y=this.getY(t),Ye.z=this.getZ(t),Ye.transformDirection(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ar&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}ze.prototype.isBufferAttribute=!0;class qd extends null{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Xd extends null{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Yd extends null{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class Jd extends null{constructor(e,t,n){super(new Int16Array(e),t,n)}}class ia extends ze{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Zd extends null{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ra extends ze{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class $d extends ze{constructor(e,t,n){super(new Uint16Array(e),t,n)}}$d.prototype.isFloat16BufferAttribute=!0;class me extends ze{constructor(e,t,n){super(new Float32Array(e),t,n)}}class jd extends null{constructor(e,t,n){super(new Float64Array(e),t,n)}}let Qd=0;const Ut=new pe,sa=new ke,Ai=new S,Dt=new Nt,pr=new Nt,gt=new S;class ve extends Vn{constructor(){super(),Object.defineProperty(this,"id",{value:Qd++}),this.uuid=Pt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(kl(e)>65535?ra:ia)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new mt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ut.makeRotationFromQuaternion(e),this.applyMatrix4(Ut),this}rotateX(e){return Ut.makeRotationX(e),this.applyMatrix4(Ut),this}rotateY(e){return Ut.makeRotationY(e),this.applyMatrix4(Ut),this}rotateZ(e){return Ut.makeRotationZ(e),this.applyMatrix4(Ut),this}translate(e,t,n){return Ut.makeTranslation(e,t,n),this.applyMatrix4(Ut),this}scale(e,t,n){return Ut.makeScale(e,t,n),this.applyMatrix4(Ut),this}lookAt(e){return sa.lookAt(e),sa.updateMatrix(),this.applyMatrix4(sa.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ai).negate(),this.translate(Ai.x,Ai.y,Ai.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new me(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Nt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new S(-1/0,-1/0,-1/0),new S(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];Dt.setFromBufferAttribute(s),this.morphTargetsRelative?(gt.addVectors(this.boundingBox.min,Dt.min),this.boundingBox.expandByPoint(gt),gt.addVectors(this.boundingBox.max,Dt.max),this.boundingBox.expandByPoint(gt)):(this.boundingBox.expandByPoint(Dt.min),this.boundingBox.expandByPoint(Dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new wn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new S,1/0);return}if(e){const n=this.boundingSphere.center;if(Dt.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];pr.setFromBufferAttribute(a),this.morphTargetsRelative?(gt.addVectors(Dt.min,pr.min),Dt.expandByPoint(gt),gt.addVectors(Dt.max,pr.max),Dt.expandByPoint(gt)):(Dt.expandByPoint(pr.min),Dt.expandByPoint(pr.max))}Dt.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)gt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(gt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)gt.fromBufferAttribute(a,c),l&&(Ai.fromBufferAttribute(e,c),gt.add(Ai)),i=Math.max(i,n.distanceToSquared(gt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,o=t.uv.array,a=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new ze(new Float32Array(4*a),4));const l=t.tangent.array,c=[],u=[];for(let z=0;z<a;z++)c[z]=new S,u[z]=new S;const h=new S,f=new S,d=new S,p=new q,x=new q,v=new q,g=new S,m=new S;function _(z,I,b){h.fromArray(i,z*3),f.fromArray(i,I*3),d.fromArray(i,b*3),p.fromArray(o,z*2),x.fromArray(o,I*2),v.fromArray(o,b*2),f.sub(h),d.sub(h),x.sub(p),v.sub(p);const T=1/(x.x*v.y-v.x*x.y);!isFinite(T)||(g.copy(f).multiplyScalar(v.y).addScaledVector(d,-x.y).multiplyScalar(T),m.copy(d).multiplyScalar(x.x).addScaledVector(f,-v.x).multiplyScalar(T),c[z].add(g),c[I].add(g),c[b].add(g),u[z].add(m),u[I].add(m),u[b].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:n.length}]);for(let z=0,I=y.length;z<I;++z){const b=y[z],T=b.start,B=b.count;for(let R=T,F=T+B;R<F;R+=3)_(n[R+0],n[R+1],n[R+2])}const M=new S,w=new S,A=new S,C=new S;function N(z){A.fromArray(s,z*3),C.copy(A);const I=c[z];M.copy(I),M.sub(A.multiplyScalar(A.dot(I))).normalize(),w.crossVectors(C,I);const T=w.dot(u[z])<0?-1:1;l[z*4]=M.x,l[z*4+1]=M.y,l[z*4+2]=M.z,l[z*4+3]=T}for(let z=0,I=y.length;z<I;++z){const b=y[z],T=b.start,B=b.count;for(let R=T,F=T+B;R<F;R+=3)N(n[R+0]),N(n[R+1]),N(n[R+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ze(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new S,s=new S,o=new S,a=new S,l=new S,c=new S,u=new S,h=new S;if(e)for(let f=0,d=e.count;f<d;f+=3){const p=e.getX(f+0),x=e.getX(f+1),v=e.getX(f+2);i.fromBufferAttribute(t,p),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,v),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,x),c.fromBufferAttribute(n,v),a.add(u),l.add(u),c.add(u),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(e.attributes[i]===void 0)continue;const o=n[i].array,a=e.attributes[i],l=a.array,c=a.itemSize*t,u=Math.min(l.length,o.length-c);for(let h=0,f=c;h<u;h++,f++)o[f]=l[h]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)gt.fromBufferAttribute(e,t),gt.normalize(),e.setXYZ(t,gt.x,gt.y,gt.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u);let d=0,p=0;for(let x=0,v=l.length;x<v;x++){a.isInterleavedBufferAttribute?d=l[x]*a.data.stride+a.offset:d=l[x]*u;for(let g=0;g<u;g++)f[p++]=c[d++]}return new ze(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ve,n=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,n);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=e(f,n);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const 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 i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}ve.prototype.isBufferGeometry=!0;const tc=new pe,Li=new Tn,oa=new wn,Ln=new S,Cn=new S,Rn=new S,aa=new S,la=new S,ca=new S,us=new S,hs=new S,fs=new S,ds=new q,ps=new q,ms=new q,ua=new S,gs=new S;class xt extends ke{constructor(e=new ve,t=new An){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),oa.copy(n.boundingSphere),oa.applyMatrix4(s),e.ray.intersectsSphere(oa)===!1)||(tc.copy(s).invert(),Li.copy(e.ray).applyMatrix4(tc),n.boundingBox!==null&&Li.intersectsBox(n.boundingBox)===!1))return;let o;if(n.isBufferGeometry){const a=n.index,l=n.attributes.position,c=n.morphAttributes.position,u=n.morphTargetsRelative,h=n.attributes.uv,f=n.attributes.uv2,d=n.groups,p=n.drawRange;if(a!==null)if(Array.isArray(i))for(let x=0,v=d.length;x<v;x++){const g=d[x],m=i[g.materialIndex],_=Math.max(g.start,p.start),y=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let M=_,w=y;M<w;M+=3){const A=a.getX(M),C=a.getX(M+1),N=a.getX(M+2);o=xs(this,m,e,Li,l,c,u,h,f,A,C,N),o&&(o.faceIndex=Math.floor(M/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{const x=Math.max(0,p.start),v=Math.min(a.count,p.start+p.count);for(let g=x,m=v;g<m;g+=3){const _=a.getX(g),y=a.getX(g+1),M=a.getX(g+2);o=xs(this,i,e,Li,l,c,u,h,f,_,y,M),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}else if(l!==void 0)if(Array.isArray(i))for(let x=0,v=d.length;x<v;x++){const g=d[x],m=i[g.materialIndex],_=Math.max(g.start,p.start),y=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let M=_,w=y;M<w;M+=3){const A=M,C=M+1,N=M+2;o=xs(this,m,e,Li,l,c,u,h,f,A,C,N),o&&(o.faceIndex=Math.floor(M/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{const x=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let g=x,m=v;g<m;g+=3){const _=g,y=g+1,M=g+2;o=xs(this,i,e,Li,l,c,u,h,f,_,y,M),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}xt.prototype.isMesh=!0;function Kd(r,e,t,n,i,s,o,a){let l;if(e.side===at?l=n.intersectTriangle(o,s,i,!0,a):l=n.intersectTriangle(i,s,o,e.side!==si,a),l===null)return null;gs.copy(a),gs.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(gs);return c<t.near||c>t.far?null:{distance:c,point:gs.clone(),object:r}}function xs(r,e,t,n,i,s,o,a,l,c,u,h){Ln.fromBufferAttribute(i,c),Cn.fromBufferAttribute(i,u),Rn.fromBufferAttribute(i,h);const f=r.morphTargetInfluences;if(s&&f){us.set(0,0,0),hs.set(0,0,0),fs.set(0,0,0);for(let p=0,x=s.length;p<x;p++){const v=f[p],g=s[p];v!==0&&(aa.fromBufferAttribute(g,c),la.fromBufferAttribute(g,u),ca.fromBufferAttribute(g,h),o?(us.addScaledVector(aa,v),hs.addScaledVector(la,v),fs.addScaledVector(ca,v)):(us.addScaledVector(aa.sub(Ln),v),hs.addScaledVector(la.sub(Cn),v),fs.addScaledVector(ca.sub(Rn),v)))}Ln.add(us),Cn.add(hs),Rn.add(fs)}r.isSkinnedMesh&&(r.boneTransform(c,Ln),r.boneTransform(u,Cn),r.boneTransform(h,Rn));const d=Kd(r,e,t,n,Ln,Cn,Rn,ua);if(d){a&&(ds.fromBufferAttribute(a,c),ps.fromBufferAttribute(a,u),ms.fromBufferAttribute(a,h),d.uv=ct.getUV(ua,Ln,Cn,Rn,ds,ps,ms,new q)),l&&(ds.fromBufferAttribute(l,c),ps.fromBufferAttribute(l,u),ms.fromBufferAttribute(l,h),d.uv2=ct.getUV(ua,Ln,Cn,Rn,ds,ps,ms,new q));const p={a:c,b:u,c:h,normal:new S,materialIndex:0};ct.getNormal(Ln,Cn,Rn,p.normal),d.face=p}return d}class Xn extends ve{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let f=0,d=0;p("z","y","x",-1,-1,n,t,e,o,s,0),p("z","y","x",1,-1,n,t,-e,o,s,1),p("x","z","y",1,1,e,n,t,i,o,2),p("x","z","y",1,-1,e,n,-t,i,o,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new me(c,3)),this.setAttribute("normal",new me(u,3)),this.setAttribute("uv",new me(h,2));function p(x,v,g,m,_,y,M,w,A,C,N){const z=y/A,I=M/C,b=y/2,T=M/2,B=w/2,R=A+1,F=C+1;let U=0,Z=0;const ee=new S;for(let V=0;V<F;V++){const W=V*I-T;for(let ne=0;ne<R;ne++){const K=ne*z-b;ee[x]=K*m,ee[v]=W*_,ee[g]=B,c.push(ee.x,ee.y,ee.z),ee[x]=0,ee[v]=0,ee[g]=w>0?1:-1,u.push(ee.x,ee.y,ee.z),h.push(ne/A),h.push(1-V/C),U+=1}}for(let V=0;V<C;V++)for(let W=0;W<A;W++){const ne=f+W+R*V,K=f+W+R*(V+1),he=f+(W+1)+R*(V+1),be=f+(W+1)+R*V;l.push(ne,K,be),l.push(K,he,be),Z+=6}a.addGroup(d,Z,N),d+=Z,f+=U}}static fromJSON(e){return new Xn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ci(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Tt(r){const e={};for(let t=0;t<r.length;t++){const n=Ci(r[t]);for(const i in n)e[i]=n[i]}return e}const ep={clone:Ci,merge:Tt};var tp=`void main() {
|
|
6
6
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
7
|
}`,np=`void main() {
|
|
8
8
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -41,7 +41,7 @@ var mv=Object.defineProperty;var Vh=Object.getOwnPropertySymbols;var gv=Object.p
|
|
|
41
41
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
42
|
|
|
43
43
|
}
|
|
44
|
-
`},i=new Xn(5,5,5),s=new Yt({name:"CubemapFromEquirect",uniforms:Ci(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:at,blending:vn});s.uniforms.tEquirect.value=t;const o=new xt(i,s),a=t.minFilter;return t.minFilter===ci&&(t.minFilter=nt),new ha(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}fa.prototype.isWebGLCubeRenderTarget=!0;const da=new S,ip=new S,rp=new mt;class hn{constructor(e=new S(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=da.subVectors(n,t).cross(ip.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(da),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||rp.getNormalMatrix(e),i=this.coplanarPoint(da).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}hn.prototype.isPlane=!0;const Ii=new wn,vs=new S;class _s{constructor(e=new hn,t=new hn,n=new hn,i=new hn,s=new hn,o=new hn){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],u=n[6],h=n[7],f=n[8],d=n[9],
|
|
44
|
+
`},i=new Xn(5,5,5),s=new Yt({name:"CubemapFromEquirect",uniforms:Ci(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:at,blending:vn});s.uniforms.tEquirect.value=t;const o=new xt(i,s),a=t.minFilter;return t.minFilter===ci&&(t.minFilter=nt),new ha(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}fa.prototype.isWebGLCubeRenderTarget=!0;const da=new S,ip=new S,rp=new mt;class hn{constructor(e=new S(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=da.subVectors(n,t).cross(ip.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(da),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||rp.getNormalMatrix(e),i=this.coplanarPoint(da).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}hn.prototype.isPlane=!0;const Ii=new wn,vs=new S;class _s{constructor(e=new hn,t=new hn,n=new hn,i=new hn,s=new hn,o=new hn){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],u=n[6],h=n[7],f=n[8],d=n[9],p=n[10],x=n[11],v=n[12],g=n[13],m=n[14],_=n[15];return t[0].setComponents(a-i,h-l,x-f,_-v).normalize(),t[1].setComponents(a+i,h+l,x+f,_+v).normalize(),t[2].setComponents(a+s,h+c,x+d,_+g).normalize(),t[3].setComponents(a-s,h-c,x-d,_-g).normalize(),t[4].setComponents(a-o,h-u,x-p,_-m).normalize(),t[5].setComponents(a+o,h+u,x+p,_+m).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Ii.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ii)}intersectsSprite(e){return Ii.center.set(0,0,0),Ii.radius=.7071067811865476,Ii.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ii)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(vs.x=i.normal.x>0?e.max.x:e.min.x,vs.y=i.normal.y>0?e.max.y:e.min.y,vs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(vs)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function nc(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function sp(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const h=c.array,f=c.usage,d=r.createBuffer();r.bindBuffer(u,d),r.bufferData(u,h,f),c.onUploadCallback();let p=5126;return h instanceof Float32Array?p=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?c.isFloat16BufferAttribute?t?p=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):p=5123:h instanceof Int16Array?p=5122:h instanceof Uint32Array?p=5125:h instanceof Int32Array?p=5124:h instanceof Int8Array?p=5120:(h instanceof Uint8Array||h instanceof Uint8ClampedArray)&&(p=5121),{buffer:d,type:p,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const f=u.array,d=u.updateRange;r.bindBuffer(h,c),d.count===-1?r.bufferSubData(h,0,f):(t?r.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):r.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1)}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(r.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=n.get(c);(!f||f.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const h=n.get(c);h===void 0?n.set(c,i(c,u)):h.version<c.version&&(s(h.buffer,c,u),h.version=c.version)}return{get:o,remove:a,update:l}}class gr extends ve{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,u=l+1,h=e/a,f=t/l,d=[],p=[],x=[],v=[];for(let g=0;g<u;g++){const m=g*f-o;for(let _=0;_<c;_++){const y=_*h-s;p.push(y,-m,0),x.push(0,0,1),v.push(_/a),v.push(1-g/l)}}for(let g=0;g<l;g++)for(let m=0;m<a;m++){const _=m+c*g,y=m+c*(g+1),M=m+1+c*(g+1),w=m+1+c*g;d.push(_,y,w),d.push(y,M,w)}this.setIndex(d),this.setAttribute("position",new me(p,3)),this.setAttribute("normal",new me(x,3)),this.setAttribute("uv",new me(v,2))}static fromJSON(e){return new gr(e.width,e.height,e.widthSegments,e.heightSegments)}}var op=`#ifdef USE_ALPHAMAP
|
|
45
45
|
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
46
46
|
#endif`,ap=`#ifdef USE_ALPHAMAP
|
|
47
47
|
uniform sampler2D alphaMap;
|
|
@@ -2789,7 +2789,7 @@ void main() {
|
|
|
2789
2789
|
#include <tonemapping_fragment>
|
|
2790
2790
|
#include <encodings_fragment>
|
|
2791
2791
|
#include <fog_fragment>
|
|
2792
|
-
}`},oe={common:{diffuse:{value:new le(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new mt},uv2Transform:{value:new mt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new q(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new mt}},sprite:{diffuse:{value:new le(16777215)},opacity:{value:1},center:{value:new q(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new mt}}},Jt={basic:{uniforms:Tt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.fog]),vertexShader:Me.meshbasic_vert,fragmentShader:Me.meshbasic_frag},lambert:{uniforms:Tt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.fog,oe.lights,{emissive:{value:new le(0)}}]),vertexShader:Me.meshlambert_vert,fragmentShader:Me.meshlambert_frag},phong:{uniforms:Tt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new le(0)},specular:{value:new le(1118481)},shininess:{value:30}}]),vertexShader:Me.meshphong_vert,fragmentShader:Me.meshphong_frag},standard:{uniforms:Tt([oe.common,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.roughnessmap,oe.metalnessmap,oe.fog,oe.lights,{emissive:{value:new le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Me.meshphysical_vert,fragmentShader:Me.meshphysical_frag},toon:{uniforms:Tt([oe.common,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.gradientmap,oe.fog,oe.lights,{emissive:{value:new le(0)}}]),vertexShader:Me.meshtoon_vert,fragmentShader:Me.meshtoon_frag},matcap:{uniforms:Tt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,{matcap:{value:null}}]),vertexShader:Me.meshmatcap_vert,fragmentShader:Me.meshmatcap_frag},points:{uniforms:Tt([oe.points,oe.fog]),vertexShader:Me.points_vert,fragmentShader:Me.points_frag},dashed:{uniforms:Tt([oe.common,oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Me.linedashed_vert,fragmentShader:Me.linedashed_frag},depth:{uniforms:Tt([oe.common,oe.displacementmap]),vertexShader:Me.depth_vert,fragmentShader:Me.depth_frag},normal:{uniforms:Tt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,{opacity:{value:1}}]),vertexShader:Me.meshnormal_vert,fragmentShader:Me.meshnormal_frag},sprite:{uniforms:Tt([oe.sprite,oe.fog]),vertexShader:Me.sprite_vert,fragmentShader:Me.sprite_frag},background:{uniforms:{uvTransform:{value:new mt},t2D:{value:null}},vertexShader:Me.background_vert,fragmentShader:Me.background_frag},cube:{uniforms:Tt([oe.envmap,{opacity:{value:1}}]),vertexShader:Me.cube_vert,fragmentShader:Me.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Me.equirect_vert,fragmentShader:Me.equirect_frag},distanceRGBA:{uniforms:Tt([oe.common,oe.displacementmap,{referencePosition:{value:new S},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Me.distanceRGBA_vert,fragmentShader:Me.distanceRGBA_frag},shadow:{uniforms:Tt([oe.lights,oe.fog,{color:{value:new le(0)},opacity:{value:1}}]),vertexShader:Me.shadow_vert,fragmentShader:Me.shadow_frag}};Jt.physical={uniforms:Tt([Jt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new q(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new le(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new q},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new le(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new le(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Me.meshphysical_vert,fragmentShader:Me.meshphysical_frag};function eg(r,e,t,n,i){const s=new le(0);let o=0,a,l,c=null,u=0,h=null;function f(m,x){let v=!1,g=x.isScene===!0?x.background:null;g&&g.isTexture&&(g=e.get(g));const p=r.xr,_=p.getSession&&p.getSession();_&&_.environmentBlendMode==="additive"&&(g=null),g===null?d(s,o):g&&g.isColor&&(d(g,1),v=!0),(r.autoClear||v)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),g&&(g.isCubeTexture||g.mapping===sr)?(l===void 0&&(l=new xt(new Xn(1,1,1),new Yt({name:"BackgroundCubeMaterial",uniforms:Ci(Jt.cube.uniforms),vertexShader:Jt.cube.vertexShader,fragmentShader:Jt.cube.fragmentShader,side:at,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(y,M,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,(c!==g||u!==g.version||h!==r.toneMapping)&&(l.material.needsUpdate=!0,c=g,u=g.version,h=r.toneMapping),m.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(a===void 0&&(a=new xt(new gr(2,2),new Yt({name:"BackgroundMaterial",uniforms:Ci(Jt.background.uniforms),vertexShader:Jt.background.vertexShader,fragmentShader:Jt.background.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=g,g.matrixAutoUpdate===!0&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),(c!==g||u!==g.version||h!==r.toneMapping)&&(a.material.needsUpdate=!0,c=g,u=g.version,h=r.toneMapping),m.unshift(a,a.geometry,a.material,0,0,null))}function d(m,x){t.buffers.color.setClear(m.r,m.g,m.b,x,i)}return{getClearColor:function(){return s},setClearColor:function(m,x=1){s.set(m),o=x,d(s,o)},getClearAlpha:function(){return o},setClearAlpha:function(m){o=m,d(s,o)},render:f}}function tg(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=x(null);let c=l;function u(T,B,R,F,U){let Z=!1;if(o){const ee=m(F,R,B);c!==ee&&(c=ee,f(c.object)),Z=v(F,U),Z&&g(F,U)}else{const ee=B.wireframe===!0;(c.geometry!==F.id||c.program!==R.id||c.wireframe!==ee)&&(c.geometry=F.id,c.program=R.id,c.wireframe=ee,Z=!0)}T.isInstancedMesh===!0&&(Z=!0),U!==null&&t.update(U,34963),Z&&(A(T,B,R,F),U!==null&&r.bindBuffer(34963,t.get(U).buffer))}function h(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function f(T){return n.isWebGL2?r.bindVertexArray(T):s.bindVertexArrayOES(T)}function d(T){return n.isWebGL2?r.deleteVertexArray(T):s.deleteVertexArrayOES(T)}function m(T,B,R){const F=R.wireframe===!0;let U=a[T.id];U===void 0&&(U={},a[T.id]=U);let Z=U[B.id];Z===void 0&&(Z={},U[B.id]=Z);let ee=Z[F];return ee===void 0&&(ee=x(h()),Z[F]=ee),ee}function x(T){const B=[],R=[],F=[];for(let U=0;U<i;U++)B[U]=0,R[U]=0,F[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:R,attributeDivisors:F,object:T,attributes:{},index:null}}function v(T,B){const R=c.attributes,F=T.attributes;let U=0;for(const Z in F){const ee=R[Z],V=F[Z];if(ee===void 0||ee.attribute!==V||ee.data!==V.data)return!0;U++}return c.attributesNum!==U||c.index!==B}function g(T,B){const R={},F=T.attributes;let U=0;for(const Z in F){const ee=F[Z],V={};V.attribute=ee,ee.data&&(V.data=ee.data),R[Z]=V,U++}c.attributes=R,c.attributesNum=U,c.index=B}function p(){const T=c.newAttributes;for(let B=0,R=T.length;B<R;B++)T[B]=0}function _(T){y(T,0)}function y(T,B){const R=c.newAttributes,F=c.enabledAttributes,U=c.attributeDivisors;R[T]=1,F[T]===0&&(r.enableVertexAttribArray(T),F[T]=1),U[T]!==B&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](T,B),U[T]=B)}function M(){const T=c.newAttributes,B=c.enabledAttributes;for(let R=0,F=B.length;R<F;R++)B[R]!==T[R]&&(r.disableVertexAttribArray(R),B[R]=0)}function w(T,B,R,F,U,Z){n.isWebGL2===!0&&(R===5124||R===5125)?r.vertexAttribIPointer(T,B,R,U,Z):r.vertexAttribPointer(T,B,R,F,U,Z)}function A(T,B,R,F){if(n.isWebGL2===!1&&(T.isInstancedMesh||F.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;p();const U=F.attributes,Z=R.getAttributes(),ee=B.defaultAttributeValues;for(const V in Z){const W=Z[V];if(W.location>=0){let ne=U[V];if(ne===void 0&&(V==="instanceMatrix"&&T.instanceMatrix&&(ne=T.instanceMatrix),V==="instanceColor"&&T.instanceColor&&(ne=T.instanceColor)),ne!==void 0){const K=ne.normalized,he=ne.itemSize,be=t.get(ne);if(be===void 0)continue;const Y=be.buffer,we=be.type,de=be.bytesPerElement;if(ne.isInterleavedBufferAttribute){const ge=ne.data,ye=ge.stride,Ue=ne.offset;if(ge&&ge.isInstancedInterleavedBuffer){for(let k=0;k<W.locationSize;k++)y(W.location+k,ge.meshPerAttribute);T.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ge.meshPerAttribute*ge.count)}else for(let k=0;k<W.locationSize;k++)_(W.location+k);r.bindBuffer(34962,Y);for(let k=0;k<W.locationSize;k++)w(W.location+k,he/W.locationSize,we,K,ye*de,(Ue+he/W.locationSize*k)*de)}else{if(ne.isInstancedBufferAttribute){for(let ge=0;ge<W.locationSize;ge++)y(W.location+ge,ne.meshPerAttribute);T.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let ge=0;ge<W.locationSize;ge++)_(W.location+ge);r.bindBuffer(34962,Y);for(let ge=0;ge<W.locationSize;ge++)w(W.location+ge,he/W.locationSize,we,K,he*de,he/W.locationSize*ge*de)}}else if(ee!==void 0){const K=ee[V];if(K!==void 0)switch(K.length){case 2:r.vertexAttrib2fv(W.location,K);break;case 3:r.vertexAttrib3fv(W.location,K);break;case 4:r.vertexAttrib4fv(W.location,K);break;default:r.vertexAttrib1fv(W.location,K)}}}}M()}function C(){I();for(const T in a){const B=a[T];for(const R in B){const F=B[R];for(const U in F)d(F[U].object),delete F[U];delete B[R]}delete a[T]}}function N(T){if(a[T.id]===void 0)return;const B=a[T.id];for(const R in B){const F=B[R];for(const U in F)d(F[U].object),delete F[U];delete B[R]}delete a[T.id]}function z(T){for(const B in a){const R=a[B];if(R[T.id]===void 0)continue;const F=R[T.id];for(const U in F)d(F[U].object),delete F[U];delete R[T.id]}}function I(){b(),c!==l&&(c=l,f(c.object))}function b(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:I,resetDefaultState:b,dispose:C,releaseStatesOfGeometry:N,releaseStatesOfProgram:z,initAttributes:p,enableAttribute:_,disableUnusedAttributes:M}}function ng(r,e,t,n){const i=n.isWebGL2;let s;function o(c){s=c}function a(c,u){r.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let f,d;if(i)f=r,d="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[d](s,c,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=l}function ig(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(A){if(A==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";A="mediump"}return A==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&r instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(34930),f=r.getParameter(35660),d=r.getParameter(3379),m=r.getParameter(34076),x=r.getParameter(34921),v=r.getParameter(36347),g=r.getParameter(36348),p=r.getParameter(36349),_=f>0,y=o||e.has("OES_texture_float"),M=_&&y,w=o?r.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:m,maxAttributes:x,maxVertexUniforms:v,maxVaryings:g,maxFragmentUniforms:p,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:M,maxSamples:w}}function rg(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new hn,a=new mt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f,d){const m=h.length!==0||f||n!==0||i;return i=f,t=u(h,d,0),n=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(h,f,d){const m=h.clippingPlanes,x=h.clipIntersection,v=h.clipShadows,g=r.get(h);if(!i||m===null||m.length===0||s&&!v)s?u(null):c();else{const p=s?0:n,_=p*4;let y=g.clippingState||null;l.value=y,y=u(m,f,_,d);for(let M=0;M!==_;++M)y[M]=t[M];g.clippingState=y,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=p}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,m){const x=h!==null?h.length:0;let v=null;if(x!==0){if(v=l.value,m!==!0||v===null){const g=d+x*4,p=f.matrixWorldInverse;a.getNormalMatrix(p),(v===null||v.length<g)&&(v=new Float32Array(g));for(let _=0,y=d;_!==x;++_,y+=4)o.copy(h[_]).applyMatrix4(p,a),o.normal.toArray(v,y),v[y+3]=o.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,v}}function sg(r){let e=new WeakMap;function t(o,a){return a===Wr?o.mapping=ai:a===qr&&(o.mapping=li),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===Wr||a===qr)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=r.getRenderTarget(),u=new fa(l.height/2);return u.fromEquirectangularTexture(r,o),e.set(o,u),r.setRenderTarget(c),o.addEventListener("dispose",i),t(u.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ms extends ys{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,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.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}}Ms.prototype.isOrthographicCamera=!0;class xr extends Yt{constructor(e){super(e),this.type="RawShaderMaterial"}}xr.prototype.isRawShaderMaterial=!0;const Di=4,Pn=8,Zt=Math.pow(2,Pn),ic=[.125,.215,.35,.446,.526,.582],rc=Pn-Di+1+ic.length,Fi=20,bs={[Vt]:0,[pi]:1},pa=new Ms,{_lodPlanes:yr,_sizeLods:sc,_sigmas:ws}=ag(),oc=new le;let ma=null;const Yn=(1+Math.sqrt(5))/2,Bi=1/Yn,ac=[new S(1,1,1),new S(-1,1,1),new S(1,1,-1),new S(-1,1,-1),new S(0,Yn,Bi),new S(0,Yn,-Bi),new S(Bi,0,Yn),new S(-Bi,0,Yn),new S(Yn,Bi,0),new S(-Yn,Bi,0)];class og{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=lg(Fi),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){ma=this._renderer.getRenderTarget();const s=this._allocateTargets();return this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=uc(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=cc(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<yr.length;e++)yr[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(ma),e.scissorTest=!1,Ss(e,0,0,e.width,e.height)}_fromTexture(e){ma=this._renderer.getRenderTarget();const t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){const t={magFilter:nt,minFilter:nt,generateMipmaps:!1,type:On,format:ft,encoding:Vt,depthBuffer:!1},n=lc(t);return n.depthBuffer=!e,this._pingPongRenderTarget=lc(t),n}_compileMaterial(e){const t=new xt(yr[0],e);this._renderer.compile(t,pa)}_sceneToCubeUV(e,t,n,i){const a=new Mt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(oc),u.toneMapping=_n,u.autoClear=!1;const d=new An({name:"PMREM.Background",side:at,depthWrite:!1,depthTest:!1}),m=new xt(new Xn,d);let x=!1;const v=e.background;v?v.isColor&&(d.color.copy(v),e.background=null,x=!0):(d.color.copy(oc),x=!0);for(let g=0;g<6;g++){const p=g%3;p==0?(a.up.set(0,l[g],0),a.lookAt(c[g],0,0)):p==1?(a.up.set(0,0,l[g]),a.lookAt(0,c[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,c[g])),Ss(i,p*Zt,g>2?Zt:0,Zt,Zt),u.setRenderTarget(i),x&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=v}_setEncoding(e,t){this._renderer.capabilities.isWebGL2===!0&&t.format===ft&&t.type===rn&&t.encoding===pi?e.value=bs[Vt]:e.value=bs[t.encoding]}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===ai||e.mapping===li;i?this._cubemapShader==null&&(this._cubemapShader=uc()):this._equirectShader==null&&(this._equirectShader=cc());const s=i?this._cubemapShader:this._equirectShader,o=new xt(yr[0],s),a=s.uniforms;a.envMap.value=e,i||a.texelSize.value.set(1/e.image.width,1/e.image.height),this._setEncoding(a.inputEncoding,e),Ss(t,0,0,3*Zt,2*Zt),n.setRenderTarget(t),n.render(o,pa)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<rc;i++){const s=Math.sqrt(ws[i]*ws[i]-ws[i-1]*ws[i-1]),o=ac[(i-1)%ac.length];this._blur(e,i-1,i,s,o)}t.autoClear=n}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new xt(yr[i],c),f=c.uniforms,d=sc[n]-1,m=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Fi-1),x=s/m,v=isFinite(s)?1+Math.floor(u*x):Fi;v>Fi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Fi}`);const g=[];let p=0;for(let w=0;w<Fi;++w){const A=w/x,C=Math.exp(-A*A/2);g.push(C),w==0?p+=C:w<v&&(p+=2*C)}for(let w=0;w<g.length;w++)g[w]=g[w]/p;f.envMap.value=e.texture,f.samples.value=v,f.weights.value=g,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a),f.dTheta.value=m,f.mipInt.value=Pn-n;const _=sc[i],y=3*Math.max(0,Zt-2*_),M=(i===0?0:2*Zt)+2*_*(i>Pn-Di?i-Pn+Di:0);Ss(t,y,M,3*_,2*_),l.setRenderTarget(t),l.render(h,pa)}}function ag(){const r=[],e=[],t=[];let n=Pn;for(let i=0;i<rc;i++){const s=Math.pow(2,n);e.push(s);let o=1/s;i>Pn-Di?o=ic[i-Pn+Di-1]:i==0&&(o=0),t.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,f=6,d=3,m=2,x=1,v=new Float32Array(d*f*h),g=new Float32Array(m*f*h),p=new Float32Array(x*f*h);for(let y=0;y<h;y++){const M=y%3*2/3-1,w=y>2?0:-1,A=[M,w,0,M+2/3,w,0,M+2/3,w+1,0,M,w,0,M+2/3,w+1,0,M,w+1,0];v.set(A,d*f*y),g.set(u,m*f*y);const C=[y,y,y,y,y,y];p.set(C,x*f*y)}const _=new ve;_.setAttribute("position",new ze(v,d)),_.setAttribute("uv",new ze(g,m)),_.setAttribute("faceIndex",new ze(p,x)),r.push(_),n>Di&&n--}return{_lodPlanes:r,_sizeLods:e,_sigmas:t}}function lc(r){const e=new zt(3*Zt,3*Zt,r);return e.texture.mapping=sr,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ss(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function lg(r){const e=new Float32Array(r),t=new S(0,1,0);return new xr({name:"SphericalGaussianBlur",defines:{n:r},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:ga(),fragmentShader:`
|
|
2792
|
+
}`},oe={common:{diffuse:{value:new le(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new mt},uv2Transform:{value:new mt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new q(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new mt}},sprite:{diffuse:{value:new le(16777215)},opacity:{value:1},center:{value:new q(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new mt}}},Jt={basic:{uniforms:Tt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.fog]),vertexShader:Me.meshbasic_vert,fragmentShader:Me.meshbasic_frag},lambert:{uniforms:Tt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.fog,oe.lights,{emissive:{value:new le(0)}}]),vertexShader:Me.meshlambert_vert,fragmentShader:Me.meshlambert_frag},phong:{uniforms:Tt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new le(0)},specular:{value:new le(1118481)},shininess:{value:30}}]),vertexShader:Me.meshphong_vert,fragmentShader:Me.meshphong_frag},standard:{uniforms:Tt([oe.common,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.roughnessmap,oe.metalnessmap,oe.fog,oe.lights,{emissive:{value:new le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Me.meshphysical_vert,fragmentShader:Me.meshphysical_frag},toon:{uniforms:Tt([oe.common,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.gradientmap,oe.fog,oe.lights,{emissive:{value:new le(0)}}]),vertexShader:Me.meshtoon_vert,fragmentShader:Me.meshtoon_frag},matcap:{uniforms:Tt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,{matcap:{value:null}}]),vertexShader:Me.meshmatcap_vert,fragmentShader:Me.meshmatcap_frag},points:{uniforms:Tt([oe.points,oe.fog]),vertexShader:Me.points_vert,fragmentShader:Me.points_frag},dashed:{uniforms:Tt([oe.common,oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Me.linedashed_vert,fragmentShader:Me.linedashed_frag},depth:{uniforms:Tt([oe.common,oe.displacementmap]),vertexShader:Me.depth_vert,fragmentShader:Me.depth_frag},normal:{uniforms:Tt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,{opacity:{value:1}}]),vertexShader:Me.meshnormal_vert,fragmentShader:Me.meshnormal_frag},sprite:{uniforms:Tt([oe.sprite,oe.fog]),vertexShader:Me.sprite_vert,fragmentShader:Me.sprite_frag},background:{uniforms:{uvTransform:{value:new mt},t2D:{value:null}},vertexShader:Me.background_vert,fragmentShader:Me.background_frag},cube:{uniforms:Tt([oe.envmap,{opacity:{value:1}}]),vertexShader:Me.cube_vert,fragmentShader:Me.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Me.equirect_vert,fragmentShader:Me.equirect_frag},distanceRGBA:{uniforms:Tt([oe.common,oe.displacementmap,{referencePosition:{value:new S},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Me.distanceRGBA_vert,fragmentShader:Me.distanceRGBA_frag},shadow:{uniforms:Tt([oe.lights,oe.fog,{color:{value:new le(0)},opacity:{value:1}}]),vertexShader:Me.shadow_vert,fragmentShader:Me.shadow_frag}};Jt.physical={uniforms:Tt([Jt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new q(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new le(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new q},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new le(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new le(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Me.meshphysical_vert,fragmentShader:Me.meshphysical_frag};function eg(r,e,t,n,i){const s=new le(0);let o=0,a,l,c=null,u=0,h=null;function f(p,x){let v=!1,g=x.isScene===!0?x.background:null;g&&g.isTexture&&(g=e.get(g));const m=r.xr,_=m.getSession&&m.getSession();_&&_.environmentBlendMode==="additive"&&(g=null),g===null?d(s,o):g&&g.isColor&&(d(g,1),v=!0),(r.autoClear||v)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),g&&(g.isCubeTexture||g.mapping===sr)?(l===void 0&&(l=new xt(new Xn(1,1,1),new Yt({name:"BackgroundCubeMaterial",uniforms:Ci(Jt.cube.uniforms),vertexShader:Jt.cube.vertexShader,fragmentShader:Jt.cube.fragmentShader,side:at,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(y,M,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,(c!==g||u!==g.version||h!==r.toneMapping)&&(l.material.needsUpdate=!0,c=g,u=g.version,h=r.toneMapping),p.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(a===void 0&&(a=new xt(new gr(2,2),new Yt({name:"BackgroundMaterial",uniforms:Ci(Jt.background.uniforms),vertexShader:Jt.background.vertexShader,fragmentShader:Jt.background.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=g,g.matrixAutoUpdate===!0&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),(c!==g||u!==g.version||h!==r.toneMapping)&&(a.material.needsUpdate=!0,c=g,u=g.version,h=r.toneMapping),p.unshift(a,a.geometry,a.material,0,0,null))}function d(p,x){t.buffers.color.setClear(p.r,p.g,p.b,x,i)}return{getClearColor:function(){return s},setClearColor:function(p,x=1){s.set(p),o=x,d(s,o)},getClearAlpha:function(){return o},setClearAlpha:function(p){o=p,d(s,o)},render:f}}function tg(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=x(null);let c=l;function u(T,B,R,F,U){let Z=!1;if(o){const ee=p(F,R,B);c!==ee&&(c=ee,f(c.object)),Z=v(F,U),Z&&g(F,U)}else{const ee=B.wireframe===!0;(c.geometry!==F.id||c.program!==R.id||c.wireframe!==ee)&&(c.geometry=F.id,c.program=R.id,c.wireframe=ee,Z=!0)}T.isInstancedMesh===!0&&(Z=!0),U!==null&&t.update(U,34963),Z&&(A(T,B,R,F),U!==null&&r.bindBuffer(34963,t.get(U).buffer))}function h(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function f(T){return n.isWebGL2?r.bindVertexArray(T):s.bindVertexArrayOES(T)}function d(T){return n.isWebGL2?r.deleteVertexArray(T):s.deleteVertexArrayOES(T)}function p(T,B,R){const F=R.wireframe===!0;let U=a[T.id];U===void 0&&(U={},a[T.id]=U);let Z=U[B.id];Z===void 0&&(Z={},U[B.id]=Z);let ee=Z[F];return ee===void 0&&(ee=x(h()),Z[F]=ee),ee}function x(T){const B=[],R=[],F=[];for(let U=0;U<i;U++)B[U]=0,R[U]=0,F[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:R,attributeDivisors:F,object:T,attributes:{},index:null}}function v(T,B){const R=c.attributes,F=T.attributes;let U=0;for(const Z in F){const ee=R[Z],V=F[Z];if(ee===void 0||ee.attribute!==V||ee.data!==V.data)return!0;U++}return c.attributesNum!==U||c.index!==B}function g(T,B){const R={},F=T.attributes;let U=0;for(const Z in F){const ee=F[Z],V={};V.attribute=ee,ee.data&&(V.data=ee.data),R[Z]=V,U++}c.attributes=R,c.attributesNum=U,c.index=B}function m(){const T=c.newAttributes;for(let B=0,R=T.length;B<R;B++)T[B]=0}function _(T){y(T,0)}function y(T,B){const R=c.newAttributes,F=c.enabledAttributes,U=c.attributeDivisors;R[T]=1,F[T]===0&&(r.enableVertexAttribArray(T),F[T]=1),U[T]!==B&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](T,B),U[T]=B)}function M(){const T=c.newAttributes,B=c.enabledAttributes;for(let R=0,F=B.length;R<F;R++)B[R]!==T[R]&&(r.disableVertexAttribArray(R),B[R]=0)}function w(T,B,R,F,U,Z){n.isWebGL2===!0&&(R===5124||R===5125)?r.vertexAttribIPointer(T,B,R,U,Z):r.vertexAttribPointer(T,B,R,F,U,Z)}function A(T,B,R,F){if(n.isWebGL2===!1&&(T.isInstancedMesh||F.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;m();const U=F.attributes,Z=R.getAttributes(),ee=B.defaultAttributeValues;for(const V in Z){const W=Z[V];if(W.location>=0){let ne=U[V];if(ne===void 0&&(V==="instanceMatrix"&&T.instanceMatrix&&(ne=T.instanceMatrix),V==="instanceColor"&&T.instanceColor&&(ne=T.instanceColor)),ne!==void 0){const K=ne.normalized,he=ne.itemSize,be=t.get(ne);if(be===void 0)continue;const Y=be.buffer,we=be.type,de=be.bytesPerElement;if(ne.isInterleavedBufferAttribute){const ge=ne.data,ye=ge.stride,Ue=ne.offset;if(ge&&ge.isInstancedInterleavedBuffer){for(let k=0;k<W.locationSize;k++)y(W.location+k,ge.meshPerAttribute);T.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ge.meshPerAttribute*ge.count)}else for(let k=0;k<W.locationSize;k++)_(W.location+k);r.bindBuffer(34962,Y);for(let k=0;k<W.locationSize;k++)w(W.location+k,he/W.locationSize,we,K,ye*de,(Ue+he/W.locationSize*k)*de)}else{if(ne.isInstancedBufferAttribute){for(let ge=0;ge<W.locationSize;ge++)y(W.location+ge,ne.meshPerAttribute);T.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let ge=0;ge<W.locationSize;ge++)_(W.location+ge);r.bindBuffer(34962,Y);for(let ge=0;ge<W.locationSize;ge++)w(W.location+ge,he/W.locationSize,we,K,he*de,he/W.locationSize*ge*de)}}else if(ee!==void 0){const K=ee[V];if(K!==void 0)switch(K.length){case 2:r.vertexAttrib2fv(W.location,K);break;case 3:r.vertexAttrib3fv(W.location,K);break;case 4:r.vertexAttrib4fv(W.location,K);break;default:r.vertexAttrib1fv(W.location,K)}}}}M()}function C(){I();for(const T in a){const B=a[T];for(const R in B){const F=B[R];for(const U in F)d(F[U].object),delete F[U];delete B[R]}delete a[T]}}function N(T){if(a[T.id]===void 0)return;const B=a[T.id];for(const R in B){const F=B[R];for(const U in F)d(F[U].object),delete F[U];delete B[R]}delete a[T.id]}function z(T){for(const B in a){const R=a[B];if(R[T.id]===void 0)continue;const F=R[T.id];for(const U in F)d(F[U].object),delete F[U];delete R[T.id]}}function I(){b(),c!==l&&(c=l,f(c.object))}function b(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:I,resetDefaultState:b,dispose:C,releaseStatesOfGeometry:N,releaseStatesOfProgram:z,initAttributes:m,enableAttribute:_,disableUnusedAttributes:M}}function ng(r,e,t,n){const i=n.isWebGL2;let s;function o(c){s=c}function a(c,u){r.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let f,d;if(i)f=r,d="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[d](s,c,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=l}function ig(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(A){if(A==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";A="mediump"}return A==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&r instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(34930),f=r.getParameter(35660),d=r.getParameter(3379),p=r.getParameter(34076),x=r.getParameter(34921),v=r.getParameter(36347),g=r.getParameter(36348),m=r.getParameter(36349),_=f>0,y=o||e.has("OES_texture_float"),M=_&&y,w=o?r.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:p,maxAttributes:x,maxVertexUniforms:v,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:M,maxSamples:w}}function rg(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new hn,a=new mt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f,d){const p=h.length!==0||f||n!==0||i;return i=f,t=u(h,d,0),n=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(h,f,d){const p=h.clippingPlanes,x=h.clipIntersection,v=h.clipShadows,g=r.get(h);if(!i||p===null||p.length===0||s&&!v)s?u(null):c();else{const m=s?0:n,_=m*4;let y=g.clippingState||null;l.value=y,y=u(p,f,_,d);for(let M=0;M!==_;++M)y[M]=t[M];g.clippingState=y,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=m}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,p){const x=h!==null?h.length:0;let v=null;if(x!==0){if(v=l.value,p!==!0||v===null){const g=d+x*4,m=f.matrixWorldInverse;a.getNormalMatrix(m),(v===null||v.length<g)&&(v=new Float32Array(g));for(let _=0,y=d;_!==x;++_,y+=4)o.copy(h[_]).applyMatrix4(m,a),o.normal.toArray(v,y),v[y+3]=o.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,v}}function sg(r){let e=new WeakMap;function t(o,a){return a===Wr?o.mapping=ai:a===qr&&(o.mapping=li),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===Wr||a===qr)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=r.getRenderTarget(),u=new fa(l.height/2);return u.fromEquirectangularTexture(r,o),e.set(o,u),r.setRenderTarget(c),o.addEventListener("dispose",i),t(u.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ms extends ys{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,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.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}}Ms.prototype.isOrthographicCamera=!0;class xr extends Yt{constructor(e){super(e),this.type="RawShaderMaterial"}}xr.prototype.isRawShaderMaterial=!0;const Di=4,Pn=8,Zt=Math.pow(2,Pn),ic=[.125,.215,.35,.446,.526,.582],rc=Pn-Di+1+ic.length,Fi=20,bs={[Vt]:0,[pi]:1},pa=new Ms,{_lodPlanes:yr,_sizeLods:sc,_sigmas:ws}=ag(),oc=new le;let ma=null;const Yn=(1+Math.sqrt(5))/2,Bi=1/Yn,ac=[new S(1,1,1),new S(-1,1,1),new S(1,1,-1),new S(-1,1,-1),new S(0,Yn,Bi),new S(0,Yn,-Bi),new S(Bi,0,Yn),new S(-Bi,0,Yn),new S(Yn,Bi,0),new S(-Yn,Bi,0)];class og{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=lg(Fi),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){ma=this._renderer.getRenderTarget();const s=this._allocateTargets();return this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=uc(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=cc(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<yr.length;e++)yr[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(ma),e.scissorTest=!1,Ss(e,0,0,e.width,e.height)}_fromTexture(e){ma=this._renderer.getRenderTarget();const t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){const t={magFilter:nt,minFilter:nt,generateMipmaps:!1,type:On,format:ft,encoding:Vt,depthBuffer:!1},n=lc(t);return n.depthBuffer=!e,this._pingPongRenderTarget=lc(t),n}_compileMaterial(e){const t=new xt(yr[0],e);this._renderer.compile(t,pa)}_sceneToCubeUV(e,t,n,i){const a=new Mt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(oc),u.toneMapping=_n,u.autoClear=!1;const d=new An({name:"PMREM.Background",side:at,depthWrite:!1,depthTest:!1}),p=new xt(new Xn,d);let x=!1;const v=e.background;v?v.isColor&&(d.color.copy(v),e.background=null,x=!0):(d.color.copy(oc),x=!0);for(let g=0;g<6;g++){const m=g%3;m==0?(a.up.set(0,l[g],0),a.lookAt(c[g],0,0)):m==1?(a.up.set(0,0,l[g]),a.lookAt(0,c[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,c[g])),Ss(i,m*Zt,g>2?Zt:0,Zt,Zt),u.setRenderTarget(i),x&&u.render(p,a),u.render(e,a)}p.geometry.dispose(),p.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=v}_setEncoding(e,t){this._renderer.capabilities.isWebGL2===!0&&t.format===ft&&t.type===rn&&t.encoding===pi?e.value=bs[Vt]:e.value=bs[t.encoding]}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===ai||e.mapping===li;i?this._cubemapShader==null&&(this._cubemapShader=uc()):this._equirectShader==null&&(this._equirectShader=cc());const s=i?this._cubemapShader:this._equirectShader,o=new xt(yr[0],s),a=s.uniforms;a.envMap.value=e,i||a.texelSize.value.set(1/e.image.width,1/e.image.height),this._setEncoding(a.inputEncoding,e),Ss(t,0,0,3*Zt,2*Zt),n.setRenderTarget(t),n.render(o,pa)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<rc;i++){const s=Math.sqrt(ws[i]*ws[i]-ws[i-1]*ws[i-1]),o=ac[(i-1)%ac.length];this._blur(e,i-1,i,s,o)}t.autoClear=n}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new xt(yr[i],c),f=c.uniforms,d=sc[n]-1,p=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Fi-1),x=s/p,v=isFinite(s)?1+Math.floor(u*x):Fi;v>Fi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Fi}`);const g=[];let m=0;for(let w=0;w<Fi;++w){const A=w/x,C=Math.exp(-A*A/2);g.push(C),w==0?m+=C:w<v&&(m+=2*C)}for(let w=0;w<g.length;w++)g[w]=g[w]/m;f.envMap.value=e.texture,f.samples.value=v,f.weights.value=g,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a),f.dTheta.value=p,f.mipInt.value=Pn-n;const _=sc[i],y=3*Math.max(0,Zt-2*_),M=(i===0?0:2*Zt)+2*_*(i>Pn-Di?i-Pn+Di:0);Ss(t,y,M,3*_,2*_),l.setRenderTarget(t),l.render(h,pa)}}function ag(){const r=[],e=[],t=[];let n=Pn;for(let i=0;i<rc;i++){const s=Math.pow(2,n);e.push(s);let o=1/s;i>Pn-Di?o=ic[i-Pn+Di-1]:i==0&&(o=0),t.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,f=6,d=3,p=2,x=1,v=new Float32Array(d*f*h),g=new Float32Array(p*f*h),m=new Float32Array(x*f*h);for(let y=0;y<h;y++){const M=y%3*2/3-1,w=y>2?0:-1,A=[M,w,0,M+2/3,w,0,M+2/3,w+1,0,M,w,0,M+2/3,w+1,0,M,w+1,0];v.set(A,d*f*y),g.set(u,p*f*y);const C=[y,y,y,y,y,y];m.set(C,x*f*y)}const _=new ve;_.setAttribute("position",new ze(v,d)),_.setAttribute("uv",new ze(g,p)),_.setAttribute("faceIndex",new ze(m,x)),r.push(_),n>Di&&n--}return{_lodPlanes:r,_sizeLods:e,_sigmas:t}}function lc(r){const e=new zt(3*Zt,3*Zt,r);return e.texture.mapping=sr,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ss(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function lg(r){const e=new Float32Array(r),t=new S(0,1,0);return new xr({name:"SphericalGaussianBlur",defines:{n:r},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:ga(),fragmentShader:`
|
|
2793
2793
|
|
|
2794
2794
|
precision mediump float;
|
|
2795
2795
|
precision mediump int;
|
|
@@ -2985,7 +2985,7 @@ void main() {
|
|
|
2985
2985
|
return inputTexelToLinear( color );
|
|
2986
2986
|
|
|
2987
2987
|
}
|
|
2988
|
-
`}function cg(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const l=a.mapping,c=l===Wr||l===qr,u=l===ai||l===li;if(c||u){if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){const f=r.getRenderTarget();t===null&&(t=new og(r));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),r.setRenderTarget(f),a.addEventListener("dispose",s),d.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function ug(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function hg(r,e,t,n){const i={},s=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const m in f.attributes)e.remove(f.attributes[m]);f.removeEventListener("dispose",o),delete i[f.id];const d=s.get(f);d&&(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const m in f)e.update(f[m],34962);const d=h.morphAttributes;for(const m in d){const x=d[m];for(let v=0,g=x.length;v<g;v++)e.update(x[v],34962)}}function c(h){const f=[],d=h.index,m=h.attributes.position;let x=0;if(d!==null){const p=d.array;x=d.version;for(let _=0,y=p.length;_<y;_+=3){const M=p[_+0],w=p[_+1],A=p[_+2];f.push(M,w,w,A,A,M)}}else{const p=m.array;x=m.version;for(let _=0,y=p.length/3-1;_<y;_+=3){const M=_+0,w=_+1,A=_+2;f.push(M,w,w,A,A,M)}}const v=new(kl(f)>65535?ra:ia)(f,1);v.version=x;const g=s.get(h);g&&e.remove(g),s.set(h,v)}function u(h){const f=s.get(h);if(f){const d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function fg(r,e,t,n){const i=n.isWebGL2;let s;function o(f){s=f}let a,l;function c(f){a=f.type,l=f.bytesPerElement}function u(f,d){r.drawElements(s,d,a,f*l),t.update(d,s,1)}function h(f,d,m){if(m===0)return;let x,v;if(i)x=r,v="drawElementsInstanced";else if(x=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",x===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}x[v](s,d,a,f*l,m),t.update(d,s,m)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function dg(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}class ya extends dt{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=lt,this.minFilter=lt,this.wrapR=wt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}ya.prototype.isDataTexture2DArray=!0;function pg(r,e){return r[0]-e[0]}function mg(r,e){return Math.abs(e[1])-Math.abs(r[1])}function hc(r,e){let t=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),r.divideScalar(t)}function gg(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,o=new S,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h,f){const d=c.morphTargetInfluences;if(e.isWebGL2===!0){const m=u.morphAttributes.position.length;let x=s.get(u);if(x===void 0||x.count!==m){x!==void 0&&x.texture.dispose();const p=u.morphAttributes.normal!==void 0,_=u.morphAttributes.position,y=u.morphAttributes.normal||[],M=u.attributes.position.count,w=p===!0?2:1;let A=M*w,C=1;A>e.maxTextureSize&&(C=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const N=new Float32Array(A*C*4*m),z=new ya(N,A,C,m);z.format=ft,z.type=sn,z.needsUpdate=!0;const I=w*4;for(let b=0;b<m;b++){const T=_[b],B=y[b],R=A*C*4*b;for(let F=0;F<T.count;F++){o.fromBufferAttribute(T,F),T.normalized===!0&&hc(o,T);const U=F*I;N[R+U+0]=o.x,N[R+U+1]=o.y,N[R+U+2]=o.z,N[R+U+3]=0,p===!0&&(o.fromBufferAttribute(B,F),B.normalized===!0&&hc(o,B),N[R+U+4]=o.x,N[R+U+5]=o.y,N[R+U+6]=o.z,N[R+U+7]=0)}}x={count:m,texture:z,size:new q(A,C)},s.set(u,x)}let v=0;for(let p=0;p<d.length;p++)v+=d[p];const g=u.morphTargetsRelative?1:1-v;f.getUniforms().setValue(r,"morphTargetBaseInfluence",g),f.getUniforms().setValue(r,"morphTargetInfluences",d),f.getUniforms().setValue(r,"morphTargetsTexture",x.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",x.size)}else{const m=d===void 0?0:d.length;let x=n[u.id];if(x===void 0||x.length!==m){x=[];for(let y=0;y<m;y++)x[y]=[y,0];n[u.id]=x}for(let y=0;y<m;y++){const M=x[y];M[0]=y,M[1]=d[y]}x.sort(mg);for(let y=0;y<8;y++)y<m&&x[y][1]?(a[y][0]=x[y][0],a[y][1]=x[y][1]):(a[y][0]=Number.MAX_SAFE_INTEGER,a[y][1]=0);a.sort(pg);const v=u.morphAttributes.position,g=u.morphAttributes.normal;let p=0;for(let y=0;y<8;y++){const M=a[y],w=M[0],A=M[1];w!==Number.MAX_SAFE_INTEGER&&A?(v&&u.getAttribute("morphTarget"+y)!==v[w]&&u.setAttribute("morphTarget"+y,v[w]),g&&u.getAttribute("morphNormal"+y)!==g[w]&&u.setAttribute("morphNormal"+y,g[w]),i[y]=A,p+=A):(v&&u.hasAttribute("morphTarget"+y)===!0&&u.deleteAttribute("morphTarget"+y),g&&u.hasAttribute("morphNormal"+y)===!0&&u.deleteAttribute("morphNormal"+y),i[y]=0)}const _=u.morphTargetsRelative?1:1-p;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:l}}function xg(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);return i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),h}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class fc extends dt{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=lt,this.minFilter=lt,this.wrapR=wt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}fc.prototype.isDataTexture3D=!0;const dc=new dt,pc=new ya,mc=new fc,gc=new mr,xc=[],yc=[],vc=new Float32Array(16),_c=new Float32Array(9),Mc=new Float32Array(4);function zi(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=xc[i];if(s===void 0&&(s=new Float32Array(i),xc[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Ct(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Et(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ts(r,e){let t=yc[e];t===void 0&&(t=new Int32Array(e),yc[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function yg(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function vg(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ct(t,e))return;r.uniform2fv(this.addr,e),Et(t,e)}}function _g(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ct(t,e))return;r.uniform3fv(this.addr,e),Et(t,e)}}function Mg(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ct(t,e))return;r.uniform4fv(this.addr,e),Et(t,e)}}function bg(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Et(t,e)}else{if(Ct(t,n))return;Mc.set(n),r.uniformMatrix2fv(this.addr,!1,Mc),Et(t,n)}}function wg(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Et(t,e)}else{if(Ct(t,n))return;_c.set(n),r.uniformMatrix3fv(this.addr,!1,_c),Et(t,n)}}function Sg(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Et(t,e)}else{if(Ct(t,n))return;vc.set(n),r.uniformMatrix4fv(this.addr,!1,vc),Et(t,n)}}function Tg(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function Eg(r,e){const t=this.cache;Ct(t,e)||(r.uniform2iv(this.addr,e),Et(t,e))}function Ag(r,e){const t=this.cache;Ct(t,e)||(r.uniform3iv(this.addr,e),Et(t,e))}function Lg(r,e){const t=this.cache;Ct(t,e)||(r.uniform4iv(this.addr,e),Et(t,e))}function Cg(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function Rg(r,e){const t=this.cache;Ct(t,e)||(r.uniform2uiv(this.addr,e),Et(t,e))}function Pg(r,e){const t=this.cache;Ct(t,e)||(r.uniform3uiv(this.addr,e),Et(t,e))}function Ig(r,e){const t=this.cache;Ct(t,e)||(r.uniform4uiv(this.addr,e),Et(t,e))}function Dg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||dc,i)}function Fg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||mc,i)}function Bg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||gc,i)}function zg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||pc,i)}function Ng(r){switch(r){case 5126:return yg;case 35664:return vg;case 35665:return _g;case 35666:return Mg;case 35674:return bg;case 35675:return wg;case 35676:return Sg;case 5124:case 35670:return Tg;case 35667:case 35671:return Eg;case 35668:case 35672:return Ag;case 35669:case 35673:return Lg;case 5125:return Cg;case 36294:return Rg;case 36295:return Pg;case 36296:return Ig;case 35678:case 36198:case 36298:case 36306:case 35682:return Dg;case 35679:case 36299:case 36307:return Fg;case 35680:case 36300:case 36308:case 36293:return Bg;case 36289:case 36303:case 36311:case 36292:return zg}}function Ug(r,e){r.uniform1fv(this.addr,e)}function Og(r,e){const t=zi(e,this.size,2);r.uniform2fv(this.addr,t)}function Hg(r,e){const t=zi(e,this.size,3);r.uniform3fv(this.addr,t)}function Gg(r,e){const t=zi(e,this.size,4);r.uniform4fv(this.addr,t)}function Vg(r,e){const t=zi(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function kg(r,e){const t=zi(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function Wg(r,e){const t=zi(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function qg(r,e){r.uniform1iv(this.addr,e)}function Xg(r,e){r.uniform2iv(this.addr,e)}function Yg(r,e){r.uniform3iv(this.addr,e)}function Jg(r,e){r.uniform4iv(this.addr,e)}function Zg(r,e){r.uniform1uiv(this.addr,e)}function $g(r,e){r.uniform2uiv(this.addr,e)}function jg(r,e){r.uniform3uiv(this.addr,e)}function Qg(r,e){r.uniform4uiv(this.addr,e)}function Kg(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTexture2D(e[s]||dc,i[s])}function ex(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture3D(e[s]||mc,i[s])}function tx(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTextureCube(e[s]||gc,i[s])}function nx(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture2DArray(e[s]||pc,i[s])}function ix(r){switch(r){case 5126:return Ug;case 35664:return Og;case 35665:return Hg;case 35666:return Gg;case 35674:return Vg;case 35675:return kg;case 35676:return Wg;case 5124:case 35670:return qg;case 35667:case 35671:return Xg;case 35668:case 35672:return Yg;case 35669:case 35673:return Jg;case 5125:return Zg;case 36294:return $g;case 36295:return jg;case 36296:return Qg;case 35678:case 36198:case 36298:case 36306:case 35682:return Kg;case 35679:case 36299:case 36307:return ex;case 35680:case 36300:case 36308:case 36293:return tx;case 36289:case 36303:case 36311:case 36292:return nx}}function rx(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=Ng(e.type)}function bc(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=ix(e.type)}bc.prototype.updateCache=function(r){const e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),Et(e,r)};function wc(r){this.id=r,this.seq=[],this.map={}}wc.prototype.setValue=function(r,e,t){const n=this.seq;for(let i=0,s=n.length;i!==s;++i){const o=n[i];o.setValue(r,e[o.id],t)}};const va=/(\w+)(\])?(\[|\.)?/g;function Sc(r,e){r.seq.push(e),r.map[e.id]=e}function sx(r,e,t){const n=r.name,i=n.length;for(va.lastIndex=0;;){const s=va.exec(n),o=va.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){Sc(t,c===void 0?new rx(a,r,e):new bc(a,r,e));break}else{let h=t.map[a];h===void 0&&(h=new wc(a),Sc(t,h)),t=h}}}function In(r,e){this.seq=[],this.map={};const t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){const i=r.getActiveUniform(e,n),s=r.getUniformLocation(e,i.name);sx(i,s,this)}}In.prototype.setValue=function(r,e,t,n){const i=this.map[e];i!==void 0&&i.setValue(r,t,n)},In.prototype.setOptional=function(r,e,t){const n=e[t];n!==void 0&&this.setValue(r,t,n)},In.upload=function(r,e,t,n){for(let i=0,s=e.length;i!==s;++i){const o=e[i],a=t[o.id];a.needsUpdate!==!1&&o.setValue(r,a.value,n)}},In.seqWithValue=function(r,e){const t=[];for(let n=0,i=r.length;n!==i;++n){const s=r[n];s.id in e&&t.push(s)}return t};function Tc(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}let ox=0;function ax(r){const e=r.split(`
|
|
2988
|
+
`}function cg(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const l=a.mapping,c=l===Wr||l===qr,u=l===ai||l===li;if(c||u){if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){const f=r.getRenderTarget();t===null&&(t=new og(r));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),r.setRenderTarget(f),a.addEventListener("dispose",s),d.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function ug(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function hg(r,e,t,n){const i={},s=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const p in f.attributes)e.remove(f.attributes[p]);f.removeEventListener("dispose",o),delete i[f.id];const d=s.get(f);d&&(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const p in f)e.update(f[p],34962);const d=h.morphAttributes;for(const p in d){const x=d[p];for(let v=0,g=x.length;v<g;v++)e.update(x[v],34962)}}function c(h){const f=[],d=h.index,p=h.attributes.position;let x=0;if(d!==null){const m=d.array;x=d.version;for(let _=0,y=m.length;_<y;_+=3){const M=m[_+0],w=m[_+1],A=m[_+2];f.push(M,w,w,A,A,M)}}else{const m=p.array;x=p.version;for(let _=0,y=m.length/3-1;_<y;_+=3){const M=_+0,w=_+1,A=_+2;f.push(M,w,w,A,A,M)}}const v=new(kl(f)>65535?ra:ia)(f,1);v.version=x;const g=s.get(h);g&&e.remove(g),s.set(h,v)}function u(h){const f=s.get(h);if(f){const d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function fg(r,e,t,n){const i=n.isWebGL2;let s;function o(f){s=f}let a,l;function c(f){a=f.type,l=f.bytesPerElement}function u(f,d){r.drawElements(s,d,a,f*l),t.update(d,s,1)}function h(f,d,p){if(p===0)return;let x,v;if(i)x=r,v="drawElementsInstanced";else if(x=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",x===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}x[v](s,d,a,f*l,p),t.update(d,s,p)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function dg(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}class ya extends dt{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=lt,this.minFilter=lt,this.wrapR=wt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}ya.prototype.isDataTexture2DArray=!0;function pg(r,e){return r[0]-e[0]}function mg(r,e){return Math.abs(e[1])-Math.abs(r[1])}function hc(r,e){let t=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),r.divideScalar(t)}function gg(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,o=new S,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h,f){const d=c.morphTargetInfluences;if(e.isWebGL2===!0){const p=u.morphAttributes.position.length;let x=s.get(u);if(x===void 0||x.count!==p){x!==void 0&&x.texture.dispose();const m=u.morphAttributes.normal!==void 0,_=u.morphAttributes.position,y=u.morphAttributes.normal||[],M=u.attributes.position.count,w=m===!0?2:1;let A=M*w,C=1;A>e.maxTextureSize&&(C=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const N=new Float32Array(A*C*4*p),z=new ya(N,A,C,p);z.format=ft,z.type=sn,z.needsUpdate=!0;const I=w*4;for(let b=0;b<p;b++){const T=_[b],B=y[b],R=A*C*4*b;for(let F=0;F<T.count;F++){o.fromBufferAttribute(T,F),T.normalized===!0&&hc(o,T);const U=F*I;N[R+U+0]=o.x,N[R+U+1]=o.y,N[R+U+2]=o.z,N[R+U+3]=0,m===!0&&(o.fromBufferAttribute(B,F),B.normalized===!0&&hc(o,B),N[R+U+4]=o.x,N[R+U+5]=o.y,N[R+U+6]=o.z,N[R+U+7]=0)}}x={count:p,texture:z,size:new q(A,C)},s.set(u,x)}let v=0;for(let m=0;m<d.length;m++)v+=d[m];const g=u.morphTargetsRelative?1:1-v;f.getUniforms().setValue(r,"morphTargetBaseInfluence",g),f.getUniforms().setValue(r,"morphTargetInfluences",d),f.getUniforms().setValue(r,"morphTargetsTexture",x.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",x.size)}else{const p=d===void 0?0:d.length;let x=n[u.id];if(x===void 0||x.length!==p){x=[];for(let y=0;y<p;y++)x[y]=[y,0];n[u.id]=x}for(let y=0;y<p;y++){const M=x[y];M[0]=y,M[1]=d[y]}x.sort(mg);for(let y=0;y<8;y++)y<p&&x[y][1]?(a[y][0]=x[y][0],a[y][1]=x[y][1]):(a[y][0]=Number.MAX_SAFE_INTEGER,a[y][1]=0);a.sort(pg);const v=u.morphAttributes.position,g=u.morphAttributes.normal;let m=0;for(let y=0;y<8;y++){const M=a[y],w=M[0],A=M[1];w!==Number.MAX_SAFE_INTEGER&&A?(v&&u.getAttribute("morphTarget"+y)!==v[w]&&u.setAttribute("morphTarget"+y,v[w]),g&&u.getAttribute("morphNormal"+y)!==g[w]&&u.setAttribute("morphNormal"+y,g[w]),i[y]=A,m+=A):(v&&u.hasAttribute("morphTarget"+y)===!0&&u.deleteAttribute("morphTarget"+y),g&&u.hasAttribute("morphNormal"+y)===!0&&u.deleteAttribute("morphNormal"+y),i[y]=0)}const _=u.morphTargetsRelative?1:1-m;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:l}}function xg(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);return i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),h}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class fc extends dt{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=lt,this.minFilter=lt,this.wrapR=wt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}fc.prototype.isDataTexture3D=!0;const dc=new dt,pc=new ya,mc=new fc,gc=new mr,xc=[],yc=[],vc=new Float32Array(16),_c=new Float32Array(9),Mc=new Float32Array(4);function zi(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=xc[i];if(s===void 0&&(s=new Float32Array(i),xc[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Ct(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Et(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ts(r,e){let t=yc[e];t===void 0&&(t=new Int32Array(e),yc[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function yg(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function vg(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ct(t,e))return;r.uniform2fv(this.addr,e),Et(t,e)}}function _g(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ct(t,e))return;r.uniform3fv(this.addr,e),Et(t,e)}}function Mg(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ct(t,e))return;r.uniform4fv(this.addr,e),Et(t,e)}}function bg(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Et(t,e)}else{if(Ct(t,n))return;Mc.set(n),r.uniformMatrix2fv(this.addr,!1,Mc),Et(t,n)}}function wg(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Et(t,e)}else{if(Ct(t,n))return;_c.set(n),r.uniformMatrix3fv(this.addr,!1,_c),Et(t,n)}}function Sg(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ct(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Et(t,e)}else{if(Ct(t,n))return;vc.set(n),r.uniformMatrix4fv(this.addr,!1,vc),Et(t,n)}}function Tg(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function Eg(r,e){const t=this.cache;Ct(t,e)||(r.uniform2iv(this.addr,e),Et(t,e))}function Ag(r,e){const t=this.cache;Ct(t,e)||(r.uniform3iv(this.addr,e),Et(t,e))}function Lg(r,e){const t=this.cache;Ct(t,e)||(r.uniform4iv(this.addr,e),Et(t,e))}function Cg(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function Rg(r,e){const t=this.cache;Ct(t,e)||(r.uniform2uiv(this.addr,e),Et(t,e))}function Pg(r,e){const t=this.cache;Ct(t,e)||(r.uniform3uiv(this.addr,e),Et(t,e))}function Ig(r,e){const t=this.cache;Ct(t,e)||(r.uniform4uiv(this.addr,e),Et(t,e))}function Dg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||dc,i)}function Fg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||mc,i)}function Bg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||gc,i)}function zg(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||pc,i)}function Ng(r){switch(r){case 5126:return yg;case 35664:return vg;case 35665:return _g;case 35666:return Mg;case 35674:return bg;case 35675:return wg;case 35676:return Sg;case 5124:case 35670:return Tg;case 35667:case 35671:return Eg;case 35668:case 35672:return Ag;case 35669:case 35673:return Lg;case 5125:return Cg;case 36294:return Rg;case 36295:return Pg;case 36296:return Ig;case 35678:case 36198:case 36298:case 36306:case 35682:return Dg;case 35679:case 36299:case 36307:return Fg;case 35680:case 36300:case 36308:case 36293:return Bg;case 36289:case 36303:case 36311:case 36292:return zg}}function Ug(r,e){r.uniform1fv(this.addr,e)}function Og(r,e){const t=zi(e,this.size,2);r.uniform2fv(this.addr,t)}function Hg(r,e){const t=zi(e,this.size,3);r.uniform3fv(this.addr,t)}function Gg(r,e){const t=zi(e,this.size,4);r.uniform4fv(this.addr,t)}function Vg(r,e){const t=zi(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function kg(r,e){const t=zi(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function Wg(r,e){const t=zi(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function qg(r,e){r.uniform1iv(this.addr,e)}function Xg(r,e){r.uniform2iv(this.addr,e)}function Yg(r,e){r.uniform3iv(this.addr,e)}function Jg(r,e){r.uniform4iv(this.addr,e)}function Zg(r,e){r.uniform1uiv(this.addr,e)}function $g(r,e){r.uniform2uiv(this.addr,e)}function jg(r,e){r.uniform3uiv(this.addr,e)}function Qg(r,e){r.uniform4uiv(this.addr,e)}function Kg(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTexture2D(e[s]||dc,i[s])}function ex(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture3D(e[s]||mc,i[s])}function tx(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTextureCube(e[s]||gc,i[s])}function nx(r,e,t){const n=e.length,i=Ts(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture2DArray(e[s]||pc,i[s])}function ix(r){switch(r){case 5126:return Ug;case 35664:return Og;case 35665:return Hg;case 35666:return Gg;case 35674:return Vg;case 35675:return kg;case 35676:return Wg;case 5124:case 35670:return qg;case 35667:case 35671:return Xg;case 35668:case 35672:return Yg;case 35669:case 35673:return Jg;case 5125:return Zg;case 36294:return $g;case 36295:return jg;case 36296:return Qg;case 35678:case 36198:case 36298:case 36306:case 35682:return Kg;case 35679:case 36299:case 36307:return ex;case 35680:case 36300:case 36308:case 36293:return tx;case 36289:case 36303:case 36311:case 36292:return nx}}function rx(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=Ng(e.type)}function bc(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=ix(e.type)}bc.prototype.updateCache=function(r){const e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),Et(e,r)};function wc(r){this.id=r,this.seq=[],this.map={}}wc.prototype.setValue=function(r,e,t){const n=this.seq;for(let i=0,s=n.length;i!==s;++i){const o=n[i];o.setValue(r,e[o.id],t)}};const va=/(\w+)(\])?(\[|\.)?/g;function Sc(r,e){r.seq.push(e),r.map[e.id]=e}function sx(r,e,t){const n=r.name,i=n.length;for(va.lastIndex=0;;){const s=va.exec(n),o=va.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){Sc(t,c===void 0?new rx(a,r,e):new bc(a,r,e));break}else{let h=t.map[a];h===void 0&&(h=new wc(a),Sc(t,h)),t=h}}}function In(r,e){this.seq=[],this.map={};const t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){const i=r.getActiveUniform(e,n),s=r.getUniformLocation(e,i.name);sx(i,s,this)}}In.prototype.setValue=function(r,e,t,n){const i=this.map[e];i!==void 0&&i.setValue(r,t,n)},In.prototype.setOptional=function(r,e,t){const n=e[t];n!==void 0&&this.setValue(r,t,n)},In.upload=function(r,e,t,n){for(let i=0,s=e.length;i!==s;++i){const o=e[i],a=t[o.id];a.needsUpdate!==!1&&o.setValue(r,a.value,n)}},In.seqWithValue=function(r,e){const t=[];for(let n=0,i=r.length;n!==i;++n){const s=r[n];s.id in e&&t.push(s)}return t};function Tc(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}let ox=0;function ax(r){const e=r.split(`
|
|
2989
2989
|
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
|
|
2990
2990
|
`)}function Ec(r){switch(r){case Vt:return["Linear","( value )"];case pi:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function Ac(r,e,t){const n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();return n&&i===""?"":t.toUpperCase()+`
|
|
2991
2991
|
|
|
@@ -2997,7 +2997,7 @@ void main() {
|
|
|
2997
2997
|
precision `+r.precision+" int;";return r.precision==="highp"?e+=`
|
|
2998
2998
|
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
|
|
2999
2999
|
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
|
|
3000
|
-
#define LOW_PRECISION`),e}function yx(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===vl?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Jh?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===ir&&(e="SHADOWMAP_TYPE_VSM"),e}function vx(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case ai:case li:e="ENVMAP_TYPE_CUBE";break;case sr:case Xr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function _x(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case li:case Xr:e="ENVMAP_MODE_REFRACTION";break}return e}function Mx(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case kr:e="ENVMAP_BLENDING_MULTIPLY";break;case mf:e="ENVMAP_BLENDING_MIX";break;case gf:e="ENVMAP_BLENDING_ADD";break}return e}function bx(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=yx(t),c=vx(t),u=_x(t),h=Mx(t),f=t.isWebGL2?"":ux(t),d=hx(s),
|
|
3000
|
+
#define LOW_PRECISION`),e}function yx(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===vl?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Jh?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===ir&&(e="SHADOWMAP_TYPE_VSM"),e}function vx(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case ai:case li:e="ENVMAP_TYPE_CUBE";break;case sr:case Xr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function _x(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case li:case Xr:e="ENVMAP_MODE_REFRACTION";break}return e}function Mx(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case kr:e="ENVMAP_BLENDING_MULTIPLY";break;case mf:e="ENVMAP_BLENDING_MIX";break;case gf:e="ENVMAP_BLENDING_ADD";break}return e}function bx(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=yx(t),c=vx(t),u=_x(t),h=Mx(t),f=t.isWebGL2?"":ux(t),d=hx(s),p=i.createProgram();let x,v,g=t.glslVersion?"#version "+t.glslVersion+`
|
|
3001
3001
|
`:"";t.isRawShaderMaterial?(x=[d].filter(vr).join(`
|
|
3002
3002
|
`),x.length>0&&(x+=`
|
|
3003
3003
|
`),v=[f,d].filter(vr).join(`
|
|
@@ -3011,11 +3011,11 @@ precision `+r.precision+" int;";return r.precision==="highp"?e+=`
|
|
|
3011
3011
|
`)+`
|
|
3012
3012
|
`+x,v=["#define varying in",t.glslVersion===Hl?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Hl?"":"#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(`
|
|
3013
3013
|
`)+`
|
|
3014
|
-
`+v);const
|
|
3014
|
+
`+v);const m=g+x+o,_=g+v+a,y=Tc(i,35633,m),M=Tc(i,35632,_);if(i.attachShader(p,y),i.attachShader(p,M),t.index0AttributeName!==void 0?i.bindAttribLocation(p,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(p,0,"position"),i.linkProgram(p),r.debug.checkShaderErrors){const C=i.getProgramInfoLog(p).trim(),N=i.getShaderInfoLog(y).trim(),z=i.getShaderInfoLog(M).trim();let I=!0,b=!0;if(i.getProgramParameter(p,35714)===!1){I=!1;const T=Ac(i,y,"vertex"),B=Ac(i,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(p,35715)+`
|
|
3015
3015
|
|
|
3016
3016
|
Program Info Log: `+C+`
|
|
3017
3017
|
`+T+`
|
|
3018
|
-
`+B)}else C!==""?console.warn("THREE.WebGLProgram: Program Info Log:",C):(N===""||z==="")&&(b=!1);b&&(this.diagnostics={runnable:I,programLog:C,vertexShader:{log:N,prefix:x},fragmentShader:{log:z,prefix:v}})}i.deleteShader(y),i.deleteShader(M);let w;this.getUniforms=function(){return w===void 0&&(w=new In(i,m)),w};let A;return this.getAttributes=function(){return A===void 0&&(A=fx(i,m)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=ox++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=y,this.fragmentShader=M,this}let wx=0;class Sx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n);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;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const n=new Tx;t.set(e,n)}return t.get(e)}}class Tx{constructor(){this.id=wx++,this.usedTimes=0}}function Ex(r,e,t,n,i,s,o){const a=new Zo,l=new Sx,c=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.floatVertexTextures,d=i.maxVertexUniforms,m=i.vertexTextures;let x=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(b){const B=b.skeleton.bones;if(f)return 1024;{const F=Math.floor((d-20)/4),U=Math.min(F,B.length);return U<B.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+B.length+" bones. This GPU supports "+U+"."),0):U}}function p(b){let T;return b&&b.isTexture?T=b.encoding:b&&b.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),T=b.texture.encoding):T=Vt,u&&b&&b.isTexture&&b.format===ft&&b.type===rn&&b.encoding===pi&&(T=Vt),T}function _(b,T,B,R,F){const U=R.fog,Z=b.isMeshStandardMaterial?R.environment:null,ee=(b.isMeshStandardMaterial?t:e).get(b.envMap||Z),V=v[b.type],W=F.isSkinnedMesh?g(F):0;b.precision!==null&&(x=i.getMaxPrecision(b.precision),x!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",x,"instead."));let ne,K,he,be;if(V){const ye=Jt[V];ne=ye.vertexShader,K=ye.fragmentShader}else ne=b.vertexShader,K=b.fragmentShader,l.update(b),he=l.getVertexShaderID(b),be=l.getFragmentShaderID(b);const Y=r.getRenderTarget(),we=b.alphaTest>0,de=b.clearcoat>0;return{isWebGL2:u,shaderID:V,shaderName:b.type,vertexShader:ne,fragmentShader:K,defines:b.defines,customVertexShaderID:he,customFragmentShaderID:be,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:x,instancing:F.isInstancedMesh===!0,instancingColor:F.isInstancedMesh===!0&&F.instanceColor!==null,supportsVertexTextures:m,outputEncoding:Y!==null?p(Y.texture):r.outputEncoding,map:!!b.map,mapEncoding:p(b.map),matcap:!!b.matcap,matcapEncoding:p(b.matcap),envMap:!!ee,envMapMode:ee&&ee.mapping,envMapEncoding:p(ee),envMapCubeUV:!!ee&&(ee.mapping===sr||ee.mapping===Xr),lightMap:!!b.lightMap,lightMapEncoding:p(b.lightMap),aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,emissiveMapEncoding:p(b.emissiveMap),bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===vd,tangentSpaceNormalMap:b.normalMapType===mi,clearcoat:de,clearcoatMap:de&&!!b.clearcoatMap,clearcoatRoughnessMap:de&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:de&&!!b.clearcoatNormalMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,specularIntensityMap:!!b.specularIntensityMap,specularColorMap:!!b.specularColorMap,specularColorMapEncoding:p(b.specularColorMap),alphaMap:!!b.alphaMap,alphaTest:we,gradientMap:!!b.gradientMap,sheen:b.sheen>0,sheenColorMap:!!b.sheenColorMap,sheenColorMapEncoding:p(b.sheenColorMap),sheenRoughnessMap:!!b.sheenRoughnessMap,transmission:b.transmission>0,transmissionMap:!!b.transmissionMap,thicknessMap:!!b.thicknessMap,combine:b.combine,vertexTangents:!!b.normalMap&&!!F.geometry&&!!F.geometry.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!F.geometry&&!!F.geometry.attributes.color&&F.geometry.attributes.color.itemSize===4,vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatMap||!!b.clearcoatRoughnessMap||!!b.clearcoatNormalMap||!!b.displacementMap||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||!!b.sheenColorMap||!!b.sheenRoughnessMap,uvsVertexOnly:!(!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatNormalMap||b.transmission>0||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||b.sheen>0||!!b.sheenColorMap||!!b.sheenRoughnessMap)&&!!b.displacementMap,fog:!!U,useFog:b.fog,fogExp2:U&&U.isFogExp2,flatShading:!!b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:h,skinning:F.isSkinnedMesh===!0&&W>0,maxBones:W,useVertexTexture:f,morphTargets:!!F.geometry&&!!F.geometry.morphAttributes.position,morphNormals:!!F.geometry&&!!F.geometry.morphAttributes.normal,morphTargetsCount:!!F.geometry&&!!F.geometry.morphAttributes.position?F.geometry.morphAttributes.position.length:0,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,format:b.format,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&B.length>0,shadowMapType:r.shadowMap.type,toneMapping:b.toneMapped?r.toneMapping:_n,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===si,flipSided:b.side===at,depthPacking:b.depthPacking!==void 0?b.depthPacking:!1,index0AttributeName:b.index0AttributeName,extensionDerivatives:b.extensions&&b.extensions.derivatives,extensionFragDepth:b.extensions&&b.extensions.fragDepth,extensionDrawBuffers:b.extensions&&b.extensions.drawBuffers,extensionShaderTextureLOD:b.extensions&&b.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function y(b){const T=[];if(b.shaderID?T.push(b.shaderID):(T.push(b.customVertexShaderID),T.push(b.customFragmentShaderID)),b.defines!==void 0)for(const B in b.defines)T.push(B),T.push(b.defines[B]);return b.isRawShaderMaterial===!1&&(M(T,b),w(T,b),T.push(r.outputEncoding)),T.push(b.customProgramCacheKey),T.join()}function M(b,T){b.push(T.precision),b.push(T.outputEncoding),b.push(T.mapEncoding),b.push(T.matcapEncoding),b.push(T.envMapMode),b.push(T.envMapEncoding),b.push(T.lightMapEncoding),b.push(T.emissiveMapEncoding),b.push(T.combine),b.push(T.vertexUvs),b.push(T.fogExp2),b.push(T.sizeAttenuation),b.push(T.maxBones),b.push(T.morphTargetsCount),b.push(T.numDirLights),b.push(T.numPointLights),b.push(T.numSpotLights),b.push(T.numHemiLights),b.push(T.numRectAreaLights),b.push(T.numDirLightShadows),b.push(T.numPointLightShadows),b.push(T.numSpotLightShadows),b.push(T.shadowMapType),b.push(T.toneMapping),b.push(T.numClippingPlanes),b.push(T.numClipIntersection),b.push(T.format),b.push(T.specularColorMapEncoding),b.push(T.sheenColorMapEncoding)}function w(b,T){a.disableAll(),T.isWebGL2&&a.enable(0),T.supportsVertexTextures&&a.enable(1),T.instancing&&a.enable(2),T.instancingColor&&a.enable(3),T.map&&a.enable(4),T.matcap&&a.enable(5),T.envMap&&a.enable(6),T.envMapCubeUV&&a.enable(7),T.lightMap&&a.enable(8),T.aoMap&&a.enable(9),T.emissiveMap&&a.enable(10),T.bumpMap&&a.enable(11),T.normalMap&&a.enable(12),T.objectSpaceNormalMap&&a.enable(13),T.tangentSpaceNormalMap&&a.enable(14),T.clearcoat&&a.enable(15),T.clearcoatMap&&a.enable(16),T.clearcoatRoughnessMap&&a.enable(17),T.clearcoatNormalMap&&a.enable(18),T.displacementMap&&a.enable(19),T.specularMap&&a.enable(20),T.roughnessMap&&a.enable(21),T.metalnessMap&&a.enable(22),T.gradientMap&&a.enable(23),T.alphaMap&&a.enable(24),T.alphaTest&&a.enable(25),T.vertexColors&&a.enable(26),T.vertexAlphas&&a.enable(27),T.vertexUvs&&a.enable(28),T.vertexTangents&&a.enable(29),T.uvsVertexOnly&&a.enable(30),T.fog&&a.enable(31),b.push(a.mask),a.disableAll(),T.useFog&&a.enable(0),T.flatShading&&a.enable(1),T.logarithmicDepthBuffer&&a.enable(2),T.skinning&&a.enable(3),T.useVertexTexture&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.premultipliedAlpha&&a.enable(7),T.shadowMapEnabled&&a.enable(8),T.physicallyCorrectLights&&a.enable(9),T.doubleSided&&a.enable(10),T.flipSided&&a.enable(11),T.depthPacking&&a.enable(12),T.dithering&&a.enable(13),T.specularIntensityMap&&a.enable(14),T.specularColorMap&&a.enable(15),T.transmission&&a.enable(16),T.transmissionMap&&a.enable(17),T.thicknessMap&&a.enable(18),T.sheen&&a.enable(19),T.sheenColorMap&&a.enable(20),T.sheenRoughnessMap&&a.enable(21),b.push(a.mask)}function A(b){const T=v[b.type];let B;if(T){const R=Jt[T];B=ep.clone(R.uniforms)}else B=b.uniforms;return B}function C(b,T){let B;for(let R=0,F=c.length;R<F;R++){const U=c[R];if(U.cacheKey===T){B=U,++B.usedTimes;break}}return B===void 0&&(B=new bx(r,T,b,s),c.push(B)),B}function N(b){if(--b.usedTimes===0){const T=c.indexOf(b);c[T]=c[c.length-1],c.pop(),b.destroy()}}function z(b){l.remove(b)}function I(){l.dispose()}return{getParameters:_,getProgramCacheKey:y,getUniforms:A,acquireProgram:C,releaseProgram:N,releaseShaderCache:z,programs:c,dispose:I}}function Ax(){let r=new WeakMap;function e(s){let o=r.get(s);return o===void 0&&(o={},r.set(s,o)),o}function t(s){r.delete(s)}function n(s,o,a){r.get(s)[o]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Lx(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Dc(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Fc(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(h,f,d,m,x,v){let g=r[e];return g===void 0?(g={id:h.id,object:h,geometry:f,material:d,groupOrder:m,renderOrder:h.renderOrder,z:x,group:v},r[e]=g):(g.id=h.id,g.object=h,g.geometry=f,g.material=d,g.groupOrder=m,g.renderOrder=h.renderOrder,g.z=x,g.group=v),e++,g}function a(h,f,d,m,x,v){const g=o(h,f,d,m,x,v);d.transmission>0?n.push(g):d.transparent===!0?i.push(g):t.push(g)}function l(h,f,d,m,x,v){const g=o(h,f,d,m,x,v);d.transmission>0?n.unshift(g):d.transparent===!0?i.unshift(g):t.unshift(g)}function c(h,f){t.length>1&&t.sort(h||Lx),n.length>1&&n.sort(f||Dc),i.length>1&&i.sort(f||Dc)}function u(){for(let h=e,f=r.length;h<f;h++){const d=r[h];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:l,finish:u,sort:c}}function Cx(){let r=new WeakMap;function e(n,i){let s;return r.has(n)===!1?(s=new Fc,r.set(n,[s])):i>=r.get(n).length?(s=new Fc,r.get(n).push(s)):s=r.get(n)[i],s}function t(){r=new WeakMap}return{get:e,dispose:t}}function Rx(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new S,color:new le};break;case"SpotLight":t={position:new S,direction:new S,color:new le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new S,color:new le,distance:0,decay:0};break;case"HemisphereLight":t={direction:new S,skyColor:new le,groundColor:new le};break;case"RectAreaLight":t={color:new le,position:new S,halfWidth:new S,halfHeight:new S};break}return r[e.id]=t,t}}}function Px(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Ix=0;function Dx(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function Fx(r,e){const t=new Rx,n=Px(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)i.probe.push(new S);const s=new S,o=new pe,a=new pe;function l(u,h){let f=0,d=0,m=0;for(let N=0;N<9;N++)i.probe[N].set(0,0,0);let x=0,v=0,g=0,p=0,_=0,y=0,M=0,w=0;u.sort(Dx);const A=h!==!0?Math.PI:1;for(let N=0,z=u.length;N<z;N++){const I=u[N],b=I.color,T=I.intensity,B=I.distance,R=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)f+=b.r*T*A,d+=b.g*T*A,m+=b.b*T*A;else if(I.isLightProbe)for(let F=0;F<9;F++)i.probe[F].addScaledVector(I.sh.coefficients[F],T);else if(I.isDirectionalLight){const F=t.get(I);if(F.color.copy(I.color).multiplyScalar(I.intensity*A),I.castShadow){const U=I.shadow,Z=n.get(I);Z.shadowBias=U.bias,Z.shadowNormalBias=U.normalBias,Z.shadowRadius=U.radius,Z.shadowMapSize=U.mapSize,i.directionalShadow[x]=Z,i.directionalShadowMap[x]=R,i.directionalShadowMatrix[x]=I.shadow.matrix,y++}i.directional[x]=F,x++}else if(I.isSpotLight){const F=t.get(I);if(F.position.setFromMatrixPosition(I.matrixWorld),F.color.copy(b).multiplyScalar(T*A),F.distance=B,F.coneCos=Math.cos(I.angle),F.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),F.decay=I.decay,I.castShadow){const U=I.shadow,Z=n.get(I);Z.shadowBias=U.bias,Z.shadowNormalBias=U.normalBias,Z.shadowRadius=U.radius,Z.shadowMapSize=U.mapSize,i.spotShadow[g]=Z,i.spotShadowMap[g]=R,i.spotShadowMatrix[g]=I.shadow.matrix,w++}i.spot[g]=F,g++}else if(I.isRectAreaLight){const F=t.get(I);F.color.copy(b).multiplyScalar(T),F.halfWidth.set(I.width*.5,0,0),F.halfHeight.set(0,I.height*.5,0),i.rectArea[p]=F,p++}else if(I.isPointLight){const F=t.get(I);if(F.color.copy(I.color).multiplyScalar(I.intensity*A),F.distance=I.distance,F.decay=I.decay,I.castShadow){const U=I.shadow,Z=n.get(I);Z.shadowBias=U.bias,Z.shadowNormalBias=U.normalBias,Z.shadowRadius=U.radius,Z.shadowMapSize=U.mapSize,Z.shadowCameraNear=U.camera.near,Z.shadowCameraFar=U.camera.far,i.pointShadow[v]=Z,i.pointShadowMap[v]=R,i.pointShadowMatrix[v]=I.shadow.matrix,M++}i.point[v]=F,v++}else if(I.isHemisphereLight){const F=t.get(I);F.skyColor.copy(I.color).multiplyScalar(T*A),F.groundColor.copy(I.groundColor).multiplyScalar(T*A),i.hemi[_]=F,_++}}p>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=oe.LTC_FLOAT_1,i.rectAreaLTC2=oe.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=oe.LTC_HALF_1,i.rectAreaLTC2=oe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=d,i.ambient[2]=m;const C=i.hash;(C.directionalLength!==x||C.pointLength!==v||C.spotLength!==g||C.rectAreaLength!==p||C.hemiLength!==_||C.numDirectionalShadows!==y||C.numPointShadows!==M||C.numSpotShadows!==w)&&(i.directional.length=x,i.spot.length=g,i.rectArea.length=p,i.point.length=v,i.hemi.length=_,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=M,i.spotShadowMatrix.length=w,C.directionalLength=x,C.pointLength=v,C.spotLength=g,C.rectAreaLength=p,C.hemiLength=_,C.numDirectionalShadows=y,C.numPointShadows=M,C.numSpotShadows=w,i.version=Ix++)}function c(u,h){let f=0,d=0,m=0,x=0,v=0;const g=h.matrixWorldInverse;for(let p=0,_=u.length;p<_;p++){const y=u[p];if(y.isDirectionalLight){const M=i.directional[f];M.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(g),f++}else if(y.isSpotLight){const M=i.spot[m];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(g),m++}else if(y.isRectAreaLight){const M=i.rectArea[x];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),a.identity(),o.copy(y.matrixWorld),o.premultiply(g),a.extractRotation(o),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(y.isPointLight){const M=i.point[d];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),d++}else if(y.isHemisphereLight){const M=i.hemi[v];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(g),M.direction.normalize(),v++}}}return{setup:l,setupView:c,state:i}}function Bc(r,e){const t=new Fx(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function l(h){t.setup(n,h)}function c(h){t.setupView(n,h)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function Bx(r,e){let t=new WeakMap;function n(s,o=0){let a;return t.has(s)===!1?(a=new Bc(r,e),t.set(s,[a])):o>=t.get(s).length?(a=new Bc(r,e),t.get(s).push(a)):a=t.get(s)[o],a}function i(){t=new WeakMap}return{get:n,dispose:i}}class Ma extends _t{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=xd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!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}}Ma.prototype.isMeshDepthMaterial=!0;class ba extends _t{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new S,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}ba.prototype.isMeshDistanceMaterial=!0;const zx=`void main() {
|
|
3018
|
+
`+B)}else C!==""?console.warn("THREE.WebGLProgram: Program Info Log:",C):(N===""||z==="")&&(b=!1);b&&(this.diagnostics={runnable:I,programLog:C,vertexShader:{log:N,prefix:x},fragmentShader:{log:z,prefix:v}})}i.deleteShader(y),i.deleteShader(M);let w;this.getUniforms=function(){return w===void 0&&(w=new In(i,p)),w};let A;return this.getAttributes=function(){return A===void 0&&(A=fx(i,p)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(p),this.program=void 0},this.name=t.shaderName,this.id=ox++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=y,this.fragmentShader=M,this}let wx=0;class Sx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n);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;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const n=new Tx;t.set(e,n)}return t.get(e)}}class Tx{constructor(){this.id=wx++,this.usedTimes=0}}function Ex(r,e,t,n,i,s,o){const a=new Zo,l=new Sx,c=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.floatVertexTextures,d=i.maxVertexUniforms,p=i.vertexTextures;let x=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(b){const B=b.skeleton.bones;if(f)return 1024;{const F=Math.floor((d-20)/4),U=Math.min(F,B.length);return U<B.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+B.length+" bones. This GPU supports "+U+"."),0):U}}function m(b){let T;return b&&b.isTexture?T=b.encoding:b&&b.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),T=b.texture.encoding):T=Vt,u&&b&&b.isTexture&&b.format===ft&&b.type===rn&&b.encoding===pi&&(T=Vt),T}function _(b,T,B,R,F){const U=R.fog,Z=b.isMeshStandardMaterial?R.environment:null,ee=(b.isMeshStandardMaterial?t:e).get(b.envMap||Z),V=v[b.type],W=F.isSkinnedMesh?g(F):0;b.precision!==null&&(x=i.getMaxPrecision(b.precision),x!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",x,"instead."));let ne,K,he,be;if(V){const ye=Jt[V];ne=ye.vertexShader,K=ye.fragmentShader}else ne=b.vertexShader,K=b.fragmentShader,l.update(b),he=l.getVertexShaderID(b),be=l.getFragmentShaderID(b);const Y=r.getRenderTarget(),we=b.alphaTest>0,de=b.clearcoat>0;return{isWebGL2:u,shaderID:V,shaderName:b.type,vertexShader:ne,fragmentShader:K,defines:b.defines,customVertexShaderID:he,customFragmentShaderID:be,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:x,instancing:F.isInstancedMesh===!0,instancingColor:F.isInstancedMesh===!0&&F.instanceColor!==null,supportsVertexTextures:p,outputEncoding:Y!==null?m(Y.texture):r.outputEncoding,map:!!b.map,mapEncoding:m(b.map),matcap:!!b.matcap,matcapEncoding:m(b.matcap),envMap:!!ee,envMapMode:ee&&ee.mapping,envMapEncoding:m(ee),envMapCubeUV:!!ee&&(ee.mapping===sr||ee.mapping===Xr),lightMap:!!b.lightMap,lightMapEncoding:m(b.lightMap),aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,emissiveMapEncoding:m(b.emissiveMap),bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===vd,tangentSpaceNormalMap:b.normalMapType===mi,clearcoat:de,clearcoatMap:de&&!!b.clearcoatMap,clearcoatRoughnessMap:de&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:de&&!!b.clearcoatNormalMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,specularIntensityMap:!!b.specularIntensityMap,specularColorMap:!!b.specularColorMap,specularColorMapEncoding:m(b.specularColorMap),alphaMap:!!b.alphaMap,alphaTest:we,gradientMap:!!b.gradientMap,sheen:b.sheen>0,sheenColorMap:!!b.sheenColorMap,sheenColorMapEncoding:m(b.sheenColorMap),sheenRoughnessMap:!!b.sheenRoughnessMap,transmission:b.transmission>0,transmissionMap:!!b.transmissionMap,thicknessMap:!!b.thicknessMap,combine:b.combine,vertexTangents:!!b.normalMap&&!!F.geometry&&!!F.geometry.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!F.geometry&&!!F.geometry.attributes.color&&F.geometry.attributes.color.itemSize===4,vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatMap||!!b.clearcoatRoughnessMap||!!b.clearcoatNormalMap||!!b.displacementMap||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||!!b.sheenColorMap||!!b.sheenRoughnessMap,uvsVertexOnly:!(!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatNormalMap||b.transmission>0||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||b.sheen>0||!!b.sheenColorMap||!!b.sheenRoughnessMap)&&!!b.displacementMap,fog:!!U,useFog:b.fog,fogExp2:U&&U.isFogExp2,flatShading:!!b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:h,skinning:F.isSkinnedMesh===!0&&W>0,maxBones:W,useVertexTexture:f,morphTargets:!!F.geometry&&!!F.geometry.morphAttributes.position,morphNormals:!!F.geometry&&!!F.geometry.morphAttributes.normal,morphTargetsCount:!!F.geometry&&!!F.geometry.morphAttributes.position?F.geometry.morphAttributes.position.length:0,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,format:b.format,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&B.length>0,shadowMapType:r.shadowMap.type,toneMapping:b.toneMapped?r.toneMapping:_n,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===si,flipSided:b.side===at,depthPacking:b.depthPacking!==void 0?b.depthPacking:!1,index0AttributeName:b.index0AttributeName,extensionDerivatives:b.extensions&&b.extensions.derivatives,extensionFragDepth:b.extensions&&b.extensions.fragDepth,extensionDrawBuffers:b.extensions&&b.extensions.drawBuffers,extensionShaderTextureLOD:b.extensions&&b.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function y(b){const T=[];if(b.shaderID?T.push(b.shaderID):(T.push(b.customVertexShaderID),T.push(b.customFragmentShaderID)),b.defines!==void 0)for(const B in b.defines)T.push(B),T.push(b.defines[B]);return b.isRawShaderMaterial===!1&&(M(T,b),w(T,b),T.push(r.outputEncoding)),T.push(b.customProgramCacheKey),T.join()}function M(b,T){b.push(T.precision),b.push(T.outputEncoding),b.push(T.mapEncoding),b.push(T.matcapEncoding),b.push(T.envMapMode),b.push(T.envMapEncoding),b.push(T.lightMapEncoding),b.push(T.emissiveMapEncoding),b.push(T.combine),b.push(T.vertexUvs),b.push(T.fogExp2),b.push(T.sizeAttenuation),b.push(T.maxBones),b.push(T.morphTargetsCount),b.push(T.numDirLights),b.push(T.numPointLights),b.push(T.numSpotLights),b.push(T.numHemiLights),b.push(T.numRectAreaLights),b.push(T.numDirLightShadows),b.push(T.numPointLightShadows),b.push(T.numSpotLightShadows),b.push(T.shadowMapType),b.push(T.toneMapping),b.push(T.numClippingPlanes),b.push(T.numClipIntersection),b.push(T.format),b.push(T.specularColorMapEncoding),b.push(T.sheenColorMapEncoding)}function w(b,T){a.disableAll(),T.isWebGL2&&a.enable(0),T.supportsVertexTextures&&a.enable(1),T.instancing&&a.enable(2),T.instancingColor&&a.enable(3),T.map&&a.enable(4),T.matcap&&a.enable(5),T.envMap&&a.enable(6),T.envMapCubeUV&&a.enable(7),T.lightMap&&a.enable(8),T.aoMap&&a.enable(9),T.emissiveMap&&a.enable(10),T.bumpMap&&a.enable(11),T.normalMap&&a.enable(12),T.objectSpaceNormalMap&&a.enable(13),T.tangentSpaceNormalMap&&a.enable(14),T.clearcoat&&a.enable(15),T.clearcoatMap&&a.enable(16),T.clearcoatRoughnessMap&&a.enable(17),T.clearcoatNormalMap&&a.enable(18),T.displacementMap&&a.enable(19),T.specularMap&&a.enable(20),T.roughnessMap&&a.enable(21),T.metalnessMap&&a.enable(22),T.gradientMap&&a.enable(23),T.alphaMap&&a.enable(24),T.alphaTest&&a.enable(25),T.vertexColors&&a.enable(26),T.vertexAlphas&&a.enable(27),T.vertexUvs&&a.enable(28),T.vertexTangents&&a.enable(29),T.uvsVertexOnly&&a.enable(30),T.fog&&a.enable(31),b.push(a.mask),a.disableAll(),T.useFog&&a.enable(0),T.flatShading&&a.enable(1),T.logarithmicDepthBuffer&&a.enable(2),T.skinning&&a.enable(3),T.useVertexTexture&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.premultipliedAlpha&&a.enable(7),T.shadowMapEnabled&&a.enable(8),T.physicallyCorrectLights&&a.enable(9),T.doubleSided&&a.enable(10),T.flipSided&&a.enable(11),T.depthPacking&&a.enable(12),T.dithering&&a.enable(13),T.specularIntensityMap&&a.enable(14),T.specularColorMap&&a.enable(15),T.transmission&&a.enable(16),T.transmissionMap&&a.enable(17),T.thicknessMap&&a.enable(18),T.sheen&&a.enable(19),T.sheenColorMap&&a.enable(20),T.sheenRoughnessMap&&a.enable(21),b.push(a.mask)}function A(b){const T=v[b.type];let B;if(T){const R=Jt[T];B=ep.clone(R.uniforms)}else B=b.uniforms;return B}function C(b,T){let B;for(let R=0,F=c.length;R<F;R++){const U=c[R];if(U.cacheKey===T){B=U,++B.usedTimes;break}}return B===void 0&&(B=new bx(r,T,b,s),c.push(B)),B}function N(b){if(--b.usedTimes===0){const T=c.indexOf(b);c[T]=c[c.length-1],c.pop(),b.destroy()}}function z(b){l.remove(b)}function I(){l.dispose()}return{getParameters:_,getProgramCacheKey:y,getUniforms:A,acquireProgram:C,releaseProgram:N,releaseShaderCache:z,programs:c,dispose:I}}function Ax(){let r=new WeakMap;function e(s){let o=r.get(s);return o===void 0&&(o={},r.set(s,o)),o}function t(s){r.delete(s)}function n(s,o,a){r.get(s)[o]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Lx(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Dc(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Fc(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(h,f,d,p,x,v){let g=r[e];return g===void 0?(g={id:h.id,object:h,geometry:f,material:d,groupOrder:p,renderOrder:h.renderOrder,z:x,group:v},r[e]=g):(g.id=h.id,g.object=h,g.geometry=f,g.material=d,g.groupOrder=p,g.renderOrder=h.renderOrder,g.z=x,g.group=v),e++,g}function a(h,f,d,p,x,v){const g=o(h,f,d,p,x,v);d.transmission>0?n.push(g):d.transparent===!0?i.push(g):t.push(g)}function l(h,f,d,p,x,v){const g=o(h,f,d,p,x,v);d.transmission>0?n.unshift(g):d.transparent===!0?i.unshift(g):t.unshift(g)}function c(h,f){t.length>1&&t.sort(h||Lx),n.length>1&&n.sort(f||Dc),i.length>1&&i.sort(f||Dc)}function u(){for(let h=e,f=r.length;h<f;h++){const d=r[h];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:l,finish:u,sort:c}}function Cx(){let r=new WeakMap;function e(n,i){let s;return r.has(n)===!1?(s=new Fc,r.set(n,[s])):i>=r.get(n).length?(s=new Fc,r.get(n).push(s)):s=r.get(n)[i],s}function t(){r=new WeakMap}return{get:e,dispose:t}}function Rx(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new S,color:new le};break;case"SpotLight":t={position:new S,direction:new S,color:new le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new S,color:new le,distance:0,decay:0};break;case"HemisphereLight":t={direction:new S,skyColor:new le,groundColor:new le};break;case"RectAreaLight":t={color:new le,position:new S,halfWidth:new S,halfHeight:new S};break}return r[e.id]=t,t}}}function Px(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Ix=0;function Dx(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function Fx(r,e){const t=new Rx,n=Px(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)i.probe.push(new S);const s=new S,o=new pe,a=new pe;function l(u,h){let f=0,d=0,p=0;for(let N=0;N<9;N++)i.probe[N].set(0,0,0);let x=0,v=0,g=0,m=0,_=0,y=0,M=0,w=0;u.sort(Dx);const A=h!==!0?Math.PI:1;for(let N=0,z=u.length;N<z;N++){const I=u[N],b=I.color,T=I.intensity,B=I.distance,R=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)f+=b.r*T*A,d+=b.g*T*A,p+=b.b*T*A;else if(I.isLightProbe)for(let F=0;F<9;F++)i.probe[F].addScaledVector(I.sh.coefficients[F],T);else if(I.isDirectionalLight){const F=t.get(I);if(F.color.copy(I.color).multiplyScalar(I.intensity*A),I.castShadow){const U=I.shadow,Z=n.get(I);Z.shadowBias=U.bias,Z.shadowNormalBias=U.normalBias,Z.shadowRadius=U.radius,Z.shadowMapSize=U.mapSize,i.directionalShadow[x]=Z,i.directionalShadowMap[x]=R,i.directionalShadowMatrix[x]=I.shadow.matrix,y++}i.directional[x]=F,x++}else if(I.isSpotLight){const F=t.get(I);if(F.position.setFromMatrixPosition(I.matrixWorld),F.color.copy(b).multiplyScalar(T*A),F.distance=B,F.coneCos=Math.cos(I.angle),F.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),F.decay=I.decay,I.castShadow){const U=I.shadow,Z=n.get(I);Z.shadowBias=U.bias,Z.shadowNormalBias=U.normalBias,Z.shadowRadius=U.radius,Z.shadowMapSize=U.mapSize,i.spotShadow[g]=Z,i.spotShadowMap[g]=R,i.spotShadowMatrix[g]=I.shadow.matrix,w++}i.spot[g]=F,g++}else if(I.isRectAreaLight){const F=t.get(I);F.color.copy(b).multiplyScalar(T),F.halfWidth.set(I.width*.5,0,0),F.halfHeight.set(0,I.height*.5,0),i.rectArea[m]=F,m++}else if(I.isPointLight){const F=t.get(I);if(F.color.copy(I.color).multiplyScalar(I.intensity*A),F.distance=I.distance,F.decay=I.decay,I.castShadow){const U=I.shadow,Z=n.get(I);Z.shadowBias=U.bias,Z.shadowNormalBias=U.normalBias,Z.shadowRadius=U.radius,Z.shadowMapSize=U.mapSize,Z.shadowCameraNear=U.camera.near,Z.shadowCameraFar=U.camera.far,i.pointShadow[v]=Z,i.pointShadowMap[v]=R,i.pointShadowMatrix[v]=I.shadow.matrix,M++}i.point[v]=F,v++}else if(I.isHemisphereLight){const F=t.get(I);F.skyColor.copy(I.color).multiplyScalar(T*A),F.groundColor.copy(I.groundColor).multiplyScalar(T*A),i.hemi[_]=F,_++}}m>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=oe.LTC_FLOAT_1,i.rectAreaLTC2=oe.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=oe.LTC_HALF_1,i.rectAreaLTC2=oe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=d,i.ambient[2]=p;const C=i.hash;(C.directionalLength!==x||C.pointLength!==v||C.spotLength!==g||C.rectAreaLength!==m||C.hemiLength!==_||C.numDirectionalShadows!==y||C.numPointShadows!==M||C.numSpotShadows!==w)&&(i.directional.length=x,i.spot.length=g,i.rectArea.length=m,i.point.length=v,i.hemi.length=_,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=M,i.spotShadowMatrix.length=w,C.directionalLength=x,C.pointLength=v,C.spotLength=g,C.rectAreaLength=m,C.hemiLength=_,C.numDirectionalShadows=y,C.numPointShadows=M,C.numSpotShadows=w,i.version=Ix++)}function c(u,h){let f=0,d=0,p=0,x=0,v=0;const g=h.matrixWorldInverse;for(let m=0,_=u.length;m<_;m++){const y=u[m];if(y.isDirectionalLight){const M=i.directional[f];M.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(g),f++}else if(y.isSpotLight){const M=i.spot[p];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(g),p++}else if(y.isRectAreaLight){const M=i.rectArea[x];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),a.identity(),o.copy(y.matrixWorld),o.premultiply(g),a.extractRotation(o),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(y.isPointLight){const M=i.point[d];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),d++}else if(y.isHemisphereLight){const M=i.hemi[v];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(g),M.direction.normalize(),v++}}}return{setup:l,setupView:c,state:i}}function Bc(r,e){const t=new Fx(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function l(h){t.setup(n,h)}function c(h){t.setupView(n,h)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function Bx(r,e){let t=new WeakMap;function n(s,o=0){let a;return t.has(s)===!1?(a=new Bc(r,e),t.set(s,[a])):o>=t.get(s).length?(a=new Bc(r,e),t.get(s).push(a)):a=t.get(s)[o],a}function i(){t=new WeakMap}return{get:n,dispose:i}}class Ma extends _t{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=xd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!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}}Ma.prototype.isMeshDepthMaterial=!0;class ba extends _t{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new S,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}ba.prototype.isMeshDistanceMaterial=!0;const zx=`void main() {
|
|
3019
3019
|
gl_Position = vec4( position, 1.0 );
|
|
3020
3020
|
}`,Nx=`uniform sampler2D shadow_pass;
|
|
3021
3021
|
uniform vec2 resolution;
|
|
@@ -3043,7 +3043,7 @@ void main() {
|
|
|
3043
3043
|
squared_mean = squared_mean / samples;
|
|
3044
3044
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3045
3045
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3046
|
-
}`;function zc(r,e,t){let n=new _s;const i=new q,s=new q,o=new We,a=new Ma({depthPacking:yd}),l=new ba,c={},u=t.maxTextureSize,h={0:at,1:ri,2:si},f=new Yt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new q},radius:{value:4}},vertexShader:zx,fragmentShader:Nx}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const m=new ve;m.setAttribute("position",new ze(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new xt(m,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=vl,this.render=function(y,M,w){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||y.length===0)return;const A=r.getRenderTarget(),C=r.getActiveCubeFace(),N=r.getActiveMipmapLevel(),z=r.state;z.setBlending(vn),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);for(let I=0,b=y.length;I<b;I++){const T=y[I],B=T.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",T,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const R=B.getFrameExtents();if(i.multiply(R),s.copy(B.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/R.x),i.x=s.x*R.x,B.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/R.y),i.y=s.y*R.y,B.mapSize.y=s.y)),B.map===null&&!B.isPointLightShadow&&this.type===ir){const U={minFilter:nt,magFilter:nt,format:ft};B.map=new zt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.mapPass=new zt(i.x,i.y,U),B.camera.updateProjectionMatrix()}if(B.map===null){const U={minFilter:lt,magFilter:lt,format:ft};B.map=new zt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.camera.updateProjectionMatrix()}r.setRenderTarget(B.map),r.clear();const F=B.getViewportCount();for(let U=0;U<F;U++){const Z=B.getViewport(U);o.set(s.x*Z.x,s.y*Z.y,s.x*Z.z,s.y*Z.w),z.viewport(o),B.updateMatrices(T,U),n=B.getFrustum(),_(M,w,B.camera,T,this.type)}!B.isPointLightShadow&&this.type===ir&&g(B,w),B.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(A,C,N)};function g(y,M){const w=e.update(x);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,r.setRenderTarget(y.mapPass),r.clear(),r.renderBufferDirect(M,null,w,f,x,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,r.setRenderTarget(y.map),r.clear(),r.renderBufferDirect(M,null,w,d,x,null)}function p(y,M,w,A,C,N,z){let I=null;const b=A.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(b!==void 0?I=b:I=A.isPointLight===!0?l:a,r.localClippingEnabled&&w.clipShadows===!0&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0){const T=I.uuid,B=w.uuid;let R=c[T];R===void 0&&(R={},c[T]=R);let F=R[B];F===void 0&&(F=I.clone(),R[B]=F),I=F}return I.visible=w.visible,I.wireframe=w.wireframe,z===ir?I.side=w.shadowSide!==null?w.shadowSide:w.side:I.side=w.shadowSide!==null?w.shadowSide:h[w.side],I.alphaMap=w.alphaMap,I.alphaTest=w.alphaTest,I.clipShadows=w.clipShadows,I.clippingPlanes=w.clippingPlanes,I.clipIntersection=w.clipIntersection,I.displacementMap=w.displacementMap,I.displacementScale=w.displacementScale,I.displacementBias=w.displacementBias,I.wireframeLinewidth=w.wireframeLinewidth,I.linewidth=w.linewidth,A.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(A.matrixWorld),I.nearDistance=C,I.farDistance=N),I}function _(y,M,w,A,C){if(y.visible===!1)return;if(y.layers.test(M.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&C===ir)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,y.matrixWorld);const I=e.update(y),b=y.material;if(Array.isArray(b)){const T=I.groups;for(let B=0,R=T.length;B<R;B++){const F=T[B],U=b[F.materialIndex];if(U&&U.visible){const Z=p(y,I,U,A,w.near,w.far,C);r.renderBufferDirect(w,null,I,Z,y,F)}}}else if(b.visible){const T=p(y,I,b,A,w.near,w.far,C);r.renderBufferDirect(w,null,I,T,y,null)}}const z=y.children;for(let I=0,b=z.length;I<b;I++)_(z[I],M,w,A,C)}}function Ux(r,e,t){const n=t.isWebGL2;function i(){let D=!1;const re=new We;let te=null;const Ce=new We(0,0,0,0);return{setMask:function(xe){te!==xe&&!D&&(r.colorMask(xe,xe,xe,xe),te=xe)},setLocked:function(xe){D=xe},setClear:function(xe,Ie,ue,Pe,Ze){Ze===!0&&(xe*=Pe,Ie*=Pe,ue*=Pe),re.set(xe,Ie,ue,Pe),Ce.equals(re)===!1&&(r.clearColor(xe,Ie,ue,Pe),Ce.copy(re))},reset:function(){D=!1,te=null,Ce.set(-1,0,0,0)}}}function s(){let D=!1,re=null,te=null,Ce=null;return{setTest:function(xe){xe?K(2929):he(2929)},setMask:function(xe){re!==xe&&!D&&(r.depthMask(xe),re=xe)},setFunc:function(xe){if(te!==xe){if(xe)switch(xe){case lf:r.depthFunc(512);break;case cf:r.depthFunc(519);break;case uf:r.depthFunc(513);break;case Po:r.depthFunc(515);break;case hf:r.depthFunc(514);break;case ff:r.depthFunc(518);break;case df:r.depthFunc(516);break;case pf:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);te=xe}},setLocked:function(xe){D=xe},setClear:function(xe){Ce!==xe&&(r.clearDepth(xe),Ce=xe)},reset:function(){D=!1,re=null,te=null,Ce=null}}}function o(){let D=!1,re=null,te=null,Ce=null,xe=null,Ie=null,ue=null,Pe=null,Ze=null;return{setTest:function(Xe){D||(Xe?K(2960):he(2960))},setMask:function(Xe){re!==Xe&&!D&&(r.stencilMask(Xe),re=Xe)},setFunc:function(Xe,Qt,Kt){(te!==Xe||Ce!==Qt||xe!==Kt)&&(r.stencilFunc(Xe,Qt,Kt),te=Xe,Ce=Qt,xe=Kt)},setOp:function(Xe,Qt,Kt){(Ie!==Xe||ue!==Qt||Pe!==Kt)&&(r.stencilOp(Xe,Qt,Kt),Ie=Xe,ue=Qt,Pe=Kt)},setLocked:function(Xe){D=Xe},setClear:function(Xe){Ze!==Xe&&(r.clearStencil(Xe),Ze=Xe)},reset:function(){D=!1,re=null,te=null,Ce=null,xe=null,Ie=null,ue=null,Pe=null,Ze=null}}}const a=new i,l=new s,c=new o;let u={},h={},f=null,d=!1,m=null,x=null,v=null,g=null,p=null,_=null,y=null,M=!1,w=null,A=null,C=null,N=null,z=null;const I=r.getParameter(35661);let b=!1,T=0;const B=r.getParameter(7938);B.indexOf("WebGL")!==-1?(T=parseFloat(/^WebGL (\d)/.exec(B)[1]),b=T>=1):B.indexOf("OpenGL ES")!==-1&&(T=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),b=T>=2);let R=null,F={};const U=r.getParameter(3088),Z=r.getParameter(2978),ee=new We().fromArray(U),V=new We().fromArray(Z);function W(D,re,te){const Ce=new Uint8Array(4),xe=r.createTexture();r.bindTexture(D,xe),r.texParameteri(D,10241,9728),r.texParameteri(D,10240,9728);for(let Ie=0;Ie<te;Ie++)r.texImage2D(re+Ie,0,6408,1,1,0,6408,5121,Ce);return xe}const ne={};ne[3553]=W(3553,3553,1),ne[34067]=W(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),K(2929),l.setFunc(Po),Ue(!1),k(yl),K(2884),ge(vn);function K(D){u[D]!==!0&&(r.enable(D),u[D]=!0)}function he(D){u[D]!==!1&&(r.disable(D),u[D]=!1)}function be(D,re){return h[D]!==re?(r.bindFramebuffer(D,re),h[D]=re,n&&(D===36009&&(h[36160]=re),D===36160&&(h[36009]=re)),!0):!1}function Y(D){return f!==D?(r.useProgram(D),f=D,!0):!1}const we={[oi]:32774,[$h]:32778,[jh]:32779};if(n)we[Sl]=32775,we[Tl]=32776;else{const D=e.get("EXT_blend_minmax");D!==null&&(we[Sl]=D.MIN_EXT,we[Tl]=D.MAX_EXT)}const de={[Qh]:0,[Kh]:1,[ef]:768,[El]:770,[af]:776,[sf]:774,[nf]:772,[tf]:769,[Al]:771,[of]:775,[rf]:773};function ge(D,re,te,Ce,xe,Ie,ue,Pe){if(D===vn){d===!0&&(he(3042),d=!1);return}if(d===!1&&(K(3042),d=!0),D!==Zh){if(D!==m||Pe!==M){if((x!==oi||p!==oi)&&(r.blendEquation(32774),x=oi,p=oi),Pe)switch(D){case rr:r.blendFuncSeparate(1,771,1,771);break;case Ml:r.blendFunc(1,1);break;case bl:r.blendFuncSeparate(0,0,769,771);break;case wl:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case rr:r.blendFuncSeparate(770,771,1,771);break;case Ml:r.blendFunc(770,1);break;case bl:r.blendFunc(0,769);break;case wl:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}v=null,g=null,_=null,y=null,m=D,M=Pe}return}xe=xe||re,Ie=Ie||te,ue=ue||Ce,(re!==x||xe!==p)&&(r.blendEquationSeparate(we[re],we[xe]),x=re,p=xe),(te!==v||Ce!==g||Ie!==_||ue!==y)&&(r.blendFuncSeparate(de[te],de[Ce],de[Ie],de[ue]),v=te,g=Ce,_=Ie,y=ue),m=D,M=null}function ye(D,re){D.side===si?he(2884):K(2884);let te=D.side===at;re&&(te=!te),Ue(te),D.blending===rr&&D.transparent===!1?ge(vn):ge(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),l.setFunc(D.depthFunc),l.setTest(D.depthTest),l.setMask(D.depthWrite),a.setMask(D.colorWrite);const Ce=D.stencilWrite;c.setTest(Ce),Ce&&(c.setMask(D.stencilWriteMask),c.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),c.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),ie(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?K(32926):he(32926)}function Ue(D){w!==D&&(D?r.frontFace(2304):r.frontFace(2305),w=D)}function k(D){D!==Xh?(K(2884),D!==A&&(D===yl?r.cullFace(1029):D===Yh?r.cullFace(1028):r.cullFace(1032))):he(2884),A=D}function $(D){D!==C&&(b&&r.lineWidth(D),C=D)}function ie(D,re,te){D?(K(32823),(N!==re||z!==te)&&(r.polygonOffset(re,te),N=re,z=te)):he(32823)}function fe(D){D?K(3089):he(3089)}function ce(D){D===void 0&&(D=33984+I-1),R!==D&&(r.activeTexture(D),R=D)}function Ae(D,re){R===null&&ce();let te=F[R];te===void 0&&(te={type:void 0,texture:void 0},F[R]=te),(te.type!==D||te.texture!==re)&&(r.bindTexture(D,re||ne[D]),te.type=D,te.texture=re)}function Le(){const D=F[R];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function De(){try{r.compressedTexImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function $e(){try{r.texSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function P(){try{r.texSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function L(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function J(){try{r.texStorage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Q(){try{r.texStorage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ae(){try{r.texImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function j(){try{r.texImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Se(D){ee.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),ee.copy(D))}function _e(D){V.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),V.copy(D))}function se(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},R=null,F={},h={},f=null,d=!1,m=null,x=null,v=null,g=null,p=null,_=null,y=null,M=!1,w=null,A=null,C=null,N=null,z=null,ee.set(0,0,r.canvas.width,r.canvas.height),V.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:K,disable:he,bindFramebuffer:be,useProgram:Y,setBlending:ge,setMaterial:ye,setFlipSided:Ue,setCullFace:k,setLineWidth:$,setPolygonOffset:ie,setScissorTest:fe,activeTexture:ce,bindTexture:Ae,unbindTexture:Le,compressedTexImage2D:De,texImage2D:ae,texImage3D:j,texStorage2D:J,texStorage3D:Q,texSubImage2D:$e,texSubImage3D:P,compressedTexSubImage2D:L,scissor:Se,viewport:_e,reset:se}}function Ox(r,e,t,n,i,s,o){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,m=new WeakMap;let x,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(P){}function g(P,L){return v?new OffscreenCanvas(P,L):es("canvas")}function p(P,L,J,Q){let ae=1;if((P.width>Q||P.height>Q)&&(ae=Q/Math.max(P.width,P.height)),ae<1||L===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const j=L?Vl:Math.floor,Se=j(ae*P.width),_e=j(ae*P.height);x===void 0&&(x=g(Se,_e));const se=J?g(Se,_e):x;return se.width=Se,se.height=_e,se.getContext("2d").drawImage(P,0,0,Se,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Se+"x"+_e+")."),se}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function _(P){return Oo(P.width)&&Oo(P.height)}function y(P){return a?!1:P.wrapS!==wt||P.wrapT!==wt||P.minFilter!==lt&&P.minFilter!==nt}function M(P,L){return P.generateMipmaps&&L&&P.minFilter!==lt&&P.minFilter!==nt}function w(P){r.generateMipmap(P)}function A(P,L,J,Q){if(a===!1)return L;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let ae=L;return L===6403&&(J===5126&&(ae=33326),J===5131&&(ae=33325),J===5121&&(ae=33321)),L===6407&&(J===5126&&(ae=34837),J===5131&&(ae=34843),J===5121&&(ae=32849)),L===6408&&(J===5126&&(ae=34836),J===5131&&(ae=34842),J===5121&&(ae=Q===pi?35907:32856)),(ae===33325||ae===33326||ae===34842||ae===34836)&&e.get("EXT_color_buffer_float"),ae}function C(P,L,J){return M(P,J)===!0||P.isFramebufferTexture&&P.minFilter!==lt&&P.minFilter!==nt?Math.log2(Math.max(L.width,L.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?L.mipmaps.length:1}function N(P){return P===lt||P===Do||P===Fo?9728:9729}function z(P){const L=P.target;L.removeEventListener("dispose",z),b(L),L.isVideoTexture&&m.delete(L),o.memory.textures--}function I(P){const L=P.target;L.removeEventListener("dispose",I),T(L)}function b(P){const L=n.get(P);L.__webglInit!==void 0&&(r.deleteTexture(L.__webglTexture),n.remove(P))}function T(P){const L=P.texture,J=n.get(P),Q=n.get(L);if(!!P){if(Q.__webglTexture!==void 0&&(r.deleteTexture(Q.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let ae=0;ae<6;ae++)r.deleteFramebuffer(J.__webglFramebuffer[ae]),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer[ae]);else r.deleteFramebuffer(J.__webglFramebuffer),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&r.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer&&r.deleteRenderbuffer(J.__webglColorRenderbuffer),J.__webglDepthRenderbuffer&&r.deleteRenderbuffer(J.__webglDepthRenderbuffer);if(P.isWebGLMultipleRenderTargets)for(let ae=0,j=L.length;ae<j;ae++){const Se=n.get(L[ae]);Se.__webglTexture&&(r.deleteTexture(Se.__webglTexture),o.memory.textures--),n.remove(L[ae])}n.remove(L),n.remove(P)}}let B=0;function R(){B=0}function F(){const P=B;return P>=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),B+=1,P}function U(P,L){const J=n.get(P);if(P.isVideoTexture&&ce(P),P.version>0&&J.__version!==P.version){const Q=P.image;if(Q===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(J,P,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,J.__webglTexture)}function Z(P,L){const J=n.get(P);if(P.version>0&&J.__version!==P.version){be(J,P,L);return}t.activeTexture(33984+L),t.bindTexture(35866,J.__webglTexture)}function ee(P,L){const J=n.get(P);if(P.version>0&&J.__version!==P.version){be(J,P,L);return}t.activeTexture(33984+L),t.bindTexture(32879,J.__webglTexture)}function V(P,L){const J=n.get(P);if(P.version>0&&J.__version!==P.version){Y(J,P,L);return}t.activeTexture(33984+L),t.bindTexture(34067,J.__webglTexture)}const W={[Yr]:10497,[wt]:33071,[Jr]:33648},ne={[lt]:9728,[Do]:9984,[Fo]:9986,[nt]:9729,[Ll]:9985,[ci]:9987};function K(P,L,J){if(J?(r.texParameteri(P,10242,W[L.wrapS]),r.texParameteri(P,10243,W[L.wrapT]),(P===32879||P===35866)&&r.texParameteri(P,32882,W[L.wrapR]),r.texParameteri(P,10240,ne[L.magFilter]),r.texParameteri(P,10241,ne[L.minFilter])):(r.texParameteri(P,10242,33071),r.texParameteri(P,10243,33071),(P===32879||P===35866)&&r.texParameteri(P,32882,33071),(L.wrapS!==wt||L.wrapT!==wt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,10240,N(L.magFilter)),r.texParameteri(P,10241,N(L.minFilter)),L.minFilter!==lt&&L.minFilter!==nt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Q=e.get("EXT_texture_filter_anisotropic");if(L.type===sn&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===On&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||n.get(L).__currentAnisotropy)&&(r.texParameterf(P,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,i.getMaxAnisotropy())),n.get(L).__currentAnisotropy=L.anisotropy)}}function he(P,L){P.__webglInit===void 0&&(P.__webglInit=!0,L.addEventListener("dispose",z),P.__webglTexture=r.createTexture(),o.memory.textures++)}function be(P,L,J){let Q=3553;L.isDataTexture2DArray&&(Q=35866),L.isDataTexture3D&&(Q=32879),he(P,L),t.activeTexture(33984+J),t.bindTexture(Q,P.__webglTexture),r.pixelStorei(37440,L.flipY),r.pixelStorei(37441,L.premultiplyAlpha),r.pixelStorei(3317,L.unpackAlignment),r.pixelStorei(37443,0);const ae=y(L)&&_(L.image)===!1,j=p(L.image,ae,!1,u),Se=_(j)||a,_e=s.convert(L.format);let se=s.convert(L.type),D=A(L.internalFormat,_e,se,L.encoding);K(Q,L,Se);let re;const te=L.mipmaps,Ce=a&&L.isVideoTexture!==!0,xe=P.__version===void 0,Ie=C(L,j,Se);if(L.isDepthTexture)D=6402,a?L.type===sn?D=36012:L.type===Zr?D=33190:L.type===ui?D=35056:D=33189:L.type===sn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Gn&&D===6402&&L.type!==or&&L.type!==Zr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=or,se=s.convert(L.type)),L.format===hi&&D===6402&&(D=34041,L.type!==ui&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=ui,se=s.convert(L.type))),Ce&&xe?t.texStorage2D(3553,1,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(L.isDataTexture)if(te.length>0&&Se){Ce&&xe&&t.texStorage2D(3553,Ie,D,te[0].width,te[0].height);for(let ue=0,Pe=te.length;ue<Pe;ue++)re=te[ue],Ce?t.texSubImage2D(3553,0,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data);L.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Ie,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,j.width,j.height,_e,se,j.data)):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,j.data);else if(L.isCompressedTexture){Ce&&xe&&t.texStorage2D(3553,Ie,D,te[0].width,te[0].height);for(let ue=0,Pe=te.length;ue<Pe;ue++)re=te[ue],L.format!==ft&&L.format!==Hn?_e!==null?Ce?t.compressedTexSubImage2D(3553,ue,0,0,re.width,re.height,_e,re.data):t.compressedTexImage2D(3553,ue,D,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ce?t.texSubImage2D(3553,ue,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data)}else if(L.isDataTexture2DArray)Ce?(xe&&t.texStorage3D(35866,Ie,D,j.width,j.height,j.depth),t.texSubImage3D(35866,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(35866,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(L.isDataTexture3D)Ce?(xe&&t.texStorage3D(32879,Ie,D,j.width,j.height,j.depth),t.texSubImage3D(32879,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(32879,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(L.isFramebufferTexture)Ce&&xe?t.texStorage2D(3553,Ie,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(te.length>0&&Se){Ce&&xe&&t.texStorage2D(3553,Ie,D,te[0].width,te[0].height);for(let ue=0,Pe=te.length;ue<Pe;ue++)re=te[ue],Ce?t.texSubImage2D(3553,ue,0,0,_e,se,re):t.texImage2D(3553,ue,D,_e,se,re);L.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Ie,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,_e,se,j)):t.texImage2D(3553,0,D,_e,se,j);M(L,Se)&&w(Q),P.__version=L.version,L.onUpdate&&L.onUpdate(L)}function Y(P,L,J){if(L.image.length!==6)return;he(P,L),t.activeTexture(33984+J),t.bindTexture(34067,P.__webglTexture),r.pixelStorei(37440,L.flipY),r.pixelStorei(37441,L.premultiplyAlpha),r.pixelStorei(3317,L.unpackAlignment),r.pixelStorei(37443,0);const Q=L&&(L.isCompressedTexture||L.image[0].isCompressedTexture),ae=L.image[0]&&L.image[0].isDataTexture,j=[];for(let ue=0;ue<6;ue++)!Q&&!ae?j[ue]=p(L.image[ue],!1,!0,c):j[ue]=ae?L.image[ue].image:L.image[ue];const Se=j[0],_e=_(Se)||a,se=s.convert(L.format),D=s.convert(L.type),re=A(L.internalFormat,se,D,L.encoding),te=a&&L.isVideoTexture!==!0,Ce=P.__version===void 0;let xe=C(L,Se,_e);K(34067,L,_e);let Ie;if(Q){te&&Ce&&t.texStorage2D(34067,xe,re,Se.width,Se.height);for(let ue=0;ue<6;ue++){Ie=j[ue].mipmaps;for(let Pe=0;Pe<Ie.length;Pe++){const Ze=Ie[Pe];L.format!==ft&&L.format!==Hn?se!==null?te?t.compressedTexSubImage2D(34069+ue,Pe,0,0,Ze.width,Ze.height,se,Ze.data):t.compressedTexImage2D(34069+ue,Pe,re,Ze.width,Ze.height,0,Ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):te?t.texSubImage2D(34069+ue,Pe,0,0,Ze.width,Ze.height,se,D,Ze.data):t.texImage2D(34069+ue,Pe,re,Ze.width,Ze.height,0,se,D,Ze.data)}}}else{Ie=L.mipmaps,te&&Ce&&(Ie.length>0&&xe++,t.texStorage2D(34067,xe,re,j[0].width,j[0].height));for(let ue=0;ue<6;ue++)if(ae){te?t.texSubImage2D(34069+ue,0,0,0,j[ue].width,j[ue].height,se,D,j[ue].data):t.texImage2D(34069+ue,0,re,j[ue].width,j[ue].height,0,se,D,j[ue].data);for(let Pe=0;Pe<Ie.length;Pe++){const Xe=Ie[Pe].image[ue].image;te?t.texSubImage2D(34069+ue,Pe+1,0,0,Xe.width,Xe.height,se,D,Xe.data):t.texImage2D(34069+ue,Pe+1,re,Xe.width,Xe.height,0,se,D,Xe.data)}}else{te?t.texSubImage2D(34069+ue,0,0,0,se,D,j[ue]):t.texImage2D(34069+ue,0,re,se,D,j[ue]);for(let Pe=0;Pe<Ie.length;Pe++){const Ze=Ie[Pe];te?t.texSubImage2D(34069+ue,Pe+1,0,0,se,D,Ze.image[ue]):t.texImage2D(34069+ue,Pe+1,re,se,D,Ze.image[ue])}}}M(L,_e)&&w(34067),P.__version=L.version,L.onUpdate&&L.onUpdate(L)}function we(P,L,J,Q,ae){const j=s.convert(J.format),Se=s.convert(J.type),_e=A(J.internalFormat,j,Se,J.encoding);n.get(L).__hasExternalTextures||(ae===32879||ae===35866?t.texImage3D(ae,0,_e,L.width,L.height,L.depth,0,j,Se,null):t.texImage2D(ae,0,_e,L.width,L.height,0,j,Se,null)),t.bindFramebuffer(36160,P),L.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,Q,ae,n.get(J).__webglTexture,0,fe(L)):r.framebufferTexture2D(36160,Q,ae,n.get(J).__webglTexture,0),t.bindFramebuffer(36160,null)}function de(P,L,J){if(r.bindRenderbuffer(36161,P),L.depthBuffer&&!L.stencilBuffer){let Q=33189;if(J||L.useRenderToTexture){const ae=L.depthTexture;ae&&ae.isDepthTexture&&(ae.type===sn?Q=36012:ae.type===Zr&&(Q=33190));const j=fe(L);L.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,j,Q,L.width,L.height):r.renderbufferStorageMultisample(36161,j,Q,L.width,L.height)}else r.renderbufferStorage(36161,Q,L.width,L.height);r.framebufferRenderbuffer(36160,36096,36161,P)}else if(L.depthBuffer&&L.stencilBuffer){const Q=fe(L);J&&L.useRenderbuffer?r.renderbufferStorageMultisample(36161,Q,35056,L.width,L.height):L.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,Q,35056,L.width,L.height):r.renderbufferStorage(36161,34041,L.width,L.height),r.framebufferRenderbuffer(36160,33306,36161,P)}else{const Q=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,ae=s.convert(Q.format),j=s.convert(Q.type),Se=A(Q.internalFormat,ae,j,Q.encoding),_e=fe(L);J&&L.useRenderbuffer?r.renderbufferStorageMultisample(36161,_e,Se,L.width,L.height):L.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,_e,Se,L.width,L.height):r.renderbufferStorage(36161,Se,L.width,L.height)}r.bindRenderbuffer(36161,null)}function ge(P,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,P),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),U(L.depthTexture,0);const Q=n.get(L.depthTexture).__webglTexture,ae=fe(L);if(L.depthTexture.format===Gn)L.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,Q,0,ae):r.framebufferTexture2D(36160,36096,3553,Q,0);else if(L.depthTexture.format===hi)L.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,Q,0,ae):r.framebufferTexture2D(36160,33306,3553,Q,0);else throw new Error("Unknown depthTexture format")}function ye(P){const L=n.get(P),J=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture&&!L.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");ge(L.__webglFramebuffer,P)}else if(J){L.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)t.bindFramebuffer(36160,L.__webglFramebuffer[Q]),L.__webglDepthbuffer[Q]=r.createRenderbuffer(),de(L.__webglDepthbuffer[Q],P,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),de(L.__webglDepthbuffer,P,!1);t.bindFramebuffer(36160,null)}function Ue(P,L,J){const Q=n.get(P);L!==void 0&&we(Q.__webglFramebuffer,P,P.texture,36064,3553),J!==void 0&&ye(P)}function k(P){const L=P.texture,J=n.get(P),Q=n.get(L);P.addEventListener("dispose",I),P.isWebGLMultipleRenderTargets!==!0&&(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=L.version,o.memory.textures++);const ae=P.isWebGLCubeRenderTarget===!0,j=P.isWebGLMultipleRenderTargets===!0,Se=L.isDataTexture3D||L.isDataTexture2DArray,_e=_(P)||a;if(a&&L.format===Hn&&(L.type===sn||L.type===On)&&(L.format=ft,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ae){J.__webglFramebuffer=[];for(let se=0;se<6;se++)J.__webglFramebuffer[se]=r.createFramebuffer()}else if(J.__webglFramebuffer=r.createFramebuffer(),j)if(i.drawBuffers){const se=P.texture;for(let D=0,re=se.length;D<re;D++){const te=n.get(se[D]);te.__webglTexture===void 0&&(te.__webglTexture=r.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(P.useRenderbuffer)if(a){J.__webglMultisampledFramebuffer=r.createFramebuffer(),J.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,J.__webglColorRenderbuffer);const se=s.convert(L.format),D=s.convert(L.type),re=A(L.internalFormat,se,D,L.encoding),te=fe(P);r.renderbufferStorageMultisample(36161,te,re,P.width,P.height),t.bindFramebuffer(36160,J.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,J.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),P.depthBuffer&&(J.__webglDepthRenderbuffer=r.createRenderbuffer(),de(J.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ae){t.bindTexture(34067,Q.__webglTexture),K(34067,L,_e);for(let se=0;se<6;se++)we(J.__webglFramebuffer[se],P,L,36064,34069+se);M(L,_e)&&w(34067),t.unbindTexture()}else if(j){const se=P.texture;for(let D=0,re=se.length;D<re;D++){const te=se[D],Ce=n.get(te);t.bindTexture(3553,Ce.__webglTexture),K(3553,te,_e),we(J.__webglFramebuffer,P,te,36064+D,3553),M(te,_e)&&w(3553)}t.unbindTexture()}else{let se=3553;Se&&(a?se=L.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(se,Q.__webglTexture),K(se,L,_e),we(J.__webglFramebuffer,P,L,36064,se),M(L,_e)&&w(se),t.unbindTexture()}P.depthBuffer&&ye(P)}function $(P){const L=_(P)||a,J=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let Q=0,ae=J.length;Q<ae;Q++){const j=J[Q];if(M(j,L)){const Se=P.isWebGLCubeRenderTarget?34067:3553,_e=n.get(j).__webglTexture;t.bindTexture(Se,_e),w(Se),t.unbindTexture()}}}function ie(P){if(P.useRenderbuffer)if(a){const L=P.width,J=P.height;let Q=16384;const ae=[36064],j=P.stencilBuffer?33306:36096;P.depthBuffer&&ae.push(j),P.ignoreDepthForMultisampleCopy||(P.depthBuffer&&(Q|=256),P.stencilBuffer&&(Q|=1024));const Se=n.get(P);t.bindFramebuffer(36008,Se.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Se.__webglFramebuffer),P.ignoreDepthForMultisampleCopy&&(r.invalidateFramebuffer(36008,[j]),r.invalidateFramebuffer(36009,[j])),r.blitFramebuffer(0,0,L,J,0,0,L,J,Q,9728),r.invalidateFramebuffer(36008,ae),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Se.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function fe(P){return a&&(P.useRenderbuffer||P.useRenderToTexture)?Math.min(h,P.samples):0}function ce(P){const L=o.render.frame;m.get(P)!==L&&(m.set(P,L),P.update())}let Ae=!1,Le=!1;function De(P,L){P&&P.isWebGLRenderTarget&&(Ae===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ae=!0),P=P.texture),U(P,L)}function $e(P,L){P&&P.isWebGLCubeRenderTarget&&(Le===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Le=!0),P=P.texture),V(P,L)}this.allocateTextureUnit=F,this.resetTextureUnits=R,this.setTexture2D=U,this.setTexture2DArray=Z,this.setTexture3D=ee,this.setTextureCube=V,this.rebindTextures=Ue,this.setupRenderTarget=k,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=we,this.safeSetTexture2D=De,this.safeSetTextureCube=$e}function Hx(r,e,t){const n=t.isWebGL2;function i(s){let o;if(s===rn)return 5121;if(s===Tf)return 32819;if(s===Ef)return 32820;if(s===Af)return 33635;if(s===bf)return 5120;if(s===wf)return 5122;if(s===or)return 5123;if(s===Sf)return 5124;if(s===Zr)return 5125;if(s===sn)return 5126;if(s===On)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Lf)return 6406;if(s===Hn)return 6407;if(s===ft)return 6408;if(s===Cf)return 6409;if(s===Rf)return 6410;if(s===Gn)return 6402;if(s===hi)return 34041;if(s===Pf)return 6403;if(s===If)return 36244;if(s===Df)return 33319;if(s===Ff)return 33320;if(s===Bf)return 36248;if(s===zf)return 36249;if(s===Cl||s===Rl||s===Pl||s===Il)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Cl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Rl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Pl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Il)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Dl||s===Fl||s===Bl||s===zl)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Dl)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Fl)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Bl)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===zl)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Nf)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===Nl||s===Ul)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===Nl)return o.COMPRESSED_RGB8_ETC2;if(s===Ul)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===Uf||s===Of||s===Hf||s===Gf||s===Vf||s===kf||s===Wf||s===qf||s===Xf||s===Yf||s===Jf||s===Zf||s===$f||s===jf||s===Kf||s===ed||s===td||s===nd||s===id||s===rd||s===sd||s===od||s===ad||s===ld||s===cd||s===ud||s===hd||s===fd)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===Qf)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===ui)return n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class Nc extends Mt{constructor(e=[]){super(),this.cameras=e}}Nc.prototype.isArrayCamera=!0;class Ni extends ke{constructor(){super(),this.type="Group"}}Ni.prototype.isGroup=!0;const Gx={type:"move"};class wa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ni,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 Ni,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new S,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new S),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ni,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new S,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new S),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}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Gx))),c&&e.hand){o=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,n);if(c.joints[x.jointName]===void 0){const p=new Ni;p.matrixAutoUpdate=!1,p.visible=!1,c.joints[x.jointName]=p,c.add(p)}const g=c.joints[x.jointName];v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=v.radius),g.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;c.inputState.pinching&&f>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-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),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));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}}class Sa extends dt{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:Gn,u!==Gn&&u!==hi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Gn&&(n=or),n===void 0&&u===hi&&(n=ui),super(null,i,s,o,a,l,u,n,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:lt,this.minFilter=l!==void 0?l:lt,this.flipY=!1,this.generateMipmaps=!1}}Sa.prototype.isDepthTexture=!0;class Vx extends Vn{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor";const l=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,u=null,h=null,f=null,d=!1,m=null;const x=t.getContextAttributes();let v=null,g=null;const p=[],_=new Map,y=new Mt;y.layers.enable(1),y.viewport=new We;const M=new Mt;M.layers.enable(2),M.viewport=new We;const w=[y,M],A=new Nc;A.layers.enable(1),A.layers.enable(2);let C=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let W=p[V];return W===void 0&&(W=new wa,p[V]=W),W.getTargetRaySpace()},this.getControllerGrip=function(V){let W=p[V];return W===void 0&&(W=new wa,p[V]=W),W.getGripSpace()},this.getHand=function(V){let W=p[V];return W===void 0&&(W=new wa,p[V]=W),W.getHandSpace()};function z(V){const W=_.get(V.inputSource);W&&W.dispatchEvent({type:V.type,data:V.inputSource})}function I(){_.forEach(function(V,W){V.disconnect(W)}),_.clear(),C=null,N=null,e.setRenderTarget(v),f=null,h=null,u=null,i=null,g=null,ee.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=function(V){return er(this,null,function*(){if(i=V,i!==null){if(v=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",I),i.addEventListener("inputsourceschange",b),x.xrCompatible!==!0&&(yield t.makeXRCompatible()),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const W={antialias:i.renderState.layers===void 0?x.antialias:!0,alpha:x.alpha,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,W),i.updateRenderState({baseLayer:f}),g=new zt(f.framebufferWidth,f.framebufferHeight,{format:ft,type:rn,encoding:e.outputEncoding})}else{d=x.antialias;let W=null,ne=null,K=null;x.depth&&(K=x.stencil?35056:33190,W=x.stencil?hi:Gn,ne=x.stencil?ui:or);const he={colorFormat:x.alpha||d?32856:32849,depthFormat:K,scaleFactor:s};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(he),i.updateRenderState({layers:[h]}),d?g=new Go(h.textureWidth,h.textureHeight,{format:ft,type:rn,depthTexture:new Sa(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,useRenderToTexture:l,encoding:e.outputEncoding}):g=new zt(h.textureWidth,h.textureHeight,{format:x.alpha?ft:Hn,type:rn,depthTexture:new Sa(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,encoding:e.outputEncoding})}this.setFoveation(1),o=yield i.requestReferenceSpace(a),ee.setContext(i),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})};function b(V){const W=i.inputSources;for(let ne=0;ne<p.length;ne++)_.set(W[ne],p[ne]);for(let ne=0;ne<V.removed.length;ne++){const K=V.removed[ne],he=_.get(K);he&&(he.dispatchEvent({type:"disconnected",data:K}),_.delete(K))}for(let ne=0;ne<V.added.length;ne++){const K=V.added[ne],he=_.get(K);he&&he.dispatchEvent({type:"connected",data:K})}}const T=new S,B=new S;function R(V,W,ne){T.setFromMatrixPosition(W.matrixWorld),B.setFromMatrixPosition(ne.matrixWorld);const K=T.distanceTo(B),he=W.projectionMatrix.elements,be=ne.projectionMatrix.elements,Y=he[14]/(he[10]-1),we=he[14]/(he[10]+1),de=(he[9]+1)/he[5],ge=(he[9]-1)/he[5],ye=(he[8]-1)/he[0],Ue=(be[8]+1)/be[0],k=Y*ye,$=Y*Ue,ie=K/(-ye+Ue),fe=ie*-ye;W.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(fe),V.translateZ(ie),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const ce=Y+ie,Ae=we+ie,Le=k-fe,De=$+(K-fe),$e=de*we/Ae*ce,P=ge*we/Ae*ce;V.projectionMatrix.makePerspective(Le,De,$e,P,ce,Ae)}function F(V,W){W===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(W.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;A.near=M.near=y.near=V.near,A.far=M.far=y.far=V.far,(C!==A.near||N!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,N=A.far);const W=V.parent,ne=A.cameras;F(A,W);for(let he=0;he<ne.length;he++)F(ne[he],W);A.matrixWorld.decompose(A.position,A.quaternion,A.scale),V.position.copy(A.position),V.quaternion.copy(A.quaternion),V.scale.copy(A.scale),V.matrix.copy(A.matrix),V.matrixWorld.copy(A.matrixWorld);const K=V.children;for(let he=0,be=K.length;he<be;he++)K[he].updateMatrixWorld(!0);ne.length===2?R(A,y,M):A.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return A},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(V){h!==null&&(h.fixedFoveation=V),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=V)};let U=null;function Z(V,W){if(c=W.getViewerPose(o),m=W,c!==null){const K=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let he=!1;K.length!==A.cameras.length&&(A.cameras.length=0,he=!0);for(let be=0;be<K.length;be++){const Y=K[be];let we=null;if(f!==null)we=f.getViewport(Y);else{const ge=u.getViewSubImage(h,Y);we=ge.viewport,be===0&&(e.setRenderTargetTextures(g,ge.colorTexture,h.ignoreDepthValues?void 0:ge.depthStencilTexture),e.setRenderTarget(g))}const de=w[be];de.matrix.fromArray(Y.transform.matrix),de.projectionMatrix.fromArray(Y.projectionMatrix),de.viewport.set(we.x,we.y,we.width,we.height),be===0&&A.matrix.copy(de.matrix),he===!0&&A.cameras.push(de)}}const ne=i.inputSources;for(let K=0;K<p.length;K++){const he=p[K],be=ne[K];he.update(be,W,o)}U&&U(V,W),m=null}const ee=new nc;ee.setAnimationLoop(Z),this.setAnimationLoop=function(V){U=V},this.dispose=function(){}}}function kx(r){function e(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function t(g,p,_,y,M){p.isMeshBasicMaterial?n(g,p):p.isMeshLambertMaterial?(n(g,p),l(g,p)):p.isMeshToonMaterial?(n(g,p),u(g,p)):p.isMeshPhongMaterial?(n(g,p),c(g,p)):p.isMeshStandardMaterial?(n(g,p),p.isMeshPhysicalMaterial?f(g,p,M):h(g,p)):p.isMeshMatcapMaterial?(n(g,p),d(g,p)):p.isMeshDepthMaterial?(n(g,p),m(g,p)):p.isMeshDistanceMaterial?(n(g,p),x(g,p)):p.isMeshNormalMaterial?(n(g,p),v(g,p)):p.isLineBasicMaterial?(i(g,p),p.isLineDashedMaterial&&s(g,p)):p.isPointsMaterial?o(g,p,_,y):p.isSpriteMaterial?a(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function n(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.specularMap&&(g.specularMap.value=p.specularMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const _=r.get(p).envMap;_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let y;p.map?y=p.map:p.specularMap?y=p.specularMap:p.displacementMap?y=p.displacementMap:p.normalMap?y=p.normalMap:p.bumpMap?y=p.bumpMap:p.roughnessMap?y=p.roughnessMap:p.metalnessMap?y=p.metalnessMap:p.alphaMap?y=p.alphaMap:p.emissiveMap?y=p.emissiveMap:p.clearcoatMap?y=p.clearcoatMap:p.clearcoatNormalMap?y=p.clearcoatNormalMap:p.clearcoatRoughnessMap?y=p.clearcoatRoughnessMap:p.specularIntensityMap?y=p.specularIntensityMap:p.specularColorMap?y=p.specularColorMap:p.transmissionMap?y=p.transmissionMap:p.thicknessMap?y=p.thicknessMap:p.sheenColorMap?y=p.sheenColorMap:p.sheenRoughnessMap&&(y=p.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let M;p.aoMap?M=p.aoMap:p.lightMap&&(M=p.lightMap),M!==void 0&&(M.isWebGLRenderTarget&&(M=M.texture),M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uv2Transform.value.copy(M.matrix))}function i(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function s(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function o(g,p,_,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*_,g.scale.value=y*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let M;p.map?M=p.map:p.alphaMap&&(M=p.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uvTransform.value.copy(M.matrix))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let _;p.map?_=p.map:p.alphaMap&&(_=p.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),g.uvTransform.value.copy(_.matrix))}function l(g,p){p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap)}function c(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===at&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===at&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===at&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===at&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function h(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===at&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===at&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),r.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,_){h(g,p),g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap)),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===at&&g.clearcoatNormalScale.value.negate())),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap)}function d(g,p){p.matcap&&(g.matcap.value=p.matcap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===at&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===at&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function m(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function x(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}function v(g,p){p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===at&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===at&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function Wx(){const r=es("canvas");return r.style.display="block",r}function qe(r={}){const e=r.canvas!==void 0?r.canvas:Wx(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,s=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",u=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let h=null,f=null;const d=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Vt,this.physicallyCorrectLights=!1,this.toneMapping=_n,this.toneMappingExposure=1;const x=this;let v=!1,g=0,p=0,_=null,y=-1,M=null;const w=new We,A=new We;let C=null,N=e.width,z=e.height,I=1,b=null,T=null;const B=new We(0,0,N,z),R=new We(0,0,N,z);let F=!1;const U=[],Z=new _s;let ee=!1,V=!1,W=null;const ne=new pe,K=new S,he={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function be(){return _===null?I:1}let Y=t;function we(E,O){for(let G=0;G<E.length;G++){const H=E[G],X=e.getContext(H,O);if(X!==null)return X}return null}try{const E={alpha:n,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Gt}`),e.addEventListener("webglcontextlost",Ce,!1),e.addEventListener("webglcontextrestored",xe,!1),Y===null){const O=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&O.shift(),Y=we(O,E),Y===null)throw we(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Y.getShaderPrecisionFormat===void 0&&(Y.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let de,ge,ye,Ue,k,$,ie,fe,ce,Ae,Le,De,$e,P,L,J,Q,ae,j,Se,_e,se,D;function re(){de=new ug(Y),ge=new ig(Y,de,r),de.init(ge),se=new Hx(Y,de,ge),ye=new Ux(Y,de,ge),U[0]=1029,Ue=new dg(Y),k=new Ax,$=new Ox(Y,de,ye,k,ge,se,Ue),ie=new sg(x),fe=new cg(x),ce=new sp(Y,ge),D=new tg(Y,de,ce,ge),Ae=new hg(Y,ce,Ue,D),Le=new xg(Y,Ae,ce,Ue),j=new gg(Y,ge,$),J=new rg(k),De=new Ex(x,ie,fe,de,ge,D,J),$e=new kx(k),P=new Cx,L=new Bx(de,ge),ae=new eg(x,ie,ye,Le,a),Q=new zc(x,Le,ge),Se=new ng(Y,de,Ue,ge),_e=new fg(Y,de,Ue,ge),Ue.programs=De.programs,x.capabilities=ge,x.extensions=de,x.properties=k,x.renderLists=P,x.shadowMap=Q,x.state=ye,x.info=Ue}re();const te=new Vx(x,Y);this.xr=te,this.getContext=function(){return Y},this.getContextAttributes=function(){return Y.getContextAttributes()},this.forceContextLoss=function(){const E=de.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=de.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(E){E!==void 0&&(I=E,this.setSize(N,z,!1))},this.getSize=function(E){return E.set(N,z)},this.setSize=function(E,O,G){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}N=E,z=O,e.width=Math.floor(E*I),e.height=Math.floor(O*I),G!==!1&&(e.style.width=E+"px",e.style.height=O+"px"),this.setViewport(0,0,E,O)},this.getDrawingBufferSize=function(E){return E.set(N*I,z*I).floor()},this.setDrawingBufferSize=function(E,O,G){N=E,z=O,I=G,e.width=Math.floor(E*G),e.height=Math.floor(O*G),this.setViewport(0,0,E,O)},this.getCurrentViewport=function(E){return E.copy(w)},this.getViewport=function(E){return E.copy(B)},this.setViewport=function(E,O,G,H){E.isVector4?B.set(E.x,E.y,E.z,E.w):B.set(E,O,G,H),ye.viewport(w.copy(B).multiplyScalar(I).floor())},this.getScissor=function(E){return E.copy(R)},this.setScissor=function(E,O,G,H){E.isVector4?R.set(E.x,E.y,E.z,E.w):R.set(E,O,G,H),ye.scissor(A.copy(R).multiplyScalar(I).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(E){ye.setScissorTest(F=E)},this.setOpaqueSort=function(E){b=E},this.setTransparentSort=function(E){T=E},this.getClearColor=function(E){return E.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(E,O,G){let H=0;(E===void 0||E)&&(H|=16384),(O===void 0||O)&&(H|=256),(G===void 0||G)&&(H|=1024),Y.clear(H)},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(){e.removeEventListener("webglcontextlost",Ce,!1),e.removeEventListener("webglcontextrestored",xe,!1),P.dispose(),L.dispose(),k.dispose(),ie.dispose(),fe.dispose(),Le.dispose(),D.dispose(),De.dispose(),te.dispose(),te.removeEventListener("sessionstart",Qt),te.removeEventListener("sessionend",Kt),W&&(W.dispose(),W=null),ni.stop()};function Ce(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const E=Ue.autoReset,O=Q.enabled,G=Q.autoUpdate,H=Q.needsUpdate,X=Q.type;re(),Ue.autoReset=E,Q.enabled=O,Q.autoUpdate=G,Q.needsUpdate=H,Q.type=X}function Ie(E){const O=E.target;O.removeEventListener("dispose",Ie),ue(O)}function ue(E){Pe(E),k.remove(E)}function Pe(E){const O=k.get(E).programs;O!==void 0&&(O.forEach(function(G){De.releaseProgram(G)}),E.isShaderMaterial&&De.releaseShaderCache(E))}this.renderBufferDirect=function(E,O,G,H,X,Te){O===null&&(O=he);const Re=X.isMesh&&X.matrixWorld.determinant()<0,Fe=fv(E,O,G,H,X);ye.setMaterial(H,Re);let Ee=G.index;const He=G.attributes.position;if(Ee===null){if(He===void 0||He.count===0)return}else if(Ee.count===0)return;let Be=1;H.wireframe===!0&&(Ee=Ae.getWireframeAttribute(G),Be=2),D.setup(X,H,Fe,G,Ee);let Oe,tt=Se;Ee!==null&&(Oe=ce.get(Ee),tt=_e,tt.setIndex(Oe));const ii=Ee!==null?Ee.count:He.count,Ki=G.drawRange.start*Be,Ve=G.drawRange.count*Be,en=Te!==null?Te.start*Be:0,pt=Te!==null?Te.count*Be:1/0,tn=Math.max(Ki,en),Lo=Math.min(ii,Ki+Ve,en+pt)-1,nn=Math.max(0,Lo-tn+1);if(nn!==0){if(X.isMesh)H.wireframe===!0?(ye.setLineWidth(H.wireframeLinewidth*be()),tt.setMode(1)):tt.setMode(4);else if(X.isLine){let yn=H.linewidth;yn===void 0&&(yn=1),ye.setLineWidth(yn*be()),X.isLineSegments?tt.setMode(1):X.isLineLoop?tt.setMode(2):tt.setMode(3)}else X.isPoints?tt.setMode(0):X.isSprite&&tt.setMode(4);if(X.isInstancedMesh)tt.renderInstances(tn,nn,X.count);else if(G.isInstancedBufferGeometry){const yn=Math.min(G.instanceCount,G._maxInstanceCount);tt.renderInstances(tn,nn,yn)}else tt.render(tn,nn)}},this.compile=function(E,O){f=L.get(E),f.init(),m.push(f),E.traverseVisible(function(G){G.isLight&&G.layers.test(O.layers)&&(f.pushLight(G),G.castShadow&&f.pushShadow(G))}),f.setupLights(x.physicallyCorrectLights),E.traverse(function(G){const H=G.material;if(H)if(Array.isArray(H))for(let X=0;X<H.length;X++){const Te=H[X];xl(Te,E,G)}else xl(H,E,G)}),m.pop(),f=null};let Ze=null;function Xe(E){Ze&&Ze(E)}function Qt(){ni.stop()}function Kt(){ni.start()}const ni=new nc;ni.setAnimationLoop(Xe),typeof window!="undefined"&&ni.setContext(window),this.setAnimationLoop=function(E){Ze=E,te.setAnimationLoop(E),E===null?ni.stop():ni.start()},te.addEventListener("sessionstart",Qt),te.addEventListener("sessionend",Kt),this.render=function(E,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;E.autoUpdate===!0&&E.updateMatrixWorld(),O.parent===null&&O.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(O),O=te.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,O,_),f=L.get(E,m.length),f.init(),m.push(f),ne.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Z.setFromProjectionMatrix(ne),V=this.localClippingEnabled,ee=J.init(this.clippingPlanes,V,O),h=P.get(E,d.length),h.init(),d.push(h),Oh(E,O,0,x.sortObjects),h.finish(),x.sortObjects===!0&&h.sort(b,T),ee===!0&&J.beginShadows();const G=f.state.shadowsArray;if(Q.render(G,E,O),ee===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset(),ae.render(h,E),f.setupLights(x.physicallyCorrectLights),O.isArrayCamera){const H=O.cameras;for(let X=0,Te=H.length;X<Te;X++){const Re=H[X];Hh(h,E,Re,Re.viewport)}}else Hh(h,E,O);_!==null&&($.updateMultisampleRenderTarget(_),$.updateRenderTargetMipmap(_)),E.isScene===!0&&E.onAfterRender(x,E,O),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1),D.resetDefaultState(),y=-1,M=null,m.pop(),m.length>0?f=m[m.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Oh(E,O,G,H){if(E.visible===!1)return;if(E.layers.test(O.layers)){if(E.isGroup)G=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(O);else if(E.isLight)f.pushLight(E),E.castShadow&&f.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Z.intersectsSprite(E)){H&&K.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ne);const Re=Le.update(E),Fe=E.material;Fe.visible&&h.push(E,Re,Fe,G,K.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(E.isSkinnedMesh&&E.skeleton.frame!==Ue.render.frame&&(E.skeleton.update(),E.skeleton.frame=Ue.render.frame),!E.frustumCulled||Z.intersectsObject(E))){H&&K.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ne);const Re=Le.update(E),Fe=E.material;if(Array.isArray(Fe)){const Ee=Re.groups;for(let He=0,Be=Ee.length;He<Be;He++){const Oe=Ee[He],tt=Fe[Oe.materialIndex];tt&&tt.visible&&h.push(E,Re,tt,G,K.z,Oe)}}else Fe.visible&&h.push(E,Re,Fe,G,K.z,null)}}const Te=E.children;for(let Re=0,Fe=Te.length;Re<Fe;Re++)Oh(Te[Re],O,G,H)}function Hh(E,O,G,H){const X=E.opaque,Te=E.transmissive,Re=E.transparent;f.setupLightsView(G),Te.length>0&&uv(X,O,G),H&&ye.viewport(w.copy(H)),X.length>0&&Ao(X,O,G),Te.length>0&&Ao(Te,O,G),Re.length>0&&Ao(Re,O,G)}function uv(E,O,G){if(W===null){const Re=o===!0&&ge.isWebGL2===!0?Go:zt;W=new Re(1024,1024,{generateMipmaps:!0,type:se.convert(On)!==null?On:rn,minFilter:ci,magFilter:lt,wrapS:wt,wrapT:wt,useRenderToTexture:de.has("WEBGL_multisampled_render_to_texture")})}const H=x.getRenderTarget();x.setRenderTarget(W),x.clear();const X=x.toneMapping;x.toneMapping=_n,Ao(E,O,G),x.toneMapping=X,$.updateMultisampleRenderTarget(W),$.updateRenderTargetMipmap(W),x.setRenderTarget(H)}function Ao(E,O,G){const H=O.isScene===!0?O.overrideMaterial:null;for(let X=0,Te=E.length;X<Te;X++){const Re=E[X],Fe=Re.object,Ee=Re.geometry,He=H===null?Re.material:H,Be=Re.group;Fe.layers.test(G.layers)&&hv(Fe,O,G,Ee,He,Be)}}function hv(E,O,G,H,X,Te){E.onBeforeRender(x,O,G,H,X,Te),E.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),X.onBeforeRender(x,O,G,H,E,Te),X.transparent===!0&&X.side===si?(X.side=at,X.needsUpdate=!0,x.renderBufferDirect(G,O,H,X,E,Te),X.side=ri,X.needsUpdate=!0,x.renderBufferDirect(G,O,H,X,E,Te),X.side=si):x.renderBufferDirect(G,O,H,X,E,Te),E.onAfterRender(x,O,G,H,X,Te)}function xl(E,O,G){O.isScene!==!0&&(O=he);const H=k.get(E),X=f.state.lights,Te=f.state.shadowsArray,Re=X.state.version,Fe=De.getParameters(E,X.state,Te,O,G),Ee=De.getProgramCacheKey(Fe);let He=H.programs;H.environment=E.isMeshStandardMaterial?O.environment:null,H.fog=O.fog,H.envMap=(E.isMeshStandardMaterial?fe:ie).get(E.envMap||H.environment),He===void 0&&(E.addEventListener("dispose",Ie),He=new Map,H.programs=He);let Be=He.get(Ee);if(Be!==void 0){if(H.currentProgram===Be&&H.lightsStateVersion===Re)return Gh(E,Fe),Be}else Fe.uniforms=De.getUniforms(E),E.onBuild(G,Fe,x),E.onBeforeCompile(Fe,x),Be=De.acquireProgram(Fe,Ee),He.set(Ee,Be),H.uniforms=Fe.uniforms;const Oe=H.uniforms;(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Oe.clippingPlanes=J.uniform),Gh(E,Fe),H.needsLights=pv(E),H.lightsStateVersion=Re,H.needsLights&&(Oe.ambientLightColor.value=X.state.ambient,Oe.lightProbe.value=X.state.probe,Oe.directionalLights.value=X.state.directional,Oe.directionalLightShadows.value=X.state.directionalShadow,Oe.spotLights.value=X.state.spot,Oe.spotLightShadows.value=X.state.spotShadow,Oe.rectAreaLights.value=X.state.rectArea,Oe.ltc_1.value=X.state.rectAreaLTC1,Oe.ltc_2.value=X.state.rectAreaLTC2,Oe.pointLights.value=X.state.point,Oe.pointLightShadows.value=X.state.pointShadow,Oe.hemisphereLights.value=X.state.hemi,Oe.directionalShadowMap.value=X.state.directionalShadowMap,Oe.directionalShadowMatrix.value=X.state.directionalShadowMatrix,Oe.spotShadowMap.value=X.state.spotShadowMap,Oe.spotShadowMatrix.value=X.state.spotShadowMatrix,Oe.pointShadowMap.value=X.state.pointShadowMap,Oe.pointShadowMatrix.value=X.state.pointShadowMatrix);const tt=Be.getUniforms(),ii=In.seqWithValue(tt.seq,Oe);return H.currentProgram=Be,H.uniformsList=ii,Be}function Gh(E,O){const G=k.get(E);G.outputEncoding=O.outputEncoding,G.instancing=O.instancing,G.skinning=O.skinning,G.morphTargets=O.morphTargets,G.morphNormals=O.morphNormals,G.morphTargetsCount=O.morphTargetsCount,G.numClippingPlanes=O.numClippingPlanes,G.numIntersection=O.numClipIntersection,G.vertexAlphas=O.vertexAlphas,G.vertexTangents=O.vertexTangents,G.toneMapping=O.toneMapping}function fv(E,O,G,H,X){O.isScene!==!0&&(O=he),$.resetTextureUnits();const Te=O.fog,Re=H.isMeshStandardMaterial?O.environment:null,Fe=_===null?x.outputEncoding:_.texture.encoding,Ee=(H.isMeshStandardMaterial?fe:ie).get(H.envMap||Re),He=H.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,Be=!!H.normalMap&&!!G.attributes.tangent,Oe=!!G.morphAttributes.position,tt=!!G.morphAttributes.normal,ii=G.morphAttributes.position?G.morphAttributes.position.length:0,Ki=H.toneMapped?x.toneMapping:_n,Ve=k.get(H),en=f.state.lights;if(ee===!0&&(V===!0||E!==M)){const Xt=E===M&&H.id===y;J.setState(H,E,Xt)}let pt=!1;H.version===Ve.__version?(Ve.needsLights&&Ve.lightsStateVersion!==en.state.version||Ve.outputEncoding!==Fe||X.isInstancedMesh&&Ve.instancing===!1||!X.isInstancedMesh&&Ve.instancing===!0||X.isSkinnedMesh&&Ve.skinning===!1||!X.isSkinnedMesh&&Ve.skinning===!0||Ve.envMap!==Ee||H.fog&&Ve.fog!==Te||Ve.numClippingPlanes!==void 0&&(Ve.numClippingPlanes!==J.numPlanes||Ve.numIntersection!==J.numIntersection)||Ve.vertexAlphas!==He||Ve.vertexTangents!==Be||Ve.morphTargets!==Oe||Ve.morphNormals!==tt||Ve.toneMapping!==Ki||ge.isWebGL2===!0&&Ve.morphTargetsCount!==ii)&&(pt=!0):(pt=!0,Ve.__version=H.version);let tn=Ve.currentProgram;pt===!0&&(tn=xl(H,O,X));let Lo=!1,nn=!1,yn=!1;const At=tn.getUniforms(),Hr=Ve.uniforms;if(ye.useProgram(tn.program)&&(Lo=!0,nn=!0,yn=!0),H.id!==y&&(y=H.id,nn=!0),Lo||M!==E){if(At.setValue(Y,"projectionMatrix",E.projectionMatrix),ge.logarithmicDepthBuffer&&At.setValue(Y,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),M!==E&&(M=E,nn=!0,yn=!0),H.isShaderMaterial||H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshStandardMaterial||H.envMap){const Xt=At.map.cameraPosition;Xt!==void 0&&Xt.setValue(Y,K.setFromMatrixPosition(E.matrixWorld))}(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&At.setValue(Y,"isOrthographic",E.isOrthographicCamera===!0),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial||H.isShadowMaterial||X.isSkinnedMesh)&&At.setValue(Y,"viewMatrix",E.matrixWorldInverse)}if(X.isSkinnedMesh){At.setOptional(Y,X,"bindMatrix"),At.setOptional(Y,X,"bindMatrixInverse");const Xt=X.skeleton;Xt&&(ge.floatVertexTextures?(Xt.boneTexture===null&&Xt.computeBoneTexture(),At.setValue(Y,"boneTexture",Xt.boneTexture,$),At.setValue(Y,"boneTextureSize",Xt.boneTextureSize)):At.setOptional(Y,Xt,"boneMatrices"))}return!!G&&(G.morphAttributes.position!==void 0||G.morphAttributes.normal!==void 0)&&j.update(X,G,H,tn),(nn||Ve.receiveShadow!==X.receiveShadow)&&(Ve.receiveShadow=X.receiveShadow,At.setValue(Y,"receiveShadow",X.receiveShadow)),nn&&(At.setValue(Y,"toneMappingExposure",x.toneMappingExposure),Ve.needsLights&&dv(Hr,yn),Te&&H.fog&&$e.refreshFogUniforms(Hr,Te),$e.refreshMaterialUniforms(Hr,H,I,z,W),In.upload(Y,Ve.uniformsList,Hr,$)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(In.upload(Y,Ve.uniformsList,Hr,$),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&At.setValue(Y,"center",X.center),At.setValue(Y,"modelViewMatrix",X.modelViewMatrix),At.setValue(Y,"normalMatrix",X.normalMatrix),At.setValue(Y,"modelMatrix",X.matrixWorld),tn}function dv(E,O){E.ambientLightColor.needsUpdate=O,E.lightProbe.needsUpdate=O,E.directionalLights.needsUpdate=O,E.directionalLightShadows.needsUpdate=O,E.pointLights.needsUpdate=O,E.pointLightShadows.needsUpdate=O,E.spotLights.needsUpdate=O,E.spotLightShadows.needsUpdate=O,E.rectAreaLights.needsUpdate=O,E.hemisphereLights.needsUpdate=O}function pv(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(E,O,G){k.get(E.texture).__webglTexture=O,k.get(E.depthTexture).__webglTexture=G;const H=k.get(E);H.__hasExternalTextures=!0,H.__hasExternalTextures&&(H.__autoAllocateDepthBuffer=G===void 0,H.__autoAllocateDepthBuffer||E.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),E.useRenderToTexture=!1,E.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(E,O){const G=k.get(E);G.__webglFramebuffer=O,G.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(E,O=0,G=0){_=E,g=O,p=G;let H=!0;if(E){const Ee=k.get(E);Ee.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(36160,null),H=!1):Ee.__webglFramebuffer===void 0?$.setupRenderTarget(E):Ee.__hasExternalTextures&&$.rebindTextures(E,k.get(E.texture).__webglTexture,k.get(E.depthTexture).__webglTexture)}let X=null,Te=!1,Re=!1;if(E){const Ee=E.texture;(Ee.isDataTexture3D||Ee.isDataTexture2DArray)&&(Re=!0);const He=k.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(X=He[O],Te=!0):E.useRenderbuffer?X=k.get(E).__webglMultisampledFramebuffer:X=He,w.copy(E.viewport),A.copy(E.scissor),C=E.scissorTest}else w.copy(B).multiplyScalar(I).floor(),A.copy(R).multiplyScalar(I).floor(),C=F;if(ye.bindFramebuffer(36160,X)&&ge.drawBuffers&&H){let Ee=!1;if(E)if(E.isWebGLMultipleRenderTargets){const He=E.texture;if(U.length!==He.length||U[0]!==36064){for(let Be=0,Oe=He.length;Be<Oe;Be++)U[Be]=36064+Be;U.length=He.length,Ee=!0}}else(U.length!==1||U[0]!==36064)&&(U[0]=36064,U.length=1,Ee=!0);else(U.length!==1||U[0]!==1029)&&(U[0]=1029,U.length=1,Ee=!0);Ee&&(ge.isWebGL2?Y.drawBuffers(U):de.get("WEBGL_draw_buffers").drawBuffersWEBGL(U))}if(ye.viewport(w),ye.scissor(A),ye.setScissorTest(C),Te){const Ee=k.get(E.texture);Y.framebufferTexture2D(36160,36064,34069+O,Ee.__webglTexture,G)}else if(Re){const Ee=k.get(E.texture),He=O||0;Y.framebufferTextureLayer(36160,36064,Ee.__webglTexture,G||0,He)}y=-1},this.readRenderTargetPixels=function(E,O,G,H,X,Te,Re){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=k.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Re!==void 0&&(Fe=Fe[Re]),Fe){ye.bindFramebuffer(36160,Fe);try{const Ee=E.texture,He=Ee.format,Be=Ee.type;if(He!==ft&&se.convert(He)!==Y.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Oe=Be===On&&(de.has("EXT_color_buffer_half_float")||ge.isWebGL2&&de.has("EXT_color_buffer_float"));if(Be!==rn&&se.convert(Be)!==Y.getParameter(35738)&&!(Be===sn&&(ge.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!Oe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y.checkFramebufferStatus(36160)===36053?O>=0&&O<=E.width-H&&G>=0&&G<=E.height-X&&Y.readPixels(O,G,H,X,se.convert(He),se.convert(Be),Te):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Ee=_!==null?k.get(_).__webglFramebuffer:null;ye.bindFramebuffer(36160,Ee)}}},this.copyFramebufferToTexture=function(E,O,G=0){if(O.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const H=Math.pow(2,-G),X=Math.floor(O.image.width*H),Te=Math.floor(O.image.height*H);$.setTexture2D(O,0),Y.copyTexSubImage2D(3553,G,0,0,E.x,E.y,X,Te),ye.unbindTexture()},this.copyTextureToTexture=function(E,O,G,H=0){const X=O.image.width,Te=O.image.height,Re=se.convert(G.format),Fe=se.convert(G.type);$.setTexture2D(G,0),Y.pixelStorei(37440,G.flipY),Y.pixelStorei(37441,G.premultiplyAlpha),Y.pixelStorei(3317,G.unpackAlignment),O.isDataTexture?Y.texSubImage2D(3553,H,E.x,E.y,X,Te,Re,Fe,O.image.data):O.isCompressedTexture?Y.compressedTexSubImage2D(3553,H,E.x,E.y,O.mipmaps[0].width,O.mipmaps[0].height,Re,O.mipmaps[0].data):Y.texSubImage2D(3553,H,E.x,E.y,Re,Fe,O.image),H===0&&G.generateMipmaps&&Y.generateMipmap(3553),ye.unbindTexture()},this.copyTextureToTexture3D=function(E,O,G,H,X=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Te=E.max.x-E.min.x+1,Re=E.max.y-E.min.y+1,Fe=E.max.z-E.min.z+1,Ee=se.convert(H.format),He=se.convert(H.type);let Be;if(H.isDataTexture3D)$.setTexture3D(H,0),Be=32879;else if(H.isDataTexture2DArray)$.setTexture2DArray(H,0),Be=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Y.pixelStorei(37440,H.flipY),Y.pixelStorei(37441,H.premultiplyAlpha),Y.pixelStorei(3317,H.unpackAlignment);const Oe=Y.getParameter(3314),tt=Y.getParameter(32878),ii=Y.getParameter(3316),Ki=Y.getParameter(3315),Ve=Y.getParameter(32877),en=G.isCompressedTexture?G.mipmaps[0]:G.image;Y.pixelStorei(3314,en.width),Y.pixelStorei(32878,en.height),Y.pixelStorei(3316,E.min.x),Y.pixelStorei(3315,E.min.y),Y.pixelStorei(32877,E.min.z),G.isDataTexture||G.isDataTexture3D?Y.texSubImage3D(Be,X,O.x,O.y,O.z,Te,Re,Fe,Ee,He,en.data):G.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Y.compressedTexSubImage3D(Be,X,O.x,O.y,O.z,Te,Re,Fe,Ee,en.data)):Y.texSubImage3D(Be,X,O.x,O.y,O.z,Te,Re,Fe,Ee,He,en),Y.pixelStorei(3314,Oe),Y.pixelStorei(32878,tt),Y.pixelStorei(3316,ii),Y.pixelStorei(3315,Ki),Y.pixelStorei(32877,Ve),X===0&&H.generateMipmaps&&Y.generateMipmap(Be),ye.unbindTexture()},this.initTexture=function(E){$.setTexture2D(E,0),ye.unbindTexture()},this.resetState=function(){g=0,p=0,_=null,ye.reset(),D.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}qe.prototype.isWebGLRenderer=!0;class qx extends qe{}qx.prototype.isWebGL1Renderer=!0;class Es{constructor(e,t=25e-5){this.name="",this.color=new le(e),this.density=t}clone(){return new Es(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Es.prototype.isFogExp2=!0;class As{constructor(e,t=1,n=1e3){this.name="",this.color=new le(e),this.near=t,this.far=n}clone(){return new As(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}As.prototype.isFog=!0;class Ta extends ke{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}Ta.prototype.isScene=!0;class Ui{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ar,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Pt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Ui.prototype.isInterleavedBuffer=!0;const it=new S;class Zn{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.applyMatrix4(e),this.setXYZ(t,it.x,it.y,it.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.applyNormalMatrix(e),this.setXYZ(t,it.x,it.y,it.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.transformDirection(e),this.setXYZ(t,it.x,it.y,it.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ze(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Zn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Zn.prototype.isInterleavedBufferAttribute=!0;class Ea extends _t{constructor(e){super(),this.type="SpriteMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}Ea.prototype.isSpriteMaterial=!0;let Oi;const _r=new S,Hi=new S,Gi=new S,Vi=new q,Mr=new q,Uc=new pe,Ls=new S,br=new S,Cs=new S,Oc=new q,Aa=new q,Hc=new q;class La extends ke{constructor(e){if(super(),this.type="Sprite",Oi===void 0){Oi=new ve;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Ui(t,5);Oi.setIndex([0,1,2,0,2,3]),Oi.setAttribute("position",new Zn(n,3,0,!1)),Oi.setAttribute("uv",new Zn(n,2,3,!1))}this.geometry=Oi,this.material=e!==void 0?e:new Ea,this.center=new q(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Hi.setFromMatrixScale(this.matrixWorld),Uc.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Gi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Hi.multiplyScalar(-Gi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;Rs(Ls.set(-.5,-.5,0),Gi,o,Hi,i,s),Rs(br.set(.5,-.5,0),Gi,o,Hi,i,s),Rs(Cs.set(.5,.5,0),Gi,o,Hi,i,s),Oc.set(0,0),Aa.set(1,0),Hc.set(1,1);let a=e.ray.intersectTriangle(Ls,br,Cs,!1,_r);if(a===null&&(Rs(br.set(-.5,.5,0),Gi,o,Hi,i,s),Aa.set(0,1),a=e.ray.intersectTriangle(Ls,Cs,br,!1,_r),a===null))return;const l=e.ray.origin.distanceTo(_r);l<e.near||l>e.far||t.push({distance:l,point:_r.clone(),uv:ct.getUV(_r,Ls,br,Cs,Oc,Aa,Hc,new q),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}La.prototype.isSprite=!0;function Rs(r,e,t,n,i,s){Vi.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Mr.x=s*Vi.x-i*Vi.y,Mr.y=i*Vi.x+s*Vi.y):Mr.copy(Vi),r.copy(e),r.x+=Mr.x,r.y+=Mr.y,r.applyMatrix4(Uc)}const Ps=new S,Gc=new S;class Xx extends null{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Ps.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Ps);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ps.setFromMatrixPosition(e.matrixWorld),Gc.setFromMatrixPosition(this.matrixWorld);const n=Ps.distanceTo(Gc)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}const Vc=new S,kc=new We,Wc=new We,Yx=new S,qc=new pe;class Ca extends xt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new pe,this.bindMatrixInverse=new pe}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new We,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;kc.fromBufferAttribute(i.attributes.skinIndex,e),Wc.fromBufferAttribute(i.attributes.skinWeight,e),Vc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=Wc.getComponent(s);if(o!==0){const a=kc.getComponent(s);qc.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(Yx.copy(Vc).applyMatrix4(qc),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}Ca.prototype.isSkinnedMesh=!0;class Ra extends ke{constructor(){super(),this.type="Bone"}}Ra.prototype.isBone=!0;class ki extends dt{constructor(e=null,t=1,n=1,i,s,o,a,l,c=lt,u=lt,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={data:e,width:t,height:n},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}ki.prototype.isDataTexture=!0;const Xc=new pe,Jx=new pe;class Pa{constructor(e=[],t=[]){this.uuid=Pt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new pe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new pe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:Jx;Xc.multiplyMatrices(a,t[s]),Xc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Pa(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Gl(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ki(t,e,e,ft,sn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Ra),this.bones.push(o),this.boneInverses.push(new pe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Wi extends ze{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}Wi.prototype.isInstancedBufferAttribute=!0;const Yc=new pe,Jc=new pe,Is=[],wr=new xt;class Zc extends xt{constructor(e,t,n){super(e,t),this.instanceMatrix=new Wi(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(wr.geometry=this.geometry,wr.material=this.material,wr.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,Yc),Jc.multiplyMatrices(n,Yc),wr.matrixWorld=Jc,wr.raycast(e,Is);for(let o=0,a=Is.length;o<a;o++){const l=Is[o];l.instanceId=s,l.object=this,t.push(l)}Is.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Wi(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Zc.prototype.isInstancedMesh=!0;class bt extends _t{constructor(e){super(),this.type="LineBasicMaterial",this.color=new le(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}bt.prototype.isLineBasicMaterial=!0;const $c=new S,jc=new S,Qc=new pe,Ia=new Tn,Ds=new wn;class $n extends ke{constructor(e=new ve,t=new bt){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)$c.fromBufferAttribute(t,i-1),jc.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=$c.distanceTo(jc);e.setAttribute("lineDistance",new me(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ds.copy(n.boundingSphere),Ds.applyMatrix4(i),Ds.radius+=s,e.ray.intersectsSphere(Ds)===!1)return;Qc.copy(i).invert(),Ia.copy(e.ray).applyMatrix4(Qc);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new S,u=new S,h=new S,f=new S,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const m=n.index,v=n.attributes.position;if(m!==null){const g=Math.max(0,o.start),p=Math.min(m.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){const M=m.getX(_),w=m.getX(_+1);if(c.fromBufferAttribute(v,M),u.fromBufferAttribute(v,w),Ia.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);C<e.near||C>e.far||t.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),p=Math.min(v.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){if(c.fromBufferAttribute(v,_),u.fromBufferAttribute(v,_+1),Ia.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(f);w<e.near||w>e.far||t.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$n.prototype.isLine=!0;const Kc=new S,eu=new S;class fn extends $n{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Kc.fromBufferAttribute(t,i),eu.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Kc.distanceTo(eu);e.setAttribute("lineDistance",new me(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}fn.prototype.isLineSegments=!0;class tu extends $n{constructor(e,t){super(e,t),this.type="LineLoop"}}tu.prototype.isLineLoop=!0;class qi extends _t{constructor(e){super(),this.type="PointsMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}}qi.prototype.isPointsMaterial=!0;const nu=new pe,Da=new Tn,Fs=new wn,Bs=new S;class zs extends ke{constructor(e=new ve,t=new qi){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Fs.copy(n.boundingSphere),Fs.applyMatrix4(i),Fs.radius+=s,e.ray.intersectsSphere(Fs)===!1)return;nu.copy(i).invert(),Da.copy(e.ray).applyMatrix4(nu);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){const c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let m=f,x=d;m<x;m++){const v=c.getX(m);Bs.fromBufferAttribute(h,v),iu(Bs,v,l,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let m=f,x=d;m<x;m++)Bs.fromBufferAttribute(h,m),iu(Bs,m,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}zs.prototype.isPoints=!0;function iu(r,e,t,n,i,s,o){const a=Da.distanceSqToPoint(r);if(a<t){const l=new S;Da.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Zx extends dt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.format=a!==void 0?a:Hn,this.minFilter=o!==void 0?o:nt,this.magFilter=s!==void 0?s:nt,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Zx.prototype.isVideoTexture=!0;class $x extends dt{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=lt,this.minFilter=lt,this.generateMipmaps=!1,this.needsUpdate=!0}}$x.prototype.isFramebufferTexture=!0;class ru extends dt{constructor(e,t,n,i,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}ru.prototype.isCompressedTexture=!0;class jx extends dt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.needsUpdate=!0}}jx.prototype.isCanvasTexture=!0;class Ns extends ve{constructor(e=1,t=8,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new S,u=new q;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const d=n+h/t*i;c.x=e*Math.cos(d),c.y=e*Math.sin(d),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new me(o,3)),this.setAttribute("normal",new me(a,3)),this.setAttribute("uv",new me(l,2))}static fromJSON(e){return new Ns(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xi extends ve{constructor(e=1,t=1,n=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],f=[],d=[];let m=0;const x=[],v=n/2;let g=0;p(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new me(h,3)),this.setAttribute("normal",new me(f,3)),this.setAttribute("uv",new me(d,2));function p(){const y=new S,M=new S;let w=0;const A=(t-e)/n;for(let C=0;C<=s;C++){const N=[],z=C/s,I=z*(t-e)+e;for(let b=0;b<=i;b++){const T=b/i,B=T*l+a,R=Math.sin(B),F=Math.cos(B);M.x=I*R,M.y=-z*n+v,M.z=I*F,h.push(M.x,M.y,M.z),y.set(R,A,F).normalize(),f.push(y.x,y.y,y.z),d.push(T,1-z),N.push(m++)}x.push(N)}for(let C=0;C<i;C++)for(let N=0;N<s;N++){const z=x[N][C],I=x[N+1][C],b=x[N+1][C+1],T=x[N][C+1];u.push(z,I,T),u.push(I,b,T),w+=6}c.addGroup(g,w,0),g+=w}function _(y){const M=m,w=new q,A=new S;let C=0;const N=y===!0?e:t,z=y===!0?1:-1;for(let b=1;b<=i;b++)h.push(0,v*z,0),f.push(0,z,0),d.push(.5,.5),m++;const I=m;for(let b=0;b<=i;b++){const B=b/i*l+a,R=Math.cos(B),F=Math.sin(B);A.x=N*F,A.y=v*z,A.z=N*R,h.push(A.x,A.y,A.z),f.push(0,z,0),w.x=R*.5+.5,w.y=F*.5*z+.5,d.push(w.x,w.y),m++}for(let b=0;b<i;b++){const T=M+b,B=I+b;y===!0?u.push(B,B+1,T):u.push(B+1,B,T),C+=3}c.addGroup(g,C,y===!0?1:2),g+=C}}static fromJSON(e){return new Xi(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Us extends Xi{constructor(e=1,t=1,n=8,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Us(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Dn extends ve{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),c(n),u(),this.setAttribute("position",new me(s,3)),this.setAttribute("normal",new me(s.slice(),3)),this.setAttribute("uv",new me(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(p){const _=new S,y=new S,M=new S;for(let w=0;w<t.length;w+=3)d(t[w+0],_),d(t[w+1],y),d(t[w+2],M),l(_,y,M,p)}function l(p,_,y,M){const w=M+1,A=[];for(let C=0;C<=w;C++){A[C]=[];const N=p.clone().lerp(y,C/w),z=_.clone().lerp(y,C/w),I=w-C;for(let b=0;b<=I;b++)b===0&&C===w?A[C][b]=N:A[C][b]=N.clone().lerp(z,b/I)}for(let C=0;C<w;C++)for(let N=0;N<2*(w-C)-1;N++){const z=Math.floor(N/2);N%2===0?(f(A[C][z+1]),f(A[C+1][z]),f(A[C][z])):(f(A[C][z+1]),f(A[C+1][z+1]),f(A[C+1][z]))}}function c(p){const _=new S;for(let y=0;y<s.length;y+=3)_.x=s[y+0],_.y=s[y+1],_.z=s[y+2],_.normalize().multiplyScalar(p),s[y+0]=_.x,s[y+1]=_.y,s[y+2]=_.z}function u(){const p=new S;for(let _=0;_<s.length;_+=3){p.x=s[_+0],p.y=s[_+1],p.z=s[_+2];const y=v(p)/2/Math.PI+.5,M=g(p)/Math.PI+.5;o.push(y,1-M)}m(),h()}function h(){for(let p=0;p<o.length;p+=6){const _=o[p+0],y=o[p+2],M=o[p+4],w=Math.max(_,y,M),A=Math.min(_,y,M);w>.9&&A<.1&&(_<.2&&(o[p+0]+=1),y<.2&&(o[p+2]+=1),M<.2&&(o[p+4]+=1))}}function f(p){s.push(p.x,p.y,p.z)}function d(p,_){const y=p*3;_.x=e[y+0],_.y=e[y+1],_.z=e[y+2]}function m(){const p=new S,_=new S,y=new S,M=new S,w=new q,A=new q,C=new q;for(let N=0,z=0;N<s.length;N+=9,z+=6){p.set(s[N+0],s[N+1],s[N+2]),_.set(s[N+3],s[N+4],s[N+5]),y.set(s[N+6],s[N+7],s[N+8]),w.set(o[z+0],o[z+1]),A.set(o[z+2],o[z+3]),C.set(o[z+4],o[z+5]),M.copy(p).add(_).add(y).divideScalar(3);const I=v(M);x(w,z+0,p,I),x(A,z+2,_,I),x(C,z+4,y,I)}}function x(p,_,y,M){M<0&&p.x===1&&(o[_]=p.x-1),y.x===0&&y.z===0&&(o[_]=M/2/Math.PI+.5)}function v(p){return Math.atan2(p.z,-p.x)}function g(p){return Math.atan2(-p.y,Math.sqrt(p.x*p.x+p.z*p.z))}}static fromJSON(e){return new Dn(e.vertices,e.indices,e.radius,e.details)}}class Os extends Dn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Os(e.radius,e.detail)}}const Hs=new S,Gs=new S,Fa=new S,Vs=new ct;class su extends ve{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(kn*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},d=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:v,c:g}=Vs;if(x.fromBufferAttribute(a,c[0]),v.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),Vs.getNormal(Fa),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let p=0;p<3;p++){const _=(p+1)%3,y=h[p],M=h[_],w=Vs[u[p]],A=Vs[u[_]],C=`${y}_${M}`,N=`${M}_${y}`;N in f&&f[N]?(Fa.dot(f[N].normal)<=s&&(d.push(w.x,w.y,w.z),d.push(A.x,A.y,A.z)),f[N]=null):C in f||(f[C]={index0:c[p],index1:c[_],normal:Fa.clone()})}}for(const m in f)if(f[m]){const{index0:x,index1:v}=f[m];Hs.fromBufferAttribute(a,x),Gs.fromBufferAttribute(a,v),d.push(Hs.x,Hs.y,Hs.z),d.push(Gs.x,Gs.y,Gs.z)}this.setAttribute("position",new me(d,3))}}}class Ot{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new q:new S);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new S,i=[],s=[],o=[],a=new S,l=new pe;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new S)}s[0]=new S,o[0]=new S;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),f<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(vt(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(vt(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class ks extends Ot{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const n=t||new q,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}ks.prototype.isEllipseCurve=!0;class ou extends ks{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.type="ArcCurve"}}ou.prototype.isArcCurve=!0;function Ba(){let r=0,e=0,t=0,n=0;function i(s,o,a,l){r=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,i(o,a,f,d)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Ws=new S,za=new Ba,Na=new Ba,Ua=new Ba;class au extends Ot{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new S){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(Ws.subVectors(i[0],i[1]).add(i[0]),c=Ws);const h=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Ws.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Ws),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),d),x=Math.pow(h.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(u),d);x<1e-4&&(x=1),m<1e-4&&(m=x),v<1e-4&&(v=x),za.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,x,v),Na.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,x,v),Ua.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,x,v)}else this.curveType==="catmullrom"&&(za.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Na.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),Ua.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return n.set(za.calc(l),Na.calc(l),Ua.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new S().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}au.prototype.isCatmullRomCurve3=!0;function lu(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*r+t}function Qx(r,e){const t=1-r;return t*t*e}function Kx(r,e){return 2*(1-r)*r*e}function e0(r,e){return r*r*e}function Sr(r,e,t,n){return Qx(r,e)+Kx(r,t)+e0(r,n)}function t0(r,e){const t=1-r;return t*t*t*e}function n0(r,e){const t=1-r;return 3*t*t*r*e}function i0(r,e){return 3*(1-r)*r*r*e}function r0(r,e){return r*r*r*e}function Tr(r,e,t,n,i){return t0(r,e)+n0(r,t)+i0(r,n)+r0(r,i)}class Oa extends Ot{constructor(e=new q,t=new q,n=new q,i=new q){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new q){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Tr(e,i.x,s.x,o.x,a.x),Tr(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}Oa.prototype.isCubicBezierCurve=!0;class cu extends Ot{constructor(e=new S,t=new S,n=new S,i=new S){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Tr(e,i.x,s.x,o.x,a.x),Tr(e,i.y,s.y,o.y,a.y),Tr(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}cu.prototype.isCubicBezierCurve3=!0;class qs extends Ot{constructor(e=new q,t=new q){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new q){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new q;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}qs.prototype.isLineCurve=!0;class s0 extends Ot{constructor(e=new S,t=new S){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new S){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ha extends Ot{constructor(e=new q,t=new q,n=new q){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new q){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Sr(e,i.x,s.x,o.x),Sr(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Ha.prototype.isQuadraticBezierCurve=!0;class Ga extends Ot{constructor(e=new S,t=new S,n=new S){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Sr(e,i.x,s.x,o.x),Sr(e,i.y,s.y,o.y),Sr(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Ga.prototype.isQuadraticBezierCurve3=!0;class Va extends Ot{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new q){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(lu(a,l.x,c.x,u.x,h.x),lu(a,l.y,c.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new q().fromArray(i))}return this}}Va.prototype.isSplineCurve=!0;var ka=Object.freeze({__proto__:null,ArcCurve:ou,CatmullRomCurve3:au,CubicBezierCurve:Oa,CubicBezierCurve3:cu,EllipseCurve:ks,LineCurve:qs,LineCurve3:s0,QuadraticBezierCurve:Ha,QuadraticBezierCurve3:Ga,SplineCurve:Va});class o0 extends Ot{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new qs(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new ka[i.type]().fromJSON(i))}return this}}class Xs extends o0{constructor(e){super(),this.type="Path",this.currentPoint=new q,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new qs(this.currentPoint.clone(),new q(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Ha(this.currentPoint.clone(),new q(e,t),new q(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new Oa(this.currentPoint.clone(),new q(e,t),new q(n,i),new q(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Va(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,o,a,l),this}absellipse(e,t,n,i,s,o,a,l){const c=new ks(e,t,n,i,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class dn extends Xs{constructor(e){super(e),this.uuid=Pt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Xs().fromJSON(i))}return this}}const a0={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=uu(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(n&&(s=f0(r,e,s,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(let m=t;m<i;m+=t)h=r[m],f=r[m+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return Er(s,o,t,a,l,d),o}};function uu(r,e,t,n,i){let s,o;if(i===w0(r,e,t,n)>0)for(s=e;s<t;s+=n)o=du(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=du(s,r[s],r[s+1],o);return o&&Ys(o,o.next)&&(Lr(o),o=o.next),o}function Fn(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Ys(t,t.next)||Qe(t.prev,t,t.next)===0)){if(Lr(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Er(r,e,t,n,i,s,o){if(!r)return;!o&&s&&x0(r,n,i,s);let a=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?c0(r,n,i,s):l0(r)){e.push(l.i/t),e.push(r.i/t),e.push(c.i/t),Lr(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=u0(Fn(r),e,t),Er(r,e,t,n,i,s,2)):o===2&&h0(r,e,t,n,i,s):Er(Fn(r),e,t,n,i,s,1);break}}}function l0(r){const e=r.prev,t=r,n=r.next;if(Qe(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(Yi(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Qe(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function c0(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Qe(i,s,o)>=0)return!1;const a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,c=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,u=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,h=Wa(a,l,e,t,n),f=Wa(c,u,e,t,n);let d=r.prevZ,m=r.nextZ;for(;d&&d.z>=h&&m&&m.z<=f;){if(d!==r.prev&&d!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0||(d=d.prevZ,m!==r.prev&&m!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Qe(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==r.prev&&d!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==r.prev&&m!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&Qe(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function u0(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Ys(i,s)&&hu(i,n,n.next,s)&&Ar(i,s)&&Ar(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),Lr(n),Lr(n.next),n=r=s),n=n.next}while(n!==r);return Fn(n)}function h0(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&_0(o,a)){let l=fu(o,a);o=Fn(o,o.next),l=Fn(l,l.next),Er(o,e,t,n,i,s),Er(l,e,t,n,i,s);return}a=a.next}o=o.next}while(o!==r)}function f0(r,e,t,n){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=uu(r,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(v0(c));for(i.sort(d0),s=0;s<i.length;s++)p0(i[s],t),t=Fn(t,t.next);return t}function d0(r,e){return r.x-e.x}function p0(r,e){if(e=m0(r,e),e){const t=fu(e,r);Fn(e,e.next),Fn(t,t.next)}}function m0(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s){if(s=f,f===n){if(i===t.y)return t;if(i===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,c=o.y;let u=1/0,h;t=o;do n>=t.x&&t.x>=l&&n!==t.x&&Yi(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),Ar(t,r)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&g0(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function g0(r,e){return Qe(r.prev,r,e.prev)<0&&Qe(e.next,r,r.next)<0}function x0(r,e,t,n){let i=r;do i.z===null&&(i.z=Wa(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,y0(i)}function y0(r){let e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function Wa(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function v0(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Yi(r,e,t,n,i,s,o,a){return(i-o)*(e-a)-(r-o)*(s-a)>=0&&(r-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(i-o)*(n-a)>=0}function _0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!M0(r,e)&&(Ar(r,e)&&Ar(e,r)&&b0(r,e)&&(Qe(r.prev,r,e.prev)||Qe(r,e.prev,e))||Ys(r,e)&&Qe(r.prev,r,r.next)>0&&Qe(e.prev,e,e.next)>0)}function Qe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Ys(r,e){return r.x===e.x&&r.y===e.y}function hu(r,e,t,n){const i=Zs(Qe(r,e,t)),s=Zs(Qe(r,e,n)),o=Zs(Qe(t,n,r)),a=Zs(Qe(t,n,e));return!!(i!==s&&o!==a||i===0&&Js(r,t,e)||s===0&&Js(r,n,e)||o===0&&Js(t,r,n)||a===0&&Js(t,e,n))}function Js(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Zs(r){return r>0?1:r<0?-1:0}function M0(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&hu(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ar(r,e){return Qe(r.prev,r,r.next)<0?Qe(r,e,r.next)>=0&&Qe(r,r.prev,e)>=0:Qe(r,e,r.prev)<0||Qe(r,r.next,e)<0}function b0(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function fu(r,e){const t=new qa(r.i,r.x,r.y),n=new qa(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function du(r,e,t,n){const i=new qa(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Lr(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function qa(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function w0(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class pn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return pn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];pu(e),mu(n,e);let o=e.length;t.forEach(pu);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,mu(n,t[l]);const a=a0.triangulate(n,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function pu(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function mu(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Bn extends ve{constructor(e=new dn([new q(.5,.5),new q(-.5,.5),new q(-.5,-.5),new q(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new me(i,3)),this.setAttribute("uv",new me(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1;let h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,p=t.UVGenerator!==void 0?t.UVGenerator:S0;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let _,y=!1,M,w,A,C;g&&(_=g.getSpacedPoints(u),y=!0,f=!1,M=g.computeFrenetFrames(u,!1),w=new S,A=new S,C=new S),f||(v=0,d=0,m=0,x=0);const N=a.extractPoints(c);let z=N.shape;const I=N.holes;if(!pn.isClockWise(z)){z=z.reverse();for(let k=0,$=I.length;k<$;k++){const ie=I[k];pn.isClockWise(ie)&&(I[k]=ie.reverse())}}const T=pn.triangulateShape(z,I),B=z;for(let k=0,$=I.length;k<$;k++){const ie=I[k];z=z.concat(ie)}function R(k,$,ie){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().multiplyScalar(ie).add(k)}const F=z.length,U=T.length;function Z(k,$,ie){let fe,ce,Ae;const Le=k.x-$.x,De=k.y-$.y,$e=ie.x-k.x,P=ie.y-k.y,L=Le*Le+De*De,J=Le*P-De*$e;if(Math.abs(J)>Number.EPSILON){const Q=Math.sqrt(L),ae=Math.sqrt($e*$e+P*P),j=$.x-De/Q,Se=$.y+Le/Q,_e=ie.x-P/ae,se=ie.y+$e/ae,D=((_e-j)*P-(se-Se)*$e)/(Le*P-De*$e);fe=j+Le*D-k.x,ce=Se+De*D-k.y;const re=fe*fe+ce*ce;if(re<=2)return new q(fe,ce);Ae=Math.sqrt(re/2)}else{let Q=!1;Le>Number.EPSILON?$e>Number.EPSILON&&(Q=!0):Le<-Number.EPSILON?$e<-Number.EPSILON&&(Q=!0):Math.sign(De)===Math.sign(P)&&(Q=!0),Q?(fe=-De,ce=Le,Ae=Math.sqrt(L)):(fe=Le,ce=De,Ae=Math.sqrt(L/2))}return new q(fe/Ae,ce/Ae)}const ee=[];for(let k=0,$=B.length,ie=$-1,fe=k+1;k<$;k++,ie++,fe++)ie===$&&(ie=0),fe===$&&(fe=0),ee[k]=Z(B[k],B[ie],B[fe]);const V=[];let W,ne=ee.concat();for(let k=0,$=I.length;k<$;k++){const ie=I[k];W=[];for(let fe=0,ce=ie.length,Ae=ce-1,Le=fe+1;fe<ce;fe++,Ae++,Le++)Ae===ce&&(Ae=0),Le===ce&&(Le=0),W[fe]=Z(ie[fe],ie[Ae],ie[Le]);V.push(W),ne=ne.concat(W)}for(let k=0;k<v;k++){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+x;for(let ce=0,Ae=B.length;ce<Ae;ce++){const Le=R(B[ce],ee[ce],fe);we(Le.x,Le.y,-ie)}for(let ce=0,Ae=I.length;ce<Ae;ce++){const Le=I[ce];W=V[ce];for(let De=0,$e=Le.length;De<$e;De++){const P=R(Le[De],W[De],fe);we(P.x,P.y,-ie)}}}const K=m+x;for(let k=0;k<F;k++){const $=f?R(z[k],ne[k],K):z[k];y?(A.copy(M.normals[0]).multiplyScalar($.x),w.copy(M.binormals[0]).multiplyScalar($.y),C.copy(_[0]).add(A).add(w),we(C.x,C.y,C.z)):we($.x,$.y,0)}for(let k=1;k<=u;k++)for(let $=0;$<F;$++){const ie=f?R(z[$],ne[$],K):z[$];y?(A.copy(M.normals[k]).multiplyScalar(ie.x),w.copy(M.binormals[k]).multiplyScalar(ie.y),C.copy(_[k]).add(A).add(w),we(C.x,C.y,C.z)):we(ie.x,ie.y,h/u*k)}for(let k=v-1;k>=0;k--){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+x;for(let ce=0,Ae=B.length;ce<Ae;ce++){const Le=R(B[ce],ee[ce],fe);we(Le.x,Le.y,h+ie)}for(let ce=0,Ae=I.length;ce<Ae;ce++){const Le=I[ce];W=V[ce];for(let De=0,$e=Le.length;De<$e;De++){const P=R(Le[De],W[De],fe);y?we(P.x,P.y+_[u-1].y,_[u-1].x+ie):we(P.x,P.y,h+ie)}}}he(),be();function he(){const k=i.length/3;if(f){let $=0,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];de(ce[2]+ie,ce[1]+ie,ce[0]+ie)}$=u+v*2,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];de(ce[0]+ie,ce[1]+ie,ce[2]+ie)}}else{for(let $=0;$<U;$++){const ie=T[$];de(ie[2],ie[1],ie[0])}for(let $=0;$<U;$++){const ie=T[$];de(ie[0]+F*u,ie[1]+F*u,ie[2]+F*u)}}n.addGroup(k,i.length/3-k,0)}function be(){const k=i.length/3;let $=0;Y(B,$),$+=B.length;for(let ie=0,fe=I.length;ie<fe;ie++){const ce=I[ie];Y(ce,$),$+=ce.length}n.addGroup(k,i.length/3-k,1)}function Y(k,$){let ie=k.length;for(;--ie>=0;){const fe=ie;let ce=ie-1;ce<0&&(ce=k.length-1);for(let Ae=0,Le=u+v*2;Ae<Le;Ae++){const De=F*Ae,$e=F*(Ae+1),P=$+fe+De,L=$+ce+De,J=$+ce+$e,Q=$+fe+$e;ge(P,L,J,Q)}}}function we(k,$,ie){l.push(k),l.push($),l.push(ie)}function de(k,$,ie){ye(k),ye($),ye(ie);const fe=i.length/3,ce=p.generateTopUV(n,i,fe-3,fe-2,fe-1);Ue(ce[0]),Ue(ce[1]),Ue(ce[2])}function ge(k,$,ie,fe){ye(k),ye($),ye(fe),ye($),ye(ie),ye(fe);const ce=i.length/3,Ae=p.generateSideWallUV(n,i,ce-6,ce-3,ce-2,ce-1);Ue(Ae[0]),Ue(Ae[1]),Ue(Ae[3]),Ue(Ae[1]),Ue(Ae[2]),Ue(Ae[3])}function ye(k){i.push(l[k*3+0]),i.push(l[k*3+1]),i.push(l[k*3+2])}function Ue(k){s.push(k.x),s.push(k.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return T0(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ka[i.type]().fromJSON(i)),new Bn(n,e.options)}}const S0={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new q(s,o),new q(a,l),new q(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],h=e[n*3+2],f=e[i*3],d=e[i*3+1],m=e[i*3+2],x=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new q(o,1-l),new q(c,1-h),new q(f,1-m),new q(x,1-g)]:[new q(a,1-l),new q(u,1-h),new q(d,1-m),new q(v,1-g)]}};function T0(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class $s extends Dn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new $s(e.radius,e.detail)}}class js extends ve{constructor(e=[new q(0,.5),new q(.5,0),new q(0,-.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=vt(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new S,f=new q,d=new S,m=new S,x=new S;let v=0,g=0;for(let p=0;p<=e.length-1;p++)switch(p){case 0:v=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-v,d.z=g*0,x.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:v=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-v,d.z=g*0,m.copy(d),d.x+=x.x,d.y+=x.y,d.z+=x.z,d.normalize(),l.push(d.x,d.y,d.z),x.copy(m)}for(let p=0;p<=t;p++){const _=n+p*u*i,y=Math.sin(_),M=Math.cos(_);for(let w=0;w<=e.length-1;w++){h.x=e[w].x*y,h.y=e[w].y,h.z=e[w].x*M,o.push(h.x,h.y,h.z),f.x=p/t,f.y=w/(e.length-1),a.push(f.x,f.y);const A=l[3*w+0]*y,C=l[3*w+1],N=l[3*w+0]*M;c.push(A,C,N)}}for(let p=0;p<t;p++)for(let _=0;_<e.length-1;_++){const y=_+p*e.length,M=y,w=y+e.length,A=y+e.length+1,C=y+1;s.push(M,w,C),s.push(w,A,C)}this.setIndex(s),this.setAttribute("position",new me(o,3)),this.setAttribute("uv",new me(a,2)),this.setAttribute("normal",new me(c,3))}static fromJSON(e){return new js(e.points,e.segments,e.phiStart,e.phiLength)}}class Cr extends Dn{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Cr(e.radius,e.detail)}}class Qs extends ve{constructor(e=.5,t=1,n=8,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/i,d=new S,m=new q;for(let x=0;x<=i;x++){for(let v=0;v<=n;v++){const g=s+v/n*o;d.x=h*Math.cos(g),d.y=h*Math.sin(g),l.push(d.x,d.y,d.z),c.push(0,0,1),m.x=(d.x/t+1)/2,m.y=(d.y/t+1)/2,u.push(m.x,m.y)}h+=f}for(let x=0;x<i;x++){const v=x*(n+1);for(let g=0;g<n;g++){const p=g+v,_=p,y=p+n+1,M=p+n+2,w=p+1;a.push(_,y,w),a.push(y,M,w)}}this.setIndex(a),this.setAttribute("position",new me(l,3)),this.setAttribute("normal",new me(c,3)),this.setAttribute("uv",new me(u,2))}static fromJSON(e){return new Qs(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Rr extends ve{constructor(e=new dn([new q(0,.5),new q(-.5,-.5),new q(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new me(i,3)),this.setAttribute("normal",new me(s,3)),this.setAttribute("uv",new me(o,2));function c(u){const h=i.length/3,f=u.extractPoints(t);let d=f.shape;const m=f.holes;pn.isClockWise(d)===!1&&(d=d.reverse());for(let v=0,g=m.length;v<g;v++){const p=m[v];pn.isClockWise(p)===!0&&(m[v]=p.reverse())}const x=pn.triangulateShape(d,m);for(let v=0,g=m.length;v<g;v++){const p=m[v];d=d.concat(p)}for(let v=0,g=d.length;v<g;v++){const p=d[v];i.push(p.x,p.y,0),s.push(0,0,1),o.push(p.x,p.y)}for(let v=0,g=x.length;v<g;v++){const p=x[v],_=p[0]+h,y=p[1]+h,M=p[2]+h;n.push(_,y,M),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return E0(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new Rr(n,e.curveSegments)}}function E0(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Pr extends ve{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new S,f=new S,d=[],m=[],x=[],v=[];for(let g=0;g<=n;g++){const p=[],_=g/n;let y=0;g==0&&o==0?y=.5/t:g==n&&l==Math.PI&&(y=-.5/t);for(let M=0;M<=t;M++){const w=M/t;h.x=-e*Math.cos(i+w*s)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+w*s)*Math.sin(o+_*a),m.push(h.x,h.y,h.z),f.copy(h).normalize(),x.push(f.x,f.y,f.z),v.push(w+y,1-_),p.push(c++)}u.push(p)}for(let g=0;g<n;g++)for(let p=0;p<t;p++){const _=u[g][p+1],y=u[g][p],M=u[g+1][p],w=u[g+1][p+1];(g!==0||o>0)&&d.push(_,y,w),(g!==n-1||l<Math.PI)&&d.push(y,M,w)}this.setIndex(d),this.setAttribute("position",new me(m,3)),this.setAttribute("normal",new me(x,3)),this.setAttribute("uv",new me(v,2))}static fromJSON(e){return new Pr(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ks extends Dn{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ks(e.radius,e.detail)}}class eo extends ve{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],u=new S,h=new S,f=new S;for(let d=0;d<=n;d++)for(let m=0;m<=i;m++){const x=m/i*s,v=d/n*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(x),h.y=(e+t*Math.cos(v))*Math.sin(x),h.z=t*Math.sin(v),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(m/i),c.push(d/n)}for(let d=1;d<=n;d++)for(let m=1;m<=i;m++){const x=(i+1)*d+m-1,v=(i+1)*(d-1)+m-1,g=(i+1)*(d-1)+m,p=(i+1)*d+m;o.push(x,v,p),o.push(v,g,p)}this.setIndex(o),this.setAttribute("position",new me(a,3)),this.setAttribute("normal",new me(l,3)),this.setAttribute("uv",new me(c,2))}static fromJSON(e){return new eo(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class to extends ve{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],c=[],u=[],h=new S,f=new S,d=new S,m=new S,x=new S,v=new S,g=new S;for(let _=0;_<=n;++_){const y=_/n*s*Math.PI*2;p(y,s,o,e,d),p(y+.01,s,o,e,m),v.subVectors(m,d),g.addVectors(m,d),x.crossVectors(v,g),g.crossVectors(x,v),x.normalize(),g.normalize();for(let M=0;M<=i;++M){const w=M/i*Math.PI*2,A=-t*Math.cos(w),C=t*Math.sin(w);h.x=d.x+(A*g.x+C*x.x),h.y=d.y+(A*g.y+C*x.y),h.z=d.z+(A*g.z+C*x.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(_/n),u.push(M/i)}}for(let _=1;_<=n;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),w=(i+1)*_+(y-1),A=(i+1)*_+y,C=(i+1)*(_-1)+y;a.push(M,w,C),a.push(w,A,C)}this.setIndex(a),this.setAttribute("position",new me(l,3)),this.setAttribute("normal",new me(c,3)),this.setAttribute("uv",new me(u,2));function p(_,y,M,w,A){const C=Math.cos(_),N=Math.sin(_),z=M/y*_,I=Math.cos(z);A.x=w*(2+I)*.5*C,A.y=w*(2+I)*N*.5,A.z=w*Math.sin(z)*.5}}static fromJSON(e){return new to(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class no extends ve{constructor(e=new Ga(new S(-1,-1,0),new S(-1,1,0),new S(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new S,l=new S,c=new q;let u=new S;const h=[],f=[],d=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new me(h,3)),this.setAttribute("normal",new me(f,3)),this.setAttribute("uv",new me(d,2));function x(){for(let _=0;_<t;_++)v(_);v(s===!1?t:0),p(),g()}function v(_){u=e.getPointAt(_/t,u);const y=o.normals[_],M=o.binormals[_];for(let w=0;w<=i;w++){const A=w/i*Math.PI*2,C=Math.sin(A),N=-Math.cos(A);l.x=N*y.x+C*M.x,l.y=N*y.y+C*M.y,l.z=N*y.z+C*M.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),w=(i+1)*_+(y-1),A=(i+1)*_+y,C=(i+1)*(_-1)+y;m.push(M,w,C),m.push(w,A,C)}}function p(){for(let _=0;_<=t;_++)for(let y=0;y<=i;y++)c.x=_/t,c.y=y/i,d.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new no(new ka[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class gu extends ve{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new S,s=new S;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,d=h.count;for(let m=f,x=f+d;m<x;m+=3)for(let v=0;v<3;v++){const g=a.getX(m+v),p=a.getX(m+(v+1)%3);i.fromBufferAttribute(o,g),s.fromBufferAttribute(o,p),xu(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),xu(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new me(t,3))}}}function xu(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}var yu=Object.freeze({__proto__:null,BoxGeometry:Xn,BoxBufferGeometry:Xn,CircleGeometry:Ns,CircleBufferGeometry:Ns,ConeGeometry:Us,ConeBufferGeometry:Us,CylinderGeometry:Xi,CylinderBufferGeometry:Xi,DodecahedronGeometry:Os,DodecahedronBufferGeometry:Os,EdgesGeometry:su,ExtrudeGeometry:Bn,ExtrudeBufferGeometry:Bn,IcosahedronGeometry:$s,IcosahedronBufferGeometry:$s,LatheGeometry:js,LatheBufferGeometry:js,OctahedronGeometry:Cr,OctahedronBufferGeometry:Cr,PlaneGeometry:gr,PlaneBufferGeometry:gr,PolyhedronGeometry:Dn,PolyhedronBufferGeometry:Dn,RingGeometry:Qs,RingBufferGeometry:Qs,ShapeGeometry:Rr,ShapeBufferGeometry:Rr,SphereGeometry:Pr,SphereBufferGeometry:Pr,TetrahedronGeometry:Ks,TetrahedronBufferGeometry:Ks,TorusGeometry:eo,TorusBufferGeometry:eo,TorusKnotGeometry:to,TorusKnotBufferGeometry:to,TubeGeometry:no,TubeBufferGeometry:no,WireframeGeometry:gu});class vu extends _t{constructor(e){super(),this.type="ShadowMaterial",this.color=new le(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}vu.prototype.isShadowMaterial=!0;class Xa extends _t{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new le(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}Xa.prototype.isMeshStandardMaterial=!0;class _u extends Xa{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new q(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return vt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new le(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}_u.prototype.isMeshPhysicalMaterial=!0;class Mu extends _t{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new le(16777215),this.specular=new le(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}Mu.prototype.isMeshPhongMaterial=!0;class bu extends _t{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new le(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}bu.prototype.isMeshToonMaterial=!0;class wu extends _t{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}wu.prototype.isMeshNormalMaterial=!0;class Su extends _t{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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}}Su.prototype.isMeshLambertMaterial=!0;class Tu extends _t{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new le(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}}Tu.prototype.isMeshMatcapMaterial=!0;class Eu extends bt{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Eu.prototype.isLineDashedMaterial=!0;var A0=Object.freeze({__proto__:null,ShadowMaterial:vu,SpriteMaterial:Ea,RawShaderMaterial:xr,ShaderMaterial:Yt,PointsMaterial:qi,MeshPhysicalMaterial:_u,MeshStandardMaterial:Xa,MeshPhongMaterial:Mu,MeshToonMaterial:bu,MeshNormalMaterial:wu,MeshLambertMaterial:Su,MeshDepthMaterial:Ma,MeshDistanceMaterial:ba,MeshBasicMaterial:An,MeshMatcapMaterial:Tu,LineDashedMaterial:Eu,LineBasicMaterial:bt,Material:_t});const je={arraySlice:function(r,e,t){return je.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){const m=c.times[d]*i;if(!(m<t||m>=n)){h.push(c.times[d]);for(let x=0;x<u;++x)f.push(c.values[d*u+x])}}h.length!==0&&(c.times=je.convertArray(h,c.times.constructor),c.values=je.convertArray(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const m=a.times.length-1;let x;if(s<=a.times[0]){const g=u,p=h-u;x=je.arraySlice(a.values,g,p)}else if(s>=a.times[m]){const g=m*h+u,p=g+h-u;x=je.arraySlice(a.values,g,p)}else{const g=a.createInterpolant(),p=u,_=h-u;g.evaluate(s),x=je.arraySlice(g.resultBuffer,p,_)}l==="quaternion"&&new St().fromArray(x).normalize().conjugate().toArray(x);const v=c.times.length;for(let g=0;g<v;++g){const p=g*d+f;if(l==="quaternion")St.multiplyQuaternionsFlat(c.values,p,x,0,c.values,p);else{const _=d-f*2;for(let y=0;y<_;++y)c.values[p+y]-=x[y]}}}return r.blendMode=Ol,r}};class zn{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}zn.prototype.beforeStart_=zn.prototype.copySampleValue_,zn.prototype.afterEnd_=zn.prototype.copySampleValue_;class L0 extends zn{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:fi,endingEnd:fi}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case di:s=e,a=2*t-n;break;case Qr:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case di:o=e,l=2*n-t;break;case Qr:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,m=(n-t)/(i-t),x=m*m,v=x*m,g=-f*v+2*f*x-f*m,p=(1+f)*v+(-1.5-2*f)*x+(-.5+f)*m+1,_=(-1-d)*v+(1.5+d)*x+.5*m,y=d*v-d*x;for(let M=0;M!==a;++M)s[M]=g*o[u+M]+p*o[c+M]+_*o[l+M]+y*o[h+M];return s}}class Au extends zn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}}class C0 extends zn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class $t{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=je.convertArray(t,this.TimeBufferType),this.values=je.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:je.convertArray(e.times,Array),values:je.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new C0(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Au(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new L0(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case $r:t=this.InterpolantFactoryMethodDiscrete;break;case jr:t=this.InterpolantFactoryMethodLinear;break;case Bo:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return $r;case this.InterpolantFactoryMethodLinear:return jr;case this.InterpolantFactoryMethodSmooth:return Bo}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=je.arraySlice(n,s,o),this.values=je.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&je.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=je.arraySlice(this.times),t=je.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Bo,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*n,f=h-n,d=h+n;for(let m=0;m!==n;++m){const x=t[h+m];if(x!==t[f+m]||x!==t[d+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=je.arraySlice(e,0,o),this.values=je.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=je.arraySlice(this.times,0),t=je.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}$t.prototype.TimeBufferType=Float32Array,$t.prototype.ValueBufferType=Float32Array,$t.prototype.DefaultInterpolation=jr;class Ji extends $t{}Ji.prototype.ValueTypeName="bool",Ji.prototype.ValueBufferType=Array,Ji.prototype.DefaultInterpolation=$r,Ji.prototype.InterpolantFactoryMethodLinear=void 0,Ji.prototype.InterpolantFactoryMethodSmooth=void 0;class Lu extends $t{}Lu.prototype.ValueTypeName="color";class io extends $t{}io.prototype.ValueTypeName="number";class R0 extends zn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)St.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ir extends $t{InterpolantFactoryMethodLinear(e){return new R0(this.times,this.values,this.getValueSize(),e)}}Ir.prototype.ValueTypeName="quaternion",Ir.prototype.DefaultInterpolation=jr,Ir.prototype.InterpolantFactoryMethodSmooth=void 0;class Zi extends $t{}Zi.prototype.ValueTypeName="string",Zi.prototype.ValueBufferType=Array,Zi.prototype.DefaultInterpolation=$r,Zi.prototype.InterpolantFactoryMethodLinear=void 0,Zi.prototype.InterpolantFactoryMethodSmooth=void 0;class ro extends $t{}ro.prototype.ValueTypeName="vector";class so{constructor(e,t=-1,n,i=zo){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Pt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(I0(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push($t.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=je.getKeyframeOrder(l);l=je.sortedArray(l,1,u),c=je.sortedArray(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new io(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,m,x){if(d.length!==0){const v=[],g=[];je.flattenJSON(d,v,g,m),v.length!==0&&x.push(new h(f,v,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let x=0;x<f[m].morphTargets.length;x++)d[f[m].morphTargets[x]]=-1;for(const x in d){const v=[],g=[];for(let p=0;p!==f[m].morphTargets.length;++p){const _=f[m];v.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new io(".morphTargetInfluence["+x+"]",v,g))}l=d.length*(o||1)}else{const d=".bones["+t[h].name+"]";n(ro,d+".position",f,"pos",i),n(Ir,d+".quaternion",f,"rot",i),n(ro,d+".scale",f,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function P0(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return io;case"vector":case"vector2":case"vector3":case"vector4":return ro;case"color":return Lu;case"quaternion":return Ir;case"bool":case"boolean":return Ji;case"string":return Zi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function I0(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=P0(r.type);if(r.times===void 0){const t=[],n=[];je.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const $i={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Cu{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const d=c[h],m=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return m}return null}}}const D0=new Cu;class Nn{constructor(e){this.manager=e!==void 0?e:D0,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const mn={};class gn extends Nn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=$i.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(mn[e]!==void 0){mn[e].push({onLoad:t,onProgress:n,onError:i});return}mn[e]=[],mn[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(o).then(a=>{if(a.status===200||a.status===0){if(a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||a.body.getReader===void 0)return a;const l=mn[e],c=a.body.getReader(),u=a.headers.get("Content-Length"),h=u?parseInt(u):0,f=h!==0;let d=0;const m=new ReadableStream({start(x){v();function v(){c.read().then(({done:g,value:p})=>{if(g)x.close();else{d+=p.byteLength;const _=new ProgressEvent("progress",{lengthComputable:f,loaded:d,total:h});for(let y=0,M=l.length;y<M;y++){const w=l[y];w.onProgress&&w.onProgress(_)}x.enqueue(p),v()}})}}});return new Response(m)}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{switch(this.responseType){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(l=>new DOMParser().parseFromString(l,this.mimeType));case"json":return a.json();default:return a.text()}}).then(a=>{$i.add(e,a);const l=mn[e];delete mn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onLoad&&h.onLoad(a)}}).catch(a=>{const l=mn[e];if(l===void 0)throw this.manager.itemError(e),a;delete mn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onError&&h.onError(a)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class C_ extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=so.parse(e[n]);t.push(i)}return t}}class R_ extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new ru,l=new gn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const d=s.parse(f,!0);o[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},c+=1,c===6&&(d.mipmapCount===1&&(a.minFilter=nt),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let m=0;m<d;m++){o[m]={mipmaps:[]};for(let x=0;x<f.mipmapCount;x++)o[m].mipmaps.push(f.mipmaps[m*f.mipmapCount+x]),o[m].format=f.format,o[m].width=f.width,o[m].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=nt),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class oo extends Nn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$i.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=es("img");function l(){u(),$i.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class F0 extends Nn{constructor(e){super(e)}load(e,t,n,i){const s=new mr,o=new oo(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class B0 extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new ki,a=new gn(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){const c=s.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:wt,o.wrapT=c.wrapT!==void 0?c.wrapT:wt,o.magFilter=c.magFilter!==void 0?c.magFilter:nt,o.minFilter=c.minFilter!==void 0?c.minFilter:nt,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=ci),c.mipmapCount===1&&(o.minFilter=nt),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},n,i),o}}class z0 extends Nn{constructor(e){super(e)}load(e,t,n,i){const s=new dt,o=new oo(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class jt extends ke{constructor(e,t=1){super(),this.type="Light",this.color=new le(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}jt.prototype.isLight=!0;class Ru extends jt{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(ke.DefaultUp),this.updateMatrix(),this.groundColor=new le(t)}copy(e){return jt.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Ru.prototype.isHemisphereLight=!0;const Pu=new pe,Iu=new S,Du=new S;class Ya{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new q(512,512),this.map=null,this.mapPass=null,this.matrix=new pe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new _s,this._frameExtents=new q(1,1),this._viewportCount=1,this._viewports=[new We(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Iu.setFromMatrixPosition(e.matrixWorld),t.position.copy(Iu),Du.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Du),t.updateMatrixWorld(),Pu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Fu extends Ya{constructor(){super(new Mt(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=cr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Fu.prototype.isSpotLightShadow=!0;class Bu extends jt{constructor(e,t,n=0,i=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ke.DefaultUp),this.updateMatrix(),this.target=new ke,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.shadow=new Fu}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Bu.prototype.isSpotLight=!0;const zu=new pe,Dr=new S,Ja=new S;class Nu extends Ya{constructor(){super(new Mt(90,1,.5,500)),this._frameExtents=new q(4,2),this._viewportCount=6,this._viewports=[new We(2,1,1,1),new We(0,1,1,1),new We(3,1,1,1),new We(1,1,1,1),new We(3,0,1,1),new We(1,0,1,1)],this._cubeDirections=[new S(1,0,0),new S(-1,0,0),new S(0,0,1),new S(0,0,-1),new S(0,1,0),new S(0,-1,0)],this._cubeUps=[new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,0,1),new S(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Dr.setFromMatrixPosition(e.matrixWorld),n.position.copy(Dr),Ja.copy(n.position),Ja.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ja),n.updateMatrixWorld(),i.makeTranslation(-Dr.x,-Dr.y,-Dr.z),zu.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zu)}}Nu.prototype.isPointLightShadow=!0;class Uu extends jt{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Nu}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Uu.prototype.isPointLight=!0;class Ou extends Ya{constructor(){super(new Ms(-5,5,5,-5,.5,500))}}Ou.prototype.isDirectionalLightShadow=!0;class Hu extends jt{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ke.DefaultUp),this.updateMatrix(),this.target=new ke,this.shadow=new Ou}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Hu.prototype.isDirectionalLight=!0;class Gu extends jt{constructor(e,t){super(e,t),this.type="AmbientLight"}}Gu.prototype.isAmbientLight=!0;class Vu extends jt{constructor(e,t,n=10,i=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}Vu.prototype.isRectAreaLight=!0;class ku{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new S)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}ku.prototype.isSphericalHarmonics3=!0;class ao extends jt{constructor(e=new ku,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}ao.prototype.isLightProbe=!0;class N0 extends null{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new gn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=new A0[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new le().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new le().setHex(o.value);break;case"v2":i.uniforms[s].value=new q().fromArray(o.value);break;case"v3":i.uniforms[s].value=new S().fromArray(o.value);break;case"v4":i.uniforms[s].value=new We().fromArray(o.value);break;case"m3":i.uniforms[s].value=new mt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new pe().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new q().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new q().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Za{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(n){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Wu extends ve{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}Wu.prototype.isInstancedBufferGeometry=!0;class U0 extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,m){if(t[m]!==void 0)return t[m];const v=d.interleavedBuffers[m],g=s(d,v.buffer),p=gi(v.type,g),_=new Ui(p,v.stride);return _.uuid=v.uuid,t[m]=_,_}function s(d,m){if(n[m]!==void 0)return n[m];const v=d.arrayBuffers[m],g=new Uint32Array(v).buffer;return n[m]=g,g}const o=e.isInstancedBufferGeometry?new Wu:new ve,a=e.data.index;if(a!==void 0){const d=gi(a.type,a.array);o.setIndex(new ze(d,1))}const l=e.data.attributes;for(const d in l){const m=l[d];let x;if(m.isInterleavedBufferAttribute){const v=i(e.data,m.data);x=new Zn(v,m.itemSize,m.offset,m.normalized)}else{const v=gi(m.type,m.array),g=m.isInstancedBufferAttribute?Wi:ze;x=new g(v,m.itemSize,m.normalized)}m.name!==void 0&&(x.name=m.name),m.usage!==void 0&&x.setUsage(m.usage),m.updateRange!==void 0&&(x.updateRange.offset=m.updateRange.offset,x.updateRange.count=m.updateRange.count),o.setAttribute(d,x)}const c=e.data.morphAttributes;if(c)for(const d in c){const m=c[d],x=[];for(let v=0,g=m.length;v<g;v++){const p=m[v];let _;if(p.isInterleavedBufferAttribute){const y=i(e.data,p.data);_=new Zn(y,p.itemSize,p.offset,p.normalized)}else{const y=gi(p.type,p.array);_=new ze(y,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),x.push(_)}o.morphAttributes[d]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,m=h.length;d!==m;++d){const x=h[d];o.addGroup(x.start,x.count,x.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const d=new S;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new wn(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class P_ extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Za.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new gn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}loadAsync(e,t){return er(this,null,function*(){const n=this,i=this.path===""?Za.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new gn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=yield s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return yield n.parseAsync(a)})}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in o)if(o[f]instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}parseAsync(e){return er(this,null,function*(){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=yield this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l})}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new dn().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Pa().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new U0;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in yu?a=yu[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new N0;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];if(l.type==="MultiMaterial"){const c=[];for(let u=0;u<l.materials.length;u++){const h=l.materials[u];n[h.uuid]===void 0&&(n[h.uuid]=s.parse(h)),c.push(n[h.uuid])}i[l.uuid]=c}else n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=so.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:gi(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Cu(t);s=new oo(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){i[h.uuid]=[];for(let d=0,m=f.length;d<m;d++){const x=f[d],v=a(x);v!==null&&(v instanceof HTMLImageElement?i[h.uuid].push(v):i[h.uuid].push(new ki(v.data,v.width,v.height)))}}else{const d=a(h.url);d!==null&&(i[h.uuid]=d)}}}return i}parseImagesAsync(e){return er(this,null,function*(){const t=this,n={};let i;function s(o){return er(this,null,function*(){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return yield i.loadAsync(l)}else return o.data?{data:gi(o.type,o.data),width:o.width,height:o.height}:null})}if(e!==void 0&&e.length>0){i=new oo(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=yield s(f);d!==null&&(d instanceof HTMLImageElement?n[l.uuid].push(d):n[l.uuid].push(new ki(d.data,d.width,d.height)))}}else{const u=yield s(l.url);u!==null&&(n[l.uuid]=u)}}}return n})}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let l;const c=t[a.image];Array.isArray(c)?(l=new mr(c),c.length===6&&(l.needsUpdate=!0)):(c&&c.data?l=new ki(c.data,c.width,c.height):l=new dt(c),c&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,O0)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],qu),l.wrapT=n(a.wrap[1],qu)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,Xu)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,Xu)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,s){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let m=0,x=f.length;m<x;m++){const v=f[m];n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),d.push(n[v])}return d}return n[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),n[f]}}function c(f){return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),i[f]}let u,h;switch(e.type){case"Scene":o=new Ta,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new le(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new As(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Es(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Mt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Ms(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Gu(e.color,e.intensity);break;case"DirectionalLight":o=new Hu(e.color,e.intensity);break;case"PointLight":o=new Uu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Vu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Bu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Ru(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new ao().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new Ca(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new xt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,d=e.instanceMatrix,m=e.instanceColor;o=new Zc(u,h,f),o.instanceMatrix=new Wi(new Float32Array(d.array),16),m!==void 0&&(o.instanceColor=new Wi(new Float32Array(m.array),m.itemSize));break;case"LOD":o=new Xx;break;case"Line":o=new $n(a(e.geometry),l(e.material));break;case"LineLoop":o=new tu(a(e.geometry),l(e.material));break;case"LineSegments":o=new fn(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new zs(a(e.geometry),l(e.material));break;case"Sprite":o=new La(l(e.material));break;case"Group":o=new Ni;break;case"Bone":o=new Ra;break;default:o=new ke}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,s))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const m=f[d];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const m=f[d],x=o.getObjectByProperty("uuid",m.object);x!==void 0&&o.addLevel(x,m.distance)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}const O0={UVMapping:Io,CubeReflectionMapping:ai,CubeRefractionMapping:li,EquirectangularReflectionMapping:Wr,EquirectangularRefractionMapping:qr,CubeUVReflectionMapping:sr,CubeUVRefractionMapping:Xr},qu={RepeatWrapping:Yr,ClampToEdgeWrapping:wt,MirroredRepeatWrapping:Jr},Xu={NearestFilter:lt,NearestMipmapNearestFilter:Do,NearestMipmapLinearFilter:Fo,LinearFilter:nt,LinearMipmapNearestFilter:Ll,LinearMipmapLinearFilter:ci};class H0 extends Nn{constructor(e){super(e),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$i.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){$i.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}H0.prototype.isImageBitmapLoader=!0;let lo;const Yu={getContext:function(){return lo===void 0&&(lo=new(window.AudioContext||window.webkitAudioContext)),lo},setContext:function(r){lo=r}};class G0 extends Nn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gn(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const l=a.slice(0);Yu.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}}class V0 extends ao{constructor(e,t,n=1){super(void 0,n);const i=new le().set(e),s=new le().set(t),o=new S(i.r,i.g,i.b),a=new S(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}V0.prototype.isHemisphereLightProbe=!0;class k0 extends ao{constructor(e,t=1){super(void 0,t);const n=new le().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}k0.prototype.isAmbientLightProbe=!0;const Ju=new pe,Zu=new pe,jn=new pe;class I_{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Mt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Mt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,jn.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(kn*t.fov*.5)/t.zoom;let a,l;Zu.elements[12]=-i,Ju.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,jn.elements[0]=2*t.near/(l-a),jn.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(jn),a=-o*t.aspect-s,l=o*t.aspect-s,jn.elements[0]=2*t.near/(l-a),jn.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(jn)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Zu),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ju)}}class W0{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=$u(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=$u();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function $u(){return(typeof performance=="undefined"?Date:performance).now()}const Qn=new S,ju=new St,q0=new S,Kn=new S;class D_ extends null{constructor(){super(),this.type="AudioListener",this.context=Yu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new W0}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Qn,ju,q0),Kn.set(0,0,-1).applyQuaternion(ju),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Qn.x,i),t.positionY.linearRampToValueAtTime(Qn.y,i),t.positionZ.linearRampToValueAtTime(Qn.z,i),t.forwardX.linearRampToValueAtTime(Kn.x,i),t.forwardY.linearRampToValueAtTime(Kn.y,i),t.forwardZ.linearRampToValueAtTime(Kn.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Qn.x,Qn.y,Qn.z),t.setOrientation(Kn.x,Kn.y,Kn.z,n.x,n.y,n.z)}}class X0 extends ke{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const ei=new S,Qu=new St,Y0=new S,ti=new S;class F_ extends null{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(ei,Qu,Y0),ti.set(0,0,1).applyQuaternion(Qu);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ei.x,n),t.positionY.linearRampToValueAtTime(ei.y,n),t.positionZ.linearRampToValueAtTime(ei.z,n),t.orientationX.linearRampToValueAtTime(ti.x,n),t.orientationY.linearRampToValueAtTime(ti.y,n),t.orientationZ.linearRampToValueAtTime(ti.z,n)}else t.setPosition(ei.x,ei.y,ei.z),t.setOrientation(ti.x,ti.y,ti.z)}}class J0{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Z0{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){St.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;St.multiplyQuaternionsFlat(e,o,e,t,e,n),St.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const $a="\\[\\]\\.:\\/",$0=new RegExp("["+$a+"]","g"),ja="[^"+$a+"]",j0="[^"+$a.replace("\\.","")+"]",Q0=/((?:WC+[\/:])*)/.source.replace("WC",ja),K0=/(WCOD+)?/.source.replace("WCOD",j0),ey=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ja),ty=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ja),ny=new RegExp("^"+Q0+K0+ey+ty+"$"),iy=["material","materials","bones"];class ry{constructor(e,t,n){const i=n||Ge.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ge{constructor(e,t,n){this.path=t,this.parsedPath=n||Ge.parseTrackName(t),this.node=Ge.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ge.Composite(e,t,n):new Ge(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($0,"")}static parseTrackName(e){const t=ny.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);iy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Ge.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ge.Composite=ry,Ge.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ge.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ge.prototype.GetterByBindingType=[Ge.prototype._getValue_direct,Ge.prototype._getValue_array,Ge.prototype._getValue_arrayElement,Ge.prototype._getValue_toArray],Ge.prototype.SetterByBindingTypeAndVersioning=[[Ge.prototype._setValue_direct,Ge.prototype._setValue_direct_setNeedsUpdate,Ge.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_array,Ge.prototype._setValue_array_setNeedsUpdate,Ge.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_arrayElement,Ge.prototype._setValue_arrayElement_setNeedsUpdate,Ge.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_fromArray,Ge.prototype._setValue_fromArray_setNeedsUpdate,Ge.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class sy{constructor(){this.uuid=Pt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],d=f.uuid;let m=t[d];if(m===void 0){m=l++,t[d]=m,e.push(f);for(let x=0,v=o;x!==v;++x)s[x].push(new Ge(f,n[x],i[x]))}else if(m<c){a=e[m];const x=--c,v=e[x];t[v.uuid]=m,e[m]=v,t[d]=x,e[x]=f;for(let g=0,p=o;g!==p;++g){const _=s[g],y=_[x];let M=_[m];_[m]=y,M===void 0&&(M=new Ge(f,n[g],i[g])),_[x]=M}}else e[m]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,m=i;d!==m;++d){const x=n[d],v=x[h],g=x[u];x[u]=v,x[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,d=e[f],m=--o,x=e[m];t[d.uuid]=h,e[h]=d,t[x.uuid]=f,e[f]=x,e.pop();for(let v=0,g=i;v!==g;++v){const p=n[v],_=p[f],y=p[m];p[h]=_,p[f]=y,p.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,x=i;m!==x;++m){const v=n[m];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){const m=l[f];h[f]=new Ge(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}sy.prototype.isAnimationObjectGroup=!0;class oy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:fi,endingEnd:fi};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pd,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Ol:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case zo:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===md;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===dd){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=di,i.endingEnd=di):(e?i.endingStart=this.zeroSlopeAtStart?di:fi:i.endingStart=Qr,t?i.endingEnd=this.zeroSlopeAtEnd?di:fi:i.endingEnd=Qr)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}class ay extends Vn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=i[h],d=f.name;let m=u[d];if(m!==void 0)o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,d));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;m=new Z0(Ge.create(n,d,x),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Au(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?so.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=zo),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new oy(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?so.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}ay.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Qa{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Qa(this.value.clone===void 0?this.value:this.value.clone())}}class ly extends Ui{constructor(e,t,n=1){super(e,t),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}ly.prototype.isInstancedInterleavedBuffer=!0;class cy{constructor(e,t,n,i,s){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}cy.prototype.isGLBufferAttribute=!0;class B_{constructor(e,t,n=0,i=1/0){this.ray=new Tn(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Zo,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return Ka(e,this,n,t),n.sort(Ku),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Ka(e[i],this,n,t);return n.sort(Ku),n}}function Ku(r,e){return r.distance-e.distance}function Ka(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,o=i.length;s<o;s++)Ka(i[s],e,t,!0)}}class z_{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(vt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class N_{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const eh=new q;class Fr{constructor(e=new q(1/0,1/0),t=new q(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=eh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return eh.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Fr.prototype.isBox2=!0;const th=new S,co=new S;class uy{constructor(e=new S,t=new S){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){th.subVectors(e,this.start),co.subVectors(this.end,this.start);const n=co.dot(co);let s=co.dot(th)/n;return t&&(s=vt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const nh=new S;class U_ extends null{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new ve,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new me(i,3));const s=new bt({fog:!1,toneMapped:!1});this.cone=new fn(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),nh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(nh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Un=new S,uo=new pe,el=new pe;class hy extends fn{constructor(e){const t=ih(e),n=new ve,i=[],s=[],o=new le(0,0,1),a=new le(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}n.setAttribute("position",new me(i,3)),n.setAttribute("color",new me(s,3));const l=new bt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");el.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(uo.multiplyMatrices(el,a.matrixWorld),Un.setFromMatrixPosition(uo),i.setXYZ(o,Un.x,Un.y,Un.z),uo.multiplyMatrices(el,a.parent.matrixWorld),Un.setFromMatrixPosition(uo),i.setXYZ(o+1,Un.x,Un.y,Un.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function ih(r){const e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,ih(r.children[t]));return e}class O_ extends null{constructor(e,t,n){const i=new Pr(t,4,2),s=new An({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const fy=new S,rh=new le,sh=new le;class H_ extends null{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Cr(t);i.rotateY(Math.PI*.5),this.material=new An({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new ze(o,3)),this.add(new xt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");rh.copy(this.light.color),sh.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?rh:sh;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(fy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class dy extends fn{constructor(e=10,t=10,n=4473924,i=8947848){n=new le(n),i=new le(i);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,m=-a;f<=t;f++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const x=f===s?n:i;x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3}const u=new ve;u.setAttribute("position",new me(l,3)),u.setAttribute("color",new me(c,3));const h=new bt({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}}class G_ extends null{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new le(s),o=new le(o);const a=[],l=[];for(let h=0;h<=t;h++){const f=h/t*(Math.PI*2),d=Math.sin(f)*e,m=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,m);const x=h&1?s:o;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let h=0;h<=n;h++){const f=h&1?s:o,d=e-e/n*h;for(let m=0;m<i;m++){let x=m/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d;a.push(v,0,g),l.push(f.r,f.g,f.b),x=(m+1)/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d,a.push(v,0,g),l.push(f.r,f.g,f.b)}}const c=new ve;c.setAttribute("position",new me(a,3)),c.setAttribute("color",new me(l,3));const u=new bt({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}}const oh=new S,ho=new S,ah=new S;class V_ extends null{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new ve;i.setAttribute("position",new me([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new bt({fog:!1,toneMapped:!1});this.lightPlane=new $n(i,s),this.add(this.lightPlane),i=new ve,i.setAttribute("position",new me([0,0,0,0,0,1],3)),this.targetLine=new $n(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){oh.setFromMatrixPosition(this.light.matrixWorld),ho.setFromMatrixPosition(this.light.target.matrixWorld),ah.subVectors(ho,oh),this.lightPlane.lookAt(ho),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(ho),this.targetLine.scale.z=ah.length()}}const fo=new S,Ke=new ys;class k_ extends null{constructor(e){const t=new ve,n=new bt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new le(16755200),l=new le(16711680),c=new le(43775),u=new le(16777215),h=new le(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(m,x,v){d(m,v),d(x,v)}function d(m,x){i.push(0,0,0),s.push(x.r,x.g,x.b),o[m]===void 0&&(o[m]=[]),o[m].push(i.length/3-1)}t.setAttribute("position",new me(i,3)),t.setAttribute("color",new me(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Ke.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),rt("c",t,e,Ke,0,0,-1),rt("t",t,e,Ke,0,0,1),rt("n1",t,e,Ke,-n,-i,-1),rt("n2",t,e,Ke,n,-i,-1),rt("n3",t,e,Ke,-n,i,-1),rt("n4",t,e,Ke,n,i,-1),rt("f1",t,e,Ke,-n,-i,1),rt("f2",t,e,Ke,n,-i,1),rt("f3",t,e,Ke,-n,i,1),rt("f4",t,e,Ke,n,i,1),rt("u1",t,e,Ke,n*.7,i*1.1,-1),rt("u2",t,e,Ke,-n*.7,i*1.1,-1),rt("u3",t,e,Ke,0,i*2,-1),rt("cf1",t,e,Ke,-n,0,1),rt("cf2",t,e,Ke,n,0,1),rt("cf3",t,e,Ke,0,-i,1),rt("cf4",t,e,Ke,0,i,1),rt("cn1",t,e,Ke,-n,0,-1),rt("cn2",t,e,Ke,n,0,-1),rt("cn3",t,e,Ke,0,-i,-1),rt("cn4",t,e,Ke,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function rt(r,e,t,n,i,s,o){fo.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],fo.x,fo.y,fo.z)}}const po=new Nt;class py extends null{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new ze(i,3)),super(s,new bt({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&po.setFromObject(this.object),po.isEmpty())return;const t=po.min,n=po.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return fn.prototype.copy.call(this,e),this.object=e.object,this}}class W_ extends null{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new me(i,3)),super(s,new bt({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class q_ extends null{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],o=new ve;o.setAttribute("position",new me(s,3)),o.computeBoundingSphere(),super(o,new bt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new ve;l.setAttribute("position",new me(a,3)),l.computeBoundingSphere(),this.add(new xt(l,new An({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?at:ri,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}const lh=new S;let mo,tl;class X_ extends null{constructor(e=new S(0,0,1),t=new S(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",mo===void 0&&(mo=new ve,mo.setAttribute("position",new me([0,0,0,0,1,0],3)),tl=new Xi(0,.5,1,5,1),tl.translate(0,-.5,0)),this.position.copy(t),this.line=new $n(mo,new bt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new xt(tl,new An({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lh,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class my extends null{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new ve;i.setAttribute("position",new me(t,3)),i.setAttribute("color",new me(n,3));const s=new bt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new le,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Y_{constructor(){this.type="ShapePath",this.color=new le,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Xs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(p){const _=[];for(let y=0,M=p.length;y<M;y++){const w=p[y],A=new dn;A.curves=w.curves,_.push(A)}return _}function i(p,_){const y=_.length;let M=!1;for(let w=y-1,A=0;A<y;w=A++){let C=_[w],N=_[A],z=N.x-C.x,I=N.y-C.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(C=_[A],z=-z,N=_[w],I=-I),p.y<C.y||p.y>N.y)continue;if(p.y===C.y){if(p.x===C.x)return!0}else{const b=I*(p.x-C.x)-z*(p.y-C.y);if(b===0)return!0;if(b<0)continue;M=!M}}else{if(p.y!==C.y)continue;if(N.x<=p.x&&p.x<=C.x||C.x<=p.x&&p.x<=N.x)return!0}}return M}const s=pn.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,l,c;const u=[];if(o.length===1)return l=o[0],c=new dn,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;const f=[],d=[];let m=[],x=0,v;d[x]=void 0,m[x]=[];for(let p=0,_=o.length;p<_;p++)l=o[p],v=l.getPoints(),a=s(v),a=e?!a:a,a?(!h&&d[x]&&x++,d[x]={s:new dn,p:v},d[x].s.curves=l.curves,h&&x++,m[x]=[]):m[x].push({h:l,p:v[0]});if(!d[0])return n(o);if(d.length>1){let p=!1;const _=[];for(let y=0,M=d.length;y<M;y++)f[y]=[];for(let y=0,M=d.length;y<M;y++){const w=m[y];for(let A=0;A<w.length;A++){const C=w[A];let N=!0;for(let z=0;z<d.length;z++)i(C.p,d[z].p)&&(y!==z&&_.push({froms:y,tos:z,hole:A}),N?(N=!1,f[z].push(C)):p=!0);N&&f[y].push(C)}}_.length>0&&(p||(m=f))}let g;for(let p=0,_=d.length;p<_;p++){c=d[p].s,u.push(c),g=m[p];for(let y=0,M=g.length;y<M;y++)c.holes.push(g[y].h)}return u}}const ch=new Float32Array(1),gy=new Int32Array(ch.buffer);class J_{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),ch[0]=e;const t=gy[0];let n=t>>16&32768,i=t>>12&2047;const s=t>>23&255;return s<103?n:s>142?(n|=31744,n|=(s==255?0:1)&&t&8388607,n):s<113?(i|=2048,n|=(i>>114-s)+(i>>113-s&1),n):(n|=s-112<<10|i>>1,n+=i&1,n)}}const Z_=0,$_=1,j_=0,Q_=1,K_=2;function eM(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function tM(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}function nM(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new zs(r,e)}function iM(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new La(r)}function rM(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new zs(r,e)}function sM(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new qi(r)}function oM(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new qi(r)}function aM(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new qi(r)}function lM(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new S(r,e,t)}function cM(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new ze(r,e).setUsage(lr)}function uM(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new qd(r,e)}function hM(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Xd(r,e)}function fM(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Yd(r,e)}function dM(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Jd(r,e)}function pM(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ia(r,e)}function mM(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Zd(r,e)}function gM(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new ra(r,e)}function xM(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new me(r,e)}function yM(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new jd(r,e)}Ot.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Ot.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r},Xs.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};function vM(r){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new my(r)}function _M(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new py(r,e)}function MM(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new fn(new su(r.geometry),new bt({color:e!==void 0?e:16777215}))}dy.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},hy.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function bM(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new fn(new gu(r.geometry),new bt({color:e!==void 0?e:16777215}))}Nn.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Za.extractUrlBase(r)},Nn.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};function wM(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new gn(r)}function SM(r){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new B0(r)}Fr.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)},Fr.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Fr.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Fr.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)},Nt.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)},Nt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Nt.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Nt.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},Nt.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)},wn.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},_s.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)},uy.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)},mt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},mt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},mt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},mt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},pe.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)},pe.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},pe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new S().setFromMatrixColumn(this,3)},pe.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)},pe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},pe.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},pe.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)},pe.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},pe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},pe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},pe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},pe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},pe.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},pe.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)},pe.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},hn.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)},St.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)},St.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Tn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Tn.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)},Tn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},ct.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},ct.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)},ct.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)},ct.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)},ct.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)},ct.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ct.getBarycoord(r,e,t,n,i)},ct.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ct.getNormal(r,e,t,n)},dn.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)},dn.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Bn(this,r)},dn.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rr(this,r)},q.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},q.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},q.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},S.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},S.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},S.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)},S.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)},S.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)},S.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)},S.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},S.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},S.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},We.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},We.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ke.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)},ke.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ke.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)},ke.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ke.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(ke.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),xt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(xt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),gd},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ca.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Mt.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)},Object.defineProperties(jt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}}),Object.defineProperties(ze.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===lr},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(lr)}}}),ze.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?lr:ar),this},ze.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},ze.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ve.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)},ve.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new ze(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)},ve.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)},ve.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ve.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ve.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)},ve.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(ve.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Ui.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?lr:ar),this},Ui.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Bn.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Bn.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Bn.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Ta.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Qa.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(_t.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new le}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===_l}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Yt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}}),qe.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)},qe.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)},qe.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},qe.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},qe.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},qe.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},qe.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},qe.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},qe.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},qe.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},qe.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},qe.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},qe.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},qe.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},qe.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)},qe.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},qe.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},qe.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},qe.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},qe.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},qe.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},qe.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},qe.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},qe.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},qe.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(qe.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?pi:Vt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(zc.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});function TM(r,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new fa(r,t)}Object.defineProperties(zt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}}),X0.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new G0().load(r,function(n){e.setBuffer(n)}),this},J0.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ha.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)},ha.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)},yi.crossOrigin=void 0,yi.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new z0;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},yi.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new F0;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},yi.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},yi.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function EM(){console.error("THREE.CanvasRenderer has been removed")}function AM(){console.error("THREE.JSONLoader has been removed.")}const LM={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function CM(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function RM(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new ve}function PM(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new ve}function IM(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function DM(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function FM(){console.error("THREE.ImmediateRenderObject has been removed.")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Gt}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Gt);function BM(r){r.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}function xy(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,l=new ve;let c=0;for(let u=0;u<r.length;++u){const h=r[u];let f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in h.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in h.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0;const h=[];for(let f=0;f<r.length;++f){const d=r[f].index;for(let m=0;m<d.count;++m)h.push(d.getX(m)+u);u+=r[f].attributes.position.count}l.setIndex(h)}for(const u in s){const h=uh(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in o){const h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const d=[];for(let x=0;x<o[u].length;++x)d.push(o[u][x][f]);const m=uh(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function uh(r){let e,t,n,i=0;for(let a=0;a<r.length;++a){const l=r[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=l.array.length}const s=new e(i);let o=0;for(let a=0;a<r.length;++a)s.set(r[a].array,o),o+=r[a].array.length;return new ze(s,t,n)}function zM(r){let e,t=0,n=0;for(let c=0,u=r.length;c<u;++c){const h=r[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=h.array.length,n+=h.itemSize}const i=new InterleavedBuffer(new e(t),n);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=r.length;c<u;c++){const h=r[c],f=h.itemSize,d=h.count,m=new InterleavedBufferAttribute(i,f,s,h.normalized);o.push(m),s+=f;for(let x=0;x<d;x++)for(let v=0;v<f;v++)m[l[v]](x,h[a[v]](x))}return o}function NM(r){let e=0;for(const n in r.attributes){const i=r.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const t=r.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function UM(r,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=r.getIndex(),i=r.getAttribute("position"),s=n?n.count:i.count;let o=0;const a=Object.keys(r.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let x=0,v=a.length;x<v;x++){const g=a[x];l[g]=[];const p=r.morphAttributes[g];p&&(c[g]=new Array(p.length).fill().map(()=>[]))}const f=Math.log10(1/e),d=Math.pow(10,f);for(let x=0;x<s;x++){const v=n?n.getX(x):x;let g="";for(let p=0,_=a.length;p<_;p++){const y=a[p],M=r.getAttribute(y),w=M.itemSize;for(let A=0;A<w;A++)g+=`${~~(M[h[A]](v)*d)},`}if(g in t)u.push(t[g]);else{for(let p=0,_=a.length;p<_;p++){const y=a[p],M=r.getAttribute(y),w=r.morphAttributes[y],A=M.itemSize,C=l[y],N=c[y];for(let z=0;z<A;z++){const I=h[z];if(C.push(M[I](v)),w)for(let b=0,T=w.length;b<T;b++)N[b].push(w[b][I](v))}}t[g]=o,u.push(o),o++}}const m=r.clone();for(let x=0,v=a.length;x<v;x++){const g=a[x],p=r.getAttribute(g),_=new p.array.constructor(l[g]),y=new BufferAttribute(_,p.itemSize,p.normalized);if(m.setAttribute(g,y),g in c)for(let M=0;M<c[g].length;M++){const w=r.morphAttributes[g][M],A=new w.array.constructor(c[g][M]),C=new BufferAttribute(A,w.itemSize,w.normalized);m.morphAttributes[g][M]=C}}return m.setIndex(u),m}function OM(r,e){if(e===TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===TriangleFanDrawMode||e===TriangleStripDrawMode){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===TriangleFanDrawMode)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}function HM(r){if(r.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const e=new Vector3,t=new Vector3,n=new Vector3,i=new Vector3,s=new Vector3,o=new Vector3,a=new Vector3,l=new Vector3,c=new Vector3;function u(V,W,ne,K,he,be,Y,we,de){e.fromBufferAttribute(ne,be),t.fromBufferAttribute(ne,Y),n.fromBufferAttribute(ne,we);const ge=V.morphTargetInfluences;if(W.morphTargets&&K&&ge){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let ye=0,Ue=K.length;ye<Ue;ye++){const k=ge[ye],$=K[ye];k!==0&&(i.fromBufferAttribute($,be),s.fromBufferAttribute($,Y),o.fromBufferAttribute($,we),he?(a.addScaledVector(i,k),l.addScaledVector(s,k),c.addScaledVector(o,k)):(a.addScaledVector(i.sub(e),k),l.addScaledVector(s.sub(t),k),c.addScaledVector(o.sub(n),k)))}e.add(a),t.add(l),n.add(c)}V.isSkinnedMesh&&(V.boneTransform(be,e),V.boneTransform(Y,t),V.boneTransform(we,n)),de[be*3+0]=e.x,de[be*3+1]=e.y,de[be*3+2]=e.z,de[Y*3+0]=t.x,de[Y*3+1]=t.y,de[Y*3+2]=t.z,de[we*3+0]=n.x,de[we*3+1]=n.y,de[we*3+2]=n.z}const h=r.geometry,f=r.material;let d,m,x;const v=h.index,g=h.attributes.position,p=h.morphAttributes.position,_=h.morphTargetsRelative,y=h.attributes.normal,M=h.morphAttributes.position,w=h.groups,A=h.drawRange;let C,N,z,I,b,T,B,R;const F=new Float32Array(g.count*g.itemSize),U=new Float32Array(y.count*y.itemSize);if(v!==null)if(Array.isArray(f))for(C=0,z=w.length;C<z;C++)for(b=w[C],T=f[b.materialIndex],B=Math.max(b.start,A.start),R=Math.min(b.start+b.count,A.start+A.count),N=B,I=R;N<I;N+=3)d=v.getX(N),m=v.getX(N+1),x=v.getX(N+2),u(r,T,g,p,_,d,m,x,F),u(r,T,y,M,_,d,m,x,U);else for(B=Math.max(0,A.start),R=Math.min(v.count,A.start+A.count),C=B,z=R;C<z;C+=3)d=v.getX(C),m=v.getX(C+1),x=v.getX(C+2),u(r,f,g,p,_,d,m,x,F),u(r,f,y,M,_,d,m,x,U);else if(g!==void 0)if(Array.isArray(f))for(C=0,z=w.length;C<z;C++)for(b=w[C],T=f[b.materialIndex],B=Math.max(b.start,A.start),R=Math.min(b.start+b.count,A.start+A.count),N=B,I=R;N<I;N+=3)d=N,m=N+1,x=N+2,u(r,T,g,p,_,d,m,x,F),u(r,T,y,M,_,d,m,x,U);else for(B=Math.max(0,A.start),R=Math.min(g.count,A.start+A.count),C=B,z=R;C<z;C+=3)d=C,m=C+1,x=C+2,u(r,f,g,p,_,d,m,x,F),u(r,f,y,M,_,d,m,x,U);const Z=new Float32BufferAttribute(F,3),ee=new Float32BufferAttribute(U,3);return{positionAttribute:g,normalAttribute:y,morphedPositionAttribute:Z,morphedNormalAttribute:ee}}function nl(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function hh(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function il(r,e){return il=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},il(r,e)}function yy(r,e){return il(r,e)}function fh(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&yy(r,e)}function vy(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function rl(r){return rl=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},rl(r)}function dh(r){return rl(r)}function _y(r){return r&&r.constructor===Symbol?"symbol":typeof r}function My(r,e){return e&&(_y(e)==="object"||typeof e=="function")?e:nl(r)}function ph(r){var e=vy();return function(){var n=dh(r),i;if(e){var s=dh(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return My(this,i)}}var by=`
|
|
3046
|
+
}`;function zc(r,e,t){let n=new _s;const i=new q,s=new q,o=new We,a=new Ma({depthPacking:yd}),l=new ba,c={},u=t.maxTextureSize,h={0:at,1:ri,2:si},f=new Yt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new q},radius:{value:4}},vertexShader:zx,fragmentShader:Nx}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const p=new ve;p.setAttribute("position",new ze(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new xt(p,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=vl,this.render=function(y,M,w){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||y.length===0)return;const A=r.getRenderTarget(),C=r.getActiveCubeFace(),N=r.getActiveMipmapLevel(),z=r.state;z.setBlending(vn),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);for(let I=0,b=y.length;I<b;I++){const T=y[I],B=T.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",T,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const R=B.getFrameExtents();if(i.multiply(R),s.copy(B.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/R.x),i.x=s.x*R.x,B.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/R.y),i.y=s.y*R.y,B.mapSize.y=s.y)),B.map===null&&!B.isPointLightShadow&&this.type===ir){const U={minFilter:nt,magFilter:nt,format:ft};B.map=new zt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.mapPass=new zt(i.x,i.y,U),B.camera.updateProjectionMatrix()}if(B.map===null){const U={minFilter:lt,magFilter:lt,format:ft};B.map=new zt(i.x,i.y,U),B.map.texture.name=T.name+".shadowMap",B.camera.updateProjectionMatrix()}r.setRenderTarget(B.map),r.clear();const F=B.getViewportCount();for(let U=0;U<F;U++){const Z=B.getViewport(U);o.set(s.x*Z.x,s.y*Z.y,s.x*Z.z,s.y*Z.w),z.viewport(o),B.updateMatrices(T,U),n=B.getFrustum(),_(M,w,B.camera,T,this.type)}!B.isPointLightShadow&&this.type===ir&&g(B,w),B.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(A,C,N)};function g(y,M){const w=e.update(x);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,r.setRenderTarget(y.mapPass),r.clear(),r.renderBufferDirect(M,null,w,f,x,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,r.setRenderTarget(y.map),r.clear(),r.renderBufferDirect(M,null,w,d,x,null)}function m(y,M,w,A,C,N,z){let I=null;const b=A.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(b!==void 0?I=b:I=A.isPointLight===!0?l:a,r.localClippingEnabled&&w.clipShadows===!0&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0){const T=I.uuid,B=w.uuid;let R=c[T];R===void 0&&(R={},c[T]=R);let F=R[B];F===void 0&&(F=I.clone(),R[B]=F),I=F}return I.visible=w.visible,I.wireframe=w.wireframe,z===ir?I.side=w.shadowSide!==null?w.shadowSide:w.side:I.side=w.shadowSide!==null?w.shadowSide:h[w.side],I.alphaMap=w.alphaMap,I.alphaTest=w.alphaTest,I.clipShadows=w.clipShadows,I.clippingPlanes=w.clippingPlanes,I.clipIntersection=w.clipIntersection,I.displacementMap=w.displacementMap,I.displacementScale=w.displacementScale,I.displacementBias=w.displacementBias,I.wireframeLinewidth=w.wireframeLinewidth,I.linewidth=w.linewidth,A.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(A.matrixWorld),I.nearDistance=C,I.farDistance=N),I}function _(y,M,w,A,C){if(y.visible===!1)return;if(y.layers.test(M.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&C===ir)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,y.matrixWorld);const I=e.update(y),b=y.material;if(Array.isArray(b)){const T=I.groups;for(let B=0,R=T.length;B<R;B++){const F=T[B],U=b[F.materialIndex];if(U&&U.visible){const Z=m(y,I,U,A,w.near,w.far,C);r.renderBufferDirect(w,null,I,Z,y,F)}}}else if(b.visible){const T=m(y,I,b,A,w.near,w.far,C);r.renderBufferDirect(w,null,I,T,y,null)}}const z=y.children;for(let I=0,b=z.length;I<b;I++)_(z[I],M,w,A,C)}}function Ux(r,e,t){const n=t.isWebGL2;function i(){let D=!1;const re=new We;let te=null;const Ce=new We(0,0,0,0);return{setMask:function(xe){te!==xe&&!D&&(r.colorMask(xe,xe,xe,xe),te=xe)},setLocked:function(xe){D=xe},setClear:function(xe,Ie,ue,Pe,Ze){Ze===!0&&(xe*=Pe,Ie*=Pe,ue*=Pe),re.set(xe,Ie,ue,Pe),Ce.equals(re)===!1&&(r.clearColor(xe,Ie,ue,Pe),Ce.copy(re))},reset:function(){D=!1,te=null,Ce.set(-1,0,0,0)}}}function s(){let D=!1,re=null,te=null,Ce=null;return{setTest:function(xe){xe?K(2929):he(2929)},setMask:function(xe){re!==xe&&!D&&(r.depthMask(xe),re=xe)},setFunc:function(xe){if(te!==xe){if(xe)switch(xe){case lf:r.depthFunc(512);break;case cf:r.depthFunc(519);break;case uf:r.depthFunc(513);break;case Po:r.depthFunc(515);break;case hf:r.depthFunc(514);break;case ff:r.depthFunc(518);break;case df:r.depthFunc(516);break;case pf:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);te=xe}},setLocked:function(xe){D=xe},setClear:function(xe){Ce!==xe&&(r.clearDepth(xe),Ce=xe)},reset:function(){D=!1,re=null,te=null,Ce=null}}}function o(){let D=!1,re=null,te=null,Ce=null,xe=null,Ie=null,ue=null,Pe=null,Ze=null;return{setTest:function(Xe){D||(Xe?K(2960):he(2960))},setMask:function(Xe){re!==Xe&&!D&&(r.stencilMask(Xe),re=Xe)},setFunc:function(Xe,Qt,Kt){(te!==Xe||Ce!==Qt||xe!==Kt)&&(r.stencilFunc(Xe,Qt,Kt),te=Xe,Ce=Qt,xe=Kt)},setOp:function(Xe,Qt,Kt){(Ie!==Xe||ue!==Qt||Pe!==Kt)&&(r.stencilOp(Xe,Qt,Kt),Ie=Xe,ue=Qt,Pe=Kt)},setLocked:function(Xe){D=Xe},setClear:function(Xe){Ze!==Xe&&(r.clearStencil(Xe),Ze=Xe)},reset:function(){D=!1,re=null,te=null,Ce=null,xe=null,Ie=null,ue=null,Pe=null,Ze=null}}}const a=new i,l=new s,c=new o;let u={},h={},f=null,d=!1,p=null,x=null,v=null,g=null,m=null,_=null,y=null,M=!1,w=null,A=null,C=null,N=null,z=null;const I=r.getParameter(35661);let b=!1,T=0;const B=r.getParameter(7938);B.indexOf("WebGL")!==-1?(T=parseFloat(/^WebGL (\d)/.exec(B)[1]),b=T>=1):B.indexOf("OpenGL ES")!==-1&&(T=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),b=T>=2);let R=null,F={};const U=r.getParameter(3088),Z=r.getParameter(2978),ee=new We().fromArray(U),V=new We().fromArray(Z);function W(D,re,te){const Ce=new Uint8Array(4),xe=r.createTexture();r.bindTexture(D,xe),r.texParameteri(D,10241,9728),r.texParameteri(D,10240,9728);for(let Ie=0;Ie<te;Ie++)r.texImage2D(re+Ie,0,6408,1,1,0,6408,5121,Ce);return xe}const ne={};ne[3553]=W(3553,3553,1),ne[34067]=W(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),K(2929),l.setFunc(Po),Ue(!1),k(yl),K(2884),ge(vn);function K(D){u[D]!==!0&&(r.enable(D),u[D]=!0)}function he(D){u[D]!==!1&&(r.disable(D),u[D]=!1)}function be(D,re){return h[D]!==re?(r.bindFramebuffer(D,re),h[D]=re,n&&(D===36009&&(h[36160]=re),D===36160&&(h[36009]=re)),!0):!1}function Y(D){return f!==D?(r.useProgram(D),f=D,!0):!1}const we={[oi]:32774,[$h]:32778,[jh]:32779};if(n)we[Sl]=32775,we[Tl]=32776;else{const D=e.get("EXT_blend_minmax");D!==null&&(we[Sl]=D.MIN_EXT,we[Tl]=D.MAX_EXT)}const de={[Qh]:0,[Kh]:1,[ef]:768,[El]:770,[af]:776,[sf]:774,[nf]:772,[tf]:769,[Al]:771,[of]:775,[rf]:773};function ge(D,re,te,Ce,xe,Ie,ue,Pe){if(D===vn){d===!0&&(he(3042),d=!1);return}if(d===!1&&(K(3042),d=!0),D!==Zh){if(D!==p||Pe!==M){if((x!==oi||m!==oi)&&(r.blendEquation(32774),x=oi,m=oi),Pe)switch(D){case rr:r.blendFuncSeparate(1,771,1,771);break;case Ml:r.blendFunc(1,1);break;case bl:r.blendFuncSeparate(0,0,769,771);break;case wl:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case rr:r.blendFuncSeparate(770,771,1,771);break;case Ml:r.blendFunc(770,1);break;case bl:r.blendFunc(0,769);break;case wl:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}v=null,g=null,_=null,y=null,p=D,M=Pe}return}xe=xe||re,Ie=Ie||te,ue=ue||Ce,(re!==x||xe!==m)&&(r.blendEquationSeparate(we[re],we[xe]),x=re,m=xe),(te!==v||Ce!==g||Ie!==_||ue!==y)&&(r.blendFuncSeparate(de[te],de[Ce],de[Ie],de[ue]),v=te,g=Ce,_=Ie,y=ue),p=D,M=null}function ye(D,re){D.side===si?he(2884):K(2884);let te=D.side===at;re&&(te=!te),Ue(te),D.blending===rr&&D.transparent===!1?ge(vn):ge(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),l.setFunc(D.depthFunc),l.setTest(D.depthTest),l.setMask(D.depthWrite),a.setMask(D.colorWrite);const Ce=D.stencilWrite;c.setTest(Ce),Ce&&(c.setMask(D.stencilWriteMask),c.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),c.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),ie(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?K(32926):he(32926)}function Ue(D){w!==D&&(D?r.frontFace(2304):r.frontFace(2305),w=D)}function k(D){D!==Xh?(K(2884),D!==A&&(D===yl?r.cullFace(1029):D===Yh?r.cullFace(1028):r.cullFace(1032))):he(2884),A=D}function $(D){D!==C&&(b&&r.lineWidth(D),C=D)}function ie(D,re,te){D?(K(32823),(N!==re||z!==te)&&(r.polygonOffset(re,te),N=re,z=te)):he(32823)}function fe(D){D?K(3089):he(3089)}function ce(D){D===void 0&&(D=33984+I-1),R!==D&&(r.activeTexture(D),R=D)}function Ae(D,re){R===null&&ce();let te=F[R];te===void 0&&(te={type:void 0,texture:void 0},F[R]=te),(te.type!==D||te.texture!==re)&&(r.bindTexture(D,re||ne[D]),te.type=D,te.texture=re)}function Le(){const D=F[R];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function De(){try{r.compressedTexImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function $e(){try{r.texSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function P(){try{r.texSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function L(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function J(){try{r.texStorage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Q(){try{r.texStorage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ae(){try{r.texImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function j(){try{r.texImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Se(D){ee.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),ee.copy(D))}function _e(D){V.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),V.copy(D))}function se(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},R=null,F={},h={},f=null,d=!1,p=null,x=null,v=null,g=null,m=null,_=null,y=null,M=!1,w=null,A=null,C=null,N=null,z=null,ee.set(0,0,r.canvas.width,r.canvas.height),V.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:K,disable:he,bindFramebuffer:be,useProgram:Y,setBlending:ge,setMaterial:ye,setFlipSided:Ue,setCullFace:k,setLineWidth:$,setPolygonOffset:ie,setScissorTest:fe,activeTexture:ce,bindTexture:Ae,unbindTexture:Le,compressedTexImage2D:De,texImage2D:ae,texImage3D:j,texStorage2D:J,texStorage3D:Q,texSubImage2D:$e,texSubImage3D:P,compressedTexSubImage2D:L,scissor:Se,viewport:_e,reset:se}}function Ox(r,e,t,n,i,s,o){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,p=new WeakMap;let x,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(P){}function g(P,L){return v?new OffscreenCanvas(P,L):es("canvas")}function m(P,L,J,Q){let ae=1;if((P.width>Q||P.height>Q)&&(ae=Q/Math.max(P.width,P.height)),ae<1||L===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const j=L?Vl:Math.floor,Se=j(ae*P.width),_e=j(ae*P.height);x===void 0&&(x=g(Se,_e));const se=J?g(Se,_e):x;return se.width=Se,se.height=_e,se.getContext("2d").drawImage(P,0,0,Se,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Se+"x"+_e+")."),se}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function _(P){return Oo(P.width)&&Oo(P.height)}function y(P){return a?!1:P.wrapS!==wt||P.wrapT!==wt||P.minFilter!==lt&&P.minFilter!==nt}function M(P,L){return P.generateMipmaps&&L&&P.minFilter!==lt&&P.minFilter!==nt}function w(P){r.generateMipmap(P)}function A(P,L,J,Q){if(a===!1)return L;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let ae=L;return L===6403&&(J===5126&&(ae=33326),J===5131&&(ae=33325),J===5121&&(ae=33321)),L===6407&&(J===5126&&(ae=34837),J===5131&&(ae=34843),J===5121&&(ae=32849)),L===6408&&(J===5126&&(ae=34836),J===5131&&(ae=34842),J===5121&&(ae=Q===pi?35907:32856)),(ae===33325||ae===33326||ae===34842||ae===34836)&&e.get("EXT_color_buffer_float"),ae}function C(P,L,J){return M(P,J)===!0||P.isFramebufferTexture&&P.minFilter!==lt&&P.minFilter!==nt?Math.log2(Math.max(L.width,L.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?L.mipmaps.length:1}function N(P){return P===lt||P===Do||P===Fo?9728:9729}function z(P){const L=P.target;L.removeEventListener("dispose",z),b(L),L.isVideoTexture&&p.delete(L),o.memory.textures--}function I(P){const L=P.target;L.removeEventListener("dispose",I),T(L)}function b(P){const L=n.get(P);L.__webglInit!==void 0&&(r.deleteTexture(L.__webglTexture),n.remove(P))}function T(P){const L=P.texture,J=n.get(P),Q=n.get(L);if(!!P){if(Q.__webglTexture!==void 0&&(r.deleteTexture(Q.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let ae=0;ae<6;ae++)r.deleteFramebuffer(J.__webglFramebuffer[ae]),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer[ae]);else r.deleteFramebuffer(J.__webglFramebuffer),J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&r.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer&&r.deleteRenderbuffer(J.__webglColorRenderbuffer),J.__webglDepthRenderbuffer&&r.deleteRenderbuffer(J.__webglDepthRenderbuffer);if(P.isWebGLMultipleRenderTargets)for(let ae=0,j=L.length;ae<j;ae++){const Se=n.get(L[ae]);Se.__webglTexture&&(r.deleteTexture(Se.__webglTexture),o.memory.textures--),n.remove(L[ae])}n.remove(L),n.remove(P)}}let B=0;function R(){B=0}function F(){const P=B;return P>=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),B+=1,P}function U(P,L){const J=n.get(P);if(P.isVideoTexture&&ce(P),P.version>0&&J.__version!==P.version){const Q=P.image;if(Q===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(J,P,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,J.__webglTexture)}function Z(P,L){const J=n.get(P);if(P.version>0&&J.__version!==P.version){be(J,P,L);return}t.activeTexture(33984+L),t.bindTexture(35866,J.__webglTexture)}function ee(P,L){const J=n.get(P);if(P.version>0&&J.__version!==P.version){be(J,P,L);return}t.activeTexture(33984+L),t.bindTexture(32879,J.__webglTexture)}function V(P,L){const J=n.get(P);if(P.version>0&&J.__version!==P.version){Y(J,P,L);return}t.activeTexture(33984+L),t.bindTexture(34067,J.__webglTexture)}const W={[Yr]:10497,[wt]:33071,[Jr]:33648},ne={[lt]:9728,[Do]:9984,[Fo]:9986,[nt]:9729,[Ll]:9985,[ci]:9987};function K(P,L,J){if(J?(r.texParameteri(P,10242,W[L.wrapS]),r.texParameteri(P,10243,W[L.wrapT]),(P===32879||P===35866)&&r.texParameteri(P,32882,W[L.wrapR]),r.texParameteri(P,10240,ne[L.magFilter]),r.texParameteri(P,10241,ne[L.minFilter])):(r.texParameteri(P,10242,33071),r.texParameteri(P,10243,33071),(P===32879||P===35866)&&r.texParameteri(P,32882,33071),(L.wrapS!==wt||L.wrapT!==wt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,10240,N(L.magFilter)),r.texParameteri(P,10241,N(L.minFilter)),L.minFilter!==lt&&L.minFilter!==nt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Q=e.get("EXT_texture_filter_anisotropic");if(L.type===sn&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===On&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||n.get(L).__currentAnisotropy)&&(r.texParameterf(P,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,i.getMaxAnisotropy())),n.get(L).__currentAnisotropy=L.anisotropy)}}function he(P,L){P.__webglInit===void 0&&(P.__webglInit=!0,L.addEventListener("dispose",z),P.__webglTexture=r.createTexture(),o.memory.textures++)}function be(P,L,J){let Q=3553;L.isDataTexture2DArray&&(Q=35866),L.isDataTexture3D&&(Q=32879),he(P,L),t.activeTexture(33984+J),t.bindTexture(Q,P.__webglTexture),r.pixelStorei(37440,L.flipY),r.pixelStorei(37441,L.premultiplyAlpha),r.pixelStorei(3317,L.unpackAlignment),r.pixelStorei(37443,0);const ae=y(L)&&_(L.image)===!1,j=m(L.image,ae,!1,u),Se=_(j)||a,_e=s.convert(L.format);let se=s.convert(L.type),D=A(L.internalFormat,_e,se,L.encoding);K(Q,L,Se);let re;const te=L.mipmaps,Ce=a&&L.isVideoTexture!==!0,xe=P.__version===void 0,Ie=C(L,j,Se);if(L.isDepthTexture)D=6402,a?L.type===sn?D=36012:L.type===Zr?D=33190:L.type===ui?D=35056:D=33189:L.type===sn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Gn&&D===6402&&L.type!==or&&L.type!==Zr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=or,se=s.convert(L.type)),L.format===hi&&D===6402&&(D=34041,L.type!==ui&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=ui,se=s.convert(L.type))),Ce&&xe?t.texStorage2D(3553,1,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(L.isDataTexture)if(te.length>0&&Se){Ce&&xe&&t.texStorage2D(3553,Ie,D,te[0].width,te[0].height);for(let ue=0,Pe=te.length;ue<Pe;ue++)re=te[ue],Ce?t.texSubImage2D(3553,0,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data);L.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Ie,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,j.width,j.height,_e,se,j.data)):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,j.data);else if(L.isCompressedTexture){Ce&&xe&&t.texStorage2D(3553,Ie,D,te[0].width,te[0].height);for(let ue=0,Pe=te.length;ue<Pe;ue++)re=te[ue],L.format!==ft&&L.format!==Hn?_e!==null?Ce?t.compressedTexSubImage2D(3553,ue,0,0,re.width,re.height,_e,re.data):t.compressedTexImage2D(3553,ue,D,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ce?t.texSubImage2D(3553,ue,0,0,re.width,re.height,_e,se,re.data):t.texImage2D(3553,ue,D,re.width,re.height,0,_e,se,re.data)}else if(L.isDataTexture2DArray)Ce?(xe&&t.texStorage3D(35866,Ie,D,j.width,j.height,j.depth),t.texSubImage3D(35866,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(35866,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(L.isDataTexture3D)Ce?(xe&&t.texStorage3D(32879,Ie,D,j.width,j.height,j.depth),t.texSubImage3D(32879,0,0,0,0,j.width,j.height,j.depth,_e,se,j.data)):t.texImage3D(32879,0,D,j.width,j.height,j.depth,0,_e,se,j.data);else if(L.isFramebufferTexture)Ce&&xe?t.texStorage2D(3553,Ie,D,j.width,j.height):t.texImage2D(3553,0,D,j.width,j.height,0,_e,se,null);else if(te.length>0&&Se){Ce&&xe&&t.texStorage2D(3553,Ie,D,te[0].width,te[0].height);for(let ue=0,Pe=te.length;ue<Pe;ue++)re=te[ue],Ce?t.texSubImage2D(3553,ue,0,0,_e,se,re):t.texImage2D(3553,ue,D,_e,se,re);L.generateMipmaps=!1}else Ce?(xe&&t.texStorage2D(3553,Ie,D,j.width,j.height),t.texSubImage2D(3553,0,0,0,_e,se,j)):t.texImage2D(3553,0,D,_e,se,j);M(L,Se)&&w(Q),P.__version=L.version,L.onUpdate&&L.onUpdate(L)}function Y(P,L,J){if(L.image.length!==6)return;he(P,L),t.activeTexture(33984+J),t.bindTexture(34067,P.__webglTexture),r.pixelStorei(37440,L.flipY),r.pixelStorei(37441,L.premultiplyAlpha),r.pixelStorei(3317,L.unpackAlignment),r.pixelStorei(37443,0);const Q=L&&(L.isCompressedTexture||L.image[0].isCompressedTexture),ae=L.image[0]&&L.image[0].isDataTexture,j=[];for(let ue=0;ue<6;ue++)!Q&&!ae?j[ue]=m(L.image[ue],!1,!0,c):j[ue]=ae?L.image[ue].image:L.image[ue];const Se=j[0],_e=_(Se)||a,se=s.convert(L.format),D=s.convert(L.type),re=A(L.internalFormat,se,D,L.encoding),te=a&&L.isVideoTexture!==!0,Ce=P.__version===void 0;let xe=C(L,Se,_e);K(34067,L,_e);let Ie;if(Q){te&&Ce&&t.texStorage2D(34067,xe,re,Se.width,Se.height);for(let ue=0;ue<6;ue++){Ie=j[ue].mipmaps;for(let Pe=0;Pe<Ie.length;Pe++){const Ze=Ie[Pe];L.format!==ft&&L.format!==Hn?se!==null?te?t.compressedTexSubImage2D(34069+ue,Pe,0,0,Ze.width,Ze.height,se,Ze.data):t.compressedTexImage2D(34069+ue,Pe,re,Ze.width,Ze.height,0,Ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):te?t.texSubImage2D(34069+ue,Pe,0,0,Ze.width,Ze.height,se,D,Ze.data):t.texImage2D(34069+ue,Pe,re,Ze.width,Ze.height,0,se,D,Ze.data)}}}else{Ie=L.mipmaps,te&&Ce&&(Ie.length>0&&xe++,t.texStorage2D(34067,xe,re,j[0].width,j[0].height));for(let ue=0;ue<6;ue++)if(ae){te?t.texSubImage2D(34069+ue,0,0,0,j[ue].width,j[ue].height,se,D,j[ue].data):t.texImage2D(34069+ue,0,re,j[ue].width,j[ue].height,0,se,D,j[ue].data);for(let Pe=0;Pe<Ie.length;Pe++){const Xe=Ie[Pe].image[ue].image;te?t.texSubImage2D(34069+ue,Pe+1,0,0,Xe.width,Xe.height,se,D,Xe.data):t.texImage2D(34069+ue,Pe+1,re,Xe.width,Xe.height,0,se,D,Xe.data)}}else{te?t.texSubImage2D(34069+ue,0,0,0,se,D,j[ue]):t.texImage2D(34069+ue,0,re,se,D,j[ue]);for(let Pe=0;Pe<Ie.length;Pe++){const Ze=Ie[Pe];te?t.texSubImage2D(34069+ue,Pe+1,0,0,se,D,Ze.image[ue]):t.texImage2D(34069+ue,Pe+1,re,se,D,Ze.image[ue])}}}M(L,_e)&&w(34067),P.__version=L.version,L.onUpdate&&L.onUpdate(L)}function we(P,L,J,Q,ae){const j=s.convert(J.format),Se=s.convert(J.type),_e=A(J.internalFormat,j,Se,J.encoding);n.get(L).__hasExternalTextures||(ae===32879||ae===35866?t.texImage3D(ae,0,_e,L.width,L.height,L.depth,0,j,Se,null):t.texImage2D(ae,0,_e,L.width,L.height,0,j,Se,null)),t.bindFramebuffer(36160,P),L.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,Q,ae,n.get(J).__webglTexture,0,fe(L)):r.framebufferTexture2D(36160,Q,ae,n.get(J).__webglTexture,0),t.bindFramebuffer(36160,null)}function de(P,L,J){if(r.bindRenderbuffer(36161,P),L.depthBuffer&&!L.stencilBuffer){let Q=33189;if(J||L.useRenderToTexture){const ae=L.depthTexture;ae&&ae.isDepthTexture&&(ae.type===sn?Q=36012:ae.type===Zr&&(Q=33190));const j=fe(L);L.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,j,Q,L.width,L.height):r.renderbufferStorageMultisample(36161,j,Q,L.width,L.height)}else r.renderbufferStorage(36161,Q,L.width,L.height);r.framebufferRenderbuffer(36160,36096,36161,P)}else if(L.depthBuffer&&L.stencilBuffer){const Q=fe(L);J&&L.useRenderbuffer?r.renderbufferStorageMultisample(36161,Q,35056,L.width,L.height):L.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,Q,35056,L.width,L.height):r.renderbufferStorage(36161,34041,L.width,L.height),r.framebufferRenderbuffer(36160,33306,36161,P)}else{const Q=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,ae=s.convert(Q.format),j=s.convert(Q.type),Se=A(Q.internalFormat,ae,j,Q.encoding),_e=fe(L);J&&L.useRenderbuffer?r.renderbufferStorageMultisample(36161,_e,Se,L.width,L.height):L.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,_e,Se,L.width,L.height):r.renderbufferStorage(36161,Se,L.width,L.height)}r.bindRenderbuffer(36161,null)}function ge(P,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,P),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),U(L.depthTexture,0);const Q=n.get(L.depthTexture).__webglTexture,ae=fe(L);if(L.depthTexture.format===Gn)L.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,Q,0,ae):r.framebufferTexture2D(36160,36096,3553,Q,0);else if(L.depthTexture.format===hi)L.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,Q,0,ae):r.framebufferTexture2D(36160,33306,3553,Q,0);else throw new Error("Unknown depthTexture format")}function ye(P){const L=n.get(P),J=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture&&!L.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");ge(L.__webglFramebuffer,P)}else if(J){L.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)t.bindFramebuffer(36160,L.__webglFramebuffer[Q]),L.__webglDepthbuffer[Q]=r.createRenderbuffer(),de(L.__webglDepthbuffer[Q],P,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),de(L.__webglDepthbuffer,P,!1);t.bindFramebuffer(36160,null)}function Ue(P,L,J){const Q=n.get(P);L!==void 0&&we(Q.__webglFramebuffer,P,P.texture,36064,3553),J!==void 0&&ye(P)}function k(P){const L=P.texture,J=n.get(P),Q=n.get(L);P.addEventListener("dispose",I),P.isWebGLMultipleRenderTargets!==!0&&(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=L.version,o.memory.textures++);const ae=P.isWebGLCubeRenderTarget===!0,j=P.isWebGLMultipleRenderTargets===!0,Se=L.isDataTexture3D||L.isDataTexture2DArray,_e=_(P)||a;if(a&&L.format===Hn&&(L.type===sn||L.type===On)&&(L.format=ft,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ae){J.__webglFramebuffer=[];for(let se=0;se<6;se++)J.__webglFramebuffer[se]=r.createFramebuffer()}else if(J.__webglFramebuffer=r.createFramebuffer(),j)if(i.drawBuffers){const se=P.texture;for(let D=0,re=se.length;D<re;D++){const te=n.get(se[D]);te.__webglTexture===void 0&&(te.__webglTexture=r.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(P.useRenderbuffer)if(a){J.__webglMultisampledFramebuffer=r.createFramebuffer(),J.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,J.__webglColorRenderbuffer);const se=s.convert(L.format),D=s.convert(L.type),re=A(L.internalFormat,se,D,L.encoding),te=fe(P);r.renderbufferStorageMultisample(36161,te,re,P.width,P.height),t.bindFramebuffer(36160,J.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,J.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),P.depthBuffer&&(J.__webglDepthRenderbuffer=r.createRenderbuffer(),de(J.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ae){t.bindTexture(34067,Q.__webglTexture),K(34067,L,_e);for(let se=0;se<6;se++)we(J.__webglFramebuffer[se],P,L,36064,34069+se);M(L,_e)&&w(34067),t.unbindTexture()}else if(j){const se=P.texture;for(let D=0,re=se.length;D<re;D++){const te=se[D],Ce=n.get(te);t.bindTexture(3553,Ce.__webglTexture),K(3553,te,_e),we(J.__webglFramebuffer,P,te,36064+D,3553),M(te,_e)&&w(3553)}t.unbindTexture()}else{let se=3553;Se&&(a?se=L.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(se,Q.__webglTexture),K(se,L,_e),we(J.__webglFramebuffer,P,L,36064,se),M(L,_e)&&w(se),t.unbindTexture()}P.depthBuffer&&ye(P)}function $(P){const L=_(P)||a,J=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let Q=0,ae=J.length;Q<ae;Q++){const j=J[Q];if(M(j,L)){const Se=P.isWebGLCubeRenderTarget?34067:3553,_e=n.get(j).__webglTexture;t.bindTexture(Se,_e),w(Se),t.unbindTexture()}}}function ie(P){if(P.useRenderbuffer)if(a){const L=P.width,J=P.height;let Q=16384;const ae=[36064],j=P.stencilBuffer?33306:36096;P.depthBuffer&&ae.push(j),P.ignoreDepthForMultisampleCopy||(P.depthBuffer&&(Q|=256),P.stencilBuffer&&(Q|=1024));const Se=n.get(P);t.bindFramebuffer(36008,Se.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Se.__webglFramebuffer),P.ignoreDepthForMultisampleCopy&&(r.invalidateFramebuffer(36008,[j]),r.invalidateFramebuffer(36009,[j])),r.blitFramebuffer(0,0,L,J,0,0,L,J,Q,9728),r.invalidateFramebuffer(36008,ae),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Se.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function fe(P){return a&&(P.useRenderbuffer||P.useRenderToTexture)?Math.min(h,P.samples):0}function ce(P){const L=o.render.frame;p.get(P)!==L&&(p.set(P,L),P.update())}let Ae=!1,Le=!1;function De(P,L){P&&P.isWebGLRenderTarget&&(Ae===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ae=!0),P=P.texture),U(P,L)}function $e(P,L){P&&P.isWebGLCubeRenderTarget&&(Le===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Le=!0),P=P.texture),V(P,L)}this.allocateTextureUnit=F,this.resetTextureUnits=R,this.setTexture2D=U,this.setTexture2DArray=Z,this.setTexture3D=ee,this.setTextureCube=V,this.rebindTextures=Ue,this.setupRenderTarget=k,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=we,this.safeSetTexture2D=De,this.safeSetTextureCube=$e}function Hx(r,e,t){const n=t.isWebGL2;function i(s){let o;if(s===rn)return 5121;if(s===Tf)return 32819;if(s===Ef)return 32820;if(s===Af)return 33635;if(s===bf)return 5120;if(s===wf)return 5122;if(s===or)return 5123;if(s===Sf)return 5124;if(s===Zr)return 5125;if(s===sn)return 5126;if(s===On)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Lf)return 6406;if(s===Hn)return 6407;if(s===ft)return 6408;if(s===Cf)return 6409;if(s===Rf)return 6410;if(s===Gn)return 6402;if(s===hi)return 34041;if(s===Pf)return 6403;if(s===If)return 36244;if(s===Df)return 33319;if(s===Ff)return 33320;if(s===Bf)return 36248;if(s===zf)return 36249;if(s===Cl||s===Rl||s===Pl||s===Il)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Cl)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Rl)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Pl)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Il)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Dl||s===Fl||s===Bl||s===zl)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Dl)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Fl)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Bl)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===zl)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Nf)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===Nl||s===Ul)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===Nl)return o.COMPRESSED_RGB8_ETC2;if(s===Ul)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===Uf||s===Of||s===Hf||s===Gf||s===Vf||s===kf||s===Wf||s===qf||s===Xf||s===Yf||s===Jf||s===Zf||s===$f||s===jf||s===Kf||s===ed||s===td||s===nd||s===id||s===rd||s===sd||s===od||s===ad||s===ld||s===cd||s===ud||s===hd||s===fd)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===Qf)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===ui)return n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class Nc extends Mt{constructor(e=[]){super(),this.cameras=e}}Nc.prototype.isArrayCamera=!0;class Ni extends ke{constructor(){super(),this.type="Group"}}Ni.prototype.isGroup=!0;const Gx={type:"move"};class wa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ni,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 Ni,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new S,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new S),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ni,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new S,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new S),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}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Gx))),c&&e.hand){o=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,n);if(c.joints[x.jointName]===void 0){const m=new Ni;m.matrixAutoUpdate=!1,m.visible=!1,c.joints[x.jointName]=m,c.add(m)}const g=c.joints[x.jointName];v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=v.radius),g.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(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),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));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}}class Sa extends dt{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:Gn,u!==Gn&&u!==hi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Gn&&(n=or),n===void 0&&u===hi&&(n=ui),super(null,i,s,o,a,l,u,n,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:lt,this.minFilter=l!==void 0?l:lt,this.flipY=!1,this.generateMipmaps=!1}}Sa.prototype.isDepthTexture=!0;class Vx extends Vn{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor";const l=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,u=null,h=null,f=null,d=!1,p=null;const x=t.getContextAttributes();let v=null,g=null;const m=[],_=new Map,y=new Mt;y.layers.enable(1),y.viewport=new We;const M=new Mt;M.layers.enable(2),M.viewport=new We;const w=[y,M],A=new Nc;A.layers.enable(1),A.layers.enable(2);let C=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let W=m[V];return W===void 0&&(W=new wa,m[V]=W),W.getTargetRaySpace()},this.getControllerGrip=function(V){let W=m[V];return W===void 0&&(W=new wa,m[V]=W),W.getGripSpace()},this.getHand=function(V){let W=m[V];return W===void 0&&(W=new wa,m[V]=W),W.getHandSpace()};function z(V){const W=_.get(V.inputSource);W&&W.dispatchEvent({type:V.type,data:V.inputSource})}function I(){_.forEach(function(V,W){V.disconnect(W)}),_.clear(),C=null,N=null,e.setRenderTarget(v),f=null,h=null,u=null,i=null,g=null,ee.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=function(V){return er(this,null,function*(){if(i=V,i!==null){if(v=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",I),i.addEventListener("inputsourceschange",b),x.xrCompatible!==!0&&(yield t.makeXRCompatible()),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const W={antialias:i.renderState.layers===void 0?x.antialias:!0,alpha:x.alpha,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,W),i.updateRenderState({baseLayer:f}),g=new zt(f.framebufferWidth,f.framebufferHeight,{format:ft,type:rn,encoding:e.outputEncoding})}else{d=x.antialias;let W=null,ne=null,K=null;x.depth&&(K=x.stencil?35056:33190,W=x.stencil?hi:Gn,ne=x.stencil?ui:or);const he={colorFormat:x.alpha||d?32856:32849,depthFormat:K,scaleFactor:s};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(he),i.updateRenderState({layers:[h]}),d?g=new Go(h.textureWidth,h.textureHeight,{format:ft,type:rn,depthTexture:new Sa(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,useRenderToTexture:l,encoding:e.outputEncoding}):g=new zt(h.textureWidth,h.textureHeight,{format:x.alpha?ft:Hn,type:rn,depthTexture:new Sa(h.textureWidth,h.textureHeight,ne,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:x.stencil,ignoreDepth:h.ignoreDepthValues,encoding:e.outputEncoding})}this.setFoveation(1),o=yield i.requestReferenceSpace(a),ee.setContext(i),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})};function b(V){const W=i.inputSources;for(let ne=0;ne<m.length;ne++)_.set(W[ne],m[ne]);for(let ne=0;ne<V.removed.length;ne++){const K=V.removed[ne],he=_.get(K);he&&(he.dispatchEvent({type:"disconnected",data:K}),_.delete(K))}for(let ne=0;ne<V.added.length;ne++){const K=V.added[ne],he=_.get(K);he&&he.dispatchEvent({type:"connected",data:K})}}const T=new S,B=new S;function R(V,W,ne){T.setFromMatrixPosition(W.matrixWorld),B.setFromMatrixPosition(ne.matrixWorld);const K=T.distanceTo(B),he=W.projectionMatrix.elements,be=ne.projectionMatrix.elements,Y=he[14]/(he[10]-1),we=he[14]/(he[10]+1),de=(he[9]+1)/he[5],ge=(he[9]-1)/he[5],ye=(he[8]-1)/he[0],Ue=(be[8]+1)/be[0],k=Y*ye,$=Y*Ue,ie=K/(-ye+Ue),fe=ie*-ye;W.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(fe),V.translateZ(ie),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const ce=Y+ie,Ae=we+ie,Le=k-fe,De=$+(K-fe),$e=de*we/Ae*ce,P=ge*we/Ae*ce;V.projectionMatrix.makePerspective(Le,De,$e,P,ce,Ae)}function F(V,W){W===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(W.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;A.near=M.near=y.near=V.near,A.far=M.far=y.far=V.far,(C!==A.near||N!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,N=A.far);const W=V.parent,ne=A.cameras;F(A,W);for(let he=0;he<ne.length;he++)F(ne[he],W);A.matrixWorld.decompose(A.position,A.quaternion,A.scale),V.position.copy(A.position),V.quaternion.copy(A.quaternion),V.scale.copy(A.scale),V.matrix.copy(A.matrix),V.matrixWorld.copy(A.matrixWorld);const K=V.children;for(let he=0,be=K.length;he<be;he++)K[he].updateMatrixWorld(!0);ne.length===2?R(A,y,M):A.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return A},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(V){h!==null&&(h.fixedFoveation=V),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=V)};let U=null;function Z(V,W){if(c=W.getViewerPose(o),p=W,c!==null){const K=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let he=!1;K.length!==A.cameras.length&&(A.cameras.length=0,he=!0);for(let be=0;be<K.length;be++){const Y=K[be];let we=null;if(f!==null)we=f.getViewport(Y);else{const ge=u.getViewSubImage(h,Y);we=ge.viewport,be===0&&(e.setRenderTargetTextures(g,ge.colorTexture,h.ignoreDepthValues?void 0:ge.depthStencilTexture),e.setRenderTarget(g))}const de=w[be];de.matrix.fromArray(Y.transform.matrix),de.projectionMatrix.fromArray(Y.projectionMatrix),de.viewport.set(we.x,we.y,we.width,we.height),be===0&&A.matrix.copy(de.matrix),he===!0&&A.cameras.push(de)}}const ne=i.inputSources;for(let K=0;K<m.length;K++){const he=m[K],be=ne[K];he.update(be,W,o)}U&&U(V,W),p=null}const ee=new nc;ee.setAnimationLoop(Z),this.setAnimationLoop=function(V){U=V},this.dispose=function(){}}}function kx(r){function e(g,m){g.fogColor.value.copy(m.color),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function t(g,m,_,y,M){m.isMeshBasicMaterial?n(g,m):m.isMeshLambertMaterial?(n(g,m),l(g,m)):m.isMeshToonMaterial?(n(g,m),u(g,m)):m.isMeshPhongMaterial?(n(g,m),c(g,m)):m.isMeshStandardMaterial?(n(g,m),m.isMeshPhysicalMaterial?f(g,m,M):h(g,m)):m.isMeshMatcapMaterial?(n(g,m),d(g,m)):m.isMeshDepthMaterial?(n(g,m),p(g,m)):m.isMeshDistanceMaterial?(n(g,m),x(g,m)):m.isMeshNormalMaterial?(n(g,m),v(g,m)):m.isLineBasicMaterial?(i(g,m),m.isLineDashedMaterial&&s(g,m)):m.isPointsMaterial?o(g,m,_,y):m.isSpriteMaterial?a(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function n(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.specularMap&&(g.specularMap.value=m.specularMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const _=r.get(m).envMap;_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity);let y;m.map?y=m.map:m.specularMap?y=m.specularMap:m.displacementMap?y=m.displacementMap:m.normalMap?y=m.normalMap:m.bumpMap?y=m.bumpMap:m.roughnessMap?y=m.roughnessMap:m.metalnessMap?y=m.metalnessMap:m.alphaMap?y=m.alphaMap:m.emissiveMap?y=m.emissiveMap:m.clearcoatMap?y=m.clearcoatMap:m.clearcoatNormalMap?y=m.clearcoatNormalMap:m.clearcoatRoughnessMap?y=m.clearcoatRoughnessMap:m.specularIntensityMap?y=m.specularIntensityMap:m.specularColorMap?y=m.specularColorMap:m.transmissionMap?y=m.transmissionMap:m.thicknessMap?y=m.thicknessMap:m.sheenColorMap?y=m.sheenColorMap:m.sheenRoughnessMap&&(y=m.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let M;m.aoMap?M=m.aoMap:m.lightMap&&(M=m.lightMap),M!==void 0&&(M.isWebGLRenderTarget&&(M=M.texture),M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uv2Transform.value.copy(M.matrix))}function i(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity}function s(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function o(g,m,_,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*_,g.scale.value=y*.5,m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let M;m.map?M=m.map:m.alphaMap&&(M=m.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uvTransform.value.copy(M.matrix))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let _;m.map?_=m.map:m.alphaMap&&(_=m.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),g.uvTransform.value.copy(_.matrix))}function l(g,m){m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap)}function c(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===at&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===at&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===at&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===at&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function h(g,m){g.roughness.value=m.roughness,g.metalness.value=m.metalness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap),m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===at&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===at&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),r.get(m).envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function f(g,m,_){h(g,m),g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap)),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap),m.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),g.clearcoatNormalMap.value=m.clearcoatNormalMap,m.side===at&&g.clearcoatNormalScale.value.negate())),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap)}function d(g,m){m.matcap&&(g.matcap.value=m.matcap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===at&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===at&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function p(g,m){m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function x(g,m){m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),g.referencePosition.value.copy(m.referencePosition),g.nearDistance.value=m.nearDistance,g.farDistance.value=m.farDistance}function v(g,m){m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===at&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===at&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function Wx(){const r=es("canvas");return r.style.display="block",r}function qe(r={}){const e=r.canvas!==void 0?r.canvas:Wx(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,s=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",u=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let h=null,f=null;const d=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Vt,this.physicallyCorrectLights=!1,this.toneMapping=_n,this.toneMappingExposure=1;const x=this;let v=!1,g=0,m=0,_=null,y=-1,M=null;const w=new We,A=new We;let C=null,N=e.width,z=e.height,I=1,b=null,T=null;const B=new We(0,0,N,z),R=new We(0,0,N,z);let F=!1;const U=[],Z=new _s;let ee=!1,V=!1,W=null;const ne=new pe,K=new S,he={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function be(){return _===null?I:1}let Y=t;function we(E,O){for(let G=0;G<E.length;G++){const H=E[G],X=e.getContext(H,O);if(X!==null)return X}return null}try{const E={alpha:n,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Gt}`),e.addEventListener("webglcontextlost",Ce,!1),e.addEventListener("webglcontextrestored",xe,!1),Y===null){const O=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&O.shift(),Y=we(O,E),Y===null)throw we(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Y.getShaderPrecisionFormat===void 0&&(Y.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let de,ge,ye,Ue,k,$,ie,fe,ce,Ae,Le,De,$e,P,L,J,Q,ae,j,Se,_e,se,D;function re(){de=new ug(Y),ge=new ig(Y,de,r),de.init(ge),se=new Hx(Y,de,ge),ye=new Ux(Y,de,ge),U[0]=1029,Ue=new dg(Y),k=new Ax,$=new Ox(Y,de,ye,k,ge,se,Ue),ie=new sg(x),fe=new cg(x),ce=new sp(Y,ge),D=new tg(Y,de,ce,ge),Ae=new hg(Y,ce,Ue,D),Le=new xg(Y,Ae,ce,Ue),j=new gg(Y,ge,$),J=new rg(k),De=new Ex(x,ie,fe,de,ge,D,J),$e=new kx(k),P=new Cx,L=new Bx(de,ge),ae=new eg(x,ie,ye,Le,a),Q=new zc(x,Le,ge),Se=new ng(Y,de,Ue,ge),_e=new fg(Y,de,Ue,ge),Ue.programs=De.programs,x.capabilities=ge,x.extensions=de,x.properties=k,x.renderLists=P,x.shadowMap=Q,x.state=ye,x.info=Ue}re();const te=new Vx(x,Y);this.xr=te,this.getContext=function(){return Y},this.getContextAttributes=function(){return Y.getContextAttributes()},this.forceContextLoss=function(){const E=de.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=de.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(E){E!==void 0&&(I=E,this.setSize(N,z,!1))},this.getSize=function(E){return E.set(N,z)},this.setSize=function(E,O,G){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}N=E,z=O,e.width=Math.floor(E*I),e.height=Math.floor(O*I),G!==!1&&(e.style.width=E+"px",e.style.height=O+"px"),this.setViewport(0,0,E,O)},this.getDrawingBufferSize=function(E){return E.set(N*I,z*I).floor()},this.setDrawingBufferSize=function(E,O,G){N=E,z=O,I=G,e.width=Math.floor(E*G),e.height=Math.floor(O*G),this.setViewport(0,0,E,O)},this.getCurrentViewport=function(E){return E.copy(w)},this.getViewport=function(E){return E.copy(B)},this.setViewport=function(E,O,G,H){E.isVector4?B.set(E.x,E.y,E.z,E.w):B.set(E,O,G,H),ye.viewport(w.copy(B).multiplyScalar(I).floor())},this.getScissor=function(E){return E.copy(R)},this.setScissor=function(E,O,G,H){E.isVector4?R.set(E.x,E.y,E.z,E.w):R.set(E,O,G,H),ye.scissor(A.copy(R).multiplyScalar(I).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(E){ye.setScissorTest(F=E)},this.setOpaqueSort=function(E){b=E},this.setTransparentSort=function(E){T=E},this.getClearColor=function(E){return E.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(E,O,G){let H=0;(E===void 0||E)&&(H|=16384),(O===void 0||O)&&(H|=256),(G===void 0||G)&&(H|=1024),Y.clear(H)},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(){e.removeEventListener("webglcontextlost",Ce,!1),e.removeEventListener("webglcontextrestored",xe,!1),P.dispose(),L.dispose(),k.dispose(),ie.dispose(),fe.dispose(),Le.dispose(),D.dispose(),De.dispose(),te.dispose(),te.removeEventListener("sessionstart",Qt),te.removeEventListener("sessionend",Kt),W&&(W.dispose(),W=null),ni.stop()};function Ce(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const E=Ue.autoReset,O=Q.enabled,G=Q.autoUpdate,H=Q.needsUpdate,X=Q.type;re(),Ue.autoReset=E,Q.enabled=O,Q.autoUpdate=G,Q.needsUpdate=H,Q.type=X}function Ie(E){const O=E.target;O.removeEventListener("dispose",Ie),ue(O)}function ue(E){Pe(E),k.remove(E)}function Pe(E){const O=k.get(E).programs;O!==void 0&&(O.forEach(function(G){De.releaseProgram(G)}),E.isShaderMaterial&&De.releaseShaderCache(E))}this.renderBufferDirect=function(E,O,G,H,X,Te){O===null&&(O=he);const Re=X.isMesh&&X.matrixWorld.determinant()<0,Fe=fv(E,O,G,H,X);ye.setMaterial(H,Re);let Ee=G.index;const He=G.attributes.position;if(Ee===null){if(He===void 0||He.count===0)return}else if(Ee.count===0)return;let Be=1;H.wireframe===!0&&(Ee=Ae.getWireframeAttribute(G),Be=2),D.setup(X,H,Fe,G,Ee);let Oe,tt=Se;Ee!==null&&(Oe=ce.get(Ee),tt=_e,tt.setIndex(Oe));const ii=Ee!==null?Ee.count:He.count,Ki=G.drawRange.start*Be,Ve=G.drawRange.count*Be,en=Te!==null?Te.start*Be:0,pt=Te!==null?Te.count*Be:1/0,tn=Math.max(Ki,en),Lo=Math.min(ii,Ki+Ve,en+pt)-1,nn=Math.max(0,Lo-tn+1);if(nn!==0){if(X.isMesh)H.wireframe===!0?(ye.setLineWidth(H.wireframeLinewidth*be()),tt.setMode(1)):tt.setMode(4);else if(X.isLine){let yn=H.linewidth;yn===void 0&&(yn=1),ye.setLineWidth(yn*be()),X.isLineSegments?tt.setMode(1):X.isLineLoop?tt.setMode(2):tt.setMode(3)}else X.isPoints?tt.setMode(0):X.isSprite&&tt.setMode(4);if(X.isInstancedMesh)tt.renderInstances(tn,nn,X.count);else if(G.isInstancedBufferGeometry){const yn=Math.min(G.instanceCount,G._maxInstanceCount);tt.renderInstances(tn,nn,yn)}else tt.render(tn,nn)}},this.compile=function(E,O){f=L.get(E),f.init(),p.push(f),E.traverseVisible(function(G){G.isLight&&G.layers.test(O.layers)&&(f.pushLight(G),G.castShadow&&f.pushShadow(G))}),f.setupLights(x.physicallyCorrectLights),E.traverse(function(G){const H=G.material;if(H)if(Array.isArray(H))for(let X=0;X<H.length;X++){const Te=H[X];xl(Te,E,G)}else xl(H,E,G)}),p.pop(),f=null};let Ze=null;function Xe(E){Ze&&Ze(E)}function Qt(){ni.stop()}function Kt(){ni.start()}const ni=new nc;ni.setAnimationLoop(Xe),typeof window!="undefined"&&ni.setContext(window),this.setAnimationLoop=function(E){Ze=E,te.setAnimationLoop(E),E===null?ni.stop():ni.start()},te.addEventListener("sessionstart",Qt),te.addEventListener("sessionend",Kt),this.render=function(E,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;E.autoUpdate===!0&&E.updateMatrixWorld(),O.parent===null&&O.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(O),O=te.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,O,_),f=L.get(E,p.length),f.init(),p.push(f),ne.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Z.setFromProjectionMatrix(ne),V=this.localClippingEnabled,ee=J.init(this.clippingPlanes,V,O),h=P.get(E,d.length),h.init(),d.push(h),Oh(E,O,0,x.sortObjects),h.finish(),x.sortObjects===!0&&h.sort(b,T),ee===!0&&J.beginShadows();const G=f.state.shadowsArray;if(Q.render(G,E,O),ee===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset(),ae.render(h,E),f.setupLights(x.physicallyCorrectLights),O.isArrayCamera){const H=O.cameras;for(let X=0,Te=H.length;X<Te;X++){const Re=H[X];Hh(h,E,Re,Re.viewport)}}else Hh(h,E,O);_!==null&&($.updateMultisampleRenderTarget(_),$.updateRenderTargetMipmap(_)),E.isScene===!0&&E.onAfterRender(x,E,O),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1),D.resetDefaultState(),y=-1,M=null,p.pop(),p.length>0?f=p[p.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Oh(E,O,G,H){if(E.visible===!1)return;if(E.layers.test(O.layers)){if(E.isGroup)G=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(O);else if(E.isLight)f.pushLight(E),E.castShadow&&f.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Z.intersectsSprite(E)){H&&K.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ne);const Re=Le.update(E),Fe=E.material;Fe.visible&&h.push(E,Re,Fe,G,K.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(E.isSkinnedMesh&&E.skeleton.frame!==Ue.render.frame&&(E.skeleton.update(),E.skeleton.frame=Ue.render.frame),!E.frustumCulled||Z.intersectsObject(E))){H&&K.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ne);const Re=Le.update(E),Fe=E.material;if(Array.isArray(Fe)){const Ee=Re.groups;for(let He=0,Be=Ee.length;He<Be;He++){const Oe=Ee[He],tt=Fe[Oe.materialIndex];tt&&tt.visible&&h.push(E,Re,tt,G,K.z,Oe)}}else Fe.visible&&h.push(E,Re,Fe,G,K.z,null)}}const Te=E.children;for(let Re=0,Fe=Te.length;Re<Fe;Re++)Oh(Te[Re],O,G,H)}function Hh(E,O,G,H){const X=E.opaque,Te=E.transmissive,Re=E.transparent;f.setupLightsView(G),Te.length>0&&uv(X,O,G),H&&ye.viewport(w.copy(H)),X.length>0&&Ao(X,O,G),Te.length>0&&Ao(Te,O,G),Re.length>0&&Ao(Re,O,G)}function uv(E,O,G){if(W===null){const Re=o===!0&&ge.isWebGL2===!0?Go:zt;W=new Re(1024,1024,{generateMipmaps:!0,type:se.convert(On)!==null?On:rn,minFilter:ci,magFilter:lt,wrapS:wt,wrapT:wt,useRenderToTexture:de.has("WEBGL_multisampled_render_to_texture")})}const H=x.getRenderTarget();x.setRenderTarget(W),x.clear();const X=x.toneMapping;x.toneMapping=_n,Ao(E,O,G),x.toneMapping=X,$.updateMultisampleRenderTarget(W),$.updateRenderTargetMipmap(W),x.setRenderTarget(H)}function Ao(E,O,G){const H=O.isScene===!0?O.overrideMaterial:null;for(let X=0,Te=E.length;X<Te;X++){const Re=E[X],Fe=Re.object,Ee=Re.geometry,He=H===null?Re.material:H,Be=Re.group;Fe.layers.test(G.layers)&&hv(Fe,O,G,Ee,He,Be)}}function hv(E,O,G,H,X,Te){E.onBeforeRender(x,O,G,H,X,Te),E.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),X.onBeforeRender(x,O,G,H,E,Te),X.transparent===!0&&X.side===si?(X.side=at,X.needsUpdate=!0,x.renderBufferDirect(G,O,H,X,E,Te),X.side=ri,X.needsUpdate=!0,x.renderBufferDirect(G,O,H,X,E,Te),X.side=si):x.renderBufferDirect(G,O,H,X,E,Te),E.onAfterRender(x,O,G,H,X,Te)}function xl(E,O,G){O.isScene!==!0&&(O=he);const H=k.get(E),X=f.state.lights,Te=f.state.shadowsArray,Re=X.state.version,Fe=De.getParameters(E,X.state,Te,O,G),Ee=De.getProgramCacheKey(Fe);let He=H.programs;H.environment=E.isMeshStandardMaterial?O.environment:null,H.fog=O.fog,H.envMap=(E.isMeshStandardMaterial?fe:ie).get(E.envMap||H.environment),He===void 0&&(E.addEventListener("dispose",Ie),He=new Map,H.programs=He);let Be=He.get(Ee);if(Be!==void 0){if(H.currentProgram===Be&&H.lightsStateVersion===Re)return Gh(E,Fe),Be}else Fe.uniforms=De.getUniforms(E),E.onBuild(G,Fe,x),E.onBeforeCompile(Fe,x),Be=De.acquireProgram(Fe,Ee),He.set(Ee,Be),H.uniforms=Fe.uniforms;const Oe=H.uniforms;(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Oe.clippingPlanes=J.uniform),Gh(E,Fe),H.needsLights=pv(E),H.lightsStateVersion=Re,H.needsLights&&(Oe.ambientLightColor.value=X.state.ambient,Oe.lightProbe.value=X.state.probe,Oe.directionalLights.value=X.state.directional,Oe.directionalLightShadows.value=X.state.directionalShadow,Oe.spotLights.value=X.state.spot,Oe.spotLightShadows.value=X.state.spotShadow,Oe.rectAreaLights.value=X.state.rectArea,Oe.ltc_1.value=X.state.rectAreaLTC1,Oe.ltc_2.value=X.state.rectAreaLTC2,Oe.pointLights.value=X.state.point,Oe.pointLightShadows.value=X.state.pointShadow,Oe.hemisphereLights.value=X.state.hemi,Oe.directionalShadowMap.value=X.state.directionalShadowMap,Oe.directionalShadowMatrix.value=X.state.directionalShadowMatrix,Oe.spotShadowMap.value=X.state.spotShadowMap,Oe.spotShadowMatrix.value=X.state.spotShadowMatrix,Oe.pointShadowMap.value=X.state.pointShadowMap,Oe.pointShadowMatrix.value=X.state.pointShadowMatrix);const tt=Be.getUniforms(),ii=In.seqWithValue(tt.seq,Oe);return H.currentProgram=Be,H.uniformsList=ii,Be}function Gh(E,O){const G=k.get(E);G.outputEncoding=O.outputEncoding,G.instancing=O.instancing,G.skinning=O.skinning,G.morphTargets=O.morphTargets,G.morphNormals=O.morphNormals,G.morphTargetsCount=O.morphTargetsCount,G.numClippingPlanes=O.numClippingPlanes,G.numIntersection=O.numClipIntersection,G.vertexAlphas=O.vertexAlphas,G.vertexTangents=O.vertexTangents,G.toneMapping=O.toneMapping}function fv(E,O,G,H,X){O.isScene!==!0&&(O=he),$.resetTextureUnits();const Te=O.fog,Re=H.isMeshStandardMaterial?O.environment:null,Fe=_===null?x.outputEncoding:_.texture.encoding,Ee=(H.isMeshStandardMaterial?fe:ie).get(H.envMap||Re),He=H.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,Be=!!H.normalMap&&!!G.attributes.tangent,Oe=!!G.morphAttributes.position,tt=!!G.morphAttributes.normal,ii=G.morphAttributes.position?G.morphAttributes.position.length:0,Ki=H.toneMapped?x.toneMapping:_n,Ve=k.get(H),en=f.state.lights;if(ee===!0&&(V===!0||E!==M)){const Xt=E===M&&H.id===y;J.setState(H,E,Xt)}let pt=!1;H.version===Ve.__version?(Ve.needsLights&&Ve.lightsStateVersion!==en.state.version||Ve.outputEncoding!==Fe||X.isInstancedMesh&&Ve.instancing===!1||!X.isInstancedMesh&&Ve.instancing===!0||X.isSkinnedMesh&&Ve.skinning===!1||!X.isSkinnedMesh&&Ve.skinning===!0||Ve.envMap!==Ee||H.fog&&Ve.fog!==Te||Ve.numClippingPlanes!==void 0&&(Ve.numClippingPlanes!==J.numPlanes||Ve.numIntersection!==J.numIntersection)||Ve.vertexAlphas!==He||Ve.vertexTangents!==Be||Ve.morphTargets!==Oe||Ve.morphNormals!==tt||Ve.toneMapping!==Ki||ge.isWebGL2===!0&&Ve.morphTargetsCount!==ii)&&(pt=!0):(pt=!0,Ve.__version=H.version);let tn=Ve.currentProgram;pt===!0&&(tn=xl(H,O,X));let Lo=!1,nn=!1,yn=!1;const At=tn.getUniforms(),Hr=Ve.uniforms;if(ye.useProgram(tn.program)&&(Lo=!0,nn=!0,yn=!0),H.id!==y&&(y=H.id,nn=!0),Lo||M!==E){if(At.setValue(Y,"projectionMatrix",E.projectionMatrix),ge.logarithmicDepthBuffer&&At.setValue(Y,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),M!==E&&(M=E,nn=!0,yn=!0),H.isShaderMaterial||H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshStandardMaterial||H.envMap){const Xt=At.map.cameraPosition;Xt!==void 0&&Xt.setValue(Y,K.setFromMatrixPosition(E.matrixWorld))}(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&At.setValue(Y,"isOrthographic",E.isOrthographicCamera===!0),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial||H.isShadowMaterial||X.isSkinnedMesh)&&At.setValue(Y,"viewMatrix",E.matrixWorldInverse)}if(X.isSkinnedMesh){At.setOptional(Y,X,"bindMatrix"),At.setOptional(Y,X,"bindMatrixInverse");const Xt=X.skeleton;Xt&&(ge.floatVertexTextures?(Xt.boneTexture===null&&Xt.computeBoneTexture(),At.setValue(Y,"boneTexture",Xt.boneTexture,$),At.setValue(Y,"boneTextureSize",Xt.boneTextureSize)):At.setOptional(Y,Xt,"boneMatrices"))}return!!G&&(G.morphAttributes.position!==void 0||G.morphAttributes.normal!==void 0)&&j.update(X,G,H,tn),(nn||Ve.receiveShadow!==X.receiveShadow)&&(Ve.receiveShadow=X.receiveShadow,At.setValue(Y,"receiveShadow",X.receiveShadow)),nn&&(At.setValue(Y,"toneMappingExposure",x.toneMappingExposure),Ve.needsLights&&dv(Hr,yn),Te&&H.fog&&$e.refreshFogUniforms(Hr,Te),$e.refreshMaterialUniforms(Hr,H,I,z,W),In.upload(Y,Ve.uniformsList,Hr,$)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(In.upload(Y,Ve.uniformsList,Hr,$),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&At.setValue(Y,"center",X.center),At.setValue(Y,"modelViewMatrix",X.modelViewMatrix),At.setValue(Y,"normalMatrix",X.normalMatrix),At.setValue(Y,"modelMatrix",X.matrixWorld),tn}function dv(E,O){E.ambientLightColor.needsUpdate=O,E.lightProbe.needsUpdate=O,E.directionalLights.needsUpdate=O,E.directionalLightShadows.needsUpdate=O,E.pointLights.needsUpdate=O,E.pointLightShadows.needsUpdate=O,E.spotLights.needsUpdate=O,E.spotLightShadows.needsUpdate=O,E.rectAreaLights.needsUpdate=O,E.hemisphereLights.needsUpdate=O}function pv(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return m},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(E,O,G){k.get(E.texture).__webglTexture=O,k.get(E.depthTexture).__webglTexture=G;const H=k.get(E);H.__hasExternalTextures=!0,H.__hasExternalTextures&&(H.__autoAllocateDepthBuffer=G===void 0,H.__autoAllocateDepthBuffer||E.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),E.useRenderToTexture=!1,E.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(E,O){const G=k.get(E);G.__webglFramebuffer=O,G.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(E,O=0,G=0){_=E,g=O,m=G;let H=!0;if(E){const Ee=k.get(E);Ee.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(36160,null),H=!1):Ee.__webglFramebuffer===void 0?$.setupRenderTarget(E):Ee.__hasExternalTextures&&$.rebindTextures(E,k.get(E.texture).__webglTexture,k.get(E.depthTexture).__webglTexture)}let X=null,Te=!1,Re=!1;if(E){const Ee=E.texture;(Ee.isDataTexture3D||Ee.isDataTexture2DArray)&&(Re=!0);const He=k.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(X=He[O],Te=!0):E.useRenderbuffer?X=k.get(E).__webglMultisampledFramebuffer:X=He,w.copy(E.viewport),A.copy(E.scissor),C=E.scissorTest}else w.copy(B).multiplyScalar(I).floor(),A.copy(R).multiplyScalar(I).floor(),C=F;if(ye.bindFramebuffer(36160,X)&&ge.drawBuffers&&H){let Ee=!1;if(E)if(E.isWebGLMultipleRenderTargets){const He=E.texture;if(U.length!==He.length||U[0]!==36064){for(let Be=0,Oe=He.length;Be<Oe;Be++)U[Be]=36064+Be;U.length=He.length,Ee=!0}}else(U.length!==1||U[0]!==36064)&&(U[0]=36064,U.length=1,Ee=!0);else(U.length!==1||U[0]!==1029)&&(U[0]=1029,U.length=1,Ee=!0);Ee&&(ge.isWebGL2?Y.drawBuffers(U):de.get("WEBGL_draw_buffers").drawBuffersWEBGL(U))}if(ye.viewport(w),ye.scissor(A),ye.setScissorTest(C),Te){const Ee=k.get(E.texture);Y.framebufferTexture2D(36160,36064,34069+O,Ee.__webglTexture,G)}else if(Re){const Ee=k.get(E.texture),He=O||0;Y.framebufferTextureLayer(36160,36064,Ee.__webglTexture,G||0,He)}y=-1},this.readRenderTargetPixels=function(E,O,G,H,X,Te,Re){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=k.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Re!==void 0&&(Fe=Fe[Re]),Fe){ye.bindFramebuffer(36160,Fe);try{const Ee=E.texture,He=Ee.format,Be=Ee.type;if(He!==ft&&se.convert(He)!==Y.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Oe=Be===On&&(de.has("EXT_color_buffer_half_float")||ge.isWebGL2&&de.has("EXT_color_buffer_float"));if(Be!==rn&&se.convert(Be)!==Y.getParameter(35738)&&!(Be===sn&&(ge.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!Oe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y.checkFramebufferStatus(36160)===36053?O>=0&&O<=E.width-H&&G>=0&&G<=E.height-X&&Y.readPixels(O,G,H,X,se.convert(He),se.convert(Be),Te):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Ee=_!==null?k.get(_).__webglFramebuffer:null;ye.bindFramebuffer(36160,Ee)}}},this.copyFramebufferToTexture=function(E,O,G=0){if(O.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const H=Math.pow(2,-G),X=Math.floor(O.image.width*H),Te=Math.floor(O.image.height*H);$.setTexture2D(O,0),Y.copyTexSubImage2D(3553,G,0,0,E.x,E.y,X,Te),ye.unbindTexture()},this.copyTextureToTexture=function(E,O,G,H=0){const X=O.image.width,Te=O.image.height,Re=se.convert(G.format),Fe=se.convert(G.type);$.setTexture2D(G,0),Y.pixelStorei(37440,G.flipY),Y.pixelStorei(37441,G.premultiplyAlpha),Y.pixelStorei(3317,G.unpackAlignment),O.isDataTexture?Y.texSubImage2D(3553,H,E.x,E.y,X,Te,Re,Fe,O.image.data):O.isCompressedTexture?Y.compressedTexSubImage2D(3553,H,E.x,E.y,O.mipmaps[0].width,O.mipmaps[0].height,Re,O.mipmaps[0].data):Y.texSubImage2D(3553,H,E.x,E.y,Re,Fe,O.image),H===0&&G.generateMipmaps&&Y.generateMipmap(3553),ye.unbindTexture()},this.copyTextureToTexture3D=function(E,O,G,H,X=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Te=E.max.x-E.min.x+1,Re=E.max.y-E.min.y+1,Fe=E.max.z-E.min.z+1,Ee=se.convert(H.format),He=se.convert(H.type);let Be;if(H.isDataTexture3D)$.setTexture3D(H,0),Be=32879;else if(H.isDataTexture2DArray)$.setTexture2DArray(H,0),Be=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Y.pixelStorei(37440,H.flipY),Y.pixelStorei(37441,H.premultiplyAlpha),Y.pixelStorei(3317,H.unpackAlignment);const Oe=Y.getParameter(3314),tt=Y.getParameter(32878),ii=Y.getParameter(3316),Ki=Y.getParameter(3315),Ve=Y.getParameter(32877),en=G.isCompressedTexture?G.mipmaps[0]:G.image;Y.pixelStorei(3314,en.width),Y.pixelStorei(32878,en.height),Y.pixelStorei(3316,E.min.x),Y.pixelStorei(3315,E.min.y),Y.pixelStorei(32877,E.min.z),G.isDataTexture||G.isDataTexture3D?Y.texSubImage3D(Be,X,O.x,O.y,O.z,Te,Re,Fe,Ee,He,en.data):G.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Y.compressedTexSubImage3D(Be,X,O.x,O.y,O.z,Te,Re,Fe,Ee,en.data)):Y.texSubImage3D(Be,X,O.x,O.y,O.z,Te,Re,Fe,Ee,He,en),Y.pixelStorei(3314,Oe),Y.pixelStorei(32878,tt),Y.pixelStorei(3316,ii),Y.pixelStorei(3315,Ki),Y.pixelStorei(32877,Ve),X===0&&H.generateMipmaps&&Y.generateMipmap(Be),ye.unbindTexture()},this.initTexture=function(E){$.setTexture2D(E,0),ye.unbindTexture()},this.resetState=function(){g=0,m=0,_=null,ye.reset(),D.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}qe.prototype.isWebGLRenderer=!0;class qx extends qe{}qx.prototype.isWebGL1Renderer=!0;class Es{constructor(e,t=25e-5){this.name="",this.color=new le(e),this.density=t}clone(){return new Es(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Es.prototype.isFogExp2=!0;class As{constructor(e,t=1,n=1e3){this.name="",this.color=new le(e),this.near=t,this.far=n}clone(){return new As(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}As.prototype.isFog=!0;class Ta extends ke{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}Ta.prototype.isScene=!0;class Ui{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ar,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Pt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Pt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Ui.prototype.isInterleavedBuffer=!0;const it=new S;class Zn{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.applyMatrix4(e),this.setXYZ(t,it.x,it.y,it.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.applyNormalMatrix(e),this.setXYZ(t,it.x,it.y,it.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.transformDirection(e),this.setXYZ(t,it.x,it.y,it.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ze(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Zn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Zn.prototype.isInterleavedBufferAttribute=!0;class Ea extends _t{constructor(e){super(),this.type="SpriteMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}Ea.prototype.isSpriteMaterial=!0;let Oi;const _r=new S,Hi=new S,Gi=new S,Vi=new q,Mr=new q,Uc=new pe,Ls=new S,br=new S,Cs=new S,Oc=new q,Aa=new q,Hc=new q;class La extends ke{constructor(e){if(super(),this.type="Sprite",Oi===void 0){Oi=new ve;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Ui(t,5);Oi.setIndex([0,1,2,0,2,3]),Oi.setAttribute("position",new Zn(n,3,0,!1)),Oi.setAttribute("uv",new Zn(n,2,3,!1))}this.geometry=Oi,this.material=e!==void 0?e:new Ea,this.center=new q(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Hi.setFromMatrixScale(this.matrixWorld),Uc.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Gi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Hi.multiplyScalar(-Gi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;Rs(Ls.set(-.5,-.5,0),Gi,o,Hi,i,s),Rs(br.set(.5,-.5,0),Gi,o,Hi,i,s),Rs(Cs.set(.5,.5,0),Gi,o,Hi,i,s),Oc.set(0,0),Aa.set(1,0),Hc.set(1,1);let a=e.ray.intersectTriangle(Ls,br,Cs,!1,_r);if(a===null&&(Rs(br.set(-.5,.5,0),Gi,o,Hi,i,s),Aa.set(0,1),a=e.ray.intersectTriangle(Ls,Cs,br,!1,_r),a===null))return;const l=e.ray.origin.distanceTo(_r);l<e.near||l>e.far||t.push({distance:l,point:_r.clone(),uv:ct.getUV(_r,Ls,br,Cs,Oc,Aa,Hc,new q),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}La.prototype.isSprite=!0;function Rs(r,e,t,n,i,s){Vi.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Mr.x=s*Vi.x-i*Vi.y,Mr.y=i*Vi.x+s*Vi.y):Mr.copy(Vi),r.copy(e),r.x+=Mr.x,r.y+=Mr.y,r.applyMatrix4(Uc)}const Ps=new S,Gc=new S;class Xx extends null{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Ps.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Ps);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ps.setFromMatrixPosition(e.matrixWorld),Gc.setFromMatrixPosition(this.matrixWorld);const n=Ps.distanceTo(Gc)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}const Vc=new S,kc=new We,Wc=new We,Yx=new S,qc=new pe;class Ca extends xt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new pe,this.bindMatrixInverse=new pe}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new We,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;kc.fromBufferAttribute(i.attributes.skinIndex,e),Wc.fromBufferAttribute(i.attributes.skinWeight,e),Vc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=Wc.getComponent(s);if(o!==0){const a=kc.getComponent(s);qc.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(Yx.copy(Vc).applyMatrix4(qc),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}Ca.prototype.isSkinnedMesh=!0;class Ra extends ke{constructor(){super(),this.type="Bone"}}Ra.prototype.isBone=!0;class ki extends dt{constructor(e=null,t=1,n=1,i,s,o,a,l,c=lt,u=lt,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={data:e,width:t,height:n},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}ki.prototype.isDataTexture=!0;const Xc=new pe,Jx=new pe;class Pa{constructor(e=[],t=[]){this.uuid=Pt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new pe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new pe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:Jx;Xc.multiplyMatrices(a,t[s]),Xc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Pa(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Gl(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ki(t,e,e,ft,sn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Ra),this.bones.push(o),this.boneInverses.push(new pe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Wi extends ze{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}Wi.prototype.isInstancedBufferAttribute=!0;const Yc=new pe,Jc=new pe,Is=[],wr=new xt;class Zc extends xt{constructor(e,t,n){super(e,t),this.instanceMatrix=new Wi(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(wr.geometry=this.geometry,wr.material=this.material,wr.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,Yc),Jc.multiplyMatrices(n,Yc),wr.matrixWorld=Jc,wr.raycast(e,Is);for(let o=0,a=Is.length;o<a;o++){const l=Is[o];l.instanceId=s,l.object=this,t.push(l)}Is.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Wi(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Zc.prototype.isInstancedMesh=!0;class bt extends _t{constructor(e){super(),this.type="LineBasicMaterial",this.color=new le(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}bt.prototype.isLineBasicMaterial=!0;const $c=new S,jc=new S,Qc=new pe,Ia=new Tn,Ds=new wn;class $n extends ke{constructor(e=new ve,t=new bt){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)$c.fromBufferAttribute(t,i-1),jc.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=$c.distanceTo(jc);e.setAttribute("lineDistance",new me(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ds.copy(n.boundingSphere),Ds.applyMatrix4(i),Ds.radius+=s,e.ray.intersectsSphere(Ds)===!1)return;Qc.copy(i).invert(),Ia.copy(e.ray).applyMatrix4(Qc);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new S,u=new S,h=new S,f=new S,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const p=n.index,v=n.attributes.position;if(p!==null){const g=Math.max(0,o.start),m=Math.min(p.count,o.start+o.count);for(let _=g,y=m-1;_<y;_+=d){const M=p.getX(_),w=p.getX(_+1);if(c.fromBufferAttribute(v,M),u.fromBufferAttribute(v,w),Ia.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);C<e.near||C>e.far||t.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),m=Math.min(v.count,o.start+o.count);for(let _=g,y=m-1;_<y;_+=d){if(c.fromBufferAttribute(v,_),u.fromBufferAttribute(v,_+1),Ia.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(f);w<e.near||w>e.far||t.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$n.prototype.isLine=!0;const Kc=new S,eu=new S;class fn extends $n{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Kc.fromBufferAttribute(t,i),eu.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Kc.distanceTo(eu);e.setAttribute("lineDistance",new me(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}fn.prototype.isLineSegments=!0;class tu extends $n{constructor(e,t){super(e,t),this.type="LineLoop"}}tu.prototype.isLineLoop=!0;class qi extends _t{constructor(e){super(),this.type="PointsMaterial",this.color=new le(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}}qi.prototype.isPointsMaterial=!0;const nu=new pe,Da=new Tn,Fs=new wn,Bs=new S;class zs extends ke{constructor(e=new ve,t=new qi){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Fs.copy(n.boundingSphere),Fs.applyMatrix4(i),Fs.radius+=s,e.ray.intersectsSphere(Fs)===!1)return;nu.copy(i).invert(),Da.copy(e.ray).applyMatrix4(nu);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){const c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let p=f,x=d;p<x;p++){const v=c.getX(p);Bs.fromBufferAttribute(h,v),iu(Bs,v,l,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let p=f,x=d;p<x;p++)Bs.fromBufferAttribute(h,p),iu(Bs,p,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}zs.prototype.isPoints=!0;function iu(r,e,t,n,i,s,o){const a=Da.distanceSqToPoint(r);if(a<t){const l=new S;Da.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Zx extends dt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.format=a!==void 0?a:Hn,this.minFilter=o!==void 0?o:nt,this.magFilter=s!==void 0?s:nt,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Zx.prototype.isVideoTexture=!0;class $x extends dt{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=lt,this.minFilter=lt,this.generateMipmaps=!1,this.needsUpdate=!0}}$x.prototype.isFramebufferTexture=!0;class ru extends dt{constructor(e,t,n,i,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,i,s,h,f),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}ru.prototype.isCompressedTexture=!0;class jx extends dt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.needsUpdate=!0}}jx.prototype.isCanvasTexture=!0;class Ns extends ve{constructor(e=1,t=8,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new S,u=new q;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const d=n+h/t*i;c.x=e*Math.cos(d),c.y=e*Math.sin(d),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new me(o,3)),this.setAttribute("normal",new me(a,3)),this.setAttribute("uv",new me(l,2))}static fromJSON(e){return new Ns(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xi extends ve{constructor(e=1,t=1,n=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],f=[],d=[];let p=0;const x=[],v=n/2;let g=0;m(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new me(h,3)),this.setAttribute("normal",new me(f,3)),this.setAttribute("uv",new me(d,2));function m(){const y=new S,M=new S;let w=0;const A=(t-e)/n;for(let C=0;C<=s;C++){const N=[],z=C/s,I=z*(t-e)+e;for(let b=0;b<=i;b++){const T=b/i,B=T*l+a,R=Math.sin(B),F=Math.cos(B);M.x=I*R,M.y=-z*n+v,M.z=I*F,h.push(M.x,M.y,M.z),y.set(R,A,F).normalize(),f.push(y.x,y.y,y.z),d.push(T,1-z),N.push(p++)}x.push(N)}for(let C=0;C<i;C++)for(let N=0;N<s;N++){const z=x[N][C],I=x[N+1][C],b=x[N+1][C+1],T=x[N][C+1];u.push(z,I,T),u.push(I,b,T),w+=6}c.addGroup(g,w,0),g+=w}function _(y){const M=p,w=new q,A=new S;let C=0;const N=y===!0?e:t,z=y===!0?1:-1;for(let b=1;b<=i;b++)h.push(0,v*z,0),f.push(0,z,0),d.push(.5,.5),p++;const I=p;for(let b=0;b<=i;b++){const B=b/i*l+a,R=Math.cos(B),F=Math.sin(B);A.x=N*F,A.y=v*z,A.z=N*R,h.push(A.x,A.y,A.z),f.push(0,z,0),w.x=R*.5+.5,w.y=F*.5*z+.5,d.push(w.x,w.y),p++}for(let b=0;b<i;b++){const T=M+b,B=I+b;y===!0?u.push(B,B+1,T):u.push(B+1,B,T),C+=3}c.addGroup(g,C,y===!0?1:2),g+=C}}static fromJSON(e){return new Xi(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Us extends Xi{constructor(e=1,t=1,n=8,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Us(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Dn extends ve{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),c(n),u(),this.setAttribute("position",new me(s,3)),this.setAttribute("normal",new me(s.slice(),3)),this.setAttribute("uv",new me(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(m){const _=new S,y=new S,M=new S;for(let w=0;w<t.length;w+=3)d(t[w+0],_),d(t[w+1],y),d(t[w+2],M),l(_,y,M,m)}function l(m,_,y,M){const w=M+1,A=[];for(let C=0;C<=w;C++){A[C]=[];const N=m.clone().lerp(y,C/w),z=_.clone().lerp(y,C/w),I=w-C;for(let b=0;b<=I;b++)b===0&&C===w?A[C][b]=N:A[C][b]=N.clone().lerp(z,b/I)}for(let C=0;C<w;C++)for(let N=0;N<2*(w-C)-1;N++){const z=Math.floor(N/2);N%2===0?(f(A[C][z+1]),f(A[C+1][z]),f(A[C][z])):(f(A[C][z+1]),f(A[C+1][z+1]),f(A[C+1][z]))}}function c(m){const _=new S;for(let y=0;y<s.length;y+=3)_.x=s[y+0],_.y=s[y+1],_.z=s[y+2],_.normalize().multiplyScalar(m),s[y+0]=_.x,s[y+1]=_.y,s[y+2]=_.z}function u(){const m=new S;for(let _=0;_<s.length;_+=3){m.x=s[_+0],m.y=s[_+1],m.z=s[_+2];const y=v(m)/2/Math.PI+.5,M=g(m)/Math.PI+.5;o.push(y,1-M)}p(),h()}function h(){for(let m=0;m<o.length;m+=6){const _=o[m+0],y=o[m+2],M=o[m+4],w=Math.max(_,y,M),A=Math.min(_,y,M);w>.9&&A<.1&&(_<.2&&(o[m+0]+=1),y<.2&&(o[m+2]+=1),M<.2&&(o[m+4]+=1))}}function f(m){s.push(m.x,m.y,m.z)}function d(m,_){const y=m*3;_.x=e[y+0],_.y=e[y+1],_.z=e[y+2]}function p(){const m=new S,_=new S,y=new S,M=new S,w=new q,A=new q,C=new q;for(let N=0,z=0;N<s.length;N+=9,z+=6){m.set(s[N+0],s[N+1],s[N+2]),_.set(s[N+3],s[N+4],s[N+5]),y.set(s[N+6],s[N+7],s[N+8]),w.set(o[z+0],o[z+1]),A.set(o[z+2],o[z+3]),C.set(o[z+4],o[z+5]),M.copy(m).add(_).add(y).divideScalar(3);const I=v(M);x(w,z+0,m,I),x(A,z+2,_,I),x(C,z+4,y,I)}}function x(m,_,y,M){M<0&&m.x===1&&(o[_]=m.x-1),y.x===0&&y.z===0&&(o[_]=M/2/Math.PI+.5)}function v(m){return Math.atan2(m.z,-m.x)}function g(m){return Math.atan2(-m.y,Math.sqrt(m.x*m.x+m.z*m.z))}}static fromJSON(e){return new Dn(e.vertices,e.indices,e.radius,e.details)}}class Os extends Dn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Os(e.radius,e.detail)}}const Hs=new S,Gs=new S,Fa=new S,Vs=new ct;class su extends ve{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(kn*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},d=[];for(let p=0;p<l;p+=3){o?(c[0]=o.getX(p),c[1]=o.getX(p+1),c[2]=o.getX(p+2)):(c[0]=p,c[1]=p+1,c[2]=p+2);const{a:x,b:v,c:g}=Vs;if(x.fromBufferAttribute(a,c[0]),v.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),Vs.getNormal(Fa),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let m=0;m<3;m++){const _=(m+1)%3,y=h[m],M=h[_],w=Vs[u[m]],A=Vs[u[_]],C=`${y}_${M}`,N=`${M}_${y}`;N in f&&f[N]?(Fa.dot(f[N].normal)<=s&&(d.push(w.x,w.y,w.z),d.push(A.x,A.y,A.z)),f[N]=null):C in f||(f[C]={index0:c[m],index1:c[_],normal:Fa.clone()})}}for(const p in f)if(f[p]){const{index0:x,index1:v}=f[p];Hs.fromBufferAttribute(a,x),Gs.fromBufferAttribute(a,v),d.push(Hs.x,Hs.y,Hs.z),d.push(Gs.x,Gs.y,Gs.z)}this.setAttribute("position",new me(d,3))}}}class Ot{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new q:new S);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new S,i=[],s=[],o=[],a=new S,l=new pe;for(let d=0;d<=e;d++){const p=d/e;i[d]=this.getTangentAt(p,new S)}s[0]=new S,o[0]=new S;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),f<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(vt(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(vt(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],d*p)),o[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class ks extends Ot{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const n=t||new q,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}ks.prototype.isEllipseCurve=!0;class ou extends ks{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.type="ArcCurve"}}ou.prototype.isArcCurve=!0;function Ba(){let r=0,e=0,t=0,n=0;function i(s,o,a,l){r=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,i(o,a,f,d)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Ws=new S,za=new Ba,Na=new Ba,Ua=new Ba;class au extends Ot{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new S){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(Ws.subVectors(i[0],i[1]).add(i[0]),c=Ws);const h=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Ws.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Ws),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let p=Math.pow(c.distanceToSquared(h),d),x=Math.pow(h.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(u),d);x<1e-4&&(x=1),p<1e-4&&(p=x),v<1e-4&&(v=x),za.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,p,x,v),Na.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,p,x,v),Ua.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,p,x,v)}else this.curveType==="catmullrom"&&(za.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Na.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),Ua.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return n.set(za.calc(l),Na.calc(l),Ua.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new S().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}au.prototype.isCatmullRomCurve3=!0;function lu(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*r+t}function Qx(r,e){const t=1-r;return t*t*e}function Kx(r,e){return 2*(1-r)*r*e}function e0(r,e){return r*r*e}function Sr(r,e,t,n){return Qx(r,e)+Kx(r,t)+e0(r,n)}function t0(r,e){const t=1-r;return t*t*t*e}function n0(r,e){const t=1-r;return 3*t*t*r*e}function i0(r,e){return 3*(1-r)*r*r*e}function r0(r,e){return r*r*r*e}function Tr(r,e,t,n,i){return t0(r,e)+n0(r,t)+i0(r,n)+r0(r,i)}class Oa extends Ot{constructor(e=new q,t=new q,n=new q,i=new q){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new q){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Tr(e,i.x,s.x,o.x,a.x),Tr(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}Oa.prototype.isCubicBezierCurve=!0;class cu extends Ot{constructor(e=new S,t=new S,n=new S,i=new S){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Tr(e,i.x,s.x,o.x,a.x),Tr(e,i.y,s.y,o.y,a.y),Tr(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}cu.prototype.isCubicBezierCurve3=!0;class qs extends Ot{constructor(e=new q,t=new q){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new q){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new q;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}qs.prototype.isLineCurve=!0;class s0 extends Ot{constructor(e=new S,t=new S){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new S){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ha extends Ot{constructor(e=new q,t=new q,n=new q){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new q){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Sr(e,i.x,s.x,o.x),Sr(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Ha.prototype.isQuadraticBezierCurve=!0;class Ga extends Ot{constructor(e=new S,t=new S,n=new S){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new S){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Sr(e,i.x,s.x,o.x),Sr(e,i.y,s.y,o.y),Sr(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Ga.prototype.isQuadraticBezierCurve3=!0;class Va extends Ot{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new q){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(lu(a,l.x,c.x,u.x,h.x),lu(a,l.y,c.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new q().fromArray(i))}return this}}Va.prototype.isSplineCurve=!0;var ka=Object.freeze({__proto__:null,ArcCurve:ou,CatmullRomCurve3:au,CubicBezierCurve:Oa,CubicBezierCurve3:cu,EllipseCurve:ks,LineCurve:qs,LineCurve3:s0,QuadraticBezierCurve:Ha,QuadraticBezierCurve3:Ga,SplineCurve:Va});class o0 extends Ot{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new qs(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new ka[i.type]().fromJSON(i))}return this}}class Xs extends o0{constructor(e){super(),this.type="Path",this.currentPoint=new q,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new qs(this.currentPoint.clone(),new q(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Ha(this.currentPoint.clone(),new q(e,t),new q(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new Oa(this.currentPoint.clone(),new q(e,t),new q(n,i),new q(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Va(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,o,a,l),this}absellipse(e,t,n,i,s,o,a,l){const c=new ks(e,t,n,i,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class dn extends Xs{constructor(e){super(e),this.uuid=Pt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Xs().fromJSON(i))}return this}}const a0={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=uu(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(n&&(s=f0(r,e,s,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(let p=t;p<i;p+=t)h=r[p],f=r[p+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return Er(s,o,t,a,l,d),o}};function uu(r,e,t,n,i){let s,o;if(i===w0(r,e,t,n)>0)for(s=e;s<t;s+=n)o=du(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=du(s,r[s],r[s+1],o);return o&&Ys(o,o.next)&&(Lr(o),o=o.next),o}function Fn(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Ys(t,t.next)||Qe(t.prev,t,t.next)===0)){if(Lr(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Er(r,e,t,n,i,s,o){if(!r)return;!o&&s&&x0(r,n,i,s);let a=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?c0(r,n,i,s):l0(r)){e.push(l.i/t),e.push(r.i/t),e.push(c.i/t),Lr(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=u0(Fn(r),e,t),Er(r,e,t,n,i,s,2)):o===2&&h0(r,e,t,n,i,s):Er(Fn(r),e,t,n,i,s,1);break}}}function l0(r){const e=r.prev,t=r,n=r.next;if(Qe(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(Yi(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Qe(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function c0(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Qe(i,s,o)>=0)return!1;const a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,c=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,u=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,h=Wa(a,l,e,t,n),f=Wa(c,u,e,t,n);let d=r.prevZ,p=r.nextZ;for(;d&&d.z>=h&&p&&p.z<=f;){if(d!==r.prev&&d!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0||(d=d.prevZ,p!==r.prev&&p!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Qe(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=h;){if(d!==r.prev&&d!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&Qe(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==r.prev&&p!==r.next&&Yi(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Qe(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function u0(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Ys(i,s)&&hu(i,n,n.next,s)&&Ar(i,s)&&Ar(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),Lr(n),Lr(n.next),n=r=s),n=n.next}while(n!==r);return Fn(n)}function h0(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&_0(o,a)){let l=fu(o,a);o=Fn(o,o.next),l=Fn(l,l.next),Er(o,e,t,n,i,s),Er(l,e,t,n,i,s);return}a=a.next}o=o.next}while(o!==r)}function f0(r,e,t,n){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=uu(r,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(v0(c));for(i.sort(d0),s=0;s<i.length;s++)p0(i[s],t),t=Fn(t,t.next);return t}function d0(r,e){return r.x-e.x}function p0(r,e){if(e=m0(r,e),e){const t=fu(e,r);Fn(e,e.next),Fn(t,t.next)}}function m0(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s){if(s=f,f===n){if(i===t.y)return t;if(i===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,c=o.y;let u=1/0,h;t=o;do n>=t.x&&t.x>=l&&n!==t.x&&Yi(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),Ar(t,r)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&g0(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function g0(r,e){return Qe(r.prev,r,e.prev)<0&&Qe(e.next,r,r.next)<0}function x0(r,e,t,n){let i=r;do i.z===null&&(i.z=Wa(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,y0(i)}function y0(r){let e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function Wa(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function v0(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Yi(r,e,t,n,i,s,o,a){return(i-o)*(e-a)-(r-o)*(s-a)>=0&&(r-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(i-o)*(n-a)>=0}function _0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!M0(r,e)&&(Ar(r,e)&&Ar(e,r)&&b0(r,e)&&(Qe(r.prev,r,e.prev)||Qe(r,e.prev,e))||Ys(r,e)&&Qe(r.prev,r,r.next)>0&&Qe(e.prev,e,e.next)>0)}function Qe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Ys(r,e){return r.x===e.x&&r.y===e.y}function hu(r,e,t,n){const i=Zs(Qe(r,e,t)),s=Zs(Qe(r,e,n)),o=Zs(Qe(t,n,r)),a=Zs(Qe(t,n,e));return!!(i!==s&&o!==a||i===0&&Js(r,t,e)||s===0&&Js(r,n,e)||o===0&&Js(t,r,n)||a===0&&Js(t,e,n))}function Js(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Zs(r){return r>0?1:r<0?-1:0}function M0(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&hu(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ar(r,e){return Qe(r.prev,r,r.next)<0?Qe(r,e,r.next)>=0&&Qe(r,r.prev,e)>=0:Qe(r,e,r.prev)<0||Qe(r,r.next,e)<0}function b0(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function fu(r,e){const t=new qa(r.i,r.x,r.y),n=new qa(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function du(r,e,t,n){const i=new qa(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Lr(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function qa(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function w0(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class pn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return pn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];pu(e),mu(n,e);let o=e.length;t.forEach(pu);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,mu(n,t[l]);const a=a0.triangulate(n,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function pu(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function mu(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Bn extends ve{constructor(e=new dn([new q(.5,.5),new q(-.5,.5),new q(-.5,-.5),new q(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new me(i,3)),this.setAttribute("uv",new me(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1;let h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,m=t.UVGenerator!==void 0?t.UVGenerator:S0;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let _,y=!1,M,w,A,C;g&&(_=g.getSpacedPoints(u),y=!0,f=!1,M=g.computeFrenetFrames(u,!1),w=new S,A=new S,C=new S),f||(v=0,d=0,p=0,x=0);const N=a.extractPoints(c);let z=N.shape;const I=N.holes;if(!pn.isClockWise(z)){z=z.reverse();for(let k=0,$=I.length;k<$;k++){const ie=I[k];pn.isClockWise(ie)&&(I[k]=ie.reverse())}}const T=pn.triangulateShape(z,I),B=z;for(let k=0,$=I.length;k<$;k++){const ie=I[k];z=z.concat(ie)}function R(k,$,ie){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().multiplyScalar(ie).add(k)}const F=z.length,U=T.length;function Z(k,$,ie){let fe,ce,Ae;const Le=k.x-$.x,De=k.y-$.y,$e=ie.x-k.x,P=ie.y-k.y,L=Le*Le+De*De,J=Le*P-De*$e;if(Math.abs(J)>Number.EPSILON){const Q=Math.sqrt(L),ae=Math.sqrt($e*$e+P*P),j=$.x-De/Q,Se=$.y+Le/Q,_e=ie.x-P/ae,se=ie.y+$e/ae,D=((_e-j)*P-(se-Se)*$e)/(Le*P-De*$e);fe=j+Le*D-k.x,ce=Se+De*D-k.y;const re=fe*fe+ce*ce;if(re<=2)return new q(fe,ce);Ae=Math.sqrt(re/2)}else{let Q=!1;Le>Number.EPSILON?$e>Number.EPSILON&&(Q=!0):Le<-Number.EPSILON?$e<-Number.EPSILON&&(Q=!0):Math.sign(De)===Math.sign(P)&&(Q=!0),Q?(fe=-De,ce=Le,Ae=Math.sqrt(L)):(fe=Le,ce=De,Ae=Math.sqrt(L/2))}return new q(fe/Ae,ce/Ae)}const ee=[];for(let k=0,$=B.length,ie=$-1,fe=k+1;k<$;k++,ie++,fe++)ie===$&&(ie=0),fe===$&&(fe=0),ee[k]=Z(B[k],B[ie],B[fe]);const V=[];let W,ne=ee.concat();for(let k=0,$=I.length;k<$;k++){const ie=I[k];W=[];for(let fe=0,ce=ie.length,Ae=ce-1,Le=fe+1;fe<ce;fe++,Ae++,Le++)Ae===ce&&(Ae=0),Le===ce&&(Le=0),W[fe]=Z(ie[fe],ie[Ae],ie[Le]);V.push(W),ne=ne.concat(W)}for(let k=0;k<v;k++){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=p*Math.sin($*Math.PI/2)+x;for(let ce=0,Ae=B.length;ce<Ae;ce++){const Le=R(B[ce],ee[ce],fe);we(Le.x,Le.y,-ie)}for(let ce=0,Ae=I.length;ce<Ae;ce++){const Le=I[ce];W=V[ce];for(let De=0,$e=Le.length;De<$e;De++){const P=R(Le[De],W[De],fe);we(P.x,P.y,-ie)}}}const K=p+x;for(let k=0;k<F;k++){const $=f?R(z[k],ne[k],K):z[k];y?(A.copy(M.normals[0]).multiplyScalar($.x),w.copy(M.binormals[0]).multiplyScalar($.y),C.copy(_[0]).add(A).add(w),we(C.x,C.y,C.z)):we($.x,$.y,0)}for(let k=1;k<=u;k++)for(let $=0;$<F;$++){const ie=f?R(z[$],ne[$],K):z[$];y?(A.copy(M.normals[k]).multiplyScalar(ie.x),w.copy(M.binormals[k]).multiplyScalar(ie.y),C.copy(_[k]).add(A).add(w),we(C.x,C.y,C.z)):we(ie.x,ie.y,h/u*k)}for(let k=v-1;k>=0;k--){const $=k/v,ie=d*Math.cos($*Math.PI/2),fe=p*Math.sin($*Math.PI/2)+x;for(let ce=0,Ae=B.length;ce<Ae;ce++){const Le=R(B[ce],ee[ce],fe);we(Le.x,Le.y,h+ie)}for(let ce=0,Ae=I.length;ce<Ae;ce++){const Le=I[ce];W=V[ce];for(let De=0,$e=Le.length;De<$e;De++){const P=R(Le[De],W[De],fe);y?we(P.x,P.y+_[u-1].y,_[u-1].x+ie):we(P.x,P.y,h+ie)}}}he(),be();function he(){const k=i.length/3;if(f){let $=0,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];de(ce[2]+ie,ce[1]+ie,ce[0]+ie)}$=u+v*2,ie=F*$;for(let fe=0;fe<U;fe++){const ce=T[fe];de(ce[0]+ie,ce[1]+ie,ce[2]+ie)}}else{for(let $=0;$<U;$++){const ie=T[$];de(ie[2],ie[1],ie[0])}for(let $=0;$<U;$++){const ie=T[$];de(ie[0]+F*u,ie[1]+F*u,ie[2]+F*u)}}n.addGroup(k,i.length/3-k,0)}function be(){const k=i.length/3;let $=0;Y(B,$),$+=B.length;for(let ie=0,fe=I.length;ie<fe;ie++){const ce=I[ie];Y(ce,$),$+=ce.length}n.addGroup(k,i.length/3-k,1)}function Y(k,$){let ie=k.length;for(;--ie>=0;){const fe=ie;let ce=ie-1;ce<0&&(ce=k.length-1);for(let Ae=0,Le=u+v*2;Ae<Le;Ae++){const De=F*Ae,$e=F*(Ae+1),P=$+fe+De,L=$+ce+De,J=$+ce+$e,Q=$+fe+$e;ge(P,L,J,Q)}}}function we(k,$,ie){l.push(k),l.push($),l.push(ie)}function de(k,$,ie){ye(k),ye($),ye(ie);const fe=i.length/3,ce=m.generateTopUV(n,i,fe-3,fe-2,fe-1);Ue(ce[0]),Ue(ce[1]),Ue(ce[2])}function ge(k,$,ie,fe){ye(k),ye($),ye(fe),ye($),ye(ie),ye(fe);const ce=i.length/3,Ae=m.generateSideWallUV(n,i,ce-6,ce-3,ce-2,ce-1);Ue(Ae[0]),Ue(Ae[1]),Ue(Ae[3]),Ue(Ae[1]),Ue(Ae[2]),Ue(Ae[3])}function ye(k){i.push(l[k*3+0]),i.push(l[k*3+1]),i.push(l[k*3+2])}function Ue(k){s.push(k.x),s.push(k.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return T0(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ka[i.type]().fromJSON(i)),new Bn(n,e.options)}}const S0={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new q(s,o),new q(a,l),new q(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],h=e[n*3+2],f=e[i*3],d=e[i*3+1],p=e[i*3+2],x=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new q(o,1-l),new q(c,1-h),new q(f,1-p),new q(x,1-g)]:[new q(a,1-l),new q(u,1-h),new q(d,1-p),new q(v,1-g)]}};function T0(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class $s extends Dn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new $s(e.radius,e.detail)}}class js extends ve{constructor(e=[new q(0,.5),new q(.5,0),new q(0,-.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=vt(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new S,f=new q,d=new S,p=new S,x=new S;let v=0,g=0;for(let m=0;m<=e.length-1;m++)switch(m){case 0:v=e[m+1].x-e[m].x,g=e[m+1].y-e[m].y,d.x=g*1,d.y=-v,d.z=g*0,x.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:v=e[m+1].x-e[m].x,g=e[m+1].y-e[m].y,d.x=g*1,d.y=-v,d.z=g*0,p.copy(d),d.x+=x.x,d.y+=x.y,d.z+=x.z,d.normalize(),l.push(d.x,d.y,d.z),x.copy(p)}for(let m=0;m<=t;m++){const _=n+m*u*i,y=Math.sin(_),M=Math.cos(_);for(let w=0;w<=e.length-1;w++){h.x=e[w].x*y,h.y=e[w].y,h.z=e[w].x*M,o.push(h.x,h.y,h.z),f.x=m/t,f.y=w/(e.length-1),a.push(f.x,f.y);const A=l[3*w+0]*y,C=l[3*w+1],N=l[3*w+0]*M;c.push(A,C,N)}}for(let m=0;m<t;m++)for(let _=0;_<e.length-1;_++){const y=_+m*e.length,M=y,w=y+e.length,A=y+e.length+1,C=y+1;s.push(M,w,C),s.push(w,A,C)}this.setIndex(s),this.setAttribute("position",new me(o,3)),this.setAttribute("uv",new me(a,2)),this.setAttribute("normal",new me(c,3))}static fromJSON(e){return new js(e.points,e.segments,e.phiStart,e.phiLength)}}class Cr extends Dn{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Cr(e.radius,e.detail)}}class Qs extends ve{constructor(e=.5,t=1,n=8,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/i,d=new S,p=new q;for(let x=0;x<=i;x++){for(let v=0;v<=n;v++){const g=s+v/n*o;d.x=h*Math.cos(g),d.y=h*Math.sin(g),l.push(d.x,d.y,d.z),c.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,u.push(p.x,p.y)}h+=f}for(let x=0;x<i;x++){const v=x*(n+1);for(let g=0;g<n;g++){const m=g+v,_=m,y=m+n+1,M=m+n+2,w=m+1;a.push(_,y,w),a.push(y,M,w)}}this.setIndex(a),this.setAttribute("position",new me(l,3)),this.setAttribute("normal",new me(c,3)),this.setAttribute("uv",new me(u,2))}static fromJSON(e){return new Qs(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Rr extends ve{constructor(e=new dn([new q(0,.5),new q(-.5,-.5),new q(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new me(i,3)),this.setAttribute("normal",new me(s,3)),this.setAttribute("uv",new me(o,2));function c(u){const h=i.length/3,f=u.extractPoints(t);let d=f.shape;const p=f.holes;pn.isClockWise(d)===!1&&(d=d.reverse());for(let v=0,g=p.length;v<g;v++){const m=p[v];pn.isClockWise(m)===!0&&(p[v]=m.reverse())}const x=pn.triangulateShape(d,p);for(let v=0,g=p.length;v<g;v++){const m=p[v];d=d.concat(m)}for(let v=0,g=d.length;v<g;v++){const m=d[v];i.push(m.x,m.y,0),s.push(0,0,1),o.push(m.x,m.y)}for(let v=0,g=x.length;v<g;v++){const m=x[v],_=m[0]+h,y=m[1]+h,M=m[2]+h;n.push(_,y,M),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return E0(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new Rr(n,e.curveSegments)}}function E0(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Pr extends ve{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new S,f=new S,d=[],p=[],x=[],v=[];for(let g=0;g<=n;g++){const m=[],_=g/n;let y=0;g==0&&o==0?y=.5/t:g==n&&l==Math.PI&&(y=-.5/t);for(let M=0;M<=t;M++){const w=M/t;h.x=-e*Math.cos(i+w*s)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+w*s)*Math.sin(o+_*a),p.push(h.x,h.y,h.z),f.copy(h).normalize(),x.push(f.x,f.y,f.z),v.push(w+y,1-_),m.push(c++)}u.push(m)}for(let g=0;g<n;g++)for(let m=0;m<t;m++){const _=u[g][m+1],y=u[g][m],M=u[g+1][m],w=u[g+1][m+1];(g!==0||o>0)&&d.push(_,y,w),(g!==n-1||l<Math.PI)&&d.push(y,M,w)}this.setIndex(d),this.setAttribute("position",new me(p,3)),this.setAttribute("normal",new me(x,3)),this.setAttribute("uv",new me(v,2))}static fromJSON(e){return new Pr(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ks extends Dn{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ks(e.radius,e.detail)}}class eo extends ve{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],u=new S,h=new S,f=new S;for(let d=0;d<=n;d++)for(let p=0;p<=i;p++){const x=p/i*s,v=d/n*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(x),h.y=(e+t*Math.cos(v))*Math.sin(x),h.z=t*Math.sin(v),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(p/i),c.push(d/n)}for(let d=1;d<=n;d++)for(let p=1;p<=i;p++){const x=(i+1)*d+p-1,v=(i+1)*(d-1)+p-1,g=(i+1)*(d-1)+p,m=(i+1)*d+p;o.push(x,v,m),o.push(v,g,m)}this.setIndex(o),this.setAttribute("position",new me(a,3)),this.setAttribute("normal",new me(l,3)),this.setAttribute("uv",new me(c,2))}static fromJSON(e){return new eo(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class to extends ve{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],c=[],u=[],h=new S,f=new S,d=new S,p=new S,x=new S,v=new S,g=new S;for(let _=0;_<=n;++_){const y=_/n*s*Math.PI*2;m(y,s,o,e,d),m(y+.01,s,o,e,p),v.subVectors(p,d),g.addVectors(p,d),x.crossVectors(v,g),g.crossVectors(x,v),x.normalize(),g.normalize();for(let M=0;M<=i;++M){const w=M/i*Math.PI*2,A=-t*Math.cos(w),C=t*Math.sin(w);h.x=d.x+(A*g.x+C*x.x),h.y=d.y+(A*g.y+C*x.y),h.z=d.z+(A*g.z+C*x.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(_/n),u.push(M/i)}}for(let _=1;_<=n;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),w=(i+1)*_+(y-1),A=(i+1)*_+y,C=(i+1)*(_-1)+y;a.push(M,w,C),a.push(w,A,C)}this.setIndex(a),this.setAttribute("position",new me(l,3)),this.setAttribute("normal",new me(c,3)),this.setAttribute("uv",new me(u,2));function m(_,y,M,w,A){const C=Math.cos(_),N=Math.sin(_),z=M/y*_,I=Math.cos(z);A.x=w*(2+I)*.5*C,A.y=w*(2+I)*N*.5,A.z=w*Math.sin(z)*.5}}static fromJSON(e){return new to(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class no extends ve{constructor(e=new Ga(new S(-1,-1,0),new S(-1,1,0),new S(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new S,l=new S,c=new q;let u=new S;const h=[],f=[],d=[],p=[];x(),this.setIndex(p),this.setAttribute("position",new me(h,3)),this.setAttribute("normal",new me(f,3)),this.setAttribute("uv",new me(d,2));function x(){for(let _=0;_<t;_++)v(_);v(s===!1?t:0),m(),g()}function v(_){u=e.getPointAt(_/t,u);const y=o.normals[_],M=o.binormals[_];for(let w=0;w<=i;w++){const A=w/i*Math.PI*2,C=Math.sin(A),N=-Math.cos(A);l.x=N*y.x+C*M.x,l.y=N*y.y+C*M.y,l.z=N*y.z+C*M.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let y=1;y<=i;y++){const M=(i+1)*(_-1)+(y-1),w=(i+1)*_+(y-1),A=(i+1)*_+y,C=(i+1)*(_-1)+y;p.push(M,w,C),p.push(w,A,C)}}function m(){for(let _=0;_<=t;_++)for(let y=0;y<=i;y++)c.x=_/t,c.y=y/i,d.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new no(new ka[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class gu extends ve{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new S,s=new S;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,d=h.count;for(let p=f,x=f+d;p<x;p+=3)for(let v=0;v<3;v++){const g=a.getX(p+v),m=a.getX(p+(v+1)%3);i.fromBufferAttribute(o,g),s.fromBufferAttribute(o,m),xu(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),xu(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new me(t,3))}}}function xu(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}var yu=Object.freeze({__proto__:null,BoxGeometry:Xn,BoxBufferGeometry:Xn,CircleGeometry:Ns,CircleBufferGeometry:Ns,ConeGeometry:Us,ConeBufferGeometry:Us,CylinderGeometry:Xi,CylinderBufferGeometry:Xi,DodecahedronGeometry:Os,DodecahedronBufferGeometry:Os,EdgesGeometry:su,ExtrudeGeometry:Bn,ExtrudeBufferGeometry:Bn,IcosahedronGeometry:$s,IcosahedronBufferGeometry:$s,LatheGeometry:js,LatheBufferGeometry:js,OctahedronGeometry:Cr,OctahedronBufferGeometry:Cr,PlaneGeometry:gr,PlaneBufferGeometry:gr,PolyhedronGeometry:Dn,PolyhedronBufferGeometry:Dn,RingGeometry:Qs,RingBufferGeometry:Qs,ShapeGeometry:Rr,ShapeBufferGeometry:Rr,SphereGeometry:Pr,SphereBufferGeometry:Pr,TetrahedronGeometry:Ks,TetrahedronBufferGeometry:Ks,TorusGeometry:eo,TorusBufferGeometry:eo,TorusKnotGeometry:to,TorusKnotBufferGeometry:to,TubeGeometry:no,TubeBufferGeometry:no,WireframeGeometry:gu});class vu extends _t{constructor(e){super(),this.type="ShadowMaterial",this.color=new le(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}vu.prototype.isShadowMaterial=!0;class Xa extends _t{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new le(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}Xa.prototype.isMeshStandardMaterial=!0;class _u extends Xa{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new q(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return vt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new le(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new le(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new le(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}_u.prototype.isMeshPhysicalMaterial=!0;class Mu extends _t{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new le(16777215),this.specular=new le(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}Mu.prototype.isMeshPhongMaterial=!0;class bu extends _t{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new le(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}bu.prototype.isMeshToonMaterial=!0;class wu extends _t{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}wu.prototype.isMeshNormalMaterial=!0;class Su extends _t{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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}}Su.prototype.isMeshLambertMaterial=!0;class Tu extends _t{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new le(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}}Tu.prototype.isMeshMatcapMaterial=!0;class Eu extends bt{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Eu.prototype.isLineDashedMaterial=!0;var A0=Object.freeze({__proto__:null,ShadowMaterial:vu,SpriteMaterial:Ea,RawShaderMaterial:xr,ShaderMaterial:Yt,PointsMaterial:qi,MeshPhysicalMaterial:_u,MeshStandardMaterial:Xa,MeshPhongMaterial:Mu,MeshToonMaterial:bu,MeshNormalMaterial:wu,MeshLambertMaterial:Su,MeshDepthMaterial:Ma,MeshDistanceMaterial:ba,MeshBasicMaterial:An,MeshMatcapMaterial:Tu,LineDashedMaterial:Eu,LineBasicMaterial:bt,Material:_t});const je={arraySlice:function(r,e,t){return je.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){const p=c.times[d]*i;if(!(p<t||p>=n)){h.push(c.times[d]);for(let x=0;x<u;++x)f.push(c.values[d*u+x])}}h.length!==0&&(c.times=je.convertArray(h,c.times.constructor),c.values=je.convertArray(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const p=a.times.length-1;let x;if(s<=a.times[0]){const g=u,m=h-u;x=je.arraySlice(a.values,g,m)}else if(s>=a.times[p]){const g=p*h+u,m=g+h-u;x=je.arraySlice(a.values,g,m)}else{const g=a.createInterpolant(),m=u,_=h-u;g.evaluate(s),x=je.arraySlice(g.resultBuffer,m,_)}l==="quaternion"&&new St().fromArray(x).normalize().conjugate().toArray(x);const v=c.times.length;for(let g=0;g<v;++g){const m=g*d+f;if(l==="quaternion")St.multiplyQuaternionsFlat(c.values,m,x,0,c.values,m);else{const _=d-f*2;for(let y=0;y<_;++y)c.values[m+y]-=x[y]}}}return r.blendMode=Ol,r}};class zn{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}zn.prototype.beforeStart_=zn.prototype.copySampleValue_,zn.prototype.afterEnd_=zn.prototype.copySampleValue_;class L0 extends zn{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:fi,endingEnd:fi}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case di:s=e,a=2*t-n;break;case Qr:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case di:o=e,l=2*n-t;break;case Qr:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),x=p*p,v=x*p,g=-f*v+2*f*x-f*p,m=(1+f)*v+(-1.5-2*f)*x+(-.5+f)*p+1,_=(-1-d)*v+(1.5+d)*x+.5*p,y=d*v-d*x;for(let M=0;M!==a;++M)s[M]=g*o[u+M]+m*o[c+M]+_*o[l+M]+y*o[h+M];return s}}class Au extends zn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}}class C0 extends zn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class $t{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=je.convertArray(t,this.TimeBufferType),this.values=je.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:je.convertArray(e.times,Array),values:je.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new C0(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Au(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new L0(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case $r:t=this.InterpolantFactoryMethodDiscrete;break;case jr:t=this.InterpolantFactoryMethodLinear;break;case Bo:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return $r;case this.InterpolantFactoryMethodLinear:return jr;case this.InterpolantFactoryMethodSmooth:return Bo}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=je.arraySlice(n,s,o),this.values=je.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&je.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=je.arraySlice(this.times),t=je.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Bo,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*n,f=h-n,d=h+n;for(let p=0;p!==n;++p){const x=t[h+p];if(x!==t[f+p]||x!==t[d+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=je.arraySlice(e,0,o),this.values=je.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=je.arraySlice(this.times,0),t=je.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}$t.prototype.TimeBufferType=Float32Array,$t.prototype.ValueBufferType=Float32Array,$t.prototype.DefaultInterpolation=jr;class Ji extends $t{}Ji.prototype.ValueTypeName="bool",Ji.prototype.ValueBufferType=Array,Ji.prototype.DefaultInterpolation=$r,Ji.prototype.InterpolantFactoryMethodLinear=void 0,Ji.prototype.InterpolantFactoryMethodSmooth=void 0;class Lu extends $t{}Lu.prototype.ValueTypeName="color";class io extends $t{}io.prototype.ValueTypeName="number";class R0 extends zn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)St.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ir extends $t{InterpolantFactoryMethodLinear(e){return new R0(this.times,this.values,this.getValueSize(),e)}}Ir.prototype.ValueTypeName="quaternion",Ir.prototype.DefaultInterpolation=jr,Ir.prototype.InterpolantFactoryMethodSmooth=void 0;class Zi extends $t{}Zi.prototype.ValueTypeName="string",Zi.prototype.ValueBufferType=Array,Zi.prototype.DefaultInterpolation=$r,Zi.prototype.InterpolantFactoryMethodLinear=void 0,Zi.prototype.InterpolantFactoryMethodSmooth=void 0;class ro extends $t{}ro.prototype.ValueTypeName="vector";class so{constructor(e,t=-1,n,i=zo){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Pt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(I0(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push($t.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=je.getKeyframeOrder(l);l=je.sortedArray(l,1,u),c=je.sortedArray(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new io(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,p,x){if(d.length!==0){const v=[],g=[];je.flattenJSON(d,v,g,p),v.length!==0&&x.push(new h(f,v,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let x=0;x<f[p].morphTargets.length;x++)d[f[p].morphTargets[x]]=-1;for(const x in d){const v=[],g=[];for(let m=0;m!==f[p].morphTargets.length;++m){const _=f[p];v.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new io(".morphTargetInfluence["+x+"]",v,g))}l=d.length*(o||1)}else{const d=".bones["+t[h].name+"]";n(ro,d+".position",f,"pos",i),n(Ir,d+".quaternion",f,"rot",i),n(ro,d+".scale",f,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function P0(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return io;case"vector":case"vector2":case"vector3":case"vector4":return ro;case"color":return Lu;case"quaternion":return Ir;case"bool":case"boolean":return Ji;case"string":return Zi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function I0(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=P0(r.type);if(r.times===void 0){const t=[],n=[];je.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const $i={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Cu{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const d=c[h],p=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null}}}const D0=new Cu;class Nn{constructor(e){this.manager=e!==void 0?e:D0,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const mn={};class gn extends Nn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=$i.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(mn[e]!==void 0){mn[e].push({onLoad:t,onProgress:n,onError:i});return}mn[e]=[],mn[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(o).then(a=>{if(a.status===200||a.status===0){if(a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||a.body.getReader===void 0)return a;const l=mn[e],c=a.body.getReader(),u=a.headers.get("Content-Length"),h=u?parseInt(u):0,f=h!==0;let d=0;const p=new ReadableStream({start(x){v();function v(){c.read().then(({done:g,value:m})=>{if(g)x.close();else{d+=m.byteLength;const _=new ProgressEvent("progress",{lengthComputable:f,loaded:d,total:h});for(let y=0,M=l.length;y<M;y++){const w=l[y];w.onProgress&&w.onProgress(_)}x.enqueue(m),v()}})}}});return new Response(p)}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{switch(this.responseType){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(l=>new DOMParser().parseFromString(l,this.mimeType));case"json":return a.json();default:return a.text()}}).then(a=>{$i.add(e,a);const l=mn[e];delete mn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onLoad&&h.onLoad(a)}}).catch(a=>{const l=mn[e];if(l===void 0)throw this.manager.itemError(e),a;delete mn[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onError&&h.onError(a)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class C_ extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=so.parse(e[n]);t.push(i)}return t}}class R_ extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new ru,l=new gn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const d=s.parse(f,!0);o[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},c+=1,c===6&&(d.mipmapCount===1&&(a.minFilter=nt),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let p=0;p<d;p++){o[p]={mipmaps:[]};for(let x=0;x<f.mipmapCount;x++)o[p].mipmaps.push(f.mipmaps[p*f.mipmapCount+x]),o[p].format=f.format,o[p].width=f.width,o[p].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=nt),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class oo extends Nn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$i.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=es("img");function l(){u(),$i.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class F0 extends Nn{constructor(e){super(e)}load(e,t,n,i){const s=new mr,o=new oo(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class B0 extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new ki,a=new gn(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){const c=s.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:wt,o.wrapT=c.wrapT!==void 0?c.wrapT:wt,o.magFilter=c.magFilter!==void 0?c.magFilter:nt,o.minFilter=c.minFilter!==void 0?c.minFilter:nt,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=ci),c.mipmapCount===1&&(o.minFilter=nt),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},n,i),o}}class z0 extends Nn{constructor(e){super(e)}load(e,t,n,i){const s=new dt,o=new oo(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class jt extends ke{constructor(e,t=1){super(),this.type="Light",this.color=new le(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}jt.prototype.isLight=!0;class Ru extends jt{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(ke.DefaultUp),this.updateMatrix(),this.groundColor=new le(t)}copy(e){return jt.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Ru.prototype.isHemisphereLight=!0;const Pu=new pe,Iu=new S,Du=new S;class Ya{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new q(512,512),this.map=null,this.mapPass=null,this.matrix=new pe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new _s,this._frameExtents=new q(1,1),this._viewportCount=1,this._viewports=[new We(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Iu.setFromMatrixPosition(e.matrixWorld),t.position.copy(Iu),Du.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Du),t.updateMatrixWorld(),Pu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Fu extends Ya{constructor(){super(new Mt(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=cr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Fu.prototype.isSpotLightShadow=!0;class Bu extends jt{constructor(e,t,n=0,i=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ke.DefaultUp),this.updateMatrix(),this.target=new ke,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.shadow=new Fu}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Bu.prototype.isSpotLight=!0;const zu=new pe,Dr=new S,Ja=new S;class Nu extends Ya{constructor(){super(new Mt(90,1,.5,500)),this._frameExtents=new q(4,2),this._viewportCount=6,this._viewports=[new We(2,1,1,1),new We(0,1,1,1),new We(3,1,1,1),new We(1,1,1,1),new We(3,0,1,1),new We(1,0,1,1)],this._cubeDirections=[new S(1,0,0),new S(-1,0,0),new S(0,0,1),new S(0,0,-1),new S(0,1,0),new S(0,-1,0)],this._cubeUps=[new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,0,1),new S(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Dr.setFromMatrixPosition(e.matrixWorld),n.position.copy(Dr),Ja.copy(n.position),Ja.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ja),n.updateMatrixWorld(),i.makeTranslation(-Dr.x,-Dr.y,-Dr.z),zu.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zu)}}Nu.prototype.isPointLightShadow=!0;class Uu extends jt{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Nu}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Uu.prototype.isPointLight=!0;class Ou extends Ya{constructor(){super(new Ms(-5,5,5,-5,.5,500))}}Ou.prototype.isDirectionalLightShadow=!0;class Hu extends jt{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ke.DefaultUp),this.updateMatrix(),this.target=new ke,this.shadow=new Ou}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Hu.prototype.isDirectionalLight=!0;class Gu extends jt{constructor(e,t){super(e,t),this.type="AmbientLight"}}Gu.prototype.isAmbientLight=!0;class Vu extends jt{constructor(e,t,n=10,i=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}Vu.prototype.isRectAreaLight=!0;class ku{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new S)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}ku.prototype.isSphericalHarmonics3=!0;class ao extends jt{constructor(e=new ku,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}ao.prototype.isLightProbe=!0;class N0 extends null{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new gn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=new A0[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new le().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new le().setHex(o.value);break;case"v2":i.uniforms[s].value=new q().fromArray(o.value);break;case"v3":i.uniforms[s].value=new S().fromArray(o.value);break;case"v4":i.uniforms[s].value=new We().fromArray(o.value);break;case"m3":i.uniforms[s].value=new mt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new pe().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new q().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new q().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Za{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(n){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Wu extends ve{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}Wu.prototype.isInstancedBufferGeometry=!0;class U0 extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,p){if(t[p]!==void 0)return t[p];const v=d.interleavedBuffers[p],g=s(d,v.buffer),m=gi(v.type,g),_=new Ui(m,v.stride);return _.uuid=v.uuid,t[p]=_,_}function s(d,p){if(n[p]!==void 0)return n[p];const v=d.arrayBuffers[p],g=new Uint32Array(v).buffer;return n[p]=g,g}const o=e.isInstancedBufferGeometry?new Wu:new ve,a=e.data.index;if(a!==void 0){const d=gi(a.type,a.array);o.setIndex(new ze(d,1))}const l=e.data.attributes;for(const d in l){const p=l[d];let x;if(p.isInterleavedBufferAttribute){const v=i(e.data,p.data);x=new Zn(v,p.itemSize,p.offset,p.normalized)}else{const v=gi(p.type,p.array),g=p.isInstancedBufferAttribute?Wi:ze;x=new g(v,p.itemSize,p.normalized)}p.name!==void 0&&(x.name=p.name),p.usage!==void 0&&x.setUsage(p.usage),p.updateRange!==void 0&&(x.updateRange.offset=p.updateRange.offset,x.updateRange.count=p.updateRange.count),o.setAttribute(d,x)}const c=e.data.morphAttributes;if(c)for(const d in c){const p=c[d],x=[];for(let v=0,g=p.length;v<g;v++){const m=p[v];let _;if(m.isInterleavedBufferAttribute){const y=i(e.data,m.data);_=new Zn(y,m.itemSize,m.offset,m.normalized)}else{const y=gi(m.type,m.array);_=new ze(y,m.itemSize,m.normalized)}m.name!==void 0&&(_.name=m.name),x.push(_)}o.morphAttributes[d]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,p=h.length;d!==p;++d){const x=h[d];o.addGroup(x.start,x.count,x.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const d=new S;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new wn(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class P_ extends null{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Za.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new gn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}loadAsync(e,t){return er(this,null,function*(){const n=this,i=this.path===""?Za.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new gn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=yield s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return yield n.parseAsync(a)})}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in o)if(o[f]instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}parseAsync(e){return er(this,null,function*(){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=yield this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l})}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new dn().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Pa().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new U0;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in yu?a=yu[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new N0;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];if(l.type==="MultiMaterial"){const c=[];for(let u=0;u<l.materials.length;u++){const h=l.materials[u];n[h.uuid]===void 0&&(n[h.uuid]=s.parse(h)),c.push(n[h.uuid])}i[l.uuid]=c}else n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=so.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:gi(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Cu(t);s=new oo(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){i[h.uuid]=[];for(let d=0,p=f.length;d<p;d++){const x=f[d],v=a(x);v!==null&&(v instanceof HTMLImageElement?i[h.uuid].push(v):i[h.uuid].push(new ki(v.data,v.width,v.height)))}}else{const d=a(h.url);d!==null&&(i[h.uuid]=d)}}}return i}parseImagesAsync(e){return er(this,null,function*(){const t=this,n={};let i;function s(o){return er(this,null,function*(){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return yield i.loadAsync(l)}else return o.data?{data:gi(o.type,o.data),width:o.width,height:o.height}:null})}if(e!==void 0&&e.length>0){i=new oo(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=yield s(f);d!==null&&(d instanceof HTMLImageElement?n[l.uuid].push(d):n[l.uuid].push(new ki(d.data,d.width,d.height)))}}else{const u=yield s(l.url);u!==null&&(n[l.uuid]=u)}}}return n})}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let l;const c=t[a.image];Array.isArray(c)?(l=new mr(c),c.length===6&&(l.needsUpdate=!0)):(c&&c.data?l=new ki(c.data,c.width,c.height):l=new dt(c),c&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,O0)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],qu),l.wrapT=n(a.wrap[1],qu)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,Xu)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,Xu)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,s){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let p=0,x=f.length;p<x;p++){const v=f[p];n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),d.push(n[v])}return d}return n[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),n[f]}}function c(f){return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),i[f]}let u,h;switch(e.type){case"Scene":o=new Ta,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new le(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new As(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Es(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Mt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Ms(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Gu(e.color,e.intensity);break;case"DirectionalLight":o=new Hu(e.color,e.intensity);break;case"PointLight":o=new Uu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Vu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Bu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Ru(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new ao().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new Ca(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new xt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,d=e.instanceMatrix,p=e.instanceColor;o=new Zc(u,h,f),o.instanceMatrix=new Wi(new Float32Array(d.array),16),p!==void 0&&(o.instanceColor=new Wi(new Float32Array(p.array),p.itemSize));break;case"LOD":o=new Xx;break;case"Line":o=new $n(a(e.geometry),l(e.material));break;case"LineLoop":o=new tu(a(e.geometry),l(e.material));break;case"LineSegments":o=new fn(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new zs(a(e.geometry),l(e.material));break;case"Sprite":o=new La(l(e.material));break;case"Group":o=new Ni;break;case"Bone":o=new Ra;break;default:o=new ke}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,s))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const p=f[d];o.animations.push(s[p])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const p=f[d],x=o.getObjectByProperty("uuid",p.object);x!==void 0&&o.addLevel(x,p.distance)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}const O0={UVMapping:Io,CubeReflectionMapping:ai,CubeRefractionMapping:li,EquirectangularReflectionMapping:Wr,EquirectangularRefractionMapping:qr,CubeUVReflectionMapping:sr,CubeUVRefractionMapping:Xr},qu={RepeatWrapping:Yr,ClampToEdgeWrapping:wt,MirroredRepeatWrapping:Jr},Xu={NearestFilter:lt,NearestMipmapNearestFilter:Do,NearestMipmapLinearFilter:Fo,LinearFilter:nt,LinearMipmapNearestFilter:Ll,LinearMipmapLinearFilter:ci};class H0 extends Nn{constructor(e){super(e),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$i.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){$i.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}H0.prototype.isImageBitmapLoader=!0;let lo;const Yu={getContext:function(){return lo===void 0&&(lo=new(window.AudioContext||window.webkitAudioContext)),lo},setContext:function(r){lo=r}};class G0 extends Nn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new gn(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const l=a.slice(0);Yu.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}}class V0 extends ao{constructor(e,t,n=1){super(void 0,n);const i=new le().set(e),s=new le().set(t),o=new S(i.r,i.g,i.b),a=new S(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}V0.prototype.isHemisphereLightProbe=!0;class k0 extends ao{constructor(e,t=1){super(void 0,t);const n=new le().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}k0.prototype.isAmbientLightProbe=!0;const Ju=new pe,Zu=new pe,jn=new pe;class I_{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Mt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Mt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,jn.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(kn*t.fov*.5)/t.zoom;let a,l;Zu.elements[12]=-i,Ju.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,jn.elements[0]=2*t.near/(l-a),jn.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(jn),a=-o*t.aspect-s,l=o*t.aspect-s,jn.elements[0]=2*t.near/(l-a),jn.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(jn)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Zu),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ju)}}class W0{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=$u(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=$u();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function $u(){return(typeof performance=="undefined"?Date:performance).now()}const Qn=new S,ju=new St,q0=new S,Kn=new S;class D_ extends null{constructor(){super(),this.type="AudioListener",this.context=Yu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new W0}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Qn,ju,q0),Kn.set(0,0,-1).applyQuaternion(ju),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Qn.x,i),t.positionY.linearRampToValueAtTime(Qn.y,i),t.positionZ.linearRampToValueAtTime(Qn.z,i),t.forwardX.linearRampToValueAtTime(Kn.x,i),t.forwardY.linearRampToValueAtTime(Kn.y,i),t.forwardZ.linearRampToValueAtTime(Kn.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Qn.x,Qn.y,Qn.z),t.setOrientation(Kn.x,Kn.y,Kn.z,n.x,n.y,n.z)}}class X0 extends ke{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const ei=new S,Qu=new St,Y0=new S,ti=new S;class F_ extends null{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(ei,Qu,Y0),ti.set(0,0,1).applyQuaternion(Qu);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ei.x,n),t.positionY.linearRampToValueAtTime(ei.y,n),t.positionZ.linearRampToValueAtTime(ei.z,n),t.orientationX.linearRampToValueAtTime(ti.x,n),t.orientationY.linearRampToValueAtTime(ti.y,n),t.orientationZ.linearRampToValueAtTime(ti.z,n)}else t.setPosition(ei.x,ei.y,ei.z),t.setOrientation(ti.x,ti.y,ti.z)}}class J0{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Z0{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){St.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;St.multiplyQuaternionsFlat(e,o,e,t,e,n),St.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const $a="\\[\\]\\.:\\/",$0=new RegExp("["+$a+"]","g"),ja="[^"+$a+"]",j0="[^"+$a.replace("\\.","")+"]",Q0=/((?:WC+[\/:])*)/.source.replace("WC",ja),K0=/(WCOD+)?/.source.replace("WCOD",j0),ey=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ja),ty=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ja),ny=new RegExp("^"+Q0+K0+ey+ty+"$"),iy=["material","materials","bones"];class ry{constructor(e,t,n){const i=n||Ge.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ge{constructor(e,t,n){this.path=t,this.parsedPath=n||Ge.parseTrackName(t),this.node=Ge.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ge.Composite(e,t,n):new Ge(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($0,"")}static parseTrackName(e){const t=ny.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);iy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Ge.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ge.Composite=ry,Ge.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ge.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ge.prototype.GetterByBindingType=[Ge.prototype._getValue_direct,Ge.prototype._getValue_array,Ge.prototype._getValue_arrayElement,Ge.prototype._getValue_toArray],Ge.prototype.SetterByBindingTypeAndVersioning=[[Ge.prototype._setValue_direct,Ge.prototype._setValue_direct_setNeedsUpdate,Ge.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_array,Ge.prototype._setValue_array_setNeedsUpdate,Ge.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_arrayElement,Ge.prototype._setValue_arrayElement_setNeedsUpdate,Ge.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_fromArray,Ge.prototype._setValue_fromArray_setNeedsUpdate,Ge.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class sy{constructor(){this.uuid=Pt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],d=f.uuid;let p=t[d];if(p===void 0){p=l++,t[d]=p,e.push(f);for(let x=0,v=o;x!==v;++x)s[x].push(new Ge(f,n[x],i[x]))}else if(p<c){a=e[p];const x=--c,v=e[x];t[v.uuid]=p,e[p]=v,t[d]=x,e[x]=f;for(let g=0,m=o;g!==m;++g){const _=s[g],y=_[x];let M=_[p];_[p]=y,M===void 0&&(M=new Ge(f,n[g],i[g])),_[x]=M}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,p=i;d!==p;++d){const x=n[d],v=x[h],g=x[u];x[u]=v,x[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,d=e[f],p=--o,x=e[p];t[d.uuid]=h,e[h]=d,t[x.uuid]=f,e[f]=x,e.pop();for(let v=0,g=i;v!==g;++v){const m=n[v],_=m[f],y=m[p];m[h]=_,m[f]=y,m.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let p=0,x=i;p!==x;++p){const v=n[p];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){const p=l[f];h[f]=new Ge(p,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}sy.prototype.isAnimationObjectGroup=!0;class oy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:fi,endingEnd:fi};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pd,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Ol:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case zo:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===md;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===dd){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=di,i.endingEnd=di):(e?i.endingStart=this.zeroSlopeAtStart?di:fi:i.endingStart=Qr,t?i.endingEnd=this.zeroSlopeAtEnd?di:fi:i.endingEnd=Qr)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}class ay extends Vn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=i[h],d=f.name;let p=u[d];if(p!==void 0)o[h]=p;else{if(p=o[h],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;p=new Z0(Ge.create(n,d,x),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[h]=p}a[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Au(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?so.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=zo),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new oy(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?so.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}ay.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Qa{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Qa(this.value.clone===void 0?this.value:this.value.clone())}}class ly extends Ui{constructor(e,t,n=1){super(e,t),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}ly.prototype.isInstancedInterleavedBuffer=!0;class cy{constructor(e,t,n,i,s){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}cy.prototype.isGLBufferAttribute=!0;class B_{constructor(e,t,n=0,i=1/0){this.ray=new Tn(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Zo,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return Ka(e,this,n,t),n.sort(Ku),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Ka(e[i],this,n,t);return n.sort(Ku),n}}function Ku(r,e){return r.distance-e.distance}function Ka(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,o=i.length;s<o;s++)Ka(i[s],e,t,!0)}}class z_{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(vt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class N_{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const eh=new q;class Fr{constructor(e=new q(1/0,1/0),t=new q(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=eh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return eh.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Fr.prototype.isBox2=!0;const th=new S,co=new S;class uy{constructor(e=new S,t=new S){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){th.subVectors(e,this.start),co.subVectors(this.end,this.start);const n=co.dot(co);let s=co.dot(th)/n;return t&&(s=vt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const nh=new S;class U_ extends null{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new ve,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new me(i,3));const s=new bt({fog:!1,toneMapped:!1});this.cone=new fn(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),nh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(nh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Un=new S,uo=new pe,el=new pe;class hy extends fn{constructor(e){const t=ih(e),n=new ve,i=[],s=[],o=new le(0,0,1),a=new le(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}n.setAttribute("position",new me(i,3)),n.setAttribute("color",new me(s,3));const l=new bt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");el.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(uo.multiplyMatrices(el,a.matrixWorld),Un.setFromMatrixPosition(uo),i.setXYZ(o,Un.x,Un.y,Un.z),uo.multiplyMatrices(el,a.parent.matrixWorld),Un.setFromMatrixPosition(uo),i.setXYZ(o+1,Un.x,Un.y,Un.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function ih(r){const e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,ih(r.children[t]));return e}class O_ extends null{constructor(e,t,n){const i=new Pr(t,4,2),s=new An({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const fy=new S,rh=new le,sh=new le;class H_ extends null{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Cr(t);i.rotateY(Math.PI*.5),this.material=new An({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new ze(o,3)),this.add(new xt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");rh.copy(this.light.color),sh.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?rh:sh;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(fy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class dy extends fn{constructor(e=10,t=10,n=4473924,i=8947848){n=new le(n),i=new le(i);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,p=-a;f<=t;f++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);const x=f===s?n:i;x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3,x.toArray(c,d),d+=3}const u=new ve;u.setAttribute("position",new me(l,3)),u.setAttribute("color",new me(c,3));const h=new bt({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}}class G_ extends null{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new le(s),o=new le(o);const a=[],l=[];for(let h=0;h<=t;h++){const f=h/t*(Math.PI*2),d=Math.sin(f)*e,p=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,p);const x=h&1?s:o;l.push(x.r,x.g,x.b),l.push(x.r,x.g,x.b)}for(let h=0;h<=n;h++){const f=h&1?s:o,d=e-e/n*h;for(let p=0;p<i;p++){let x=p/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d;a.push(v,0,g),l.push(f.r,f.g,f.b),x=(p+1)/i*(Math.PI*2),v=Math.sin(x)*d,g=Math.cos(x)*d,a.push(v,0,g),l.push(f.r,f.g,f.b)}}const c=new ve;c.setAttribute("position",new me(a,3)),c.setAttribute("color",new me(l,3));const u=new bt({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}}const oh=new S,ho=new S,ah=new S;class V_ extends null{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new ve;i.setAttribute("position",new me([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new bt({fog:!1,toneMapped:!1});this.lightPlane=new $n(i,s),this.add(this.lightPlane),i=new ve,i.setAttribute("position",new me([0,0,0,0,0,1],3)),this.targetLine=new $n(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){oh.setFromMatrixPosition(this.light.matrixWorld),ho.setFromMatrixPosition(this.light.target.matrixWorld),ah.subVectors(ho,oh),this.lightPlane.lookAt(ho),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(ho),this.targetLine.scale.z=ah.length()}}const fo=new S,Ke=new ys;class k_ extends null{constructor(e){const t=new ve,n=new bt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new le(16755200),l=new le(16711680),c=new le(43775),u=new le(16777215),h=new le(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(p,x,v){d(p,v),d(x,v)}function d(p,x){i.push(0,0,0),s.push(x.r,x.g,x.b),o[p]===void 0&&(o[p]=[]),o[p].push(i.length/3-1)}t.setAttribute("position",new me(i,3)),t.setAttribute("color",new me(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Ke.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),rt("c",t,e,Ke,0,0,-1),rt("t",t,e,Ke,0,0,1),rt("n1",t,e,Ke,-n,-i,-1),rt("n2",t,e,Ke,n,-i,-1),rt("n3",t,e,Ke,-n,i,-1),rt("n4",t,e,Ke,n,i,-1),rt("f1",t,e,Ke,-n,-i,1),rt("f2",t,e,Ke,n,-i,1),rt("f3",t,e,Ke,-n,i,1),rt("f4",t,e,Ke,n,i,1),rt("u1",t,e,Ke,n*.7,i*1.1,-1),rt("u2",t,e,Ke,-n*.7,i*1.1,-1),rt("u3",t,e,Ke,0,i*2,-1),rt("cf1",t,e,Ke,-n,0,1),rt("cf2",t,e,Ke,n,0,1),rt("cf3",t,e,Ke,0,-i,1),rt("cf4",t,e,Ke,0,i,1),rt("cn1",t,e,Ke,-n,0,-1),rt("cn2",t,e,Ke,n,0,-1),rt("cn3",t,e,Ke,0,-i,-1),rt("cn4",t,e,Ke,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function rt(r,e,t,n,i,s,o){fo.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],fo.x,fo.y,fo.z)}}const po=new Nt;class py extends null{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new ze(i,3)),super(s,new bt({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&po.setFromObject(this.object),po.isEmpty())return;const t=po.min,n=po.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return fn.prototype.copy.call(this,e),this.object=e.object,this}}class W_ extends null{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new ve;s.setIndex(new ze(n,1)),s.setAttribute("position",new me(i,3)),super(s,new bt({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class q_ extends null{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],o=new ve;o.setAttribute("position",new me(s,3)),o.computeBoundingSphere(),super(o,new bt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new ve;l.setAttribute("position",new me(a,3)),l.computeBoundingSphere(),this.add(new xt(l,new An({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?at:ri,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}const lh=new S;let mo,tl;class X_ extends null{constructor(e=new S(0,0,1),t=new S(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",mo===void 0&&(mo=new ve,mo.setAttribute("position",new me([0,0,0,0,1,0],3)),tl=new Xi(0,.5,1,5,1),tl.translate(0,-.5,0)),this.position.copy(t),this.line=new $n(mo,new bt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new xt(tl,new An({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lh,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class my extends null{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new ve;i.setAttribute("position",new me(t,3)),i.setAttribute("color",new me(n,3));const s=new bt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new le,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Y_{constructor(){this.type="ShapePath",this.color=new le,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Xs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(m){const _=[];for(let y=0,M=m.length;y<M;y++){const w=m[y],A=new dn;A.curves=w.curves,_.push(A)}return _}function i(m,_){const y=_.length;let M=!1;for(let w=y-1,A=0;A<y;w=A++){let C=_[w],N=_[A],z=N.x-C.x,I=N.y-C.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(C=_[A],z=-z,N=_[w],I=-I),m.y<C.y||m.y>N.y)continue;if(m.y===C.y){if(m.x===C.x)return!0}else{const b=I*(m.x-C.x)-z*(m.y-C.y);if(b===0)return!0;if(b<0)continue;M=!M}}else{if(m.y!==C.y)continue;if(N.x<=m.x&&m.x<=C.x||C.x<=m.x&&m.x<=N.x)return!0}}return M}const s=pn.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,l,c;const u=[];if(o.length===1)return l=o[0],c=new dn,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;const f=[],d=[];let p=[],x=0,v;d[x]=void 0,p[x]=[];for(let m=0,_=o.length;m<_;m++)l=o[m],v=l.getPoints(),a=s(v),a=e?!a:a,a?(!h&&d[x]&&x++,d[x]={s:new dn,p:v},d[x].s.curves=l.curves,h&&x++,p[x]=[]):p[x].push({h:l,p:v[0]});if(!d[0])return n(o);if(d.length>1){let m=!1;const _=[];for(let y=0,M=d.length;y<M;y++)f[y]=[];for(let y=0,M=d.length;y<M;y++){const w=p[y];for(let A=0;A<w.length;A++){const C=w[A];let N=!0;for(let z=0;z<d.length;z++)i(C.p,d[z].p)&&(y!==z&&_.push({froms:y,tos:z,hole:A}),N?(N=!1,f[z].push(C)):m=!0);N&&f[y].push(C)}}_.length>0&&(m||(p=f))}let g;for(let m=0,_=d.length;m<_;m++){c=d[m].s,u.push(c),g=p[m];for(let y=0,M=g.length;y<M;y++)c.holes.push(g[y].h)}return u}}const ch=new Float32Array(1),gy=new Int32Array(ch.buffer);class J_{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),ch[0]=e;const t=gy[0];let n=t>>16&32768,i=t>>12&2047;const s=t>>23&255;return s<103?n:s>142?(n|=31744,n|=(s==255?0:1)&&t&8388607,n):s<113?(i|=2048,n|=(i>>114-s)+(i>>113-s&1),n):(n|=s-112<<10|i>>1,n+=i&1,n)}}const Z_=0,$_=1,j_=0,Q_=1,K_=2;function eM(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function tM(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}function nM(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new zs(r,e)}function iM(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new La(r)}function rM(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new zs(r,e)}function sM(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new qi(r)}function oM(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new qi(r)}function aM(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new qi(r)}function lM(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new S(r,e,t)}function cM(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new ze(r,e).setUsage(lr)}function uM(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new qd(r,e)}function hM(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Xd(r,e)}function fM(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Yd(r,e)}function dM(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Jd(r,e)}function pM(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ia(r,e)}function mM(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Zd(r,e)}function gM(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new ra(r,e)}function xM(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new me(r,e)}function yM(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new jd(r,e)}Ot.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Ot.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r},Xs.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};function vM(r){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new my(r)}function _M(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new py(r,e)}function MM(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new fn(new su(r.geometry),new bt({color:e!==void 0?e:16777215}))}dy.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},hy.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function bM(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new fn(new gu(r.geometry),new bt({color:e!==void 0?e:16777215}))}Nn.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Za.extractUrlBase(r)},Nn.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};function wM(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new gn(r)}function SM(r){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new B0(r)}Fr.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)},Fr.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Fr.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Fr.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)},Nt.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)},Nt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Nt.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Nt.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},Nt.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)},wn.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},_s.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)},uy.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)},mt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},mt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},mt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},mt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},mt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},pe.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)},pe.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},pe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new S().setFromMatrixColumn(this,3)},pe.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)},pe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},pe.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},pe.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)},pe.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},pe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},pe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},pe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},pe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},pe.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},pe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},pe.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)},pe.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()},hn.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)},St.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)},St.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Tn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},Tn.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)},Tn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},ct.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},ct.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)},ct.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)},ct.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)},ct.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)},ct.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ct.getBarycoord(r,e,t,n,i)},ct.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ct.getNormal(r,e,t,n)},dn.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)},dn.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Bn(this,r)},dn.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rr(this,r)},q.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},q.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},q.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},S.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},S.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},S.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)},S.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)},S.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)},S.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)},S.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},S.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)},S.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},We.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)},We.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ke.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)},ke.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ke.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)},ke.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ke.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(ke.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),xt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(xt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),gd},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ca.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Mt.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)},Object.defineProperties(jt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}}),Object.defineProperties(ze.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===lr},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(lr)}}}),ze.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?lr:ar),this},ze.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},ze.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ve.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)},ve.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new ze(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)},ve.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)},ve.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ve.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ve.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)},ve.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)},Object.defineProperties(ve.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Ui.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?lr:ar),this},Ui.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Bn.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Bn.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Bn.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Ta.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Qa.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(_t.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new le}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===_l}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Yt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}}),qe.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)},qe.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)},qe.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},qe.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},qe.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},qe.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},qe.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},qe.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},qe.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},qe.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},qe.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},qe.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},qe.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},qe.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},qe.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)},qe.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},qe.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},qe.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},qe.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},qe.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},qe.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},qe.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},qe.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},qe.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},qe.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(qe.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?pi:Vt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(zc.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});function TM(r,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new fa(r,t)}Object.defineProperties(zt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}}),X0.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new G0().load(r,function(n){e.setBuffer(n)}),this},J0.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ha.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)},ha.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)},yi.crossOrigin=void 0,yi.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new z0;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},yi.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new F0;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s},yi.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},yi.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function EM(){console.error("THREE.CanvasRenderer has been removed")}function AM(){console.error("THREE.JSONLoader has been removed.")}const LM={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function CM(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function RM(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new ve}function PM(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new ve}function IM(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function DM(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function FM(){console.error("THREE.ImmediateRenderObject has been removed.")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Gt}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Gt);function BM(r){r.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}function xy(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,l=new ve;let c=0;for(let u=0;u<r.length;++u){const h=r[u];let f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in h.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in h.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0;const h=[];for(let f=0;f<r.length;++f){const d=r[f].index;for(let p=0;p<d.count;++p)h.push(d.getX(p)+u);u+=r[f].attributes.position.count}l.setIndex(h)}for(const u in s){const h=uh(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in o){const h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const d=[];for(let x=0;x<o[u].length;++x)d.push(o[u][x][f]);const p=uh(d);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(p)}}return l}function uh(r){let e,t,n,i=0;for(let a=0;a<r.length;++a){const l=r[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=l.normalized),n!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=l.array.length}const s=new e(i);let o=0;for(let a=0;a<r.length;++a)s.set(r[a].array,o),o+=r[a].array.length;return new ze(s,t,n)}function zM(r){let e,t=0,n=0;for(let c=0,u=r.length;c<u;++c){const h=r[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=h.array.length,n+=h.itemSize}const i=new InterleavedBuffer(new e(t),n);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=r.length;c<u;c++){const h=r[c],f=h.itemSize,d=h.count,p=new InterleavedBufferAttribute(i,f,s,h.normalized);o.push(p),s+=f;for(let x=0;x<d;x++)for(let v=0;v<f;v++)p[l[v]](x,h[a[v]](x))}return o}function NM(r){let e=0;for(const n in r.attributes){const i=r.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const t=r.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function UM(r,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=r.getIndex(),i=r.getAttribute("position"),s=n?n.count:i.count;let o=0;const a=Object.keys(r.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let x=0,v=a.length;x<v;x++){const g=a[x];l[g]=[];const m=r.morphAttributes[g];m&&(c[g]=new Array(m.length).fill().map(()=>[]))}const f=Math.log10(1/e),d=Math.pow(10,f);for(let x=0;x<s;x++){const v=n?n.getX(x):x;let g="";for(let m=0,_=a.length;m<_;m++){const y=a[m],M=r.getAttribute(y),w=M.itemSize;for(let A=0;A<w;A++)g+=`${~~(M[h[A]](v)*d)},`}if(g in t)u.push(t[g]);else{for(let m=0,_=a.length;m<_;m++){const y=a[m],M=r.getAttribute(y),w=r.morphAttributes[y],A=M.itemSize,C=l[y],N=c[y];for(let z=0;z<A;z++){const I=h[z];if(C.push(M[I](v)),w)for(let b=0,T=w.length;b<T;b++)N[b].push(w[b][I](v))}}t[g]=o,u.push(o),o++}}const p=r.clone();for(let x=0,v=a.length;x<v;x++){const g=a[x],m=r.getAttribute(g),_=new m.array.constructor(l[g]),y=new BufferAttribute(_,m.itemSize,m.normalized);if(p.setAttribute(g,y),g in c)for(let M=0;M<c[g].length;M++){const w=r.morphAttributes[g][M],A=new w.array.constructor(c[g][M]),C=new BufferAttribute(A,w.itemSize,w.normalized);p.morphAttributes[g][M]=C}}return p.setIndex(u),p}function OM(r,e){if(e===TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===TriangleFanDrawMode||e===TriangleStripDrawMode){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===TriangleFanDrawMode)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}function HM(r){if(r.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const e=new Vector3,t=new Vector3,n=new Vector3,i=new Vector3,s=new Vector3,o=new Vector3,a=new Vector3,l=new Vector3,c=new Vector3;function u(V,W,ne,K,he,be,Y,we,de){e.fromBufferAttribute(ne,be),t.fromBufferAttribute(ne,Y),n.fromBufferAttribute(ne,we);const ge=V.morphTargetInfluences;if(W.morphTargets&&K&&ge){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let ye=0,Ue=K.length;ye<Ue;ye++){const k=ge[ye],$=K[ye];k!==0&&(i.fromBufferAttribute($,be),s.fromBufferAttribute($,Y),o.fromBufferAttribute($,we),he?(a.addScaledVector(i,k),l.addScaledVector(s,k),c.addScaledVector(o,k)):(a.addScaledVector(i.sub(e),k),l.addScaledVector(s.sub(t),k),c.addScaledVector(o.sub(n),k)))}e.add(a),t.add(l),n.add(c)}V.isSkinnedMesh&&(V.boneTransform(be,e),V.boneTransform(Y,t),V.boneTransform(we,n)),de[be*3+0]=e.x,de[be*3+1]=e.y,de[be*3+2]=e.z,de[Y*3+0]=t.x,de[Y*3+1]=t.y,de[Y*3+2]=t.z,de[we*3+0]=n.x,de[we*3+1]=n.y,de[we*3+2]=n.z}const h=r.geometry,f=r.material;let d,p,x;const v=h.index,g=h.attributes.position,m=h.morphAttributes.position,_=h.morphTargetsRelative,y=h.attributes.normal,M=h.morphAttributes.position,w=h.groups,A=h.drawRange;let C,N,z,I,b,T,B,R;const F=new Float32Array(g.count*g.itemSize),U=new Float32Array(y.count*y.itemSize);if(v!==null)if(Array.isArray(f))for(C=0,z=w.length;C<z;C++)for(b=w[C],T=f[b.materialIndex],B=Math.max(b.start,A.start),R=Math.min(b.start+b.count,A.start+A.count),N=B,I=R;N<I;N+=3)d=v.getX(N),p=v.getX(N+1),x=v.getX(N+2),u(r,T,g,m,_,d,p,x,F),u(r,T,y,M,_,d,p,x,U);else for(B=Math.max(0,A.start),R=Math.min(v.count,A.start+A.count),C=B,z=R;C<z;C+=3)d=v.getX(C),p=v.getX(C+1),x=v.getX(C+2),u(r,f,g,m,_,d,p,x,F),u(r,f,y,M,_,d,p,x,U);else if(g!==void 0)if(Array.isArray(f))for(C=0,z=w.length;C<z;C++)for(b=w[C],T=f[b.materialIndex],B=Math.max(b.start,A.start),R=Math.min(b.start+b.count,A.start+A.count),N=B,I=R;N<I;N+=3)d=N,p=N+1,x=N+2,u(r,T,g,m,_,d,p,x,F),u(r,T,y,M,_,d,p,x,U);else for(B=Math.max(0,A.start),R=Math.min(g.count,A.start+A.count),C=B,z=R;C<z;C+=3)d=C,p=C+1,x=C+2,u(r,f,g,m,_,d,p,x,F),u(r,f,y,M,_,d,p,x,U);const Z=new Float32BufferAttribute(F,3),ee=new Float32BufferAttribute(U,3);return{positionAttribute:g,normalAttribute:y,morphedPositionAttribute:Z,morphedNormalAttribute:ee}}function nl(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function hh(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function il(r,e){return il=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},il(r,e)}function yy(r,e){return il(r,e)}function fh(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&yy(r,e)}function vy(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function rl(r){return rl=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},rl(r)}function dh(r){return rl(r)}function _y(r){return r&&r.constructor===Symbol?"symbol":typeof r}function My(r,e){return e&&(_y(e)==="object"||typeof e=="function")?e:nl(r)}function ph(r){var e=vy();return function(){var n=dh(r),i;if(e){var s=dh(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return My(this,i)}}var by=`
|
|
3047
3047
|
`.concat(Me.logdepthbuf_pars_vertex,`
|
|
3048
3048
|
`).concat(Me.fog_pars_vertex,`
|
|
3049
3049
|
attribute vec3 previous;
|
|
@@ -3174,4 +3174,4 @@ void main() {
|
|
|
3174
3174
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
3175
3175
|
`).concat(Me.fog_fragment,`
|
|
3176
3176
|
}
|
|
3177
|
-
`),xn=function(r){"use strict";fh(t,r);var e=ph(t);function t(){hh(this,t);var n;return n=e.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new pe,Object.defineProperties(nl(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(s){this.setGeometry(s,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(s){this.setPoints(s,this.widthCallback)}}}),n}return t}(ve);xn.prototype.setMatrixWorld=function(r){this.matrixWorld=r},xn.prototype.setGeometry=function(r,e){this._geometry=r,this.setPoints(r.getAttribute("position").array,e)},xn.prototype.setPoints=function(r,e){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=e,this.positions=[],this.counters=[],r.length&&r[0]instanceof S)for(var t=0;t<r.length;t++){var n=r[t],i=t/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var t=0;t<r.length;t+=3){var i=t/r.length;this.positions.push(r[t],r[t+1],r[t+2]),this.positions.push(r[t],r[t+1],r[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function Sy(r,e){var t=new pe,n=new Tn,i=new wn,s=new S,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,s)!==!1){t.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(t);var a=new S,l=new S,c=new S,u=this instanceof fn?2:1,h=o.index,f=o.attributes;if(h!==null)for(var d=h.array,m=f.position.array,x=f.width.array,v=0,g=d.length-1;v<g;v+=u){var p=d[v],_=d[v+1];a.fromArray(m,p*3),l.fromArray(m,_*3);var y=x[Math.floor(v/3)]!==void 0?x[Math.floor(v/3)]:1,M=r.params.Line.threshold+this.material.lineWidth*y/2,w=M*M,A=n.distanceSqToSegment(a,l,s,c);if(!(A>w)){s.applyMatrix4(this.matrixWorld);var C=r.ray.origin.distanceTo(s);C<r.near||C>r.far||(e.push({distance:C,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=g)}}}}xn.prototype.raycast=Sy,xn.prototype.compareV3=function(r,e){var t=r*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]},xn.prototype.copyV3=function(r){var e=r*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]},xn.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e,t;this.compareV3(0,r-1)?t=this.copyV3(r-2):t=this.copyV3(0),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(var n=0;n<r;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?e=this.widthCallback(n/(r-1)):e=1,this.width.push(e),this.width.push(e),this.uvs.push(n/(r-1),0),this.uvs.push(n/(r-1),1),n<r-1){t=this.copyV3(n),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);var i=n*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}n>0&&(t=this.copyV3(n),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]))}this.compareV3(r-1,0)?t=this.copyV3(1):t=this.copyV3(r-1),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new ze(new Float32Array(this.positions),3),previous:new ze(new Float32Array(this.previous),3),next:new ze(new Float32Array(this.next),3),side:new ze(new Float32Array(this.side),1),width:new ze(new Float32Array(this.width),1),uv:new ze(new Float32Array(this.uvs),2),index:new ze(new Uint16Array(this.indices_array),1),counters:new ze(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function sl(r,e,t,n,i){var s;if(r=r.subarray||r.slice?r:r.buffer,t=t.subarray||t.slice?t:t.buffer,r=e?r.subarray?r.subarray(e,i&&e+i):r.slice(e,i&&e+i):r,t.set)t.set(r,n);else for(s=0;s<r.length;s++)t[s+n]=r[s];return t}xn.prototype.advance=function(r){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,i=e.length;sl(e,0,t,0,i),sl(e,6,e,0,i-6),e[i-6]=r.x,e[i-5]=r.y,e[i-4]=r.z,e[i-3]=r.x,e[i-2]=r.y,e[i-1]=r.z,sl(e,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},Me.meshline_vert=by,Me.meshline_frag=wy;var Ty=function(r){"use strict";fh(t,r);var e=ph(t);function t(n){hh(this,t);var i;return i=e.call(this,{uniforms:Object.assign({},oe.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new le(16777215)},opacity:{value:1},resolution:{value:new q(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new q(1,1)},offset:{value:new q(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new q(0,0)},lightColor:{value:new le(16777215)}}),vertexShader:Me.meshline_vert,fragmentShader:Me.meshline_frag}),i.isMeshLineMaterial=!0,i.type="MeshLineMaterial",Object.defineProperties(nl(i),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),i.setValues(n),i}return t}(Yt);Ty.prototype.copy=function(r){return Yt.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};function Ey(r){var e=r.setPointWidth,t=r.nodes,n=new ve,i=new xn;return n.setFromPoints(t),i.setGeometry(n,e),i}function Ay(r){if(Array.isArray(r))return r}function Ly(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function mh(r,e){return Ay(r)||tr(r,e)||Gr(r,e)||Ly()}var Je=1e-6,Cy=1e-12,Ne=Math.PI,Rt=Ne/2,gh=Ne/4,Ht=Ne*2,Ft=180/Ne,ut=Ne/180,st=Math.abs,xh=Math.atan,Br=Math.atan2,ot=Math.cos,GM=Math.ceil,Ry=Math.exp,VM=Math.floor,kM=Math.hypot,Py=Math.log,WM=Math.pow,et=Math.sin,Iy=Math.sign||function(r){return r>0?1:r<0?-1:0},go=Math.sqrt,Dy=Math.tan;function Fy(r){return r>1?0:r<-1?Ne:Math.acos(r)}function zr(r){return r>1?Rt:r<-1?-Rt:Math.asin(r)}function qM(r){return(r=et(r/2))*r}function ol(r,e){function t(n,i){return n=r(n,i),e(n[0],n[1])}return r.invert&&e.invert&&(t.invert=function(n,i){return n=e.invert(n,i),n&&r.invert(n[0],n[1])}),t}function al(r,e){return[st(r)>Ne?r+Math.round(-r/Ht)*Ht:r,e]}al.invert=al;function yh(r,e,t){return(r%=Ht)?e||t?ol(_h(r),Mh(e,t)):_h(r):e||t?Mh(e,t):al}function vh(r){return function(e,t){return e+=r,[e>Ne?e-Ht:e<-Ne?e+Ht:e,t]}}function _h(r){var e=vh(r);return e.invert=vh(-r),e}function Mh(r,e){var t=ot(r),n=et(r),i=ot(e),s=et(e);function o(a,l){var c=ot(l),u=ot(a)*c,h=et(a)*c,f=et(l),d=f*t+u*n;return[Br(h*i-d*s,u*t-f*n),zr(d*i+h*s)]}return o.invert=function(a,l){var c=ot(l),u=ot(a)*c,h=et(a)*c,f=et(l),d=f*i-h*s;return[Br(h*i+f*s,u*t+d*n),zr(d*t-u*n)]},o}function By(r){r=yh(r[0]*ut,r[1]*ut,r.length>2?r[2]*ut:0);function e(t){return t=r(t[0]*ut,t[1]*ut),t[0]*=Ft,t[1]*=Ft,t}return e.invert=function(t){return t=r.invert(t[0]*ut,t[1]*ut),t[0]*=Ft,t[1]*=Ft,t},e}function Nr(){}function bh(){var r=[],e;return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){r.push(e=[])},lineEnd:Nr,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var t=r;return r=[],e=null,t}}}function xo(r,e){return st(r[0]-e[0])<Je&&st(r[1]-e[1])<Je}function yo(r,e,t,n){this.x=r,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function wh(r,e,t,n,i){var s=[],o=[],a,l;if(r.forEach(function(m){if(!((x=m.length-1)<=0)){var x,v=m[0],g=m[x],p;if(xo(v,g)){if(!v[2]&&!g[2]){for(i.lineStart(),a=0;a<x;++a)i.point((v=m[a])[0],v[1]);i.lineEnd();return}g[0]+=2*Je}s.push(p=new yo(v,m,null,!0)),o.push(p.o=new yo(v,null,p,!1)),s.push(p=new yo(g,m,null,!1)),o.push(p.o=new yo(g,null,p,!0))}}),!!s.length){for(o.sort(e),Sh(s),Sh(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,h;;){for(var f=c,d=!0;f.v;)if((f=f.n)===c)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(a=0,l=u.length;a<l;++a)i.point((h=u[a])[0],h[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(d)for(u=f.p.z,a=u.length-1;a>=0;--a)i.point((h=u[a])[0],h[1]);else n(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,d=!d}while(!f.v);i.lineEnd()}}}function Sh(r){if(!!(e=r.length)){for(var e,t=0,n=r[0],i;++t<e;)n.n=i=r[t],i.p=n,n=i;n.n=i=r[0],i.p=n}}class ll{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const s=t[i],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t=this._n,n,i,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,i=e[--t],o=n+i,s=i-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(i=s*2,n=o+i,i==n-o&&(o=n))}return o}}function XM(r,e){const t=new ll;if(e===void 0)for(let n of r)(n=+n)&&t.add(n);else{let n=-1;for(let i of r)(i=+e(i,++n,r))&&t.add(i)}return+t}function YM(r,e){const t=new ll;let n=-1;return Float64Array.from(r,e===void 0?i=>t.add(+i||0):i=>t.add(+e(i,++n,r)||0))}function cl(r){return[Br(r[1],r[0]),zr(r[2])]}function ji(r){var e=r[0],t=r[1],n=ot(t);return[n*ot(e),n*et(e),et(t)]}function vo(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function _o(r,e){return[r[1]*e[2]-r[2]*e[1],r[2]*e[0]-r[0]*e[2],r[0]*e[1]-r[1]*e[0]]}function ul(r,e){r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}function Mo(r,e){return[r[0]*e,r[1]*e,r[2]*e]}function hl(r){var e=go(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=e,r[1]/=e,r[2]/=e}function fl(r){return st(r[0])<=Ne?r[0]:Iy(r[0])*((st(r[0])+Ne)%Ht-Ne)}function zy(r,e){var t=fl(e),n=e[1],i=et(n),s=[et(t),-ot(t),0],o=0,a=0,l=new ll;i===1?n=Rt+Je:i===-1&&(n=-Rt-Je);for(var c=0,u=r.length;c<u;++c)if(!!(f=(h=r[c]).length))for(var h,f,d=h[f-1],m=fl(d),x=d[1]/2+gh,v=et(x),g=ot(x),p=0;p<f;++p,m=y,v=w,g=A,d=_){var _=h[p],y=fl(_),M=_[1]/2+gh,w=et(M),A=ot(M),C=y-m,N=C>=0?1:-1,z=N*C,I=z>Ne,b=v*w;if(l.add(Br(b*N*et(z),g*A+b*ot(z))),o+=I?C+N*Ht:C,I^m>=t^y>=t){var T=_o(ji(d),ji(_));hl(T);var B=_o(s,T);hl(B);var R=(I^C>=0?-1:1)*zr(B[2]);(n>R||n===R&&(T[0]||T[1]))&&(a+=I^C>=0?1:-1)}}return(o<-Je||o<Je&&l<-Cy)^a&1}function*Ny(r){for(const e of r)yield*e}function Th(r){return Array.from(Ny(r))}function Eh(r,e,t,n){return function(i){var s=e(i),o=bh(),a=e(o),l=!1,c,u,h,f={point:d,lineStart:x,lineEnd:v,polygonStart:function(){f.point=g,f.lineStart=p,f.lineEnd=_,u=[],c=[]},polygonEnd:function(){f.point=d,f.lineStart=x,f.lineEnd=v,u=Th(u);var y=zy(c,n);u.length?(l||(i.polygonStart(),l=!0),wh(u,Oy,y,t,i)):y&&(l||(i.polygonStart(),l=!0),i.lineStart(),t(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),u=c=null},sphere:function(){i.polygonStart(),i.lineStart(),t(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(y,M){r(y,M)&&i.point(y,M)}function m(y,M){s.point(y,M)}function x(){f.point=m,s.lineStart()}function v(){f.point=d,s.lineEnd()}function g(y,M){h.push([y,M]),a.point(y,M)}function p(){a.lineStart(),h=[]}function _(){g(h[0][0],h[0][1]),a.lineEnd();var y=a.clean(),M=o.result(),w,A=M.length,C,N,z;if(h.pop(),c.push(h),h=null,!!A){if(y&1){if(N=M[0],(C=N.length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),w=0;w<C;++w)i.point((z=N[w])[0],z[1]);i.lineEnd()}return}A>1&&y&2&&M.push(M.pop().concat(M.shift())),u.push(M.filter(Uy))}}return f}}function Uy(r){return r.length>1}function Oy(r,e){return((r=r.x)[0]<0?r[1]-Rt-Je:Rt-r[1])-((e=e.x)[0]<0?e[1]-Rt-Je:Rt-e[1])}var Ah=Eh(function(){return!0},Hy,Vy,[-Ne,-Rt]);function Hy(r){var e=NaN,t=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(s,o){var a=s>0?Ne:-Ne,l=st(s-e);st(l-Ne)<Je?(r.point(e,t=(t+o)/2>0?Rt:-Rt),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),r.point(s,t),i=0):n!==a&&l>=Ne&&(st(e-n)<Je&&(e-=n*Je),st(s-a)<Je&&(s-=a*Je),t=Gy(e,t,s,o),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),i=0),r.point(e=s,t=o),n=a},lineEnd:function(){r.lineEnd(),e=t=NaN},clean:function(){return 2-i}}}function Gy(r,e,t,n){var i,s,o=et(r-t);return st(o)>Je?xh((et(e)*(s=ot(n))*et(t)-et(n)*(i=ot(e))*et(r))/(i*s*o)):(e+n)/2}function Vy(r,e,t,n){var i;if(r==null)i=t*Rt,n.point(-Ne,i),n.point(0,i),n.point(Ne,i),n.point(Ne,0),n.point(Ne,-i),n.point(0,-i),n.point(-Ne,-i),n.point(-Ne,0),n.point(-Ne,i);else if(st(r[0]-e[0])>Je){var s=r[0]<e[0]?Ne:-Ne;i=t*s/2,n.point(-s,i),n.point(0,i),n.point(s,i)}else n.point(e[0],e[1])}function Lh(r,e,t,n,i,s){if(!!t){var o=ot(e),a=et(e),l=n*t;i==null?(i=e+n*Ht,s=e-l/2):(i=Ch(o,i),s=Ch(o,s),(n>0?i<s:i>s)&&(i+=n*Ht));for(var c,u=i;n>0?u>s:u<s;u-=l)c=cl([o,-a*ot(u),-a*et(u)]),r.point(c[0],c[1])}}function Ch(r,e){e=ji(e),e[0]-=r,hl(e);var t=Fy(-e[1]);return((-e[2]<0?-t:t)+Ht-Je)%Ht}function JM(){var r=constant([0,0]),e=constant(90),t=constant(6),n,i,s={point:o};function o(l,c){n.push(l=i(l,c)),l[0]*=degrees,l[1]*=degrees}function a(){var l=r.apply(this,arguments),c=e.apply(this,arguments)*radians,u=t.apply(this,arguments)*radians;return n=[],i=rotateRadians(-l[0]*radians,-l[1]*radians,0).invert,Lh(s,c,u,1),l={type:"Polygon",coordinates:[n]},n=i=null,l}return a.center=function(l){return arguments.length?(r=typeof l=="function"?l:constant([+l[0],+l[1]]),a):r},a.radius=function(l){return arguments.length?(e=typeof l=="function"?l:constant(+l),a):e},a.precision=function(l){return arguments.length?(t=typeof l=="function"?l:constant(+l),a):t},a}function ky(r){var e=ot(r),t=6*ut,n=e>0,i=st(e)>Je;function s(u,h,f,d){Lh(d,r,t,f,u,h)}function o(u,h){return ot(u)*ot(h)>e}function a(u){var h,f,d,m,x;return{lineStart:function(){m=d=!1,x=1},point:function(v,g){var p=[v,g],_,y=o(v,g),M=n?y?0:c(v,g):y?c(v+(v<0?Ne:-Ne),g):0;if(!h&&(m=d=y)&&u.lineStart(),y!==d&&(_=l(h,p),(!_||xo(h,_)||xo(p,_))&&(p[2]=1)),y!==d)x=0,y?(u.lineStart(),_=l(p,h),u.point(_[0],_[1])):(_=l(h,p),u.point(_[0],_[1],2),u.lineEnd()),h=_;else if(i&&h&&n^y){var w;!(M&f)&&(w=l(p,h,!0))&&(x=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}y&&(!h||!xo(h,p))&&u.point(p[0],p[1]),h=p,d=y,f=M},lineEnd:function(){d&&u.lineEnd(),h=null},clean:function(){return x|(m&&d)<<1}}}function l(u,h,f){var d=ji(u),m=ji(h),x=[1,0,0],v=_o(d,m),g=vo(v,v),p=v[0],_=g-p*p;if(!_)return!f&&u;var y=e*g/_,M=-e*p/_,w=_o(x,v),A=Mo(x,y),C=Mo(v,M);ul(A,C);var N=w,z=vo(A,N),I=vo(N,N),b=z*z-I*(vo(A,A)-1);if(!(b<0)){var T=go(b),B=Mo(N,(-z-T)/I);if(ul(B,A),B=cl(B),!f)return B;var R=u[0],F=h[0],U=u[1],Z=h[1],ee;F<R&&(ee=R,R=F,F=ee);var V=F-R,W=st(V-Ne)<Je,ne=W||V<Je;if(!W&&Z<U&&(ee=U,U=Z,Z=ee),ne?W?U+Z>0^B[1]<(st(B[0]-R)<Je?U:Z):U<=B[1]&&B[1]<=Z:V>Ne^(R<=B[0]&&B[0]<=F)){var K=Mo(N,(-z+T)/I);return ul(K,A),[B,cl(K)]}}}function c(u,h){var f=n?r:Ne-r,d=0;return u<-f?d|=1:u>f&&(d|=2),h<-f?d|=4:h>f&&(d|=8),d}return Eh(o,a,s,n?[0,-r]:[-Ne,r-Ne])}function Wy(r,e,t,n,i,s){var o=r[0],a=r[1],l=e[0],c=e[1],u=0,h=1,f=l-o,d=c-a,m;if(m=t-o,!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<h&&(h=m)}else if(f>0){if(m>h)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>h)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<h&&(h=m)}if(m=n-a,!(!d&&m>0)){if(m/=d,d<0){if(m<u)return;m<h&&(h=m)}else if(d>0){if(m>h)return;m>u&&(u=m)}if(m=s-a,!(!d&&m<0)){if(m/=d,d<0){if(m>h)return;m>u&&(u=m)}else if(d>0){if(m<u)return;m<h&&(h=m)}return u>0&&(r[0]=o+u*f,r[1]=a+u*d),h<1&&(e[0]=o+h*f,e[1]=a+h*d),!0}}}}}var Ur=1e9,bo=-Ur;function qy(r,e,t,n){function i(c,u){return r<=c&&c<=t&&e<=u&&u<=n}function s(c,u,h,f){var d=0,m=0;if(c==null||(d=o(c,h))!==(m=o(u,h))||l(c,u)<0^h>0)do f.point(d===0||d===3?r:t,d>1?n:e);while((d=(d+h+4)%4)!==m);else f.point(u[0],u[1])}function o(c,u){return st(c[0]-r)<Je?u>0?0:3:st(c[0]-t)<Je?u>0?2:1:st(c[1]-e)<Je?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var h=o(c,1),f=o(u,1);return h!==f?h-f:h===0?u[1]-c[1]:h===1?c[0]-u[0]:h===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,h=bh(),f,d,m,x,v,g,p,_,y,M,w,A={point:C,lineStart:b,lineEnd:T,polygonStart:z,polygonEnd:I};function C(R,F){i(R,F)&&u.point(R,F)}function N(){for(var R=0,F=0,U=d.length;F<U;++F)for(var Z=d[F],ee=1,V=Z.length,W=Z[0],ne,K,he=W[0],be=W[1];ee<V;++ee)ne=he,K=be,W=Z[ee],he=W[0],be=W[1],K<=n?be>n&&(he-ne)*(n-K)>(be-K)*(r-ne)&&++R:be<=n&&(he-ne)*(n-K)<(be-K)*(r-ne)&&--R;return R}function z(){u=h,f=[],d=[],w=!0}function I(){var R=N(),F=w&&R,U=(f=Th(f)).length;(F||U)&&(c.polygonStart(),F&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),U&&wh(f,a,R,s,c),c.polygonEnd()),u=c,f=d=m=null}function b(){A.point=B,d&&d.push(m=[]),M=!0,y=!1,p=_=NaN}function T(){f&&(B(x,v),g&&y&&h.rejoin(),f.push(h.result())),A.point=C,y&&u.lineEnd()}function B(R,F){var U=i(R,F);if(d&&m.push([R,F]),M)x=R,v=F,g=U,M=!1,U&&(u.lineStart(),u.point(R,F));else if(U&&y)u.point(R,F);else{var Z=[p=Math.max(bo,Math.min(Ur,p)),_=Math.max(bo,Math.min(Ur,_))],ee=[R=Math.max(bo,Math.min(Ur,R)),F=Math.max(bo,Math.min(Ur,F))];Wy(Z,ee,r,e,t,n)?(y||(u.lineStart(),u.point(Z[0],Z[1])),u.point(ee[0],ee[1]),U||u.lineEnd(),w=!1):U&&(u.lineStart(),u.point(R,F),w=!1)}p=R,_=F,y=U}return A}}var Rh=r=>r;function ZM(r){return{stream:wo(r)}}function wo(r){return function(e){var t=new dl;for(var n in r)t[n]=r[n];return t.stream=e,t}}function dl(){}dl.prototype={constructor:dl,point:function(r,e){this.stream.point(r,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function So(r,e){r&&Ih.hasOwnProperty(r.type)&&Ih[r.type](r,e)}var Ph={Feature:function(r,e){So(r.geometry,e)},FeatureCollection:function(r,e){for(var t=r.features,n=-1,i=t.length;++n<i;)So(t[n].geometry,e)}},Ih={Sphere:function(r,e){e.sphere()},Point:function(r,e){r=r.coordinates,e.point(r[0],r[1],r[2])},MultiPoint:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)r=t[n],e.point(r[0],r[1],r[2])},LineString:function(r,e){pl(r.coordinates,e,0)},MultiLineString:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)pl(t[n],e,0)},Polygon:function(r,e){Dh(r.coordinates,e)},MultiPolygon:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)Dh(t[n],e)},GeometryCollection:function(r,e){for(var t=r.geometries,n=-1,i=t.length;++n<i;)So(t[n],e)}};function pl(r,e,t){var n=-1,i=r.length-t,s;for(e.lineStart();++n<i;)s=r[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function Dh(r,e){var t=-1,n=r.length;for(e.polygonStart();++t<n;)pl(r[t],e,1);e.polygonEnd()}function Xy(r,e){r&&Ph.hasOwnProperty(r.type)?Ph[r.type](r,e):So(r,e)}var Qi=1/0,To=Qi,Or=-Qi,Eo=Or,Yy={point:Jy,lineStart:Nr,lineEnd:Nr,polygonStart:Nr,polygonEnd:Nr,result:function(){var r=[[Qi,To],[Or,Eo]];return Or=Eo=-(To=Qi=1/0),r}};function Jy(r,e){r<Qi&&(Qi=r),r>Or&&(Or=r),e<To&&(To=e),e>Eo&&(Eo=e)}var Fh=Yy;function ml(r,e,t){var n=r.clipExtent&&r.clipExtent();return r.scale(150).translate([0,0]),n!=null&&r.clipExtent(null),Xy(t,r.stream(Fh)),e(Fh.result()),n!=null&&r.clipExtent(n),r}function Bh(r,e,t){return ml(r,function(n){var i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(i/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(i-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;r.scale(150*o).translate([a,l])},t)}function Zy(r,e,t){return Bh(r,[[0,0],e],t)}function $y(r,e,t){return ml(r,function(n){var i=+e,s=i/(n[1][0]-n[0][0]),o=(i-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];r.scale(150*s).translate([o,a])},t)}function jy(r,e,t){return ml(r,function(n){var i=+e,s=i/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(i-s*(n[1][1]+n[0][1]))/2;r.scale(150*s).translate([o,a])},t)}var zh=16,Qy=ot(30*ut);function Nh(r,e){return+e?ev(r,e):Ky(r)}function Ky(r){return wo({point:function(e,t){e=r(e,t),this.stream.point(e[0],e[1])}})}function ev(r,e){function t(n,i,s,o,a,l,c,u,h,f,d,m,x,v){var g=c-n,p=u-i,_=g*g+p*p;if(_>4*e&&x--){var y=o+f,M=a+d,w=l+m,A=go(y*y+M*M+w*w),C=zr(w/=A),N=st(st(w)-1)<Je||st(s-h)<Je?(s+h)/2:Br(M,y),z=r(N,C),I=z[0],b=z[1],T=I-n,B=b-i,R=p*T-g*B;(R*R/_>e||st((g*T+p*B)/_-.5)>.3||o*f+a*d+l*m<Qy)&&(t(n,i,s,o,a,l,I,b,N,y/=A,M/=A,w,x,v),v.point(I,b),t(I,b,N,y,M,w,c,u,h,f,d,m,x,v))}}return function(n){var i,s,o,a,l,c,u,h,f,d,m,x,v={point:g,lineStart:p,lineEnd:y,polygonStart:function(){n.polygonStart(),v.lineStart=M},polygonEnd:function(){n.polygonEnd(),v.lineStart=p}};function g(C,N){C=r(C,N),n.point(C[0],C[1])}function p(){h=NaN,v.point=_,n.lineStart()}function _(C,N){var z=ji([C,N]),I=r(C,N);t(h,f,u,d,m,x,h=I[0],f=I[1],u=C,d=z[0],m=z[1],x=z[2],zh,n),n.point(h,f)}function y(){v.point=g,n.lineEnd()}function M(){p(),v.point=w,v.lineEnd=A}function w(C,N){_(i=C,N),s=h,o=f,a=d,l=m,c=x,v.point=_}function A(){t(h,f,u,d,m,x,s,o,i,a,l,c,zh,n),v.lineEnd=y,y()}return v}}var tv=wo({point:function(r,e){this.stream.point(r*ut,e*ut)}});function nv(r){return wo({point:function(e,t){var n=r(e,t);return this.stream.point(n[0],n[1])}})}function iv(r,e,t,n,i){function s(o,a){return o*=n,a*=i,[e+r*o,t-r*a]}return s.invert=function(o,a){return[(o-e)/r*n,(t-a)/r*i]},s}function Uh(r,e,t,n,i,s){if(!s)return iv(r,e,t,n,i);var o=ot(s),a=et(s),l=o*r,c=a*r,u=o/r,h=a/r,f=(a*t-o*e)/r,d=(a*e+o*t)/r;function m(x,v){return x*=n,v*=i,[l*x-c*v+e,t-c*x-l*v]}return m.invert=function(x,v){return[n*(u*x-h*v+f),i*(d-h*x-u*v)]},m}function rv(r){return sv(function(){return r})()}function sv(r){var e,t=150,n=480,i=250,s=0,o=0,a=0,l=0,c=0,u,h=0,f=1,d=1,m=null,x=Ah,v=null,g,p,_,y=Rh,M=.5,w,A,C,N,z;function I(R){return C(R[0]*ut,R[1]*ut)}function b(R){return R=C.invert(R[0],R[1]),R&&[R[0]*Ft,R[1]*Ft]}I.stream=function(R){return N&&z===R?N:N=tv(nv(u)(x(w(y(z=R)))))},I.preclip=function(R){return arguments.length?(x=R,m=void 0,B()):x},I.postclip=function(R){return arguments.length?(y=R,v=g=p=_=null,B()):y},I.clipAngle=function(R){return arguments.length?(x=+R?ky(m=R*ut):(m=null,Ah),B()):m*Ft},I.clipExtent=function(R){return arguments.length?(y=R==null?(v=g=p=_=null,Rh):qy(v=+R[0][0],g=+R[0][1],p=+R[1][0],_=+R[1][1]),B()):v==null?null:[[v,g],[p,_]]},I.scale=function(R){return arguments.length?(t=+R,T()):t},I.translate=function(R){return arguments.length?(n=+R[0],i=+R[1],T()):[n,i]},I.center=function(R){return arguments.length?(s=R[0]%360*ut,o=R[1]%360*ut,T()):[s*Ft,o*Ft]},I.rotate=function(R){return arguments.length?(a=R[0]%360*ut,l=R[1]%360*ut,c=R.length>2?R[2]%360*ut:0,T()):[a*Ft,l*Ft,c*Ft]},I.angle=function(R){return arguments.length?(h=R%360*ut,T()):h*Ft},I.reflectX=function(R){return arguments.length?(f=R?-1:1,T()):f<0},I.reflectY=function(R){return arguments.length?(d=R?-1:1,T()):d<0},I.precision=function(R){return arguments.length?(w=Nh(A,M=R*R),B()):go(M)},I.fitExtent=function(R,F){return Bh(I,R,F)},I.fitSize=function(R,F){return Zy(I,R,F)},I.fitWidth=function(R,F){return $y(I,R,F)},I.fitHeight=function(R,F){return jy(I,R,F)};function T(){var R=Uh(t,0,0,f,d,h).apply(null,e(s,o)),F=Uh(t,n-R[0],i-R[1],f,d,h);return u=yh(a,l,c),A=ol(e,F),C=ol(u,A),w=Nh(A,M),B()}function B(){return N=z=null,I}return function(){return e=r.apply(this,arguments),I.invert=e.invert&&b,T()}}function gl(r,e){return[r,Py(Dy((Rt+e)/2))]}gl.invert=function(r,e){return[r,2*xh(Ry(e))-Rt]};function ov(){return av(gl).scale(961/Ht)}function av(r){var e=rv(r),t=e.center,n=e.scale,i=e.translate,s=e.clipExtent,o=null,a,l,c;e.scale=function(h){return arguments.length?(n(h),u()):n()},e.translate=function(h){return arguments.length?(i(h),u()):i()},e.center=function(h){return arguments.length?(t(h),u()):t()},e.clipExtent=function(h){return arguments.length?(h==null?o=a=l=c=null:(o=+h[0][0],a=+h[0][1],l=+h[1][0],c=+h[1][1]),u()):o==null?null:[[o,a],[l,c]]};function u(){var h=Ne*n(),f=e(By(e.rotate()).invert([0,0]));return s(o==null?[[f[0]-h,f[1]-h],[f[0]+h,f[1]+h]]:r===gl?[[Math.max(f[0]-h,o),a],[Math.min(f[0]+h,l),c]]:[[o,Math.max(f[1]-h,a)],[l,Math.min(f[1]+h,c)]])}return u()}var lv=function(r){return ov().center(r.center).scale(r.scale).translate([0,0]).precision(.1)},cv=function(r,e){return e.map(function(t){var n=mh(t,2),i=n[0],s=n[1],o=mh(r([i,s]),2),a=o[0],l=o[1];return new S(a,-l,0)})};self.onmessage=function(r){var e=r.data,t=e.req,n=t.coordinatesArr,i=t.projection,s=e.uuid,o=lv({center:i.center,scale:i.scale}),a=n.map(function(h){return cv(o,h)}),l=xy(a.map(function(h){return Ey({nodes:h})}),!1),c={},u=[];nr(Object.keys(l.attributes)).concat(["index"]).forEach(function(h){var f=h==="index"?l.index:l.attributes[h];c[h]={array:f.array,itemSize:f.itemSize},u.push(f.array.buffer)}),self.postMessage({res:c,uuid:s},u),l.dispose()},module.exports=Lt})();
|
|
3177
|
+
`),xn=function(r){"use strict";fh(t,r);var e=ph(t);function t(){hh(this,t);var n;return n=e.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new pe,Object.defineProperties(nl(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(s){this.setGeometry(s,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(s){this.setPoints(s,this.widthCallback)}}}),n}return t}(ve);xn.prototype.setMatrixWorld=function(r){this.matrixWorld=r},xn.prototype.setGeometry=function(r,e){this._geometry=r,this.setPoints(r.getAttribute("position").array,e)},xn.prototype.setPoints=function(r,e){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=e,this.positions=[],this.counters=[],r.length&&r[0]instanceof S)for(var t=0;t<r.length;t++){var n=r[t],i=t/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var t=0;t<r.length;t+=3){var i=t/r.length;this.positions.push(r[t],r[t+1],r[t+2]),this.positions.push(r[t],r[t+1],r[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function Sy(r,e){var t=new pe,n=new Tn,i=new wn,s=new S,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,s)!==!1){t.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(t);var a=new S,l=new S,c=new S,u=this instanceof fn?2:1,h=o.index,f=o.attributes;if(h!==null)for(var d=h.array,p=f.position.array,x=f.width.array,v=0,g=d.length-1;v<g;v+=u){var m=d[v],_=d[v+1];a.fromArray(p,m*3),l.fromArray(p,_*3);var y=x[Math.floor(v/3)]!==void 0?x[Math.floor(v/3)]:1,M=r.params.Line.threshold+this.material.lineWidth*y/2,w=M*M,A=n.distanceSqToSegment(a,l,s,c);if(!(A>w)){s.applyMatrix4(this.matrixWorld);var C=r.ray.origin.distanceTo(s);C<r.near||C>r.far||(e.push({distance:C,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=g)}}}}xn.prototype.raycast=Sy,xn.prototype.compareV3=function(r,e){var t=r*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]},xn.prototype.copyV3=function(r){var e=r*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]},xn.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e,t;this.compareV3(0,r-1)?t=this.copyV3(r-2):t=this.copyV3(0),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(var n=0;n<r;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?e=this.widthCallback(n/(r-1)):e=1,this.width.push(e),this.width.push(e),this.uvs.push(n/(r-1),0),this.uvs.push(n/(r-1),1),n<r-1){t=this.copyV3(n),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);var i=n*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}n>0&&(t=this.copyV3(n),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]))}this.compareV3(r-1,0)?t=this.copyV3(1):t=this.copyV3(r-1),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new ze(new Float32Array(this.positions),3),previous:new ze(new Float32Array(this.previous),3),next:new ze(new Float32Array(this.next),3),side:new ze(new Float32Array(this.side),1),width:new ze(new Float32Array(this.width),1),uv:new ze(new Float32Array(this.uvs),2),index:new ze(new Uint16Array(this.indices_array),1),counters:new ze(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function sl(r,e,t,n,i){var s;if(r=r.subarray||r.slice?r:r.buffer,t=t.subarray||t.slice?t:t.buffer,r=e?r.subarray?r.subarray(e,i&&e+i):r.slice(e,i&&e+i):r,t.set)t.set(r,n);else for(s=0;s<r.length;s++)t[s+n]=r[s];return t}xn.prototype.advance=function(r){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,i=e.length;sl(e,0,t,0,i),sl(e,6,e,0,i-6),e[i-6]=r.x,e[i-5]=r.y,e[i-4]=r.z,e[i-3]=r.x,e[i-2]=r.y,e[i-1]=r.z,sl(e,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},Me.meshline_vert=by,Me.meshline_frag=wy;var Ty=function(r){"use strict";fh(t,r);var e=ph(t);function t(n){hh(this,t);var i;return i=e.call(this,{uniforms:Object.assign({},oe.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new le(16777215)},opacity:{value:1},resolution:{value:new q(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new q(1,1)},offset:{value:new q(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new q(0,0)},lightColor:{value:new le(16777215)}}),vertexShader:Me.meshline_vert,fragmentShader:Me.meshline_frag}),i.isMeshLineMaterial=!0,i.type="MeshLineMaterial",Object.defineProperties(nl(i),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),i.setValues(n),i}return t}(Yt);Ty.prototype.copy=function(r){return Yt.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};function Ey(r){var e=r.setPointWidth,t=r.nodes,n=new ve,i=new xn;return n.setFromPoints(t),i.setGeometry(n,e),i}function Ay(r){if(Array.isArray(r))return r}function Ly(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function mh(r,e){return Ay(r)||tr(r,e)||Gr(r,e)||Ly()}var Je=1e-6,Cy=1e-12,Ne=Math.PI,Rt=Ne/2,gh=Ne/4,Ht=Ne*2,Ft=180/Ne,ut=Ne/180,st=Math.abs,xh=Math.atan,Br=Math.atan2,ot=Math.cos,GM=Math.ceil,Ry=Math.exp,VM=Math.floor,kM=Math.hypot,Py=Math.log,WM=Math.pow,et=Math.sin,Iy=Math.sign||function(r){return r>0?1:r<0?-1:0},go=Math.sqrt,Dy=Math.tan;function Fy(r){return r>1?0:r<-1?Ne:Math.acos(r)}function zr(r){return r>1?Rt:r<-1?-Rt:Math.asin(r)}function qM(r){return(r=et(r/2))*r}function ol(r,e){function t(n,i){return n=r(n,i),e(n[0],n[1])}return r.invert&&e.invert&&(t.invert=function(n,i){return n=e.invert(n,i),n&&r.invert(n[0],n[1])}),t}function al(r,e){return[st(r)>Ne?r+Math.round(-r/Ht)*Ht:r,e]}al.invert=al;function yh(r,e,t){return(r%=Ht)?e||t?ol(_h(r),Mh(e,t)):_h(r):e||t?Mh(e,t):al}function vh(r){return function(e,t){return e+=r,[e>Ne?e-Ht:e<-Ne?e+Ht:e,t]}}function _h(r){var e=vh(r);return e.invert=vh(-r),e}function Mh(r,e){var t=ot(r),n=et(r),i=ot(e),s=et(e);function o(a,l){var c=ot(l),u=ot(a)*c,h=et(a)*c,f=et(l),d=f*t+u*n;return[Br(h*i-d*s,u*t-f*n),zr(d*i+h*s)]}return o.invert=function(a,l){var c=ot(l),u=ot(a)*c,h=et(a)*c,f=et(l),d=f*i-h*s;return[Br(h*i+f*s,u*t+d*n),zr(d*t-u*n)]},o}function By(r){r=yh(r[0]*ut,r[1]*ut,r.length>2?r[2]*ut:0);function e(t){return t=r(t[0]*ut,t[1]*ut),t[0]*=Ft,t[1]*=Ft,t}return e.invert=function(t){return t=r.invert(t[0]*ut,t[1]*ut),t[0]*=Ft,t[1]*=Ft,t},e}function Nr(){}function bh(){var r=[],e;return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){r.push(e=[])},lineEnd:Nr,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var t=r;return r=[],e=null,t}}}function xo(r,e){return st(r[0]-e[0])<Je&&st(r[1]-e[1])<Je}function yo(r,e,t,n){this.x=r,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function wh(r,e,t,n,i){var s=[],o=[],a,l;if(r.forEach(function(p){if(!((x=p.length-1)<=0)){var x,v=p[0],g=p[x],m;if(xo(v,g)){if(!v[2]&&!g[2]){for(i.lineStart(),a=0;a<x;++a)i.point((v=p[a])[0],v[1]);i.lineEnd();return}g[0]+=2*Je}s.push(m=new yo(v,p,null,!0)),o.push(m.o=new yo(v,null,m,!1)),s.push(m=new yo(g,p,null,!1)),o.push(m.o=new yo(g,null,m,!0))}}),!!s.length){for(o.sort(e),Sh(s),Sh(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,h;;){for(var f=c,d=!0;f.v;)if((f=f.n)===c)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(a=0,l=u.length;a<l;++a)i.point((h=u[a])[0],h[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(d)for(u=f.p.z,a=u.length-1;a>=0;--a)i.point((h=u[a])[0],h[1]);else n(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,d=!d}while(!f.v);i.lineEnd()}}}function Sh(r){if(!!(e=r.length)){for(var e,t=0,n=r[0],i;++t<e;)n.n=i=r[t],i.p=n,n=i;n.n=i=r[0],i.p=n}}class ll{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const s=t[i],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t=this._n,n,i,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,i=e[--t],o=n+i,s=i-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(i=s*2,n=o+i,i==n-o&&(o=n))}return o}}function XM(r,e){const t=new ll;if(e===void 0)for(let n of r)(n=+n)&&t.add(n);else{let n=-1;for(let i of r)(i=+e(i,++n,r))&&t.add(i)}return+t}function YM(r,e){const t=new ll;let n=-1;return Float64Array.from(r,e===void 0?i=>t.add(+i||0):i=>t.add(+e(i,++n,r)||0))}function cl(r){return[Br(r[1],r[0]),zr(r[2])]}function ji(r){var e=r[0],t=r[1],n=ot(t);return[n*ot(e),n*et(e),et(t)]}function vo(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function _o(r,e){return[r[1]*e[2]-r[2]*e[1],r[2]*e[0]-r[0]*e[2],r[0]*e[1]-r[1]*e[0]]}function ul(r,e){r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}function Mo(r,e){return[r[0]*e,r[1]*e,r[2]*e]}function hl(r){var e=go(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=e,r[1]/=e,r[2]/=e}function fl(r){return st(r[0])<=Ne?r[0]:Iy(r[0])*((st(r[0])+Ne)%Ht-Ne)}function zy(r,e){var t=fl(e),n=e[1],i=et(n),s=[et(t),-ot(t),0],o=0,a=0,l=new ll;i===1?n=Rt+Je:i===-1&&(n=-Rt-Je);for(var c=0,u=r.length;c<u;++c)if(!!(f=(h=r[c]).length))for(var h,f,d=h[f-1],p=fl(d),x=d[1]/2+gh,v=et(x),g=ot(x),m=0;m<f;++m,p=y,v=w,g=A,d=_){var _=h[m],y=fl(_),M=_[1]/2+gh,w=et(M),A=ot(M),C=y-p,N=C>=0?1:-1,z=N*C,I=z>Ne,b=v*w;if(l.add(Br(b*N*et(z),g*A+b*ot(z))),o+=I?C+N*Ht:C,I^p>=t^y>=t){var T=_o(ji(d),ji(_));hl(T);var B=_o(s,T);hl(B);var R=(I^C>=0?-1:1)*zr(B[2]);(n>R||n===R&&(T[0]||T[1]))&&(a+=I^C>=0?1:-1)}}return(o<-Je||o<Je&&l<-Cy)^a&1}function*Ny(r){for(const e of r)yield*e}function Th(r){return Array.from(Ny(r))}function Eh(r,e,t,n){return function(i){var s=e(i),o=bh(),a=e(o),l=!1,c,u,h,f={point:d,lineStart:x,lineEnd:v,polygonStart:function(){f.point=g,f.lineStart=m,f.lineEnd=_,u=[],c=[]},polygonEnd:function(){f.point=d,f.lineStart=x,f.lineEnd=v,u=Th(u);var y=zy(c,n);u.length?(l||(i.polygonStart(),l=!0),wh(u,Oy,y,t,i)):y&&(l||(i.polygonStart(),l=!0),i.lineStart(),t(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),u=c=null},sphere:function(){i.polygonStart(),i.lineStart(),t(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(y,M){r(y,M)&&i.point(y,M)}function p(y,M){s.point(y,M)}function x(){f.point=p,s.lineStart()}function v(){f.point=d,s.lineEnd()}function g(y,M){h.push([y,M]),a.point(y,M)}function m(){a.lineStart(),h=[]}function _(){g(h[0][0],h[0][1]),a.lineEnd();var y=a.clean(),M=o.result(),w,A=M.length,C,N,z;if(h.pop(),c.push(h),h=null,!!A){if(y&1){if(N=M[0],(C=N.length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),w=0;w<C;++w)i.point((z=N[w])[0],z[1]);i.lineEnd()}return}A>1&&y&2&&M.push(M.pop().concat(M.shift())),u.push(M.filter(Uy))}}return f}}function Uy(r){return r.length>1}function Oy(r,e){return((r=r.x)[0]<0?r[1]-Rt-Je:Rt-r[1])-((e=e.x)[0]<0?e[1]-Rt-Je:Rt-e[1])}var Ah=Eh(function(){return!0},Hy,Vy,[-Ne,-Rt]);function Hy(r){var e=NaN,t=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(s,o){var a=s>0?Ne:-Ne,l=st(s-e);st(l-Ne)<Je?(r.point(e,t=(t+o)/2>0?Rt:-Rt),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),r.point(s,t),i=0):n!==a&&l>=Ne&&(st(e-n)<Je&&(e-=n*Je),st(s-a)<Je&&(s-=a*Je),t=Gy(e,t,s,o),r.point(n,t),r.lineEnd(),r.lineStart(),r.point(a,t),i=0),r.point(e=s,t=o),n=a},lineEnd:function(){r.lineEnd(),e=t=NaN},clean:function(){return 2-i}}}function Gy(r,e,t,n){var i,s,o=et(r-t);return st(o)>Je?xh((et(e)*(s=ot(n))*et(t)-et(n)*(i=ot(e))*et(r))/(i*s*o)):(e+n)/2}function Vy(r,e,t,n){var i;if(r==null)i=t*Rt,n.point(-Ne,i),n.point(0,i),n.point(Ne,i),n.point(Ne,0),n.point(Ne,-i),n.point(0,-i),n.point(-Ne,-i),n.point(-Ne,0),n.point(-Ne,i);else if(st(r[0]-e[0])>Je){var s=r[0]<e[0]?Ne:-Ne;i=t*s/2,n.point(-s,i),n.point(0,i),n.point(s,i)}else n.point(e[0],e[1])}function Lh(r,e,t,n,i,s){if(!!t){var o=ot(e),a=et(e),l=n*t;i==null?(i=e+n*Ht,s=e-l/2):(i=Ch(o,i),s=Ch(o,s),(n>0?i<s:i>s)&&(i+=n*Ht));for(var c,u=i;n>0?u>s:u<s;u-=l)c=cl([o,-a*ot(u),-a*et(u)]),r.point(c[0],c[1])}}function Ch(r,e){e=ji(e),e[0]-=r,hl(e);var t=Fy(-e[1]);return((-e[2]<0?-t:t)+Ht-Je)%Ht}function JM(){var r=constant([0,0]),e=constant(90),t=constant(6),n,i,s={point:o};function o(l,c){n.push(l=i(l,c)),l[0]*=degrees,l[1]*=degrees}function a(){var l=r.apply(this,arguments),c=e.apply(this,arguments)*radians,u=t.apply(this,arguments)*radians;return n=[],i=rotateRadians(-l[0]*radians,-l[1]*radians,0).invert,Lh(s,c,u,1),l={type:"Polygon",coordinates:[n]},n=i=null,l}return a.center=function(l){return arguments.length?(r=typeof l=="function"?l:constant([+l[0],+l[1]]),a):r},a.radius=function(l){return arguments.length?(e=typeof l=="function"?l:constant(+l),a):e},a.precision=function(l){return arguments.length?(t=typeof l=="function"?l:constant(+l),a):t},a}function ky(r){var e=ot(r),t=6*ut,n=e>0,i=st(e)>Je;function s(u,h,f,d){Lh(d,r,t,f,u,h)}function o(u,h){return ot(u)*ot(h)>e}function a(u){var h,f,d,p,x;return{lineStart:function(){p=d=!1,x=1},point:function(v,g){var m=[v,g],_,y=o(v,g),M=n?y?0:c(v,g):y?c(v+(v<0?Ne:-Ne),g):0;if(!h&&(p=d=y)&&u.lineStart(),y!==d&&(_=l(h,m),(!_||xo(h,_)||xo(m,_))&&(m[2]=1)),y!==d)x=0,y?(u.lineStart(),_=l(m,h),u.point(_[0],_[1])):(_=l(h,m),u.point(_[0],_[1],2),u.lineEnd()),h=_;else if(i&&h&&n^y){var w;!(M&f)&&(w=l(m,h,!0))&&(x=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}y&&(!h||!xo(h,m))&&u.point(m[0],m[1]),h=m,d=y,f=M},lineEnd:function(){d&&u.lineEnd(),h=null},clean:function(){return x|(p&&d)<<1}}}function l(u,h,f){var d=ji(u),p=ji(h),x=[1,0,0],v=_o(d,p),g=vo(v,v),m=v[0],_=g-m*m;if(!_)return!f&&u;var y=e*g/_,M=-e*m/_,w=_o(x,v),A=Mo(x,y),C=Mo(v,M);ul(A,C);var N=w,z=vo(A,N),I=vo(N,N),b=z*z-I*(vo(A,A)-1);if(!(b<0)){var T=go(b),B=Mo(N,(-z-T)/I);if(ul(B,A),B=cl(B),!f)return B;var R=u[0],F=h[0],U=u[1],Z=h[1],ee;F<R&&(ee=R,R=F,F=ee);var V=F-R,W=st(V-Ne)<Je,ne=W||V<Je;if(!W&&Z<U&&(ee=U,U=Z,Z=ee),ne?W?U+Z>0^B[1]<(st(B[0]-R)<Je?U:Z):U<=B[1]&&B[1]<=Z:V>Ne^(R<=B[0]&&B[0]<=F)){var K=Mo(N,(-z+T)/I);return ul(K,A),[B,cl(K)]}}}function c(u,h){var f=n?r:Ne-r,d=0;return u<-f?d|=1:u>f&&(d|=2),h<-f?d|=4:h>f&&(d|=8),d}return Eh(o,a,s,n?[0,-r]:[-Ne,r-Ne])}function Wy(r,e,t,n,i,s){var o=r[0],a=r[1],l=e[0],c=e[1],u=0,h=1,f=l-o,d=c-a,p;if(p=t-o,!(!f&&p>0)){if(p/=f,f<0){if(p<u)return;p<h&&(h=p)}else if(f>0){if(p>h)return;p>u&&(u=p)}if(p=i-o,!(!f&&p<0)){if(p/=f,f<0){if(p>h)return;p>u&&(u=p)}else if(f>0){if(p<u)return;p<h&&(h=p)}if(p=n-a,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<h&&(h=p)}else if(d>0){if(p>h)return;p>u&&(u=p)}if(p=s-a,!(!d&&p<0)){if(p/=d,d<0){if(p>h)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<h&&(h=p)}return u>0&&(r[0]=o+u*f,r[1]=a+u*d),h<1&&(e[0]=o+h*f,e[1]=a+h*d),!0}}}}}var Ur=1e9,bo=-Ur;function qy(r,e,t,n){function i(c,u){return r<=c&&c<=t&&e<=u&&u<=n}function s(c,u,h,f){var d=0,p=0;if(c==null||(d=o(c,h))!==(p=o(u,h))||l(c,u)<0^h>0)do f.point(d===0||d===3?r:t,d>1?n:e);while((d=(d+h+4)%4)!==p);else f.point(u[0],u[1])}function o(c,u){return st(c[0]-r)<Je?u>0?0:3:st(c[0]-t)<Je?u>0?2:1:st(c[1]-e)<Je?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var h=o(c,1),f=o(u,1);return h!==f?h-f:h===0?u[1]-c[1]:h===1?c[0]-u[0]:h===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,h=bh(),f,d,p,x,v,g,m,_,y,M,w,A={point:C,lineStart:b,lineEnd:T,polygonStart:z,polygonEnd:I};function C(R,F){i(R,F)&&u.point(R,F)}function N(){for(var R=0,F=0,U=d.length;F<U;++F)for(var Z=d[F],ee=1,V=Z.length,W=Z[0],ne,K,he=W[0],be=W[1];ee<V;++ee)ne=he,K=be,W=Z[ee],he=W[0],be=W[1],K<=n?be>n&&(he-ne)*(n-K)>(be-K)*(r-ne)&&++R:be<=n&&(he-ne)*(n-K)<(be-K)*(r-ne)&&--R;return R}function z(){u=h,f=[],d=[],w=!0}function I(){var R=N(),F=w&&R,U=(f=Th(f)).length;(F||U)&&(c.polygonStart(),F&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),U&&wh(f,a,R,s,c),c.polygonEnd()),u=c,f=d=p=null}function b(){A.point=B,d&&d.push(p=[]),M=!0,y=!1,m=_=NaN}function T(){f&&(B(x,v),g&&y&&h.rejoin(),f.push(h.result())),A.point=C,y&&u.lineEnd()}function B(R,F){var U=i(R,F);if(d&&p.push([R,F]),M)x=R,v=F,g=U,M=!1,U&&(u.lineStart(),u.point(R,F));else if(U&&y)u.point(R,F);else{var Z=[m=Math.max(bo,Math.min(Ur,m)),_=Math.max(bo,Math.min(Ur,_))],ee=[R=Math.max(bo,Math.min(Ur,R)),F=Math.max(bo,Math.min(Ur,F))];Wy(Z,ee,r,e,t,n)?(y||(u.lineStart(),u.point(Z[0],Z[1])),u.point(ee[0],ee[1]),U||u.lineEnd(),w=!1):U&&(u.lineStart(),u.point(R,F),w=!1)}m=R,_=F,y=U}return A}}var Rh=r=>r;function ZM(r){return{stream:wo(r)}}function wo(r){return function(e){var t=new dl;for(var n in r)t[n]=r[n];return t.stream=e,t}}function dl(){}dl.prototype={constructor:dl,point:function(r,e){this.stream.point(r,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function So(r,e){r&&Ih.hasOwnProperty(r.type)&&Ih[r.type](r,e)}var Ph={Feature:function(r,e){So(r.geometry,e)},FeatureCollection:function(r,e){for(var t=r.features,n=-1,i=t.length;++n<i;)So(t[n].geometry,e)}},Ih={Sphere:function(r,e){e.sphere()},Point:function(r,e){r=r.coordinates,e.point(r[0],r[1],r[2])},MultiPoint:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)r=t[n],e.point(r[0],r[1],r[2])},LineString:function(r,e){pl(r.coordinates,e,0)},MultiLineString:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)pl(t[n],e,0)},Polygon:function(r,e){Dh(r.coordinates,e)},MultiPolygon:function(r,e){for(var t=r.coordinates,n=-1,i=t.length;++n<i;)Dh(t[n],e)},GeometryCollection:function(r,e){for(var t=r.geometries,n=-1,i=t.length;++n<i;)So(t[n],e)}};function pl(r,e,t){var n=-1,i=r.length-t,s;for(e.lineStart();++n<i;)s=r[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function Dh(r,e){var t=-1,n=r.length;for(e.polygonStart();++t<n;)pl(r[t],e,1);e.polygonEnd()}function Xy(r,e){r&&Ph.hasOwnProperty(r.type)?Ph[r.type](r,e):So(r,e)}var Qi=1/0,To=Qi,Or=-Qi,Eo=Or,Yy={point:Jy,lineStart:Nr,lineEnd:Nr,polygonStart:Nr,polygonEnd:Nr,result:function(){var r=[[Qi,To],[Or,Eo]];return Or=Eo=-(To=Qi=1/0),r}};function Jy(r,e){r<Qi&&(Qi=r),r>Or&&(Or=r),e<To&&(To=e),e>Eo&&(Eo=e)}var Fh=Yy;function ml(r,e,t){var n=r.clipExtent&&r.clipExtent();return r.scale(150).translate([0,0]),n!=null&&r.clipExtent(null),Xy(t,r.stream(Fh)),e(Fh.result()),n!=null&&r.clipExtent(n),r}function Bh(r,e,t){return ml(r,function(n){var i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(i/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(i-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;r.scale(150*o).translate([a,l])},t)}function Zy(r,e,t){return Bh(r,[[0,0],e],t)}function $y(r,e,t){return ml(r,function(n){var i=+e,s=i/(n[1][0]-n[0][0]),o=(i-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];r.scale(150*s).translate([o,a])},t)}function jy(r,e,t){return ml(r,function(n){var i=+e,s=i/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(i-s*(n[1][1]+n[0][1]))/2;r.scale(150*s).translate([o,a])},t)}var zh=16,Qy=ot(30*ut);function Nh(r,e){return+e?ev(r,e):Ky(r)}function Ky(r){return wo({point:function(e,t){e=r(e,t),this.stream.point(e[0],e[1])}})}function ev(r,e){function t(n,i,s,o,a,l,c,u,h,f,d,p,x,v){var g=c-n,m=u-i,_=g*g+m*m;if(_>4*e&&x--){var y=o+f,M=a+d,w=l+p,A=go(y*y+M*M+w*w),C=zr(w/=A),N=st(st(w)-1)<Je||st(s-h)<Je?(s+h)/2:Br(M,y),z=r(N,C),I=z[0],b=z[1],T=I-n,B=b-i,R=m*T-g*B;(R*R/_>e||st((g*T+m*B)/_-.5)>.3||o*f+a*d+l*p<Qy)&&(t(n,i,s,o,a,l,I,b,N,y/=A,M/=A,w,x,v),v.point(I,b),t(I,b,N,y,M,w,c,u,h,f,d,p,x,v))}}return function(n){var i,s,o,a,l,c,u,h,f,d,p,x,v={point:g,lineStart:m,lineEnd:y,polygonStart:function(){n.polygonStart(),v.lineStart=M},polygonEnd:function(){n.polygonEnd(),v.lineStart=m}};function g(C,N){C=r(C,N),n.point(C[0],C[1])}function m(){h=NaN,v.point=_,n.lineStart()}function _(C,N){var z=ji([C,N]),I=r(C,N);t(h,f,u,d,p,x,h=I[0],f=I[1],u=C,d=z[0],p=z[1],x=z[2],zh,n),n.point(h,f)}function y(){v.point=g,n.lineEnd()}function M(){m(),v.point=w,v.lineEnd=A}function w(C,N){_(i=C,N),s=h,o=f,a=d,l=p,c=x,v.point=_}function A(){t(h,f,u,d,p,x,s,o,i,a,l,c,zh,n),v.lineEnd=y,y()}return v}}var tv=wo({point:function(r,e){this.stream.point(r*ut,e*ut)}});function nv(r){return wo({point:function(e,t){var n=r(e,t);return this.stream.point(n[0],n[1])}})}function iv(r,e,t,n,i){function s(o,a){return o*=n,a*=i,[e+r*o,t-r*a]}return s.invert=function(o,a){return[(o-e)/r*n,(t-a)/r*i]},s}function Uh(r,e,t,n,i,s){if(!s)return iv(r,e,t,n,i);var o=ot(s),a=et(s),l=o*r,c=a*r,u=o/r,h=a/r,f=(a*t-o*e)/r,d=(a*e+o*t)/r;function p(x,v){return x*=n,v*=i,[l*x-c*v+e,t-c*x-l*v]}return p.invert=function(x,v){return[n*(u*x-h*v+f),i*(d-h*x-u*v)]},p}function rv(r){return sv(function(){return r})()}function sv(r){var e,t=150,n=480,i=250,s=0,o=0,a=0,l=0,c=0,u,h=0,f=1,d=1,p=null,x=Ah,v=null,g,m,_,y=Rh,M=.5,w,A,C,N,z;function I(R){return C(R[0]*ut,R[1]*ut)}function b(R){return R=C.invert(R[0],R[1]),R&&[R[0]*Ft,R[1]*Ft]}I.stream=function(R){return N&&z===R?N:N=tv(nv(u)(x(w(y(z=R)))))},I.preclip=function(R){return arguments.length?(x=R,p=void 0,B()):x},I.postclip=function(R){return arguments.length?(y=R,v=g=m=_=null,B()):y},I.clipAngle=function(R){return arguments.length?(x=+R?ky(p=R*ut):(p=null,Ah),B()):p*Ft},I.clipExtent=function(R){return arguments.length?(y=R==null?(v=g=m=_=null,Rh):qy(v=+R[0][0],g=+R[0][1],m=+R[1][0],_=+R[1][1]),B()):v==null?null:[[v,g],[m,_]]},I.scale=function(R){return arguments.length?(t=+R,T()):t},I.translate=function(R){return arguments.length?(n=+R[0],i=+R[1],T()):[n,i]},I.center=function(R){return arguments.length?(s=R[0]%360*ut,o=R[1]%360*ut,T()):[s*Ft,o*Ft]},I.rotate=function(R){return arguments.length?(a=R[0]%360*ut,l=R[1]%360*ut,c=R.length>2?R[2]%360*ut:0,T()):[a*Ft,l*Ft,c*Ft]},I.angle=function(R){return arguments.length?(h=R%360*ut,T()):h*Ft},I.reflectX=function(R){return arguments.length?(f=R?-1:1,T()):f<0},I.reflectY=function(R){return arguments.length?(d=R?-1:1,T()):d<0},I.precision=function(R){return arguments.length?(w=Nh(A,M=R*R),B()):go(M)},I.fitExtent=function(R,F){return Bh(I,R,F)},I.fitSize=function(R,F){return Zy(I,R,F)},I.fitWidth=function(R,F){return $y(I,R,F)},I.fitHeight=function(R,F){return jy(I,R,F)};function T(){var R=Uh(t,0,0,f,d,h).apply(null,e(s,o)),F=Uh(t,n-R[0],i-R[1],f,d,h);return u=yh(a,l,c),A=ol(e,F),C=ol(u,A),w=Nh(A,M),B()}function B(){return N=z=null,I}return function(){return e=r.apply(this,arguments),I.invert=e.invert&&b,T()}}function gl(r,e){return[r,Py(Dy((Rt+e)/2))]}gl.invert=function(r,e){return[r,2*xh(Ry(e))-Rt]};function ov(){return av(gl).scale(961/Ht)}function av(r){var e=rv(r),t=e.center,n=e.scale,i=e.translate,s=e.clipExtent,o=null,a,l,c;e.scale=function(h){return arguments.length?(n(h),u()):n()},e.translate=function(h){return arguments.length?(i(h),u()):i()},e.center=function(h){return arguments.length?(t(h),u()):t()},e.clipExtent=function(h){return arguments.length?(h==null?o=a=l=c=null:(o=+h[0][0],a=+h[0][1],l=+h[1][0],c=+h[1][1]),u()):o==null?null:[[o,a],[l,c]]};function u(){var h=Ne*n(),f=e(By(e.rotate()).invert([0,0]));return s(o==null?[[f[0]-h,f[1]-h],[f[0]+h,f[1]+h]]:r===gl?[[Math.max(f[0]-h,o),a],[Math.min(f[0]+h,l),c]]:[[o,Math.max(f[1]-h,a)],[l,Math.min(f[1]+h,c)]])}return u()}var lv=function(r){return ov().center(r.center).scale(r.scale).translate([0,0]).precision(.1)},cv=function(r,e){return e.map(function(t){var n=mh(t,2),i=n[0],s=n[1],o=mh(r([i,s]),2),a=o[0],l=o[1];return new S(a,-l,0)})};self.onmessage=function(r){var e=r.data,t=e.req,n=t.coordinatesArr,i=t.projection,s=t.lineWidth,o=e.uuid,a=lv({center:i.center,scale:i.scale}),l=n.map(function(f){return cv(a,f)}),c=xy(l.map(function(f,d){var p,x=(p=s[d])!==null&&p!==void 0?p:s[0];return Ey({nodes:f,setPointWidth:function(){return x}})}),!1),u={},h=[];nr(Object.keys(c.attributes)).concat(["index"]).forEach(function(f){var d=f==="index"?c.index:c.attributes[f];u[f]={array:d.array,itemSize:d.itemSize},h.push(d.array.buffer)}),self.postMessage({res:u,uuid:o},h),c.dispose()}})();
|