parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c>8&255]+In[t>>16&255]+In[t>>24&255]+"-"+In[255&e]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[63&n|128]+In[n>>8&255]+"-"+In[n>>16&255]+In[n>>24&255]+In[255&i]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(On=t%2147483647),((On=16807*On%2147483647)-1)/2147483646},degToRad:function(t){return t*Bn.DEG2RAD},radToDeg:function(t){return t*Bn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,i,r){const o=Math.cos,s=Math.sin,a=o(n/2),c=s(n/2),l=o((e+i)/2),h=s((e+i)/2),u=o((e-i)/2),p=s((e-i)/2),d=o((i-e)/2),f=s((i-e)/2);switch(r){case"XYX":t.set(a*h,c*u,c*p,a*l);break;case"YZY":t.set(c*p,a*h,c*u,a*l);break;case"ZXZ":t.set(c*u,c*p,a*h,a*l);break;case"XZX":t.set(a*h,c*f,c*d,a*l);break;case"YXY":t.set(c*d,a*h,c*f,a*l);break;case"ZYZ":t.set(c*f,c*d,a*h,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};exports.MathUtils=exports.Math=Bn;class Fn{constructor(t=0,e=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=Fn;class Gn{constructor(){Object.defineProperty(this,"isMatrix3",{value:!0}),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(t,e,n,i,r,o,s,a,c){const l=this.elements;return l[0]=t,l[1]=i,l[2]=s,l[3]=e,l[4]=r,l[5]=a,l[6]=n,l[7]=o,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[3],a=n[6],c=n[1],l=n[4],h=n[7],u=n[2],p=n[5],d=n[8],f=i[0],m=i[3],g=i[6],x=i[1],v=i[4],y=i[7],_=i[2],b=i[5],w=i[8];return r[0]=o*f+s*x+a*_,r[3]=o*m+s*v+a*b,r[6]=o*g+s*y+a*w,r[1]=c*f+l*x+h*_,r[4]=c*m+l*v+h*b,r[7]=c*g+l*y+h*w,r[2]=u*f+p*x+d*_,r[5]=u*m+p*v+d*b,r[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],c=t[7],l=t[8];return e*o*l-e*s*c-n*r*l+n*s*a+i*r*c-i*o*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=l*o-s*c,u=s*a-l*r,p=c*r-o*a,d=e*h+n*u+i*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const f=1/d;return t[0]=h*f,t[1]=(i*c-l*n)*f,t[2]=(s*n-i*o)*f,t[3]=u*f,t[4]=(l*e-i*a)*f,t[5]=(i*r-s*e)*f,t[6]=p*f,t[7]=(n*a-c*e)*f,t[8]=(o*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).copy(this).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),c=Math.sin(r);this.set(n*a,n*c,-n*(a*o+c*s)+o+t,-i*c,i*a,-i*(-c*o+a*s)+s+e,0,0,1)}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],s=i[6],a=i[1],c=i[4],l=i[7];return i[0]=e*r+n*a,i[3]=e*o+n*c,i[6]=e*s+n*l,i[1]=-n*r+e*a,i[4]=-n*o+e*c,i[7]=-n*s+e*l,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}let Un;exports.Matrix3=Gn;const zn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Un&&(Un=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Un.width=t.width,Un.height=t.height;const n=Un.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Un}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=zn;let Hn=0;function kn(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=lt,i=lt,r=gt,o=yt,s=Ot,a=bt,c=1,l=Xe){Object.defineProperty(this,"id",{value:Hn++}),this.uuid=Bn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=c,this.format=s,this.internalFormat=null,this.type=a,this.offset=new Fn(0,0),this.repeat=new Fn(1,1),this.center=new Fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.version=0,this.onUpdate=null}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?zn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=300,kn.prototype=Object.assign(Object.create(Nn.prototype),{constructor:kn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.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(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=Bn.generateUUID()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t1)switch(this.wrapS){case ct:t.x=t.x-Math.floor(t.x);break;case lt:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ct:t.y=t.y-Math.floor(t.y);break;case lt:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(kn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});class Wn{constructor(t=0,e=0,n=0,i=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=t.elements,s=o[0],a=o[4],c=o[8],l=o[1],h=o[5],u=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(a-l)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+l)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(s+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(h+1)/2,m=(f+1)/2,g=(a+l)/4,x=(c+p)/4,v=(u+d)/4;return t>o&&t>m?t<.01?(n=0,i=.707106781,r=.707106781):(i=g/(n=Math.sqrt(t)),r=x/n):o>m?o<.01?(n=.707106781,i=0,r=.707106781):(n=g/(i=Math.sqrt(o)),r=v/i):m<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(m)),i=v/r),this.set(n,i,r,e),this}let m=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(l-a)*(l-a));return Math.abs(m)<.001&&(m=1),this.x=(d-u)/m,this.y=(c-p)/m,this.z=(l-a)/m,this.w=Math.acos((s+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}function jn(t,e,n){this.width=t,this.height=e,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function qn(t,e,n){jn.call(this,t,e,n),this.samples=4}exports.Vector4=Wn,jn.prototype=Object.assign(Object.create(Nn.prototype),{constructor:jn,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),qn.prototype=Object.assign(Object.create(jn.prototype),{constructor:qn,isWebGLMultisampleRenderTarget:!0,copy:function(t){return jn.prototype.copy.call(this,t),this.samples=t.samples,this}});class Xn{constructor(t=0,e=0,n=0,i=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return n.copy(t).slerp(e,i)}static slerpFlat(t,e,n,i,r,o,s){let a=n[i+0],c=n[i+1],l=n[i+2],h=n[i+3];const u=r[o+0],p=r[o+1],d=r[o+2],f=r[o+3];if(h!==f||a!==u||c!==p||l!==d){let t=1-s;const e=a*u+c*p+l*d+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*n;if(a=a*t+u*r,c=c*t+p*r,l=l*t+d*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+c*c+l*l+h*h);a*=t,c*=t,l*=t,h*=t}}t[e]=a,t[e+1]=c,t[e+2]=l,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],c=n[i+2],l=n[i+3],h=r[o],u=r[o+1],p=r[o+2],d=r[o+3];return t[e]=s*d+l*h+a*p-c*u,t[e+1]=a*d+l*u+c*h-s*p,t[e+2]=c*d+l*p+s*u-a*h,t[e+3]=l*d-s*h-a*u-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,c=s(n/2),l=s(i/2),h=s(r/2),u=a(n/2),p=a(i/2),d=a(r/2);switch(o){case"XYZ":this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d;break;case"YXZ":this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d;break;case"ZXY":this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d;break;case"ZYX":this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d;break;case"YZX":this._x=u*l*h+c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h-u*p*d;break;case"XZY":this._x=u*l*h-c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],c=e[2],l=e[6],h=e[10],u=n+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-c)*t,this._z=(o-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(l-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+c)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-c)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(o-i)/t,this._x=(r+c)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Bn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,c=e._z,l=e._w;return this._x=n*l+o*s+i*c-r*a,this._y=i*l+o*a+r*s-n*c,this._z=r*l+o*c+n*a-i*s,this._w=o*l-n*s-i*a-r*c,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(a),l=Math.atan2(c,s),h=Math.sin((1-e)*l)/c,u=Math.sin(e*l)/c;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn;class Yn{constructor(t=0,e=0,n=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,c=a*e+o*i-s*n,l=a*n+s*e-r*i,h=a*i+r*n-o*e,u=-r*e-o*n-s*i;return this.x=c*a+u*-r+l*-s-h*-o,this.y=l*a+u*-o+h*-r-c*-s,this.z=h*a+u*-s+c*-o-l*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Bn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t,e){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new Yn(1/0,1/0,1/0),this.max=void 0!==e?e:new Yn(-1/0,-1/0,-1/0)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,c=t.length;ar&&(r=c),l>o&&(o=l),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,c=t.count;ar&&(r=c),l>o&&(o=l),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,ti),ti.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ci),li.subVectors(this.max,ci),ni.subVectors(t.a,ci),ii.subVectors(t.b,ci),ri.subVectors(t.c,ci),oi.subVectors(ii,ni),si.subVectors(ri,ii),ai.subVectors(ni,ri);let e=[0,-oi.z,oi.y,0,-si.z,si.y,0,-ai.z,ai.y,oi.z,0,-oi.x,si.z,0,-si.x,ai.z,0,-ai.x,-oi.y,oi.x,0,-si.y,si.x,0,-ai.y,ai.x,0];return!!Kn(e,ni,ii,ri,li)&&(!!Kn(e=[1,0,0,0,1,0,0,0,1],ni,ii,ri,li)&&(hi.crossVectors(oi,si),Kn(e=[hi.x,hi.y,hi.z],ni,ii,ri,li)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return ti.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(ti).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:($n[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),$n[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),$n[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),$n[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),$n[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),$n[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),$n[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),$n[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints($n),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}function Kn(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){ui.fromArray(t,o);const s=r.x*Math.abs(ui.x)+r.y*Math.abs(ui.y)+r.z*Math.abs(ui.z),a=e.dot(ui),c=n.dot(ui),l=i.dot(ui);if(Math.max(-Math.max(a,c,l),Math.min(a,c,l))>s)return!1}return!0}exports.Box3=Qn;const $n=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],ti=new Yn,ei=new Qn,ni=new Yn,ii=new Yn,ri=new Yn,oi=new Yn,si=new Yn,ai=new Yn,ci=new Yn,li=new Yn,hi=new Yn,ui=new Yn,pi=new Qn;class di{constructor(t,e){this.center=void 0!==t?t:new Yn,this.radius=void 0!==e?e:-1}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pi.setFromPoints(t).getCenter(n);let i=0;for(let r=0,o=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}}exports.Sphere=di;const fi=new Yn,mi=new Yn,gi=new Yn,xi=new Yn,vi=new Yn,yi=new Yn,_i=new Yn;class bi{constructor(t,e){this.origin=void 0!==t?t:new Yn,this.direction=void 0!==e?e:new Yn(0,0,-1)}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,fi)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=fi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(fi.copy(this.direction).multiplyScalar(e).add(this.origin),fi.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){mi.copy(t).add(e).multiplyScalar(.5),gi.copy(e).sub(t).normalize(),xi.copy(this.origin).sub(mi);const r=.5*t.distanceTo(e),o=-this.direction.dot(gi),s=xi.dot(this.direction),a=-xi.dot(gi),c=xi.lengthSq(),l=Math.abs(1-o*o);let h,u,p,d;if(l>0)if(u=o*s-a,d=r*l,(h=o*a-s)>=0)if(u>=-d)if(u<=d){const t=1/l;p=(h*=t)*(h+o*(u*=t)+2*s)+u*(o*h+u+2*a)+c}else u=r,p=-(h=Math.max(0,-(o*u+s)))*h+u*(u+2*a)+c;else u=-r,p=-(h=Math.max(0,-(o*u+s)))*h+u*(u+2*a)+c;else u<=-d?p=-(h=Math.max(0,-(-o*r+s)))*h+(u=h>0?-r:Math.min(Math.max(-r,-a),r))*(u+2*a)+c:u<=d?(h=0,p=(u=Math.min(Math.max(-r,-a),r))*(u+2*a)+c):p=-(h=Math.max(0,-(o*r+s)))*h+(u=h>0?r:Math.min(Math.max(-r,-a),r))*(u+2*a)+c;else u=o>0?-r:r,p=-(h=Math.max(0,-(o*u+s)))*h+u*(u+2*a)+c;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(gi).multiplyScalar(u).add(mi),p}intersectSphere(t,e){fi.subVectors(t.center,this.origin);const n=fi.dot(this.direction),i=fi.dot(fi)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,s,a;const c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,i=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,i=(t.min.x-u.x)*c),l>=0?(r=(t.min.y-u.y)*l,o=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,o=(t.min.y-u.y)*l),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(s=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,fi)}intersectTriangle(t,e,n,i,r){vi.subVectors(e,t),yi.subVectors(n,t),_i.crossVectors(vi,yi);let o,s=this.direction.dot(_i);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}xi.subVectors(this.origin,t);const a=o*this.direction.dot(yi.crossVectors(xi,yi));if(a<0)return null;const c=o*this.direction.dot(vi.cross(xi));if(c<0)return null;if(a+c>s)return null;const l=-o*xi.dot(_i);return l<0?null:this.at(l/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}exports.Ray=bi;class wi{constructor(){Object.defineProperty(this,"isMatrix4",{value:!0}),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(t,e,n,i,r,o,s,a,c,l,h,u,p,d,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=c,g[6]=l,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wi).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Mi.setFromMatrixColumn(t,0).length(),r=1/Mi.setFromMatrixColumn(t,1).length(),o=1/Mi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*l,n=o*h,i=s*l,r=s*h;e[0]=a*l,e[4]=-a*h,e[8]=c,e[1]=n+i*c,e[5]=t-r*c,e[9]=-s*a,e[2]=r-t*c,e[6]=i+n*c,e[10]=o*a}else if("YXZ"===t.order){const t=a*l,n=a*h,i=c*l,r=c*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*c,e[1]=o*h,e[5]=o*l,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*l,n=a*h,i=c*l,r=c*h;e[0]=t-r*s,e[4]=-o*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*l,e[9]=r-t*s,e[2]=-o*c,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*l,n=o*h,i=s*l,r=s*h;e[0]=a*l,e[4]=i*c-n,e[8]=t*c+r,e[1]=a*h,e[5]=r*c+t,e[9]=n*c-i,e[2]=-c,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*c,i=s*a,r=s*c;e[0]=a*l,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*l,e[9]=-s*l,e[2]=-c*l,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*a,n=o*c,i=s*a,r=s*c;e[0]=a*l,e[4]=-h,e[8]=c*l,e[1]=t*h+r,e[5]=o*l,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*l,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ti,t,Ei)}lookAt(t,e,n){const i=this.elements;return Ri.subVectors(t,e),0===Ri.lengthSq()&&(Ri.z=1),Ri.normalize(),Ai.crossVectors(n,Ri),0===Ai.lengthSq()&&(1===Math.abs(n.z)?Ri.x+=1e-4:Ri.z+=1e-4,Ri.normalize(),Ai.crossVectors(n,Ri)),Ai.normalize(),Li.crossVectors(Ri,Ai),i[0]=Ai.x,i[4]=Li.x,i[8]=Ri.x,i[1]=Ai.y,i[5]=Li.y,i[9]=Ri.y,i[2]=Ai.z,i[6]=Li.z,i[10]=Ri.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],c=n[12],l=n[1],h=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=i[0],w=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],D=i[14],N=i[3],I=i[7],O=i[11],B=i[15];return r[0]=o*b+s*T+a*R+c*N,r[4]=o*w+s*E+a*C+c*I,r[8]=o*M+s*A+a*P+c*O,r[12]=o*S+s*L+a*D+c*B,r[1]=l*b+h*T+u*R+p*N,r[5]=l*w+h*E+u*C+p*I,r[9]=l*M+h*A+u*P+p*O,r[13]=l*S+h*L+u*D+p*B,r[2]=d*b+f*T+m*R+g*N,r[6]=d*w+f*E+m*C+g*I,r[10]=d*M+f*A+m*P+g*O,r[14]=d*S+f*L+m*D+g*B,r[3]=x*b+v*T+y*R+_*N,r[7]=x*w+v*E+y*C+_*I,r[11]=x*M+v*A+y*P+_*O,r[15]=x*S+v*L+y*D+_*B,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],c=t[13],l=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+r*a*h-i*c*h-r*s*u+n*c*u+i*s*p-n*a*p)+t[7]*(+e*a*p-e*c*u+r*o*u-i*o*p+i*c*l-r*a*l)+t[11]*(+e*c*h-e*s*p-r*o*h+n*o*p+r*s*l-n*c*l)+t[15]*(-i*s*l-e*a*h+e*s*u+i*o*h-n*o*u+n*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],p=t[11],d=t[12],f=t[13],m=t[14],g=t[15],x=h*m*c-f*u*c+f*a*p-s*m*p-h*a*g+s*u*g,v=d*u*c-l*m*c-d*a*p+o*m*p+l*a*g-o*u*g,y=l*f*c-d*h*c+d*s*p-o*f*p-l*s*g+o*h*g,_=d*h*a-l*f*a-d*s*u+o*f*u+l*s*m-o*h*m,b=e*x+n*v+i*y+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=x*w,t[1]=(f*u*r-h*m*r-f*i*p+n*m*p+h*i*g-n*u*g)*w,t[2]=(s*m*r-f*a*r+f*i*c-n*m*c-s*i*g+n*a*g)*w,t[3]=(h*a*r-s*u*r-h*i*c+n*u*c+s*i*p-n*a*p)*w,t[4]=v*w,t[5]=(l*m*r-d*u*r+d*i*p-e*m*p-l*i*g+e*u*g)*w,t[6]=(d*a*r-o*m*r-d*i*c+e*m*c+o*i*g-e*a*g)*w,t[7]=(o*u*r-l*a*r+l*i*c-e*u*c-o*i*p+e*a*p)*w,t[8]=y*w,t[9]=(d*h*r-l*f*r-d*n*p+e*f*p+l*n*g-e*h*g)*w,t[10]=(o*f*r-d*s*r+d*n*c-e*f*c-o*n*g+e*s*g)*w,t[11]=(l*s*r-o*h*r-l*n*c+e*h*c+o*n*p-e*s*p)*w,t[12]=_*w,t[13]=(l*f*i-d*h*i+d*n*u-e*f*u-l*n*m+e*h*m)*w,t[14]=(d*s*i-o*f*i-d*n*a+e*f*a+o*n*m-e*s*m)*w,t[15]=(o*h*i-l*s*i+l*n*a-e*h*a-o*n*u+e*s*u)*w,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,c=r*o,l=r*s;return this.set(c*o+n,c*s-i*a,c*a+i*s,0,c*s+i*a,l*s+n,l*a-i*o,0,c*a-i*s,l*a+i*o,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,c=r+r,l=o+o,h=s+s,u=r*c,p=r*l,d=r*h,f=o*l,m=o*h,g=s*h,x=a*c,v=a*l,y=a*h,_=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*_,i[1]=(p+y)*_,i[2]=(d-v)*_,i[3]=0,i[4]=(p-y)*b,i[5]=(1-(u+g))*b,i[6]=(m+x)*b,i[7]=0,i[8]=(d+v)*w,i[9]=(m-x)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Mi.set(i[0],i[1],i[2]).length();const o=Mi.set(i[4],i[5],i[6]).length(),s=Mi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Si.copy(this);const a=1/r,c=1/o,l=1/s;return Si.elements[0]*=a,Si.elements[1]*=a,Si.elements[2]*=a,Si.elements[4]*=c,Si.elements[5]*=c,Si.elements[6]*=c,Si.elements[8]*=l,Si.elements[9]*=l,Si.elements[10]*=l,e.setFromRotationMatrix(Si),n.x=r,n.y=o,n.z=s,this}makePerspective(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),c=2*r/(n-i),l=(e+t)/(e-t),h=(n+i)/(n-i),u=-(o+r)/(o-r),p=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=l,s[12]=0,s[1]=0,s[5]=c,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),c=1/(n-i),l=1/(o-r),h=(e+t)*a,u=(n+i)*c,p=(o+r)*l;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*l,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wi;const Mi=new Yn,Si=new wi,Ti=new Yn(0,0,0),Ei=new Yn(1,1,1),Ai=new Yn,Li=new Yn,Ri=new Yn;class Ci{constructor(t=0,e=0,n=0,i=Ci.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const i=Bn.clamp,r=t.elements,o=r[0],s=r[4],a=r[8],c=r[1],l=r[5],h=r[9],u=r[2],p=r[6],d=r[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,l),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,o),this._z=0);break;case"ZXY":this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,o));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,l),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Pi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Pi,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Di.setFromEuler(this),this.setFromQuaternion(Di,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Ci,Ci.DefaultOrder="XYZ",Ci.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const Pi=new wi,Di=new Xn;class Ni{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n1?void 0:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ji.getNormalMatrix(t),i=this.coplanarPoint(Yi).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}exports.Plane=Qi;const Ki=new Yn,$i=new Yn,tr=new Yn,er=new Yn,nr=new Yn,ir=new Yn,rr=new Yn,or=new Yn,sr=new Yn,ar=new Yn;class cr{constructor(t,e,n){this.a=void 0!==t?t:new Yn,this.b=void 0!==e?e:new Yn,this.c=void 0!==n?n:new Yn}static getNormal(t,e,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new Yn),i.subVectors(n,e),Ki.subVectors(t,e),i.cross(Ki);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Ki.subVectors(i,e),$i.subVectors(n,e),tr.subVectors(t,e);const o=Ki.dot(Ki),s=Ki.dot($i),a=Ki.dot(tr),c=$i.dot($i),l=$i.dot(tr),h=o*c-s*s;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Yn),0===h)return r.set(-2,-1,-1);const u=1/h,p=(c*a-s*l)*u,d=(o*l-s*a)*u;return r.set(1-p-d,d,p)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,er),er.x>=0&&er.y>=0&&er.x+er.y<=1}static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,er),a.set(0,0),a.addScaledVector(r,er.x),a.addScaledVector(o,er.y),a.addScaledVector(s,er.z),a}static isFrontFacing(t,e,n,i){return Ki.subVectors(n,e),$i.subVectors(t,e),Ki.cross($i).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ki.subVectors(this.c,this.b),$i.subVectors(this.a,this.b),.5*Ki.cross($i).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return cr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qi),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return cr.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return cr.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return cr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return cr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,i=this.b,r=this.c;let o,s;nr.subVectors(i,n),ir.subVectors(r,n),or.subVectors(t,n);const a=nr.dot(or),c=ir.dot(or);if(a<=0&&c<=0)return e.copy(n);sr.subVectors(t,i);const l=nr.dot(sr),h=ir.dot(sr);if(l>=0&&h<=l)return e.copy(i);const u=a*h-l*c;if(u<=0&&a>=0&&l<=0)return o=a/(a-l),e.copy(n).addScaledVector(nr,o);ar.subVectors(t,r);const p=nr.dot(ar),d=ir.dot(ar);if(d>=0&&p<=d)return e.copy(r);const f=p*c-a*d;if(f<=0&&c>=0&&d<=0)return s=c/(c-d),e.copy(n).addScaledVector(ir,s);const m=l*d-p*h;if(m<=0&&h-l>=0&&p-d>=0)return rr.subVectors(r,i),s=(h-l)/(h-l+(p-d)),e.copy(i).addScaledVector(rr,s);const g=1/(m+f+u);return o=f*g,s=u*g,e.copy(n).addScaledVector(nr,o).addScaledVector(ir,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=cr;const lr={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},hr={h:0,s:0,l:0},ur={h:0,s:0,l:0};function pr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function dr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function fr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class mr{constructor(t,e,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Bn.euclideanModulo(t,1),e=Bn.clamp(e,0,1),n=Bn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=pr(r,i,t+1/3),this.g=pr(r,i,t),this.b=pr(r,i,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[5]),this;if(t=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[5]),this;break;case"hsl":case"hsla":if(t=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[5]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=lr[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=dr(t.r),this.g=dr(t.g),this.b=dr(t.b),this}copyLinearToSRGB(t){return this.r=fr(t.r),this.g=fr(t.g),this.b=fr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),o=Math.min(e,n,i);let s,a;const c=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=c<=.5?t/(r+o):t/(2-r-o),r){case e:s=(n-i)/t+(n0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(vr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),yr.prototype=Object.create(vr.prototype),yr.prototype.constructor=yr,yr.prototype.isMeshBasicMaterial=!0,yr.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};const _r=new Yn,br=new Fn;function wr(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0}function Mr(t,e,n){wr.call(this,new Int8Array(t),e,n)}function Sr(t,e,n){wr.call(this,new Uint8Array(t),e,n)}function Tr(t,e,n){wr.call(this,new Uint8ClampedArray(t),e,n)}function Er(t,e,n){wr.call(this,new Int16Array(t),e,n)}function Ar(t,e,n){wr.call(this,new Uint16Array(t),e,n)}function Lr(t,e,n){wr.call(this,new Int32Array(t),e,n)}function Rr(t,e,n){wr.call(this,new Uint32Array(t),e,n)}function Cr(t,e,n){wr.call(this,new Uint16Array(t),e,n)}function Pr(t,e,n){wr.call(this,new Float32Array(t),e,n)}function Dr(t,e,n){wr.call(this,new Float64Array(t),e,n)}Object.defineProperty(wr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(wr.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0,o=i[1]&&i[1].length>0,s=t.morphTargets,a=s.length;let c;if(a>0){c=[];for(let t=0;t0){u=[];for(let t=0;t0&&0===e.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;ge&&(e=t[n]);return e}const Or={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Br(t,e){return new Or[t](e)}let Fr=1;const Gr=new wi,Ur=new Xi,zr=new Yn,Hr=new Qn,kr=new Qn,Vr=new Yn;function Wr(){Object.defineProperty(this,"id",{value:Fr+=2}),this.uuid=Bn.generateUUID(),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={}}Wr.prototype=Object.assign(Object.create(Nn.prototype),{constructor:Wr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Ir(t)>65535?Rr:Ar)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Gn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Gr.makeRotationX(t),this.applyMatrix4(Gr),this},rotateY:function(t){return Gr.makeRotationY(t),this.applyMatrix4(Gr),this},rotateZ:function(t){return Gr.makeRotationZ(t),this.applyMatrix4(Gr),this},translate:function(t,e,n){return Gr.makeTranslation(t,e,n),this.applyMatrix4(Gr),this},scale:function(t,e,n){return Gr.makeScale(t,e,n),this.applyMatrix4(Gr),this},lookAt:function(t){return Ur.lookAt(t),Ur.updateMatrix(),this.applyMatrix4(Ur.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zr).negate(),this.translate(zr.x,zr.y,zr.z),this},setFromObject:function(t){const e=t.geometry;if(t.isPoints||t.isLine){const t=new Pr(3*e.vertices.length,3),n=new Pr(3*e.colors.length,3);if(this.setAttribute("position",t.copyVector3sArray(e.vertices)),this.setAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){const t=new Pr(e.lineDistances.length,1);this.setAttribute("lineDistance",t.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){const e=[];for(let n=0,i=t.length;n0){const e=new Float32Array(3*t.normals.length);this.setAttribute("normal",new wr(e,3).copyVector3sArray(t.normals))}if(t.colors.length>0){const e=new Float32Array(3*t.colors.length);this.setAttribute("color",new wr(e,3).copyColorsArray(t.colors))}if(t.uvs.length>0){const e=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new wr(e,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){const e=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new wr(e,2).copyVector2sArray(t.uvs2))}this.groups=t.groups;for(const n in t.morphTargets){const e=[],i=t.morphTargets[n];for(let t=0,n=i.length;t0){const e=new Pr(4*t.skinIndices.length,4);this.setAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){const e=new Pr(4*t.skinWeights.length,4);this.setAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Qn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Yn(-1/0,-1/0,-1/0),new Yn(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],i=e.toJSON(t.data);""!==e.name&&(i.name=e.name),t.data.attributes[a]=i}const i={};let r=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let i=0,r=e.length;i0&&(i[a]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t},clone:function(){return(new Wr).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const c in i){const t=i[c];this.setAttribute(c,t.clone(e))}const r=t.morphAttributes;for(const c in r){const t=[],n=r[c];for(let i=0,r=n.length;in.far?null:{distance:l,point:ao.clone(),object:t}}function ho(t,e,n,i,r,o,s,a,c,l,h,u){Yr.fromBufferAttribute(r,l),Zr.fromBufferAttribute(r,h),Jr.fromBufferAttribute(r,u);const p=t.morphTargetInfluences;if(e.morphTargets&&o&&p){to.set(0,0,0),eo.set(0,0,0),no.set(0,0,0);for(let t=0,e=o.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Xr.copy(n.boundingSphere),Xr.applyMatrix4(r),!1===t.ray.intersectsSphere(Xr))return;if(jr.copy(r).invert(),qr.copy(t.ray).applyMatrix4(jr),null!==n.boundingBox&&!1===qr.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position,a=n.morphAttributes.position,c=n.morphTargetsRelative,l=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,d=u.length;n0&&(c=l);for(let n=0,h=a.length;n0?1:-1,l.push(A.x,A.y,A.z),h.push(a/m),h.push(1-s/g),T+=1}}for(let s=0;s0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},yo.prototype=Object.assign(Object.create(Xi.prototype),{constructor:yo,isCamera:!0,copy:function(t,e){return Xi.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xi.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xi.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),_o.prototype=Object.assign(Object.create(yo.prototype),{constructor:_o,isPerspectiveCamera:!0,copy:function(t,e){return yo.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Bn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Bn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Bn.RAD2DEG*Math.atan(Math.tan(.5*Bn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Bn.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xi.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const bo=90,wo=1;function Mo(t,e,n){if(Xi.call(this),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new _o(bo,wo,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(1,0,0)),this.add(i);const r=new _o(bo,wo,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(-1,0,0)),this.add(r);const o=new _o(bo,wo,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Yn(0,1,0)),this.add(o);const s=new _o(bo,wo,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new Yn(0,-1,0)),this.add(s);const a=new _o(bo,wo,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const c=new _o(bo,wo,t,e);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new Yn(0,0,-1)),this.add(c),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();const l=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,c),t.setRenderTarget(h),t.xr.enabled=l}}function So(t,e,n,i,r,o,s,a,c,l){t=void 0!==t?t:[],e=void 0!==e?e:nt,s=void 0!==s?s:It,kn.call(this,t,e,n,i,r,o,s,a,c,l),this.flipY=!1,this._needsFlipEnvMap=!0}function To(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),jn.call(this,t,t,e),e=e||{},this.texture=new So(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture._needsFlipEnvMap=!1}function Eo(t,e,n,i,r,o,s,a,c,l,h,u){kn.call(this,null,o,s,a,c,l,i,r,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==c?c:ut,this.minFilter=void 0!==l?l:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Mo.prototype=Object.create(Xi.prototype),Mo.prototype.constructor=Mo,So.prototype=Object.create(kn.prototype),So.prototype.constructor=So,So.prototype.isCubeTexture=!0,Object.defineProperty(So.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),To.prototype=Object.create(jn.prototype),To.prototype.constructor=To,To.prototype.isWebGLCubeRenderTarget=!0,To.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=Ot,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include \n\t\t\t\t#include \n\n\t\t\t}\n\t\t",fragmentShader:"\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t"},i=new uo(5,5,5),r=new vo({name:"CubemapFromEquirect",uniforms:po(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});r.uniforms.tEquirect.value=e;const o=new co(i,r),s=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new Mo(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this},To.prototype.clear=function(t,e,n,i){const r=t.getRenderTarget();for(let o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(e,n,i);t.setRenderTarget(r)},Eo.prototype=Object.create(kn.prototype),Eo.prototype.constructor=Eo,Eo.prototype.isDataTexture=!0;const Ao=new di,Lo=new Yn;class Ro{constructor(t,e,n,i,r,o){this.planes=[void 0!==t?t:new Qi,void 0!==e?e:new Qi,void 0!==n?n:new Qi,void 0!==i?i:new Qi,void 0!==r?r:new Qi,void 0!==o?o:new Qi]}set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this}clone(){return(new this.constructor).copy(this)}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],c=n[5],l=n[6],h=n[7],u=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(s-i,h-a,f-u,v-m).normalize(),e[1].setComponents(s+i,h+a,f+u,v+m).normalize(),e[2].setComponents(s+r,h+c,f+p,v+g).normalize(),e[3].setComponents(s-r,h-c,f-p,v-g).normalize(),e[4].setComponents(s-o,h-l,f-d,v-x).normalize(),e[5].setComponents(s+o,h+l,f+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ao.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ao)}intersectsSprite(t){return Ao.center.set(0,0,0),Ao.radius=.7071067811865476,Ao.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ao)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++){if(e[r].distanceToPoint(n)0?t.max.x:t.min.x,Lo.y=i.normal.y>0?t.max.y:t.min.y,Lo.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Lo)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}function Co(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Po(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version=0){const o=c[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=n.get(o);if(void 0===s)continue;const c=s.buffer,l=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,u=o.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),t.bindBuffer(34962,c),x(i,r,l,e,s*h,u*h)}else o.isInstancedBufferAttribute?(m(i,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(i),t.bindBuffer(34962,c),x(i,r,l,e,0,0)}else if("instanceMatrix"===e){const e=n.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i+0,4,s,!1,64,0),t.vertexAttribPointer(i+1,4,s,!1,64,16),t.vertexAttribPointer(i+2,4,s,!1,64,32),t.vertexAttribPointer(i+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i,3,s,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i,n);break;case 3:t.vertexAttrib3fv(i,n);break;case 4:t.vertexAttrib4fv(i,n);break;default:t.vertexAttrib1fv(i,n)}}}}g()}(r,c,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:d,enableAttribute:f,disableUnusedAttributes:g}}function oc(t,e,n,i){const r=i.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,i){t.drawArrays(o,e,i),n.update(i,o,1)},this.renderInstances=function(i,s,a){if(0===a)return;let c,l;if(r)c=t,l="drawArraysInstanced";else if(l="drawArraysInstancedANGLE",null===(c=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[l](o,i,s,a),n.update(s,o,a)}}function sc(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const c=!0===n.logarithmicDepthBuffer,l=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=o||!!e.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;const n=e.get("EXT_texture_filter_anisotropic");return i=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:o?t.getParameter(36183):0}}function ac(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new Qi,a=new Gn,c={value:null,needsUpdate:!1};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const o=null!==t?t.length:0;let l=null;if(0!==o){if(l=c.value,!0!==r||null===l){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===l||l.length0){const s=t.getRenderList(),a=t.getRenderTarget(),c=t.getRenderState(),l=new To(o.height/2);return l.fromEquirectangularTexture(t,r),e.set(r,l),t.setRenderTarget(a),t.setRenderList(s),t.setRenderState(c),r.addEventListener("dispose",i),n(l.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function lc(t){const e={};return{has:function(n){if(void 0!==e[n])return null!==e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,null!==i},get:function(t){return this.has(t)||console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e[t]}}}function hc(t,e,n,i){const r=new WeakMap,o=new WeakMap;function s(t){const a=t.target,c=r.get(a);null!==c.index&&e.remove(c.index);for(const n in c.attributes)e.remove(c.attributes[n]);a.removeEventListener("dispose",s),r.delete(a);const l=o.get(c);l&&(e.remove(l),o.delete(c)),i.releaseStatesOfGeometry(c),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e65535?Rr:Ar)(n,1);a.version=s;const c=o.get(t);c&&e.remove(c),o.set(t,a)}return{get:function(t,e){let i=r.get(e);return i||(e.addEventListener("dispose",s),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Wr).setFromObject(t)),i=e._bufferGeometry),r.set(e,i),n.memory.geometries++,i)},update:function(t){const n=t.attributes;for(const r in n)e.update(n[r],34962);const i=t.morphAttributes;for(const r in i){const t=i[r];for(let n=0,i=t.length;n0)return t;const r=e*n;let o=Mc[r];if(void 0===o&&(o=new Float32Array(r),Mc[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)}return o}function Rc(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function Pl(t){return t.replace(Cl,Dl)}function Dl(t,e){const n=tc[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Pl(n)}const Nl=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Il=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ol(t){return t.replace(Il,Fl).replace(Nl,Bl)}function Bl(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Fl(t,e,n,i)}function Fl(t,e,n,i){let r="";for(let o=parseInt(e);o0?t.gammaFactor:1,d=n.isWebGL2?"":Sl(n),f=Tl(o),m=r.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[f].filter(Al).join("\n")).length>0&&(g+="\n"),(x=[d,f].filter(Al).join("\n")).length>0&&(x+="\n")):(g=[Gl(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Al).join("\n"),x=[d,Gl(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?tc.tonemapping_pars_fragment:"",n.toneMapping!==Z?Ml("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",tc.encodings_pars_fragment,n.map?bl("mapTexelToLinear",n.mapEncoding):"",n.matcap?bl("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?bl("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?bl("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?bl("lightMapTexelToLinear",n.lightMapEncoding):"",wl("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Al).join("\n")),s=Rl(s=Ll(s=Pl(s),n),n),a=Rl(a=Ll(a=Pl(a),n),n),s=Ol(s),a=Ol(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#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("\n")+"\n"+x);const y=v+x+a,_=gl(r,35633,v+g+s),b=gl(r,35632,y);if(r.attachShader(m,_),r.attachShader(m,b),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(_).trim(),n=r.getShaderInfoLog(b).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=_l(r,_,"vertex"),n=_l(r,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return r.deleteShader(_),r.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new ml(r,m)),w},this.getAttributes=function(){return void 0===M&&(M=El(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=xl++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=_,this.fragmentShader=b,this}function Wl(t,e,n,i,r,o){const s=[],a=i.isWebGL2,c=i.logarithmicDepthBuffer,l=i.floatVertexTextures,h=i.maxVertexUniforms,u=i.vertexTextures;let f=i.precision;const m={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"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t?t.isTexture?e=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(r,s,g,v,y){const _=v.fog,b=r.isMeshStandardMaterial?v.environment:null,w=e.get(r.envMap||b),M=m[r.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(l)return 1024;{const t=h,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i0,maxBones:S,useVertexTexture:l,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===d,flipSided:r.side===p,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&i.sort(t||ql),r.length>1&&r.sort(e||Xl)}}}function Zl(t){let e=new WeakMap;return{get:function(n,i){const r=e.get(n);let o;return void 0===r?(o=new Yl(t),e.set(n,new WeakMap),e.get(n).set(i,o)):void 0===(o=r.get(i))&&(o=new Yl(t),r.set(i,o)),o},dispose:function(){e=new WeakMap}}}function Jl(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new mr};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new mr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new mr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new mr,groundColor:new mr};break;case"RectAreaLight":n={color:new mr,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Ql(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Kl=0;function $l(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function th(t,e){const n=new Jl,i=Ql(),r={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 c=0;c<9;c++)r.probe.push(new Yn);const o=new Yn,s=new wi,a=new wi;return{setup:function(c,l,h){let u=0,p=0,d=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let f=0,m=0,g=0,x=0,v=0,y=0,_=0,b=0;const w=h.matrixWorldInverse;c.sort($l);for(let t=0,e=c.length;t0&&(e.isWebGL2?(r.rectAreaLTC1=ec.LTC_FLOAT_1,r.rectAreaLTC2=ec.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=ec.LTC_FLOAT_1,r.rectAreaLTC2=ec.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=ec.LTC_HALF_1,r.rectAreaLTC2=ec.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=u,r.ambient[1]=p,r.ambient[2]=d;const M=r.hash;M.directionalLength===f&&M.pointLength===m&&M.spotLength===g&&M.rectAreaLength===x&&M.hemiLength===v&&M.numDirectionalShadows===y&&M.numPointShadows===_&&M.numSpotShadows===b||(r.directional.length=f,r.spot.length=g,r.rectArea.length=x,r.point.length=m,r.hemi.length=v,r.directionalShadow.length=y,r.directionalShadowMap.length=y,r.pointShadow.length=_,r.pointShadowMap.length=_,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=y,r.pointShadowMatrix.length=_,r.spotShadowMatrix.length=b,M.directionalLength=f,M.pointLength=m,M.spotLength=g,M.rectAreaLength=x,M.hemiLength=v,M.numDirectionalShadows=y,M.numPointShadows=_,M.numSpotShadows=b,r.version=Kl++)},state:r}}function eh(t,e){const n=new th(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,r,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function nh(t,e){let n=new WeakMap;return{get:function(i,r){let o;return!1===n.has(i)?(o=new eh(t,e),n.set(i,new WeakMap),n.get(i).set(r,o)):!1===n.get(i).has(r)?(o=new eh(t,e),n.get(i).set(r,o)):o=n.get(i).get(r),o},dispose:function(){n=new WeakMap}}}function ih(t){vr.call(this),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,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(t)}function rh(t){vr.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}ih.prototype=Object.create(vr.prototype),ih.prototype.constructor=ih,ih.prototype.isMeshDepthMaterial=!0,ih.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},rh.prototype=Object.create(vr.prototype),rh.prototype.constructor=rh,rh.prototype.isMeshDistanceMaterial=!0,rh.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var oh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",sh="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function ah(t,e,n){let i=new Ro;const r=new Fn,o=new Fn,s=new Wn,a=[],l=[],f={},m={0:p,1:u,2:d},x=new vo({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fn},radius:{value:4}},vertexShader:sh,fragmentShader:oh}),v=x.clone();v.defines.HORIZONAL_PASS=1;const y=new Wr;y.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new co(y,x),b=this;function w(n,i){const r=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,v,_,null)}function M(t,e,n){const i=t<<0|e<<1|n<<2;let r=a[i];return void 0===r&&(r=new ih({depthPacking:nn,morphTargets:t,skinning:e}),a[i]=r),r}function S(t,e,n){const i=t<<0|e<<1|n<<2;let r=l[i];return void 0===r&&(r=new rh({morphTargets:t,skinning:e}),l[i]=r),r}function T(e,n,i,r,o,s,a){let c=null,l=M,u=e.customDepthMaterial;if(!0===r.isPointLight&&(l=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===i.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===i.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),c=l(t,r,!0===e.isInstancedMesh)}else c=u;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const t=c.uuid,e=i.uuid;let n=f[t];void 0===n&&(n={},f[t]=n);let r=n[e];void 0===r&&(r=c.clone(),n[e]=r),c=r}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=a===h?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:m[i.side],c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=o,c.farDistance=s),c}function E(n,r,o,s,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let c=0,l=e.length;cn||r.y>n)&&(r.x>n&&(o.x=Math.floor(n/p.x),r.x=o.x*p.x,u.mapSize.x=o.x),r.y>n&&(o.y=Math.floor(n/p.y),r.y=o.y*p.y,u.mapSize.y=o.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Ot};u.map=new jn(r.x,r.y,t),u.map.texture.name=l.name+".shadowMap",u.mapPass=new jn(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Ot};u.map=new jn(r.x,r.y,t),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(st=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(at)[1]),ot=st>=2);let ct=null,lt={};const ht=new Wn,ut=new Wn;function pt(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let s=0;si||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Bn.floorPowerOfTwo:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===d&&(d=m(o,s));const a=n?m(o,s):d;return a.width=o,a.height=s,a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Bn.isPowerOfTwo(t.width)&&Bn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function _(n,i,r){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function b(t){return t===ut||t===pt||t===ft?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),i.remove(e)}(n),n.isVideoTexture&&p.delete(n),s.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=i.get(e),r=i.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let i=0;i<6;i++)t.deleteFramebuffer(n.__webglFramebuffer[i]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[i]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&t.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(e.texture),i.remove(e)}(n),s.memory.textures--}let S=0;function T(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function E(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;C(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY);const s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),c=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=s||c?c?i.image[t].image:i.image[t]:g(i.image[t],!1,!0,l);const u=h[0],p=x(u)||a,d=o.convert(i.format),f=o.convert(i.type),m=_(i.internalFormat,d,f);let b;if(R(34067,i,p),s){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),s.memory.textures++)}function P(e,i,r){let s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),C(e,i),n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment);const c=function(t){return!a&&(t.wrapS!==lt||t.wrapT!==lt||t.minFilter!==ut&&t.minFilter!==gt)}(i)&&!1===x(i.image),l=g(i.image,c,!1,h),u=x(l)||a,p=o.convert(i.format);let d,f=o.convert(i.type),m=_(i.internalFormat,p,f);R(s,i,u);const b=i.mipmaps;if(i.isDepthTexture)m=6402,a?m=i.type===At?36012:i.type===Et?33190:i.type===Dt?35056:33189:i.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Ut&&6402===m&&i.type!==St&&i.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=St,f=o.convert(i.type)),i.format===zt&&6402===m&&(m=34041,i.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Dt,f=o.convert(i.type))),n.texImage2D(3553,0,m,l.width,l.height,0,p,f,null);else if(i.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t0&&u){for(let t=0,e=b.length;t=c&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+c),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?P(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?P(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const r=i.get(e),c=i.get(e.texture);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),s.memory.textures++;const l=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,u=x(e)||a;if(!a||e.texture.format!==It||e.texture.type!==At&&e.texture.type!==Lt||(e.texture.format=Ot,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){r.__webglFramebuffer=[];for(let e=0;e<6;e++)r.__webglFramebuffer[e]=t.createFramebuffer()}else if(r.__webglFramebuffer=t.createFramebuffer(),h)if(a){r.__webglMultisampledFramebuffer=t.createFramebuffer(),r.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,r.__webglColorRenderbuffer);const n=o.convert(e.texture.format),i=o.convert(e.texture.type),s=_(e.texture.internalFormat,n,i),a=O(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),t.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(r.__webglDepthRenderbuffer=t.createRenderbuffer(),N(r.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){n.bindTexture(34067,c.__webglTexture),R(34067,e.texture,u);for(let t=0;t<6;t++)D(r.__webglFramebuffer[t],e,36064,34069+t);v(e.texture,u)&&y(34067,e.texture,e.width,e.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),R(3553,e.texture,u),D(r.__webglFramebuffer,e,36064,3553),v(e.texture,u)&&y(3553,e.texture,e.width,e.height),n.bindTexture(3553,null);e.depthBuffer&&I(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const r=t.isWebGLCubeRenderTarget?34067:3553,o=i.get(e).__webglTexture;n.bindTexture(r,o),y(r,e,t.width,t.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=i.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),E(t,e)}}function hh(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return i?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===Nt)return 6406;if(t===It)return 6407;if(t===Ot)return 6408;if(t===Bt)return 6409;if(t===Ft)return 6410;if(t===Ut)return 6402;if(t===zt)return 34041;if(t===Ht)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===ie)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===ie)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===re||t===oe||t===se||t===ae||t===ce||t===le||t===he||t===ue||t===pe||t===de||t===fe||t===me||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?i?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function uh(t=[]){_o.call(this),this.cameras=t}function ph(){Xi.call(this),this.type="Group"}function dh(){this._targetRay=null,this._grip=null,this._hand=null}function fh(t,e){const n=this;let i=null,r=1,o=null,s="local-floor",a=null;const c=[],l=new Map,h=new _o;h.layers.enable(1),h.viewport=new Wn;const u=new _o;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new uh;d.layers.enable(1),d.layers.enable(2);let f=null,m=null;function g(t){const e=l.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){l.forEach(function(t,e){t.disconnect(e)}),l.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){o=t,S.setContext(i),S.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function y(t){const e=i.inputSources;for(let n=0;n0&&_t(o,t,e),s.length>0&&_t(s,t,e),!0===t.isScene&&t.onAfterRender(d,t,e),null!==v&&(q.updateRenderTargetMipmap(v),q.updateMultisampleRenderTarget(v)),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1),u=null,p=null},this.setFramebuffer=function(t){m!==t&&null===v&<.bindFramebuffer(36160,t),m=t},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return x},this.getRenderList=function(){return u},this.setRenderList=function(t){u=t},this.getRenderState=function(){return p},this.setRenderState=function(t){p=t},this.getRenderTarget=function(){return v},this.setRenderTarget=function(t,e=0,n=0){v=t,g=e,x=n,t&&void 0===j.get(t).__webglFramebuffer&&q.setupRenderTarget(t);let i=m,r=!1;if(t){const n=j.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=n[e],r=!0):i=t.isWebGLMultisampleRenderTarget?j.get(t).__webglMultisampledFramebuffer:n,M.copy(t.viewport),S.copy(t.scissor),T=t.scissorTest}else M.copy(P).multiplyScalar(L).floor(),S.copy(D).multiplyScalar(L).floor(),T=N;if(y!==i&&(lt.bindFramebuffer(36160,i),y=i),V.viewport(M),V.scissor(S),V.setScissorTest(T),r){const i=j.get(t.texture);lt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=j.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){let s=!1;a!==y&&(lt.bindFramebuffer(36160,a),s=!0);try{const a=t.texture,c=a.format,l=a.type;if(c!==Ot&&at.convert(c)!==lt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===bt||at.convert(l)===lt.getParameter(35738)||l===At&&(k.isWebGL2||H.get("OES_texture_float")||H.get("WEBGL_color_buffer_float"))||l===Lt&&(k.isWebGL2?H.get("EXT_color_buffer_float"):H.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===lt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&<.readPixels(e,n,i,r,at.convert(c),at.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&<.bindFramebuffer(36160,y)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i),s=at.convert(e.format);q.setTexture2D(e,0),lt.copyTexImage2D(3553,n,s,t.x,t.y,r,o,0),V.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,o=e.image.height,s=at.convert(n.format),a=at.convert(n.type);q.setTexture2D(n,0),lt.pixelStorei(37440,n.flipY),lt.pixelStorei(37441,n.premultiplyAlpha),lt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?lt.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?lt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):lt.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&<.generateMipmap(3553),V.unbindTexture()},this.initTexture=function(t){q.setTexture2D(t,0),V.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function vh(t){xh.call(this,t)}uh.prototype=Object.assign(Object.create(_o.prototype),{constructor:uh,isArrayCamera:!0}),ph.prototype=Object.assign(Object.create(Xi.prototype),{constructor:ph,isGroup:!0}),Object.assign(dh.prototype,{constructor:dh,getHandSpace:function(){if(null===this._hand&&(this._hand=new ph,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let t=0;t<=window.XRHand.LITTLE_PHALANX_TIP;t++){const t=new ph;t.matrixAutoUpdate=!1,t.visible=!1,this._hand.joints.push(t),this._hand.add(t)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new ph,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new ph,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let i=null,r=null,o=null;const s=this._targetRay,a=this._grip,c=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(c&&t.hand){o=!0;for(let i=0;i<=window.XRHand.LITTLE_PHALANX_TIP;i++)if(t.hand[i]){const r=e.getJointPose(t.hand[i],n),o=c.joints[i];null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.jointRadius=r.radius),o.visible=null!==r;const s=c.joints[window.XRHand.INDEX_PHALANX_TIP],a=c.joints[window.XRHand.THUMB_PHALANX_TIP],l=s.position.distanceTo(a.position),h=.02,u=.005;c.inputState.pinching&&l>h+u?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&l<=h-u&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}}else null!==s&&null!==(i=e.getPose(t.targetRaySpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale)),null!==a&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==c&&(c.visible=null!==o),this}}),Object.assign(fh.prototype,Nn.prototype),vh.prototype=Object.assign(Object.create(xh.prototype),{constructor:vh,isWebGL1Renderer:!0});class yh{constructor(t,e){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new mr(t),this.density=void 0!==e?e:25e-5}clone(){return new yh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=yh;class _h{constructor(t,e,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new mr(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new _h(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=_h;class bh extends Xi{constructor(){super(),Object.defineProperty(this,"isScene",{value:!0}),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function wh(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bn.generateUUID()}exports.Scene=bh,Object.defineProperty(wh.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(wh.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:a,point:Ah.clone(),uv:cr.getUV(Ah,Nh,Ih,Oh,Bh,Fh,Gh,new Fn),face:null,object:this})},copy:function(t){return Xi.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}});const Hh=new Yn,kh=new Yn;function Vh(){Xi.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Wh(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),co.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new wi,this.bindMatrixInverse=new wi}function jh(){Xi.call(this),this.type="Bone"}Vh.prototype=Object.assign(Object.create(Xi.prototype),{constructor:Vh,isLOD:!0,copy:function(t){Xi.prototype.copy.call(this,t,!1);const e=t.levels;for(let n=0,i=e.length;n0){let n,i;for(n=1,i=e.length;n0){Hh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Hh);this.getObjectForDistance(n).raycast(t,e)}},update:function(t){const e=this.levels;if(e.length>1){Hh.setFromMatrixPosition(t.matrixWorld),kh.setFromMatrixPosition(this.matrixWorld);const n=Hh.distanceTo(kh)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;is)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);pt.far||e.push({distance:p,point:l.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else for(let n=0,o=r.count-1;ns)continue;h.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(h);it.far||e.push({distance:i,point:l.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){const i=n.vertices,r=i.length;for(let n=0;ns)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:l.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const au=new Yn,cu=new Yn;function lu(t,e){su.call(this,t,e),this.type="LineSegments"}function hu(t,e){su.call(this,t,e),this.type="LineLoop"}function uu(t){vr.call(this),this.type="PointsMaterial",this.color=new mr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}lu.prototype=Object.assign(Object.create(su.prototype),{constructor:lu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;tr.far)return;o.push({distance:c,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:s})}}function vu(t,e,n,i,r,o,s,a,c){kn.call(this,t,e,n,i,r,o,s,a,c),this.format=void 0!==s?s:It,this.minFilter=void 0!==o?o:gt,this.magFilter=void 0!==r?r:gt,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,t.requestVideoFrameCallback(e)})}function yu(t,e,n,i,r,o,s,a,c,l,h,u){kn.call(this,null,o,s,a,c,l,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function _u(t,e,n,i,r,o,s,a,c){kn.call(this,t,e,n,i,r,o,s,a,c),this.needsUpdate=!0}function bu(t,e,n,i,r,o,s,a,c,l){if((l=void 0!==l?l:Ut)!==Ut&&l!==zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Ut&&(n=St),void 0===n&&l===zt&&(n=Dt),kn.call(this,null,i,r,o,s,a,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==s?s:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}gu.prototype=Object.assign(Object.create(Xi.prototype),{constructor:gu,isPoints:!0,copy:function(t){return Xi.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),fu.copy(n.boundingSphere),fu.applyMatrix4(i),fu.radius+=r,!1===t.ray.intersectsSphere(fu))return;pu.copy(i).invert(),du.copy(t.ray).applyMatrix4(pu);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,a=n.length;r0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),vu.prototype=Object.assign(Object.create(kn.prototype),{constructor:vu,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),yu.prototype=Object.create(kn.prototype),yu.prototype.constructor=yu,yu.prototype.isCompressedTexture=!0,_u.prototype=Object.create(kn.prototype),_u.prototype.constructor=_u,_u.prototype.isCanvasTexture=!0,bu.prototype=Object.create(kn.prototype),bu.prototype.constructor=bu,bu.prototype.isDepthTexture=!0;let wu=0;const Mu=new wi,Su=new Xi,Tu=new Yn;function Eu(){Object.defineProperty(this,"id",{value:wu+=2}),this.uuid=Bn.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Eu.prototype=Object.assign(Object.create(Nn.prototype),{constructor:Eu,isGeometry:!0,applyMatrix4:function(t){const e=(new Gn).getNormalMatrix(t);for(let n=0,i=this.vertices.length;n0)for(let u=0;u0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,n=this.faces.length;e=0;a--){const t=o[a];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e0,s=t.vertexNormals.length>0,a=1!==t.color.r||1!==t.color.g||1!==t.color.b,c=t.vertexColors.length>0;let f=0;if(f=l(f,0,0),f=l(f,1,e),f=l(f,2,i),f=l(f,3,r),f=l(f,4,o),f=l(f,5,s),f=l(f,6,a),f=l(f,7,c),n.push(f),n.push(t.a,t.b,t.c),n.push(t.materialIndex),r){const t=this.faceVertexUvs[0][d];n.push(p(t[0]),p(t[1]),p(t[2]))}if(o&&n.push(h(t.normal)),s){const e=t.vertexNormals;n.push(h(e[0]),h(e[1]),h(e[2]))}if(a&&n.push(u(t.color)),c){const e=t.vertexColors;n.push(u(e[0]),u(e[1]),u(e[2]))}}function l(t,e,n){return n?t|1<0&&(t.data.colors=o),a.length>0&&(t.data.uvs=[a]),t.data.faces=n,t},clone:function(){return(new Eu).copy(this)},copy:function(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;const e=t.vertices;for(let u=0,p=e.length;u0&&x(!0),e>0&&x(!1)),this.setIndex(l),this.setAttribute("position",new Pr(h,3)),this.setAttribute("normal",new Pr(u,3)),this.setAttribute("uv",new Pr(p,2))}}exports.CylinderBufferGeometry=Cu;class Pu extends Eu{constructor(t,e,n,i,r,o,s,a){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new Cu(t,e,n,i,r,o,s,a)),this.mergeVertices()}}exports.CylinderGeometry=Pu;class Du extends Pu{constructor(t,e,n,i,r,o,s){super(0,t,e,n,i,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}}exports.ConeGeometry=Du;class Nu extends Cu{constructor(t=1,e=1,n=8,i=1,r=!1,o=0,s=2*Math.PI){super(0,t,e,n,i,r,o,s),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}}exports.ConeBufferGeometry=Nu;class Iu extends Wr{constructor(t,e,n=1,i=0){super(),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],o=[];function s(t,e,n,i){const r=i+1,o=[];for(let s=0;s<=r;s++){o[s]=[];const i=t.clone().lerp(n,s/r),a=e.clone().lerp(n,s/r),c=r-s;for(let t=0;t<=c;t++)o[s][t]=0===t&&s===r?i:i.clone().lerp(a,t/c)}for(let s=0;s.9&&s<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Pr(r,3)),this.setAttribute("normal",new Pr(r.slice(),3)),this.setAttribute("uv",new Pr(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronBufferGeometry=Iu;class Ou extends Iu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-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],[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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronBufferGeometry=Ou;class Bu extends Eu{constructor(t,e){super(),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ou(t,e)),this.mergeVertices()}}exports.DodecahedronGeometry=Bu;const Fu=new Yn,Gu=new Yn,Uu=new Yn,zu=new cr;class Hu extends Wr{constructor(t,e){super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,t.isGeometry&&(t=(new Wr).fromGeometry(t));const n=Math.pow(10,4),i=Math.cos(Bn.DEG2RAD*e),r=t.getIndex(),o=t.getAttribute("position"),s=r?r.count:o.count,a=[0,0,0],c=["a","b","c"],l=new Array(3),h={},u=[];for(let p=0;p80*n){a=l=t[0],c=h=t[1];for(let e=n;el&&(l=u),p>h&&(h=p);d=0!==(d=Math.max(l-a,h-c))?1/d:0}return ju(o,s,n,a,c,d),s}};function Vu(t,e,n,i,r){let o,s;if(r===yp(t,e,n,i)>0)for(o=e;o=e;o-=i)s=gp(o,t[o],t[o+1],s);return s&&cp(s,s.next)&&(xp(s),s=s.next),s}function Wu(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!cp(i,i.next)&&0!==ap(i.prev,i,i.next))i=i.next;else{if(xp(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function ju(t,e,n,i,r,o,s){if(!t)return;!s&&o&&ep(t,i,r,o);let a,c,l=t;for(;t.prev!==t.next;)if(a=t.prev,c=t.next,o?Xu(t,i,r,o):qu(t))e.push(a.i/n),e.push(t.i/n),e.push(c.i/n),xp(t),t=c.next,l=c.next;else if((t=c)===l){s?1===s?ju(t=Yu(Wu(t),e,n),e,n,i,r,o,2):2===s&&Zu(t,e,n,i,r,o):ju(Wu(t),e,n,i,r,o,1);break}}function qu(t){const e=t.prev,n=t,i=t.next;if(ap(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(op(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ap(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Xu(t,e,n,i){const r=t.prev,o=t,s=t.next;if(ap(r,o,s)>=0)return!1;const a=r.xo.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,h=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,u=ip(a,c,e,n,i),p=ip(l,h,e,n,i);let d=t.prevZ,f=t.nextZ;for(;d&&d.z>=u&&f&&f.z<=p;){if(d!==t.prev&&d!==t.next&&op(r.x,r.y,o.x,o.y,s.x,s.y,d.x,d.y)&&ap(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==t.prev&&f!==t.next&&op(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&ap(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&op(r.x,r.y,o.x,o.y,s.x,s.y,d.x,d.y)&&ap(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&op(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&ap(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Yu(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!cp(r,o)&&lp(r,i,i.next,o)&&dp(r,o)&&dp(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),xp(i),xp(i.next),i=t=o),i=i.next}while(i!==t);return Wu(i)}function Zu(t,e,n,i,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&sp(s,t)){let a=mp(s,t);return s=Wu(s,s.next),a=Wu(a,a.next),ju(s,e,n,i,r,o),void ju(a,e,n,i,r,o)}t=t.next}s=s.next}while(s!==t)}function Ju(t,e,n,i){const r=[];let o,s,a,c,l;for(o=0,s=e.length;o=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x=n.x&&n.x>=c&&i!==n.x&&op(ro.x||n.x===o.x&&tp(o,n)))&&(o=n,u=h)),n=n.next}while(n!==a);return o}function tp(t,e){return ap(t.prev,t,e.prev)<0&&ap(e.next,t,t.next)<0}function ep(t,e,n,i){let r=t;do{null===r.z&&(r.z=ip(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,np(r)}function np(t){let e,n,i,r,o,s,a,c,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,i=n,a=0,e=0;e0||c>0&&i;)0!==a&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(s>1);return t}function ip(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function rp(t){let e=t,n=t;do{(e.x=0&&(t-s)*(i-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(r-s)*(i-a)>=0}function sp(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!pp(t,e)&&(dp(t,e)&&dp(e,t)&&fp(t,e)&&(ap(t.prev,t,e.prev)||ap(t,e.prev,e))||cp(t,e)&&ap(t.prev,t,t.next)>0&&ap(e.prev,e,e.next)>0)}function ap(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function cp(t,e){return t.x===e.x&&t.y===e.y}function lp(t,e,n,i){const r=up(ap(t,e,n)),o=up(ap(t,e,i)),s=up(ap(n,i,t)),a=up(ap(n,i,e));return r!==o&&s!==a||(!(0!==r||!hp(t,n,e))||(!(0!==o||!hp(t,i,e))||(!(0!==s||!hp(n,t,i))||!(0!==a||!hp(n,e,i)))))}function hp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function up(t){return t>0?1:t<0?-1:0}function pp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&lp(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function dp(t,e){return ap(t.prev,t,t.next)<0?ap(t,e,t.next)>=0&&ap(t,t.prev,e)>=0:ap(t,e,t.prev)<0||ap(t,t.next,e)<0}function fp(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}function mp(t,e){const n=new vp(t.i,t.x,t.y),i=new vp(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function gp(t,e,n,i){const r=new vp(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function xp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function vp(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function yp(t,e,n,i){let r=0;for(let o=e,s=n-i;o2&&t[e-1].equals(t[0])&&t.pop()}function wp(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(c*c+l*l),d=e.x-a/u,f=e.y+s/u,m=((n.x-l/p-d)*l-(n.y+c/p-f)*c)/(s*l-a*c),g=(i=d+s*m-t.x)*i+(r=f+a*m-t.y)*r;if(g<=2)return new Fn(i,r);o=Math.sqrt(g/2)}else{let t=!1;s>Number.EPSILON?c>Number.EPSILON&&(t=!0):s<-Number.EPSILON?c<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(l)&&(t=!0),t?(i=-a,r=s,o=Math.sqrt(h)):(i=s,r=a,o=Math.sqrt(h/2))}return new Fn(i/o,r/o)}const P=[];for(let e=0,n=E.length,i=n-1,r=e+1;e=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+p;for(let e=0,r=E.length;e=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*d;t=0?(t(p-1e-5,i,l),h.subVectors(c,l)):(t(p+1e-5,i,l),h.subVectors(l,c)),i-1e-5>=0?(t(p,i-1e-5,l),u.subVectors(c,l)):(t(p,i+1e-5,l),u.subVectors(l,c)),a.crossVectors(h,u).normalize(),o.push(a.x,a.y,a.z),s.push(p,i)}}for(let d=0;d0)&&p.push(e,i,s),(g!==n-1||a=i)){a.push(t.times[o]);for(let n=0;no.tracks[c].times[0]&&(a=o.tracks[c].times[0]);for(let c=0;c=e.times[u]){const t=u*c+a,n=t+c-a;p=md.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,i=c-a;t.evaluate(o),p=md.arraySlice(t.resultBuffer,n,i)}if("quaternion"===i){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=r.times.length;for(let t=0;t=r)break t;{const s=e[1];t=(r=e[--n-1]))break e}o=n,n=0}}for(;n>>1;te;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);const t=this.getValueSize();this.times=md.arraySlice(n,r,o),this.values=md.arraySlice(this.values,r*t,o*t)}return this},validate:function(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let s=0;s!==r;s++){const e=n[s];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,e),t=!1;break}if(null!==o&&o>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,e,o),t=!1;break}o=e}if(void 0!==i&&md.isTypedArray(i))for(let s=0,a=i.length;s!==a;++s){const e=i[s];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,e),t=!1;break}}return t},optimize:function(){const t=md.arraySlice(this.times),e=md.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=t.length-1;let o=1;for(let s=1;s0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o}return o!==t.length?(this.times=md.arraySlice(t,0,o),this.values=md.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this},clone:function(){const t=md.arraySlice(this.times,0),e=md.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),bd.prototype=Object.assign(Object.create(_d.prototype),{constructor:bd,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),wd.prototype=Object.assign(Object.create(_d.prototype),{constructor:wd,ValueTypeName:"color"}),Md.prototype=Object.assign(Object.create(_d.prototype),{constructor:Md,ValueTypeName:"number"}),Sd.prototype=Object.assign(Object.create(gd.prototype),{constructor:Sd,interpolate_:function(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let c=t*s;for(let l=c+s;c!==l;c+=4)Xn.slerpFlat(r,0,o,c-s,o,c,a);return r}}),Td.prototype=Object.assign(Object.create(_d.prototype),{constructor:Td,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Sd(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Ed.prototype=Object.assign(Object.create(_d.prototype),{constructor:Ed,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ad.prototype=Object.assign(Object.create(_d.prototype),{constructor:Ad,ValueTypeName:"vector"}),Object.assign(Ld,{parse:function(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let o=0,s=n.length;o!==s;++o)e.push(Cd(n[o]).scale(i));const r=new Ld(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r},toJSON:function(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,o=n.length;r!==o;++r)e.push(_d.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){const r=e.length,o=[];for(let s=0;s1){const t=n[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const o=[];for(const s in i)o.push(Ld.CreateFromMorphTargetSequence(s,i[s],e,n));return o},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],s=[];md.flattenJSON(n,o,s,i),0!==o.length&&r.push(new t(e,o,s))}},i=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const c=t.hierarchy||[];for(let l=0;l0||0===t.search(/^data\:image\/jpeg/);r.format=i?It:Ot,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r}}),Object.assign(Vd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)r+=(n=this.getPoint(o/t)).distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let s,a=0,c=r-1;for(;a<=c;)if((s=n[i=Math.floor(a+(c-a)/2)]-o)<0)a=i+1;else{if(!(s>0)){c=i;break}c=i-1}if(n[i=c]===o)return i/(r-1);const l=n[i];return(i+(o-l)/(n[i+1]-l))/(r-1)},getTangent:function(t,e){let n=t-1e-4,i=t+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),o=this.getPoint(i),s=e||(r.isVector2?new Fn:new Yn);return s.copy(o).sub(r).normalize(),s},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,i=[],r=[],o=[],s=new Yn,a=new wi;for(let p=0;p<=t;p++){const e=p/t;i[p]=this.getTangentAt(e,new Yn),i[p].normalize()}r[0]=new Yn,o[0]=new Yn;let c=Number.MAX_VALUE;const l=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);l<=c&&(c=l,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),u<=c&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),o[0].crossVectors(i[0],r[0]);for(let p=1;p<=t;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),s.crossVectors(i[p-1],i[p]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(Bn.clamp(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(a.makeRotationAxis(s,t))}o[p].crossVectors(i[p],r[p])}if(!0===e){let e=Math.acos(Bn.clamp(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Wd.prototype=Object.create(Vd.prototype),Wd.prototype.constructor=Wd,Wd.prototype.isEllipseCurve=!0,Wd.prototype.getPoint=function(t,e){const n=e||new Fn,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(c)/r)+1)*r:0===l&&c===r-1&&(c=r-2,l=1),this.closed||c>0?s=i[(c-1)%r]:(Xd.subVectors(i[0],i[1]).add(i[0]),s=Xd);const h=i[c%r],u=i[(c+1)%r];if(this.closed||c+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Kd(s,a.x,c.x,l.x,h.x),Kd(s,a.y,c.y,l.y,h.y)),n},mf.prototype.copy=function(t){Vd.prototype.copy.call(this,t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[i]-e,r=this.curves[i],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}i++}return null},getLength:function(){const t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){Vd.prototype.copy.call(this,t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=c.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),this},copy:function(t){return xf.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){const t=xf.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return xf.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),yf.prototype=Object.assign(Object.create(vf.prototype),{constructor:yf,getPointsHoles:function(t){const e=[];for(let n=0,i=this.holes.length;n0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const r in t.uniforms){const e=t.uniforms[r];switch(i.uniforms[r]={},e.type){case"t":i.uniforms[r].value=n(e.value);break;case"c":i.uniforms[r].value=(new mr).setHex(e.value);break;case"v2":i.uniforms[r].value=(new Fn).fromArray(e.value);break;case"v3":i.uniforms[r].value=(new Yn).fromArray(e.value);break;case"v4":i.uniforms[r].value=(new Wn).fromArray(e.value);break;case"m3":i.uniforms[r].value=(new Gn).fromArray(e.value);break;case"m4":i.uniforms[r].value=(new wi).fromArray(e.value);break;default:i.uniforms[r].value=e.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const r in t.extensions)i.extensions[r]=t.extensions[r];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Fn).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Fn).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),i},setTextures:function(t){return this.textures=t,this}});const Of={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,r=t.length;i0){const n=new Dd(e);(r=new Ud(n)).setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;eNumber.EPSILON){if(c<0&&(n=e[o],a=-a,s=e[r],c=-c),t.ys.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=c*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(s.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=s.x)return!0}}return i}const r=_p.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let s,a,c;const l=[];if(1===o.length)return a=o[0],(c=new yf).curves=a.curves,l.push(c),l;let h=!r(o[0].getPoints());h=t?!h:h;const u=[],p=[];let d,f,m=[],g=0;p[g]=void 0,m[g]=[];for(let x=0,v=o.length;x1){let t=!1;const e=[];for(let n=0,i=p.length;n0&&(t||(m=u))}for(let x=0,v=p.length;x0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let a=e,c=e+e;a!==c;++a)if(n[a]!==n[a+e]){s.setValue(n,i);break}},saveOriginalState:function(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,o=i;r!==o;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_setAdditiveIdentityNumeric:function(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){Xn.slerpFlat(t,e,t,e,t,n,i)},_slerpAdditive:function(t,e,n,i,r){const o=this._workIndex*r;Xn.multiplyQuaternionsFlat(t,o,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,o,i)},_lerp:function(t,e,n,i,r){const o=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[n+s]*i}},_lerpAdditive:function(t,e,n,i,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[n+o]*i}}});const vm="\\[\\]\\.:\\/",ym=new RegExp("[\\[\\]\\.:\\/]","g"),_m="[^\\[\\]\\.:\\/]",bm="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",wm=/((?:WC+[\/:])*)/.source.replace("WC",_m),Mm=/(WCOD+)?/.source.replace("WCOD",bm),Sm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_m),Tm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_m),Em=new RegExp("^"+wm+Mm+Sm+Tm+"$"),Am=["material","materials","bones"];function Lm(t,e,n){const i=n||Rm.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Rm(t,e,n){this.path=e,this.parsedPath=n||Rm.parseTrackName(e),this.node=Rm.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Cm(){this.uuid=Bn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,i=arguments.length;n!==i;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}Object.assign(Lm.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Rm,{Composite:Lm,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Rm.Composite(t,e,n):new Rm(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(ym,"")},parseTrackName:function(t){const e=Em.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Am.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i=r){const o=r++,l=t[o];e[l.uuid]=c,t[c]=l,e[a]=o,t[o]=s;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[c];e[c]=i,e[o]=r}}}this.nCachedObjects_=r},uncache:function(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,c=e[a];if(void 0!==c)if(delete e[a],c0&&(e[s.uuid]=c),t[c]=s,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[c]=e[r],e.pop()}}}this.nCachedObjects_=r},subscribe_:function(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const o=this._paths,s=this._parsedPaths,a=this._objects,c=a.length,l=this.nCachedObjects_,h=new Array(c);i=r.length,n[t]=i,o.push(t),s.push(e),r.push(h);for(let u=l,p=a.length;u!==p;++u){const n=a[u];h[u]=new Rm(n,t,e)}return h},unsubscribe_:function(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=n,o[n]=a,o.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}});class Pm{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:Ue,endingEnd:Ue};for(let c=0;c!==o;++c){const t=r[c].createInterpolant(null);s[c]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ie,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&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,o=n/i;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,c=s.sampleValues;return a[0]=r,a[1]=r+n,c[0]=t/o,c[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulateAdditive(s);break;case ke:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulate(i,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const o=n===Oe;if(0===t)return-1===r?i:o&&1==(1&r)?e-i:i;if(n===Ne){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(o&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=ze,i.endingEnd=ze):(i.endingStart=t?this.zeroSlopeAtStart?ze:Ue:He,i.endingEnd=e?this.zeroSlopeAtEnd?ze:Ue:He)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=n,this}}function Dm(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}Dm.prototype=Object.assign(Object.create(Nn.prototype),{constructor:Dm,_bindAction:function(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,s=t._interpolants,a=n.uuid,c=this._bindingsByRootAndName;let l=c[a];void 0===l&&(l={},c[a]=l);for(let h=0;h!==r;++h){const t=i[h],r=t.name;let c=l[r];if(void 0!==c)o[h]=c;else{if(void 0!==(c=o[h])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,a,r));continue}const i=e&&e._propertyBindings[h].binding.parsedPath;++(c=new xm(Rm.create(n,r,i),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(c,a,r),o[h]=c}s[h].resultBuffer=c.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this},update:function(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let c=0;c!==n;++c){e[c]._update(i,t,r,o)}const s=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)s[c].apply(o);return this},setTime:function(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Fn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Fn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Hm.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=km;const Vm=new Yn,Wm=new Yn;class jm{constructor(t,e){this.start=void 0!==t?t:new Yn,this.end=void 0!==e?e:new Yn}set(t,e){return this.start.copy(t),this.end.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Vm.subVectors(t,this.start),Wm.subVectors(this.end,this.start);const n=Wm.dot(Wm);let i=Wm.dot(Vm)/n;return e&&(i=Bn.clamp(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}function qm(t){Xi.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=jm,qm.prototype=Object.create(Xi.prototype),qm.prototype.constructor=qm,qm.prototype.isImmediateRenderObject=!0;const Xm=new Yn;class Ym extends Xi{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new Wr,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,s=1,a=32;o.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{yg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(yg,e)}}setLength(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=wg;class Mg extends lu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new Wr;n.setAttribute("position",new Pr(e,3)),n.setAttribute("color",new Pr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new tu({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=Mg;const Sg=new Float32Array(1),Tg=new Int32Array(Sg.buffer),Eg={toHalfFloat:function(t){Sg[0]=t;const e=Tg[0];let n=e>>16&32768,i=e>>12&2047;const r=e>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&e):r<113?n|=((i|=2048)>>114-r)+(i>>113-r&1):(n|=r-112<<10|i>>1,n+=1&i)}};exports.DataUtils=Eg;const Ag=4,Lg=8,Rg=Math.pow(2,Lg),Cg=[.125,.215,.35,.446,.526,.582],Pg=Lg-Ag+1+Cg.length,Dg=20,Ng={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},Ig=new Af,{_lodPlanes:Og,_sizeLods:Bg,_sigmas:Fg}=Wg();let Gg=null;const Ug=(1+Math.sqrt(5))/2,zg=1/Ug,Hg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Ug,zg),new Yn(0,Ug,-zg),new Yn(zg,0,Ug),new Yn(-zg,0,Ug),new Yn(Ug,zg,0),new Yn(-Ug,zg,0)];class kg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Xg(Dg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Gg=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Zg(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Yg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?Rg:0,Rg,Rg),a.setRenderTarget(i),a.render(t,r)}a.toneMapping=l,a.outputEncoding=c,a.setClearColor(h,u)}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Zg()):null==this._equirectShader&&(this._equirectShader=Yg());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new co(Og[0],i),o=i.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=Ng[t.encoding],o.outputEncoding.value=Ng[e.texture.encoding],qg(e,0,0,3*Rg,2*Rg),n.setRenderTarget(e),n.render(r,Ig)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let i=1;iDg&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${Dg}`);const m=[];let g=0;for(let v=0;vLg-Ag?i-Lg+Ag:0),3*x,2*x),a.setRenderTarget(e),a.render(l,Ig)}}function Vg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Wg(){const t=[],e=[],n=[];let i=Lg;for(let r=0;rLg-Ag?s=Cg[r-Lg+Ag-1]:0==r&&(s=0),n.push(s);const a=1/(o-1),c=-a/2,l=1+a/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=6,p=6,d=3,f=2,m=1,g=new Float32Array(d*p*u),x=new Float32Array(f*p*u),v=new Float32Array(m*p*u);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(i,d*p*t),x.set(h,f*p*t);const r=[t,t,t,t,t,t];v.set(r,m*p*t)}const y=new Wr;y.setAttribute("position",new wr(g,d)),y.setAttribute("uv",new wr(x,f)),y.setAttribute("faceIndex",new wr(v,m)),t.push(y),i>Ag&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function jg(t){const e=new jn(3*Rg,3*Rg,t);return e.texture.mapping=st,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function qg(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Xg(t){return new od({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(t)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new Yn(0,1,0)},inputEncoding:{value:Ng[Xe]},outputEncoding:{value:Ng[Xe]}},vertexShader:Jg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Qg()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Yg(){return new od({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new Fn(1,1)},inputEncoding:{value:Ng[Xe]},outputEncoding:{value:Ng[Xe]}},vertexShader:Jg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Qg()}\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Zg(){return new od({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Ng[Xe]},outputEncoding:{value:Ng[Xe]}},vertexShader:Jg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Qg()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Jg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Qg(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Kg(t,e,n,i,r,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new gr(t,e,n,r,o,s)}exports.PMREMGenerator=kg;const $g=0;exports.LineStrip=0;const tx=1;exports.LinePieces=1;const ex=0;exports.NoColors=0;const nx=1;exports.FaceColors=1;const ix=2;function rx(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function ox(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function sx(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new gu(t,e)}function ax(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Uh(t)}function cx(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new gu(t,e)}function lx(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new uu(t)}function hx(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new uu(t)}function ux(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new uu(t)}function px(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function dx(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new wr(t,e).setUsage(Mn)}function fx(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Mr(t,e)}function mx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Sr(t,e)}function gx(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Tr(t,e)}function xx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Er(t,e)}function vx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ar(t,e)}function yx(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Lr(t,e)}function _x(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Rr(t,e)}function bx(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Pr(t,e)}function wx(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Dr(t,e)}function Mx(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Qd.call(this,t),this.type="catmullrom",this.closed=!0}function Sx(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Qd.call(this,t),this.type="catmullrom"}function Tx(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Qd.call(this,t),this.type="catmullrom"}function Ex(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Mg(t)}function Ax(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new gg(t,e)}function Lx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new lu(new Hu(t.geometry),new tu({color:void 0!==e?e:16777215}))}function Rx(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new lu(new nd(t.geometry),new tu({color:void 0!==e?e:16777215}))}function Cx(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Bd(t)}function Px(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Hd(t)}function Dx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new To(t,n)}exports.VertexColors=2,Vd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Vd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(xf.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=new Eu;for(let n=0,i=t.length;n1)for(var n=1;n=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function e(r){"string"!=typeof r&&(r+="");var t,e=0,n=-1,o=!0;for(t=r.length-1;t>=0;--t)if(47===r.charCodeAt(t)){if(!o){e=t+1;break}}else-1===n&&(o=!1,n=t+1);return-1===n?"":r.slice(e,n)}function n(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n=-1&&!o;s--){var i=s>=0?arguments[s]:r.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(e=i+"/"+e,o="/"===i.charAt(0))}return(o?"/":"")+(e=t(n(e.split("/"),function(r){return!!r}),!o).join("/"))||"."},exports.normalize=function(r){var e=exports.isAbsolute(r),s="/"===o(r,-1);return(r=t(n(r.split("/"),function(r){return!!r}),!e).join("/"))||e||(r="."),r&&s&&(r+="/"),(e?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(n(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),o=e(t.split("/")),s=Math.min(n.length,o.length),i=s,u=0;u=1;--s)if(47===(t=r.charCodeAt(s))){if(!o){n=s;break}}else o=!1;return-1===n?e?"/":".":e&&1===n?"/":r.slice(0,n)},exports.basename=function(r,t){var n=e(r);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},exports.extname=function(r){"string"!=typeof r&&(r+="");for(var t=-1,e=0,n=-1,o=!0,s=0,i=r.length-1;i>=0;--i){var u=r.charCodeAt(i);if(47!==u)-1===n&&(o=!1,n=i+1),46===u?-1===t?t=i:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){e=i+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===e+1?"":r.slice(t,n)};var o="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return t<0&&(t=r.length+t),r.substr(t,e)}; },{"process":"pBGv"}],"U1HP":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.urlJoin=u;var r=e(require("path"));function e(r){return r&&r.__esModule?r:{default:r}}function t(r){return o(r)||a(r)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function a(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}function o(r){if(Array.isArray(r)){for(var e=0,t=new Array(r.length);e=this.maxSize}},{key:"add",value:function(e,t){var i=this.itemSet;if(i.has(e))return!1;if(this.isFull())return!1;var n=this.usedSet,s=this.itemList,a=this.callbacks;return s.push(e),n.add(e),i.set(e,Date.now()),a.set(e,t),!0}},{key:"remove",value:function(e){var t=this.usedSet,i=this.itemSet,n=this.itemList,s=this.callbacks;if(i.has(e)){s.get(e)(e);var a=n.indexOf(e);return n.splice(a,1),t.delete(e),i.delete(e),s.delete(e),!0}return!1}},{key:"markUsed",value:function(e){var t=this.itemSet,i=this.usedSet;t.has(e)&&!i.has(e)&&(t.set(e,Date.now()),i.add(e))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var e=this.unloadPercent,t=this.minSize,i=this.itemList,n=this.itemSet,s=this.usedSet,a=this.callbacks,r=i.length-s.size,l=i.length-t,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(l>0&&r>0){i.sort(function(e,t){var i=s.has(e),n=s.has(t);return i&&n?0:i||n?i?1:-1:u(t)-u(e)});var h=Math.min(l,r),o=Math.max(t*e,h*e),c=Math.min(o,r);c=Math.ceil(c);for(var d=i.splice(0,c),f=0,v=d.length;f0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,n(function(){e.scheduled=!1,e.unloadUnusedContent(),t&&e.markAllUnused()}))}}]),t}();exports.LRUCache=s; },{}],"MK9K":[function(require,module,exports) { "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;in&&t.length>0;){n++;var o=t.pop(),s=i.get(o);i.delete(o),s(o).then(function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()}).catch(function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()})}this.currJobs=n}},{key:"scheduleJobRun",value:function(){var e=this;this.scheduled||(requestAnimationFrame(function(){e.tryRunJobs(),e.scheduled=!1}),this.scheduled=!0)}}]),t}();exports.PriorityQueue=r; },{}],"ci3X":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FAILED=exports.LOADED=exports.PARSING=exports.LOADING=exports.UNLOADED=void 0;var e=0;exports.UNLOADED=e;var r=1;exports.LOADING=r;var t=2;exports.PARSING=t;var o=3;exports.LOADED=o;var s=4;exports.FAILED=s; },{}],"oQJ2":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.traverseSet=a,exports.determineFrustumSet=l,exports.markUsedSetLeaves=s,exports.skipTraversal=d,exports.toggleTiles=o;var e=require("./constants.js");function t(t){return t===e.LOADED||t===e.FAILED}function r(e,t){return e.__lastFrameVisited===t&&e.__used}function _(e,t){e.__lastFrameVisited!==t&&(e.__lastFrameVisited=t,e.__used=!1,e.__inFrustum=!1,e.__isLeaf=!1,e.__visible=!1,e.__active=!1,e.__error=0,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1)}function i(e,t,r){if(_(e,t),e.__used=!0,r.markUsed(e),e.__contentEmpty)for(var n=e.children,a=0,l=n.length;a1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,_=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(t&&t(e,_,i))r&&r(e,_,i);else{for(var n=e.children,l=0,s=n.length;l0&&e.__depth+1>=s)return!0}for(var c=!1,f=e.children,h=0,m=f.length;h2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,n).then(function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))}).then(function(n){var a=n.asset.version;console.assert("1.0"===a||"0.0"===a,'asset.version is expected to be a string of "1.0" or "0.0"');var l=e.default.dirname(t);return(0,r.traverseSet)(n.root,function(e,t){return i.preprocessNode(e,t,l)},null,o,o?o.__depth:0),n})}},{key:"loadRootTileSet",value:function(e){var t=this.tileSets;if(e in t)return t[e]instanceof Error?Promise.reject(t[e]):Promise.resolve(t[e]);var n=this.fetchTileSet(e,this.fetchOptions).then(function(n){t[e]=n});return n.catch(function(n){console.error(n),t[e]=n}),t[e]=n,n}},{key:"requestTileContents",value:function(e){var t=this;if(e.__loadingState===o.UNLOADED){var n=this.stats,i=this.lruCache,r=this.downloadQueue,a=this.parseQueue,l=e.__externalTileSet;i.add(e,function(e){e.__loadingState===o.LOADING?(e.__loadAbort.abort(),e.__loadAbort=null):l?e.children.length=0:t.disposeTile(e),e.__loadingState===o.LOADING?n.downloading--:e.__loadingState===o.PARSING&&n.parsing--,e.__loadingState=o.UNLOADED,e.__loadIndex++,a.remove(e),r.remove(e)}),e.__loadIndex++;var s=e.__loadIndex,u=new AbortController,d=u.signal;n.downloading++,e.__loadAbort=u,e.__loadingState=o.LOADING;var c=function(t){e.__loadIndex===s&&("AbortError"!==t.name?(a.remove(e),r.remove(e),e.__loadingState===o.PARSING?n.parsing--:e.__loadingState===o.LOADING&&n.downloading--,n.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(e.content.uri,'".')),console.error(t),e.__loadingState=o.FAILED):i.remove(e))};l?r.add(e,function(e){return e.__loadIndex!==s?Promise.resolve():t.fetchTileSet(e.content.uri,Object.assign({signal:d},t.fetchOptions),e)}).then(function(t){e.__loadIndex===s&&(n.downloading--,e.__loadAbort=null,e.__loadingState=o.LOADED,e.children.push(t.root))}).catch(c):r.add(e,function(e){return e.__loadIndex!==s?Promise.resolve():fetch(e.content.uri,Object.assign({signal:d},t.fetchOptions))}).then(function(t){if(e.__loadIndex===s){if(t.ok)return t.arrayBuffer();throw new Error("Failed to load model with error code ".concat(t.status))}}).then(function(i){if(e.__loadIndex===s)return n.downloading--,n.parsing++,e.__loadAbort=null,e.__loadingState=o.PARSING,a.add(e,function(e){if(e.__loadIndex!==s)return Promise.resolve();var n=e.content.uri.split(/\./g).pop();return t.parseTile(i,e,n)})}).then(function(){e.__loadIndex===s&&(n.parsing--,e.__loadingState=o.LOADED,e.__wasSetVisible&&t.setTileVisible(e,!0),e.__wasSetActive&&t.setTileActive(e,!0))}).catch(c)}}},{key:"dispose",value:function(){var e=this.lruCache;this.traverse(function(t){e.remove(t)})}}]),a}();exports.TilesRendererBase=c; },{"path":"UUq2","../utilities/urlJoin.js":"U1HP","../utilities/LRUCache.js":"upKt","../utilities/PriorityQueue.js":"MK9K","./traverseFunctions.js":"oQJ2","./constants.js":"ci3X"}],"M3Ed":[function(require,module,exports) { "use strict";function r(r){for(var e="",t=0,o=r.length;t2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this.header;if(!(e in o))return null;var a=o[e];if(a instanceof Object){if(Array.isArray(a))return a;var i,u,c=this.buffer,f=this.binOffset,l=this.binLength,s=a.byteOffset||0,y=a.type||n,b=a.componentType||r;if("type"in a&&n&&a.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(y){case"SCALAR":i=1;break;case"VEC2":i=2;break;case"VEC3":i=3;break;case"VEC4":i=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(e,'".'))}var p=f+s,h=t*i;switch(b){case"BYTE":u=new Int8Array(c,p,h);break;case"UNSIGNED_BYTE":u=new Uint8Array(c,p,h);break;case"SHORT":u=new Int16Array(c,p,h);break;case"UNSIGNED_SHORT":u=new Uint16Array(c,p,h);break;case"INT":u=new Int32Array(c,p,h);break;case"UNSIGNED_INT":u=new Uint32Array(c,p,h);break;case"FLOAT":u=new Float32Array(c,p,h);break;case"DOUBLE":u=new Float64Array(c,p,h);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(e,'".'))}if(p+h*u.BYTES_PER_ELEMENT>f+l)throw new Error("FeatureTable: Feature data read outside binary body length.");return u}return a}}]),t}();exports.FeatureTable=y;var b=function(e){function t(e,n,o,a,u){var c;return f(this,t),(c=r(this,i(t).call(this,e,o,a,u))).batchSize=n,c}return u(t,y),s(t,[{key:"getData",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return o(i(t.prototype),"getData",this).call(this,e,this.batchSize,n,r)}}]),t}();exports.BatchTable=b; },{"./arrayToString.js":"M3Ed"}],"DNWc":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.B3DMLoaderBase=void 0;var e=require("../utilities/FeatureTable.js");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r=2.0 are supported."));else{var d=new V(p,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(var f=0;f=0&&void 0===c[M]&&console.warn('THREE.GLTFLoader: Unknown extension "'+M+'".')}}d.setExtensions(u),d.setPlugins(c),d.parse(a,o)}}});var s={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=s.MSFT_TEXTURE_DDS,this.ddsLoader=e}function a(e){this.parser=e,this.name=s.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function i(){this.name=s.KHR_MATERIALS_UNLIT}function o(e){this.parser=e,this.name=s.KHR_MATERIALS_CLEARCOAT}function l(e){this.parser=e,this.name=s.KHR_MATERIALS_TRANSMISSION}function u(e){this.parser=e,this.name=s.KHR_TEXTURE_BASISU}function c(e){this.parser=e,this.name=s.EXT_TEXTURE_WEBP,this.isSupported=null}function p(e){this.name=s.EXT_MESHOPT_COMPRESSION,this.parser=e}a.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,s=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,i)},c.prototype.loadTexture=function(e){var t=this.name,r=this.parser,s=r.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],i=s.images[a.source],o=i.uri?r.options.manager.getHandler(i.uri):r.textureLoader;return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i,o);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})},c.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise(function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported},p.prototype.loadBufferView=function(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var s=r.extensions[this.name],n=this.parser.getDependency("buffer",s.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then(function(e){var t=s.byteOffset||0,r=s.byteLength||0,n=s.count,i=s.byteStride,o=new ArrayBuffer(n*i),l=new Uint8Array(e[0],t,r);return a.decodeGltfBuffer(new Uint8Array(o),n,i,l,s.mode,s.filter),o})}return null};var h="glTF",d=12,f={JSON:1313821514,BIN:5130562};function m(t){this.name=s.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,d);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==h)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(t,d),a=0;a",r).replace("#include ",s).replace("#include ",n).replace("#include ",a).replace("#include ",i)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function y(){return{name:s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return T},extendParams:function(t,r,s){var n=r.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var a=[];if(Array.isArray(n.diffuseFactor)){var i=n.diffuseFactor;t.color.fromArray(i),t.opacity=i[3]}if(void 0!==n.diffuseTexture&&a.push(s.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var o=n.specularGlossinessTexture;a.push(s.assignTexture(t,"glossinessMap",o)),a.push(s.assignTexture(t,"specularMap",o))}return Promise.all(a)},createMaterial:function(t){var r=new T(t);return r.fog=!0,r.color=t.color,r.map=void 0===t.map?null:t.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===t.aoMap?null:t.aoMap,r.aoMapIntensity=1,r.emissive=t.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,r.bumpMap=void 0===t.bumpMap?null:t.bumpMap,r.bumpScale=1,r.normalMap=void 0===t.normalMap?null:t.normalMap,r.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(r.normalScale=t.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===t.specularMap?null:t.specularMap,r.specular=t.specular,r.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,r.glossiness=t.glossiness,r.alphaMap=null,r.envMap=void 0===t.envMap?null:t.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function x(){this.name=s.KHR_MESH_QUANTIZATION}function M(t,r,s,n){e.Interpolant.call(this,t,r,s,n)}g.prototype.decodePrimitive=function(e,t){var r=this.json,s=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,i={},o={},l={};for(var u in a){var c=N[u]||u.toLowerCase();i[c]=a[u]}for(u in e.attributes){c=N[u]||u.toLowerCase();if(void 0!==a[u]){var p=r.accessors[e.attributes[u]],h=b[p.componentType];l[c]=h,o[c]=!0===p.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t){s.decodeDracoFile(e,function(e){for(var r in e.attributes){var s=e.attributes[r],n=o[r];void 0!==n&&(s.normalized=n)}t(e)},i,l)})})},v.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},T.prototype=Object.create(e.MeshStandardMaterial.prototype),T.prototype.constructor=T,T.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},M.prototype=Object.create(e.Interpolant.prototype),M.prototype.constructor=M,M.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,n=e*s*3+s,a=0;a!==s;a++)t[a]=r[n+a];return t},M.prototype.beforeStart_=M.prototype.copySampleValue_,M.prototype.afterEnd_=M.prototype.copySampleValue_,M.prototype.interpolate_=function(e,t,r,s){for(var n=this.resultBuffer,a=this.sampleValues,i=this.valueSize,o=2*i,l=3*i,u=s-t,c=(r-t)/u,p=c*c,h=p*c,d=e*l,f=d-l,m=-2*h+3*p,g=h-p,v=1-m,T=g-p+c,y=0;y!==i;y++){var x=a[f+y+i],M=a[f+y+o]*u,S=a[d+y+i],R=a[d+y]*u;n[y]=v*x+T*M+m*S+g*R}return n};var S=0,R=1,_=2,E=3,A=4,L=5,w=6,b={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},I={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},P={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},O={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},N={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},F={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},U="OPAQUE",D="MASK",H="BLEND";function k(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e)}function B(e,t,r){for(var s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function G(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function j(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,s=t.weights.length;r=2&&i.setY(A,R[_*l+1]),l>=3&&i.setZ(A,R[_*l+2]),l>=4&&i.setW(A,R[_*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i})},V.prototype.loadTexture=function(e){var t,r,n=this.json,a=this.options,i=n.textures[e],o=i.extensions||{};return(t=o[s.MSFT_TEXTURE_DDS]?n.images[o[s.MSFT_TEXTURE_DDS].source]:n.images[i.source]).uri&&(r=a.manager.getHandler(t.uri)),r||(r=o[s.MSFT_TEXTURE_DDS]?this.extensions[s.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,r)},V.prototype.loadTextureImage=function(t,r,s){var n=this,a=this.json,i=this.options,o=a.textures[t],l=self.URL||self.webkitURL,u=r.uri,c=!1,p=!0;return"image/jpeg"===r.mimeType&&(p=!1),void 0!==r.bufferView&&(u=n.getDependency("bufferView",r.bufferView).then(function(e){if("image/png"===r.mimeType){var t=new DataView(e,25,1).getUint8(0,!1);p=6===t||4===t||3===t}c=!0;var s=new Blob([e],{type:r.mimeType});return u=l.createObjectURL(s)})),Promise.resolve(u).then(function(t){return new Promise(function(r,n){var a=r;!0===s.isImageBitmapLoader&&(a=function(t){r(new e.CanvasTexture(t))}),s.load(k(t,i.path),a,void 0,n)})}).then(function(r){!0===c&&l.revokeObjectURL(u),r.flipY=!1,o.name&&(r.name=o.name),p||(r.format=e.RGBFormat);var s=(a.samplers||{})[o.sampler]||{};return r.magFilter=I[s.magFilter]||e.LinearFilter,r.minFilter=I[s.minFilter]||e.LinearMipmapLinearFilter,r.wrapS=P[s.wrapS]||e.RepeatWrapping,r.wrapT=P[s.wrapT]||e.RepeatWrapping,n.associations.set(r,{type:"textures",index:t}),r})},V.prototype.assignTexture=function(e,t,r){var n=this;return this.getDependency("texture",r.index).then(function(a){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[s.KHR_TEXTURE_TRANSFORM]){var i=void 0!==r.extensions?r.extensions[s.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var o=n.associations.get(a);a=n.extensions[s.KHR_TEXTURE_TRANSFORM].extendTexture(a,i),n.associations.set(a,o)}}e[t]=a})},V.prototype.assignFinalMaterial=function(t){var r=t.geometry,s=t.material,n=void 0!==r.attributes.tangent,a=void 0!==r.attributes.color,i=void 0===r.attributes.normal,o=!0===t.isSkinnedMesh,l=Object.keys(r.morphAttributes).length>0,u=l&&void 0!==r.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+s.uuid,p=this.cache.get(c);p||(p=new e.PointsMaterial,e.Material.prototype.copy.call(p,s),p.color.copy(s.color),p.map=s.map,p.sizeAttenuation=!1,this.cache.add(c,p)),s=p}else if(t.isLine){c="LineBasicMaterial:"+s.uuid;var h=this.cache.get(c);h||(h=new e.LineBasicMaterial,e.Material.prototype.copy.call(h,s),h.color.copy(s.color),this.cache.add(c,h)),s=h}if(n||a||i||o||l){c="ClonedMaterial:"+s.uuid+":";s.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),o&&(c+="skinning:"),n&&(c+="vertex-tangents:"),a&&(c+="vertex-colors:"),i&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=s.clone(),o&&(d.skinning=!0),n&&(d.vertexTangents=!0),a&&(d.vertexColors=!0),i&&(d.flatShading=!0),l&&(d.morphTargets=!0),u&&(d.morphNormals=!0),this.cache.add(c,d),this.associations.set(d,this.associations.get(s))),s=d}s.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),s.normalScale&&!n&&(s.normalScale.y=-s.normalScale.y),s.clearcoatNormalScale&&!n&&(s.clearcoatNormalScale.y=-s.clearcoatNormalScale.y),t.material=s},V.prototype.getMaterialType=function(){return e.MeshStandardMaterial},V.prototype.loadMaterial=function(t){var r,n=this,a=this.json,i=this.extensions,o=a.materials[t],l={},u=o.extensions||{},c=[];if(u[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var p=i[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=p.getMaterialType(),c.push(p.extendParams(l,o,n))}else if(u[s.KHR_MATERIALS_UNLIT]){var h=i[s.KHR_MATERIALS_UNLIT];r=h.getMaterialType(),c.push(h.extendParams(l,o,n))}else{var d=o.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(d.baseColorFactor)){var f=d.baseColorFactor;l.color.fromArray(f),l.opacity=f[3]}void 0!==d.baseColorTexture&&c.push(n.assignTexture(l,"map",d.baseColorTexture)),l.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,l.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(n.assignTexture(l,"metalnessMap",d.metallicRoughnessTexture)),c.push(n.assignTexture(l,"roughnessMap",d.metallicRoughnessTexture))),r=this._invokeOne(function(e){return e.getMaterialType&&e.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,l)})))}!0===o.doubleSided&&(l.side=e.DoubleSide);var m=o.alphaMode||U;return m===H?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===D&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&r!==e.MeshBasicMaterial&&(c.push(n.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new e.Vector2(1,1),void 0!==o.normalTexture.scale&&l.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),void 0!==o.occlusionTexture&&r!==e.MeshBasicMaterial&&(c.push(n.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&r!==e.MeshBasicMaterial&&(l.emissive=(new e.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&r!==e.MeshBasicMaterial&&c.push(n.assignTexture(l,"emissiveMap",o.emissiveTexture)),Promise.all(c).then(function(){var a;return a=r===T?i[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new r(l),o.name&&(a.name=o.name),a.map&&(a.map.encoding=e.sRGBEncoding),a.emissiveMap&&(a.emissiveMap.encoding=e.sRGBEncoding),G(a,o),n.associations.set(a,{type:"materials",index:t}),o.extensions&&B(i,a,o),a})},V.prototype.createUniqueName=function(t){for(var r=e.PropertyBinding.sanitizeNodeName(t||""),s=1;this.nodeNamesUsed[r];++s)r=t+"_"+s;return this.nodeNamesUsed[r]=!0,r},V.prototype.loadGeometries=function(t){var r=this,n=this.extensions,a=this.primitiveCache;function i(e){return n[s.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then(function(t){return X(t,e,r)})}for(var o,l,u=[],c=0,p=t.length;c0&&j(h,i),h.name=s.createUniqueName(i.name||"mesh_"+t),G(h,i),f.extensions&&B(a,h,f),s.assignFinalMaterial(h),u.push(h)}if(1===u.length)return u[0];var g=new e.Group;for(c=0,p=u.length;c1?new e.Group:1===r.length?r[0]:new e.Object3D)!==r[0])for(var l=0,u=r.length;l0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return o(this,a),(e=i(this,s(a).call(this))).manager=r,e}return p(a,e.B3DMLoaderBase),u(a,[{key:"parse",value:function(e){var t=this,n=f(s(a.prototype),"parse",this).call(this,e),o=n.glbBytes.slice().buffer;return new Promise(function(e,a){var u=t.manager;(u.getHandler("path.gltf")||new r.GLTFLoader(u)).parse(o,null,function(t){var r=n.batchTable,o=n.featureTable,a=t.scene,u=o.getData("RTC_CENTER");u&&(a.position.x+=u[0],a.position.y+=u[1],a.position.z+=u[2]),t.batchTable=r,t.featureTable=o,a.batchTable=r,a.featureTable=o,e(t)},a)})}}]),a}();exports.B3DMLoader=y; },{"../base/B3DMLoaderBase.js":"DNWc","three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0"}],"RlAR":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PNTSLoaderBase=void 0;var e=require("../utilities/FeatureTable.js");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return n(this,o),(e=i(this,l(o).call(this))).manager=r,e}return s(o,e.PNTSLoaderBase),u(o,[{key:"parse",value:function(e){var r=f(l(o.prototype),"parse",this).call(this,e),n=r.featureTable,u=n.getData("POINTS_LENGTH"),i=n.getData("POSITION",u,"FLOAT","VEC3"),a=n.getData("RGB",u,"UNSIGNED_BYTE","VEC3");if(null===i)throw new Error("PNTSLoader : POSITION_QUANTIZED feature type is not supported.");var c=new t.BufferGeometry;c.setAttribute("position",new t.BufferAttribute(i,3,!1));var s=new t.PointsMaterial;s.size=2,s.sizeAttenuation=!1,null!==a&&(c.setAttribute("color",new t.BufferAttribute(a,3,!0)),s.vertexColors=!0);var p=new t.Points(c,s);return r.scene=p,r.scene.featureTable=n,r}}]),o}();exports.PNTSLoader=y; },{"../base/PNTSLoaderBase.js":"RlAR","three":"dKqR"}],"qWWH":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.I3DMLoaderBase=void 0;var e=require("../utilities/FeatureTable.js"),t=require("../utilities/arrayToString.js");function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return o(this,a),(e=c(this,s(a).call(this))).manager=r,e}return p(a,e.I3DMLoaderBase),u(a,[{key:"parse",value:function(e){var n=this;return f(s(a.prototype),"parse",this).call(this,e).then(function(e){var o=e.featureTable,a=e.batchTable,u=e.glbBytes.slice().buffer;return new Promise(function(e,c){var i=n.manager;(i.getHandler("path.gltf")||new r.GLTFLoader(i)).parse(u,null,function(r){var n=o.getData("INSTANCES_LENGTH"),u=o.getData("POSITION",n,"FLOAT","VEC3"),c=new Map,i=[];r.scene.traverse(function(e){if(e.isMesh){var r=e.geometry,o=e.material,a=new t.InstancedMesh(r,o,n);i.push(a),c.set(e,a)}});for(var f=new t.Vector3,l=new t.Vector3,s=0;s0&&void 0!==arguments[0]?arguments[0]:e.DefaultLoadingManager;return a(this,i),(t=f(this,b(i).call(this))).manager=r,t}return y(i,t.CMPTLoaderBase),c(i,[{key:"parse",value:function(t){var u=l(b(i.prototype),"parse",this).call(this,t),a=this.manager,c=new e.Group,f=[],s=[];for(var p in u.tiles){var y=u.tiles[p],d=y.type,h=y.buffer;switch(d){case"b3dm":var v=h.slice(),g=new r.B3DMLoader(a).parse(v.buffer).then(function(e){f.push(e),c.add(e.scene)});s.push(g);break;case"pnts":var m=h.slice(),w=new n.PNTSLoader(a).parse(m.buffer);f.push(w),c.add(w.scene);break;case"i3dm":var O=h.slice(),P=new o.I3DMLoader(a).parse(O.buffer).then(function(e){f.push(e),c.add(e.scene)});s.push(P)}}return Promise.all(s).then(function(){return{tiles:f,scene:c}})}}]),i}();exports.CMPTLoader=h; },{"three":"dKqR","../base/CMPTLoaderBase.js":"c0Qu","./B3DMLoader.js":"rU0W","./PNTSLoader.js":"Pr3e","./I3DMLoader.js":"iNV5"}],"tTab":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesGroup=void 0;var t=require("three");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;rNumber.EPSILON){o=!0;break}}if(o){this.matrixWorld.copy(s);for(var a=this.children,c=0,l=a.length;c0){s.length>1&&s.sort(c);var y=s[0];return s.length=0,y}return null}for(var f=[],v=e.children,d=0,x=v.length;d1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");var O={distance:1/0,tile:null};f.push(O),O.distance=a.distanceToSquared(i.origin)*S*S,O.tile=g}}}f.sort(c);for(var j=1/0,q=null,B=0,F=f.length;Bj)break;var R=P.tile,V=R.cached.scene,W=null;if(p.has(R)?(o(V,u,s),s.length>0&&(s.length>1&&s.sort(c),W=s[0])):W=l(R,h,p,u),W){var _=W.distance*W.distance;_1?n-1:0),a=1;ar.length;)n.pop();for(;n.length1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var a=0,s=n.length;a1&&void 0!==arguments[1]?arguments[1]:16776960,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:40;r(this,o);for(var a=new e.BufferGeometry,p=[],l=0;l<3;l++){var h=y[l],b=y[(l+1)%3];s.set(0,0,0);for(var v=0;v1?p.material.color.setRGB(1,0,0):p.material.color.setRGB(T,T,T);break;case y:var G=Math.min(i.geometricError/t,1);p.material.color.setRGB(G,G,G);break;case E:var S=Math.min(i.cached.distance/o,1);p.material.color.setRGB(S,S,S);break;case _:i.children&&0!==i.children.length?p.material.color.set(0):p.material.color.set(16777215);break;case D:p.material[v]||(p.material.color.setHSL(s,l,c),p.material[v]=!0)}}})})}}},{key:"setTileVisible",value:function(e,r){c(u(i.prototype),"setTileVisible",this).call(this,e,r);var t=e.cached,o=this.sphereGroup,a=this.boxGroup,n=t.boxHelperGroup,s=t.sphereHelper;r?(a.add(n),n.updateMatrixWorld(!0),o.add(s),s.updateMatrixWorld(!0)):(a.remove(n),o.remove(s))}},{key:"parseTile",value:function(r,o,a){var n=this;return c(u(i.prototype),"parseTile",this).call(this,r,o,a).then(function(){var r=o.cached,a=r.scene;if(a){var i=r.box,s=r.boxTransform,l=new e.Group;l.matrix.copy(s),l.matrix.decompose(l.position,l.quaternion,l.scale);var c=new e.Box3Helper(i);c.raycast=b,l.add(c),r.boxHelperGroup=l,n.visibleTiles.has(o)&&n.displayBoxBounds&&(n.boxGroup.add(l),l.updateMatrixWorld(!0));var p=r.sphere,u=new t.SphereHelper(p);u.raycast=b,r.sphereHelper=u,n.visibleTiles.has(o)&&n.displaySphereBounds&&(n.sphereGroup.add(u),u.updateMatrixWorld(!0)),a.traverse(function(e){var r=e.material;r&&(e[f]=r)})}})}},{key:"disposeTile",value:function(e){c(u(i.prototype),"disposeTile",this).call(this,e);var r=e.cached;r.boxHelperGroup&&(r.boxHelperGroup.children[0].geometry.dispose(),r.sphereHelper.geometry.dispose(),delete r.boxHelperGroup,delete r.sphereHelper)}}]),i}();exports.DebugTilesRenderer=O; },{"three":"dKqR","./TilesRenderer.js":"wXIB","./SphereHelper.js":"Tf2v"}],"uBxZ":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DebugTilesRenderer",{enumerable:!0,get:function(){return e.DebugTilesRenderer}}),Object.defineProperty(exports,"NONE",{enumerable:!0,get:function(){return e.NONE}}),Object.defineProperty(exports,"SCREEN_ERROR",{enumerable:!0,get:function(){return e.SCREEN_ERROR}}),Object.defineProperty(exports,"GEOMETRIC_ERROR",{enumerable:!0,get:function(){return e.GEOMETRIC_ERROR}}),Object.defineProperty(exports,"DISTANCE",{enumerable:!0,get:function(){return e.DISTANCE}}),Object.defineProperty(exports,"DEPTH",{enumerable:!0,get:function(){return e.DEPTH}}),Object.defineProperty(exports,"RELATIVE_DEPTH",{enumerable:!0,get:function(){return e.RELATIVE_DEPTH}}),Object.defineProperty(exports,"IS_LEAF",{enumerable:!0,get:function(){return e.IS_LEAF}}),Object.defineProperty(exports,"RANDOM_COLOR",{enumerable:!0,get:function(){return e.RANDOM_COLOR}}),Object.defineProperty(exports,"TilesRenderer",{enumerable:!0,get:function(){return r.TilesRenderer}}),Object.defineProperty(exports,"B3DMLoader",{enumerable:!0,get:function(){return t.B3DMLoader}}),Object.defineProperty(exports,"PNTSLoader",{enumerable:!0,get:function(){return n.PNTSLoader}}),Object.defineProperty(exports,"I3DMLoader",{enumerable:!0,get:function(){return o.I3DMLoader}}),Object.defineProperty(exports,"CMPTLoader",{enumerable:!0,get:function(){return u.CMPTLoader}}),Object.defineProperty(exports,"TilesRendererBase",{enumerable:!0,get:function(){return i.TilesRendererBase}}),Object.defineProperty(exports,"B3DMLoaderBase",{enumerable:!0,get:function(){return a.B3DMLoaderBase}}),Object.defineProperty(exports,"I3DMLoaderBase",{enumerable:!0,get:function(){return s.I3DMLoaderBase}}),Object.defineProperty(exports,"PNTSLoaderBase",{enumerable:!0,get:function(){return d.PNTSLoaderBase}}),Object.defineProperty(exports,"CMPTLoaderBase",{enumerable:!0,get:function(){return b.CMPTLoaderBase}}),Object.defineProperty(exports,"LRUCache",{enumerable:!0,get:function(){return c.LRUCache}}),Object.defineProperty(exports,"PriorityQueue",{enumerable:!0,get:function(){return p.PriorityQueue}});var e=require("./three/DebugTilesRenderer.js"),r=require("./three/TilesRenderer.js"),t=require("./three/B3DMLoader.js"),n=require("./three/PNTSLoader.js"),o=require("./three/I3DMLoader.js"),u=require("./three/CMPTLoader.js"),i=require("./base/TilesRendererBase.js"),a=require("./base/B3DMLoaderBase.js"),s=require("./base/I3DMLoaderBase.js"),d=require("./base/PNTSLoaderBase.js"),b=require("./base/CMPTLoaderBase.js"),c=require("./utilities/LRUCache.js"),p=require("./utilities/PriorityQueue.js"); },{"./three/DebugTilesRenderer.js":"v73V","./three/TilesRenderer.js":"wXIB","./three/B3DMLoader.js":"rU0W","./three/PNTSLoader.js":"Pr3e","./three/I3DMLoader.js":"iNV5","./three/CMPTLoader.js":"hwVX","./base/TilesRendererBase.js":"svb9","./base/B3DMLoaderBase.js":"DNWc","./base/I3DMLoaderBase.js":"qWWH","./base/PNTSLoaderBase.js":"RlAR","./base/CMPTLoaderBase.js":"c0Qu","./utilities/LRUCache.js":"upKt","./utilities/PriorityQueue.js":"MK9K"}],"xTGv":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MapControls=exports.OrbitControls=void 0;var e=require("../../../build/three.module.js"),t=function(t,o){var n,a,i,r,c,s;void 0===o&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),o===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=o,this.enabled=!0,this.target=new e.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return E.phi},this.getAzimuthalAngle=function(){return E.theta},this.saveState=function(){u.target0.copy(u.target),u.position0.copy(u.object.position),u.zoom0=u.object.zoom},this.reset=function(){u.target.copy(u.target0),u.object.position.copy(u.position0),u.object.zoom=u.zoom0,u.object.updateProjectionMatrix(),u.dispatchEvent(l),u.update(),d=h.NONE},this.update=(n=new e.Vector3,a=(new e.Quaternion).setFromUnitVectors(t.up,new e.Vector3(0,1,0)),i=a.clone().invert(),r=new e.Vector3,c=new e.Quaternion,s=2*Math.PI,function(){var e=u.object.position;n.copy(e).sub(u.target),n.applyQuaternion(a),E.setFromVector3(n),u.autoRotate&&d===h.NONE&&R(2*Math.PI/60/60*u.autoRotateSpeed),u.enableDamping?(E.theta+=f.theta*u.dampingFactor,E.phi+=f.phi*u.dampingFactor):(E.theta+=f.theta,E.phi+=f.phi);var t=u.minAzimuthAngle,o=u.maxAzimuthAngle;return isFinite(t)&&isFinite(o)&&(t<-Math.PI?t+=s:t>Math.PI&&(t-=s),o<-Math.PI?o+=s:o>Math.PI&&(o-=s),E.theta=t<=o?Math.max(t,Math.min(o,E.theta)):E.theta>(t+o)/2?Math.max(t,E.theta):Math.min(o,E.theta)),E.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,E.phi)),E.makeSafe(),E.radius*=O,E.radius=Math.max(u.minDistance,Math.min(u.maxDistance,E.radius)),!0===u.enableDamping?u.target.addScaledVector(g,u.dampingFactor):u.target.add(g),n.setFromSpherical(E),n.applyQuaternion(i),e.copy(u.target).add(n),u.object.lookAt(u.target),!0===u.enableDamping?(f.theta*=1-u.dampingFactor,f.phi*=1-u.dampingFactor,g.multiplyScalar(1-u.dampingFactor)):(f.set(0,0,0),g.set(0,0,0)),O=1,!!(v||r.distanceToSquared(u.object.position)>b||8*(1-c.dot(u.object.quaternion))>b)&&(u.dispatchEvent(l),r.copy(u.object.position),c.copy(u.object.quaternion),v=!1,!0)}),this.dispose=function(){u.domElement.removeEventListener("contextmenu",te,!1),u.domElement.removeEventListener("pointerdown",G,!1),u.domElement.removeEventListener("wheel",q,!1),u.domElement.removeEventListener("touchstart",J,!1),u.domElement.removeEventListener("touchend",ee,!1),u.domElement.removeEventListener("touchmove",$,!1),u.domElement.ownerDocument.removeEventListener("pointermove",K,!1),u.domElement.ownerDocument.removeEventListener("pointerup",W,!1),u.domElement.removeEventListener("keydown",Q,!1)};var u=this,l={type:"change"},m={type:"start"},p={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,b=1e-6,E=new e.Spherical,f=new e.Spherical,O=1,g=new e.Vector3,v=!1,T=new e.Vector2,y=new e.Vector2,P=new e.Vector2,L=new e.Vector2,w=new e.Vector2,A=new e.Vector2,N=new e.Vector2,M=new e.Vector2,j=new e.Vector2;function D(){return Math.pow(.95,u.zoomSpeed)}function R(e){f.theta-=e}function S(e){f.phi-=e}var k,C=(k=new e.Vector3,function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),g.add(k)}),Y=function(){var t=new e.Vector3;return function(e,o){!0===u.screenSpacePanning?t.setFromMatrixColumn(o,1):(t.setFromMatrixColumn(o,0),t.crossVectors(u.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),x=function(){var t=new e.Vector3;return function(e,o){var n=u.domElement;if(u.object.isPerspectiveCamera){var a=u.object.position;t.copy(a).sub(u.target);var i=t.length();i*=Math.tan(u.object.fov/2*Math.PI/180),C(2*e*i/n.clientHeight,u.object.matrix),Y(2*o*i/n.clientHeight,u.object.matrix)}else u.object.isOrthographicCamera?(C(e*(u.object.right-u.object.left)/u.object.zoom/n.clientWidth,u.object.matrix),Y(o*(u.object.top-u.object.bottom)/u.object.zoom/n.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),u.enablePan=!1)}}();function H(e){u.object.isPerspectiveCamera?O/=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom*e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function U(e){u.object.isPerspectiveCamera?O*=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom/e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function V(e){T.set(e.clientX,e.clientY)}function _(e){L.set(e.clientX,e.clientY)}function z(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,o)}}function I(e){if(1==e.touches.length)L.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);L.set(t,o)}}function X(e){var t=e.touches[0].pageX-e.touches[1].pageX,o=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(t*t+o*o);N.set(0,n)}function F(e){if(1==e.touches.length)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,o)}P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var n=u.domElement;R(2*Math.PI*P.x/n.clientHeight),S(2*Math.PI*P.y/n.clientHeight),T.copy(y)}function Z(e){if(1==e.touches.length)w.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);w.set(t,o)}A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w)}function B(e){var t=e.touches[0].pageX-e.touches[1].pageX,o=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(t*t+o*o);M.set(0,n),j.set(0,Math.pow(M.y/N.y,u.zoomSpeed)),H(j.y),N.copy(M)}function G(t){if(!1!==u.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var o;switch(t.preventDefault(),u.domElement.focus?u.domElement.focus():window.focus(),t.button){case 0:o=u.mouseButtons.LEFT;break;case 1:o=u.mouseButtons.MIDDLE;break;case 2:o=u.mouseButtons.RIGHT;break;default:o=-1}switch(o){case e.MOUSE.DOLLY:if(!1===u.enableZoom)return;!function(e){N.set(e.clientX,e.clientY)}(t),d=h.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enablePan)return;_(t),d=h.PAN}else{if(!1===u.enableRotate)return;V(t),d=h.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enableRotate)return;V(t),d=h.ROTATE}else{if(!1===u.enablePan)return;_(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(u.domElement.ownerDocument.addEventListener("pointermove",K,!1),u.domElement.ownerDocument.addEventListener("pointerup",W,!1),u.dispatchEvent(m))}(t)}}function K(e){if(!1!==u.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===u.enabled)return;switch(e.preventDefault(),d){case h.ROTATE:if(!1===u.enableRotate)return;!function(e){y.set(e.clientX,e.clientY),P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var t=u.domElement;R(2*Math.PI*P.x/t.clientHeight),S(2*Math.PI*P.y/t.clientHeight),T.copy(y),u.update()}(e);break;case h.DOLLY:if(!1===u.enableZoom)return;!function(e){M.set(e.clientX,e.clientY),j.subVectors(M,N),j.y>0?H(D()):j.y<0&&U(D()),N.copy(M),u.update()}(e);break;case h.PAN:if(!1===u.enablePan)return;!function(e){w.set(e.clientX,e.clientY),A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w),u.update()}(e)}}(e)}}function W(e){switch(e.pointerType){case"mouse":case"pen":!function(e){if(u.domElement.ownerDocument.removeEventListener("pointermove",K,!1),u.domElement.ownerDocument.removeEventListener("pointerup",W,!1),!1===u.enabled)return;u.dispatchEvent(p),d=h.NONE}()}}function q(e){!1===u.enabled||!1===u.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),u.dispatchEvent(m),function(e){e.deltaY<0?U(D()):e.deltaY>0&&H(D()),u.update()}(e),u.dispatchEvent(p))}function Q(e){!1!==u.enabled&&!1!==u.enableKeys&&!1!==u.enablePan&&function(e){var t=!1;switch(e.keyCode){case u.keys.UP:x(0,u.keyPanSpeed),t=!0;break;case u.keys.BOTTOM:x(0,-u.keyPanSpeed),t=!0;break;case u.keys.LEFT:x(u.keyPanSpeed,0),t=!0;break;case u.keys.RIGHT:x(-u.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),u.update())}(e)}function J(t){if(!1!==u.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(u.touches.ONE){case e.TOUCH.ROTATE:if(!1===u.enableRotate)return;z(t),d=h.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===u.enablePan)return;I(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(u.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&X(e),u.enablePan&&I(e)}(t),d=h.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&X(e),u.enableRotate&&z(e)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&u.dispatchEvent(m)}}function $(e){if(!1!==u.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===u.enableRotate)return;F(e),u.update();break;case h.TOUCH_PAN:if(!1===u.enablePan)return;Z(e),u.update();break;case h.TOUCH_DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&B(e),u.enablePan&&Z(e)}(e),u.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&B(e),u.enableRotate&&F(e)}(e),u.update();break;default:d=h.NONE}}function ee(e){!1!==u.enabled&&(u.dispatchEvent(p),d=h.NONE)}function te(e){!1!==u.enabled&&e.preventDefault()}u.domElement.addEventListener("contextmenu",te,!1),u.domElement.addEventListener("pointerdown",G,!1),u.domElement.addEventListener("wheel",q,!1),u.domElement.addEventListener("touchstart",J,!1),u.domElement.addEventListener("touchend",ee,!1),u.domElement.addEventListener("touchmove",$,!1),u.domElement.addEventListener("keydown",Q,!1),this.update()};exports.OrbitControls=t,t.prototype=Object.create(e.EventDispatcher.prototype),t.prototype.constructor=t;var o=function(o,n){t.call(this,o,n),this.screenSpacePanning=!1,this.mouseButtons.LEFT=e.MOUSE.PAN,this.mouseButtons.RIGHT=e.MOUSE.ROTATE,this.touches.ONE=e.TOUCH.PAN,this.touches.TWO=e.TOUCH.DOLLY_ROTATE};exports.MapControls=o,o.prototype=Object.create(e.EventDispatcher.prototype),o.prototype.constructor=o; },{"../../../build/three.module.js":"dKqR"}],"Nrb7":[function(require,module,exports) { "use strict";var e,t,n,i,r,a,o,c,d,s,l=require("../src/index.js"),h=require("three"),u=require("three/examples/jsm/controls/OrbitControls.js");function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function f(e){for(var t=1;t/,"\n\t\t\t#include \n\t\t\tbatchid = _batchid;\n\t\t\t"),t.fragmentShader="\n\t\t\tvarying float batchid;\n\t\t\tuniform float highlightedBatchId;\n\t\t\tuniform vec3 highlightColor;\n\t\t"+t.fragmentShader.replace(/vec4 diffuseColor = vec4\( diffuse, opacity \);/,"\n\t\t\tvec4 diffuseColor =\n\t\t\t\tabs( batchid - highlightedBatchId ) < 0.5 ?\n\t\t\t\tvec4( highlightColor, opacity ) :\n\t\t\t\tvec4( diffuse, opacity );\n\t\t\t"),t}function b(){s=document.getElementById("info"),n=new h.Scene,(i=new h.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),i.setSize(window.innerWidth,window.innerHeight),i.setClearColor(1383455),i.shadowMap.enabled=!0,i.shadowMap.type=h.PCFSoftShadowMap,i.outputEncoding=h.sRGBEncoding,document.body.appendChild(i.domElement),(e=new h.PerspectiveCamera(60,window.innerWidth/window.innerHeight,1,4e3)).position.set(400,400,400),(t=new u.OrbitControls(e,i.domElement)).screenSpacePanning=!1,t.minDistance=1,t.maxDistance=2e3,(a=new h.DirectionalLight(16777215,1.25)).position.set(1,2,3).multiplyScalar(40),a.castShadow=!0,a.shadow.bias=-.01,a.shadow.mapSize.setScalar(2048);var g=a.shadow.camera;g.left=-200,g.bottom=-200,g.right=200,g.top=200,g.updateProjectionMatrix(),n.add(a);var f=new h.AmbientLight(16777215,.05);n.add(f),r=new h.Group,n.add(r),(new l.B3DMLoader).load("https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/master/tilesets/TilesetWithRequestVolume/city/lr.b3dm").then(function(e){console.log(e),d=e.scene,r.add(d);var t=new h.Box3;t.setFromObject(d),t.getCenter(r.position).multiplyScalar(-1),d.traverse(function(e){e.isMesh&&(e.material=new h.ShaderMaterial(m(h.ShaderLib.standard)))})}),o=new h.Raycaster,c=new h.Vector2,v(),window.addEventListener("resize",v,!1),i.domElement.addEventListener("mousemove",p,!1)}function p(t){var i=this.getBoundingClientRect();c.x=t.clientX-i.x,c.y=t.clientY-i.y,c.x=c.x/i.width*2-1,c.y=-c.y/i.height*2+1,o.setFromCamera(c,e);var r=o.intersectObject(n,!0),a=-1;if(r.length){var l=r[0],h=l.face,u=l.object,g=u.geometry.getAttribute("_batchid");if(g){for(var f=u;!f.batchTable;)f=f.parent;var w=f.batchTable;a=g.getX(h.a),s.innerText="_batchid : ".concat(a,"\n")+"Latitude : ".concat(w.getData("Latitude")[a].toFixed(3),"\n")+"Longitude : ".concat(w.getData("Longitude")[a].toFixed(3),"\n")+"Height : ".concat(w.getData("Height")[a].toFixed(3),"\n")}}else s.innerText="";d&&d.traverse(function(e){e.isMesh&&(e.material.uniforms.highlightedBatchId.value=a)})}function v(){e.aspect=window.innerWidth/window.innerHeight,i.setPixelRatio(window.devicePixelRatio),i.setSize(window.innerWidth,window.innerHeight),e.updateProjectionMatrix()}function y(){requestAnimationFrame(y),x()}function x(){i.render(n,e)}b(),y(); },{"../src/index.js":"uBxZ","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv"}]},{},["Nrb7"], null) //# sourceMappingURL=b3dmExample.f248f632.js.map