soonspacejs 2.2.38 → 2.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- var e="soonspacejs",t="2.2.38";function n(){}Object.assign(n.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}},dispatchEvent:function(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,r=n.length;t<r;t++)n[t].call(this,e)}}});const r=[];for(let e=0;e<256;e++)r[e]=(e<16?"0":"")+e.toString(16);let i=1234567;const o={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(r[255&e]+r[e>>8&255]+r[e>>16&255]+r[e>>24&255]+"-"+r[255&t]+r[t>>8&255]+"-"+r[t>>16&15|64]+r[t>>24&255]+"-"+r[63&n|128]+r[n>>8&255]+"-"+r[n>>16&255]+r[n>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(i=e%2147483647),i=16807*i%2147483647,(i-1)/2147483646},degToRad:function(e){return e*o.DEG2RAD},radToDeg:function(e){return e*o.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),c=o((t+r)/2),h=s((t+r)/2),u=o((t-r)/2),d=s((t-r)/2),p=o((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(a*h,l*u,l*d,a*c);break;case"YZY":e.set(l*d,a*h,l*u,a*c);break;case"ZXZ":e.set(l*u,l*d,a*h,a*c);break;case"XZX":e.set(a*h,l*f,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*f,a*c);break;case"ZYZ":e.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};class s{constructor(e=0,t=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}class a{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(e,t,n,r,i,o,s,a,l){const c=this.elements;return c[0]=e,c[1]=r,c[2]=s,c[3]=t,c[4]=i,c[5]=a,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],_=r[5],w=r[8];return i[0]=o*f+s*v+a*b,i[3]=o*m+s*y+a*_,i[6]=o*g+s*x+a*w,i[1]=l*f+c*v+h*b,i[4]=l*m+c*y+h*_,i[7]=l*g+c*x+h*w,i[2]=u*f+d*v+p*b,i[5]=u*m+d*y+p*_,i[8]=u*g+d*x+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8];return t*o*c-t*s*l-n*i*c+n*s*a+r*i*l-r*o*a}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=c*o-s*l,u=s*a-c*i,d=l*i-o*a,p=t*h+n*u+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(r*l-c*n)*f,e[2]=(s*n-r*o)*f,e[3]=u*f,e[4]=(c*t-r*a)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*a-l*t)*f,e[8]=(o*t-n*i)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).copy(this).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,o,s){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*o+l*s)+o+e,-r*l,r*a,-r*(-l*o+a*s)+s+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],o=r[3],s=r[6],a=r[1],l=r[4],c=r[7];return r[0]=t*i+n*a,r[3]=t*o+n*l,r[6]=t*s+n*c,r[1]=-n*i+t*a,r[4]=-n*o+t*l,r[7]=-n*s+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}let l;const c={getDataURL:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===l&&(l=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),l.width=e.width,l.height=e.height;const n=l.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=l}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}};let h=0;function u(e=u.DEFAULT_IMAGE,t=u.DEFAULT_MAPPING,n=1001,r=1001,i=1006,l=1008,c=1023,d=1009,p=1,f=3e3){Object.defineProperty(this,"id",{value:h++}),this.uuid=o.generateUUID(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=l,this.anisotropy=p,this.format=c,this.internalFormat=null,this.type=d,this.offset=new s(0,0),this.repeat=new s(1,1),this.center=new s(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new a,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=f,this.version=0,this.onUpdate=null}function d(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?c.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}u.DEFAULT_IMAGE=void 0,u.DEFAULT_MAPPING=300,u.prototype=Object.assign(Object.create(n.prototype),{constructor:u,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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=o.generateUUID()),!t&&void 0===e.images[r.uuid]){let t;if(Array.isArray(r)){t=[];for(let e=0,n=r.length;e<n;e++)r[e].isDataTexture?t.push(d(r[e].image)):t.push(d(r[e]))}else t=d(r);e.images[r.uuid]={uuid:r.uuid,url:t}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(u.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});class p{constructor(e=0,t=0,n=0,r=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i;const o=.01,s=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)<o&&Math.abs(h-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+u)<s&&Math.abs(h+f)<s&&Math.abs(p+m)<s&&Math.abs(l+d+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,a=(d+1)/2,v=(g+1)/2,y=(c+u)/4,x=(h+f)/4,b=(p+m)/4;return e>a&&e>v?e<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=y/n,i=x/n):a>v?a<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(a),n=y/r,i=b/r):v<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=x/i,r=b/i),this.set(n,r,i,t),this}let v=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(u-c)*(u-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(h-f)/v,this.z=(u-c)/v,this.w=Math.acos((l+d+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}function f(e,t,n){this.width=e,this.height=t,this.scissor=new p(0,0,e,t),this.scissorTest=!1,this.viewport=new p(0,0,e,t),n=n||{},this.texture=new u(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=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,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 m(e,t,n){f.call(this,e,t,n),this.samples=4}f.prototype=Object.assign(Object.create(n.prototype),{constructor:f,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),m.prototype=Object.assign(Object.create(f.prototype),{constructor:m,isWebGLMultisampleRenderTarget:!0,copy:function(e){return f.prototype.copy.call(this,e),this.samples=e.samples,this}});class g{constructor(e=0,t=0,n=0,r=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=e,this._y=t,this._z=n,this._w=r}static slerp(e,t,n,r){return n.copy(e).slerp(t,r)}static slerpFlat(e,t,n,r,i,o,s){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[o+0],d=i[o+1],p=i[o+2],f=i[o+3];if(h!==f||a!==u||l!==d||c!==p){let e=1-s;const t=a*u+l*d+c*p+h*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){const i=Math.sqrt(r),o=Math.atan2(i,t*n);e=Math.sin(e*o)/i,s=Math.sin(s*o)/i}const i=s*n;if(a=a*e+u*i,l=l*e+d*i,c=c*e+p*i,h=h*e+f*i,e===1-s){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,i,o){const s=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[o],u=i[o+1],d=i[o+2],p=i[o+3];return e[t]=s*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-s*d,e[t+2]=l*p+c*d+s*u-a*h,e[t+3]=c*p-s*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,r=e._y,i=e._z,o=e._order,s=Math.cos,a=Math.sin,l=s(n/2),c=s(r/2),h=s(i/2),u=a(n/2),d=a(r/2),p=a(i/2);switch(o){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],s=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+s+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(i-l)*e,this._z=(o-r)*e}else if(n>s&&n>h){const e=2*Math.sqrt(1+n-s-h);this._w=(c-a)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(i+l)/e}else if(s>h){const e=2*Math.sqrt(1+s-n-h);this._w=(i-l)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-s);this._w=(o-r)/e,this._x=(i+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(o.clamp(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,i=e._z,o=e._w,s=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+o*s+r*l-i*a,this._y=r*c+o*a+i*s-n*l,this._z=i*c+o*l+n*a-r*s,this._w=o*c-n*s-r*a-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,r=this._y,i=this._z,o=this._w;let s=o*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;const a=1-s*s;if(a<=Number.EPSILON){const e=1-t;return this._w=e*o+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}class v{constructor(e=0,t=0,n=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(x.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(x.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,s=e.z,a=e.w,l=a*t+o*r-s*n,c=a*n+s*t-i*r,h=a*r+i*n-o*t,u=-i*t-o*n-s*r;return this.x=l*a+u*-i+c*-s-h*-o,this.y=c*a+u*-o+h*-i-l*-s,this.z=h*a+u*-s+l*-o-c*-i,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,i=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return y.copy(this).projectOnVector(e),this.sub(y)}reflect(e){return this.sub(y.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(o.clamp(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}const y=new v,x=new g;class b{constructor(e,t){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==e?e:new v(1/0,1/0,1/0),this.max=void 0!==t?t:new v(-1/0,-1/0,-1/0)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;for(let a=0,l=e.length;a<l;a+=3){const l=e[a],c=e[a+1],h=e[a+2];l<t&&(t=l),c<n&&(n=c),h<r&&(r=h),l>i&&(i=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(t,n,r),this.max.set(i,o,s),this}setFromBufferAttribute(e){let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;for(let a=0,l=e.count;a<l;a++){const l=e.getX(a),c=e.getY(a),h=e.getZ(a);l<t&&(t=l),c<n&&(n=c),h<r&&(r=h),l>i&&(i=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(t,n,r),this.max.set(i,o,s),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=M.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new v),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new v),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);const t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),S.copy(t.boundingBox),S.applyMatrix4(e.matrixWorld),this.union(S));const n=e.children;for(let e=0,t=n.length;e<t;e++)this.expandByObject(n[e]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new v),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,M),M.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(R),I.subVectors(this.max,R),T.subVectors(e.a,R),A.subVectors(e.b,R),E.subVectors(e.c,R),P.subVectors(A,T),L.subVectors(E,A),C.subVectors(T,E);let t=[0,-P.z,P.y,0,-L.z,L.y,0,-C.z,C.y,P.z,0,-P.x,L.z,0,-L.x,C.z,0,-C.x,-P.y,P.x,0,-L.y,L.x,0,-C.y,C.x,0];return!!_(t,T,A,E,I)&&(t=[1,0,0,0,1,0,0,0,1],!!_(t,T,A,E,I)&&(F.crossVectors(P,L),t=[F.x,F.y,F.z],_(t,T,A,E,I)))}clampPoint(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new v),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return M.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(M).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(w[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),w[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),w[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),w[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),w[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),w[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),w[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),w[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(w)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}function _(e,t,n,r,i){for(let o=0,s=e.length-3;o<=s;o+=3){O.fromArray(e,o);const s=i.x*Math.abs(O.x)+i.y*Math.abs(O.y)+i.z*Math.abs(O.z),a=t.dot(O),l=n.dot(O),c=r.dot(O);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>s)return!1}return!0}const w=[new v,new v,new v,new v,new v,new v,new v,new v],M=new v,S=new b,T=new v,A=new v,E=new v,P=new v,L=new v,C=new v,R=new v,I=new v,F=new v,O=new v,N=new b;class D{constructor(e,t){this.center=void 0!==e?e:new v,this.radius=void 0!==t?t:-1}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):N.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new v),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new b),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}}const B=new v,U=new v,k=new v,z=new v,G=new v,H=new v,j=new v;class V{constructor(e,t){this.origin=void 0!==e?e:new v,this.direction=void 0!==t?t:new v(0,0,-1)}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new v),t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,B)),this}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new v),t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=B.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(B.copy(this.direction).multiplyScalar(t).add(this.origin),B.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){U.copy(e).add(t).multiplyScalar(.5),k.copy(t).sub(e).normalize(),z.copy(this.origin).sub(U);const i=.5*e.distanceTo(t),o=-this.direction.dot(k),s=z.dot(this.direction),a=-z.dot(k),l=z.lengthSq(),c=Math.abs(1-o*o);let h,u,d,p;if(c>0)if(h=o*a-s,u=o*s-a,p=i*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+o*u+2*s)+u*(o*h+u+2*a)+l}else u=i,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u=-i,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-o*i+s)),u=h>0?-i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-i,-a),i),d=u*(u+2*a)+l):(h=Math.max(0,-(o*i+s)),u=h>0?i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l);else u=o>0?-i:i,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(k).multiplyScalar(u).add(U),d}intersectSphere(e,t){B.subVectors(e.center,this.origin);const n=B.dot(this.direction),r=B.dot(B)-n*n,i=e.radius*e.radius;if(r>i)return null;const o=Math.sqrt(i-r),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,o,s,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),c>=0?(i=(e.min.y-u.y)*c,o=(e.max.y-u.y)*c):(i=(e.max.y-u.y)*c,o=(e.min.y-u.y)*c),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),h>=0?(s=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(s=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||s>r?null:((s>n||n!=n)&&(n=s),(a<r||r!=r)&&(r=a),r<0?null:this.at(n>=0?n:r,t)))}intersectsBox(e){return null!==this.intersectBox(e,B)}intersectTriangle(e,t,n,r,i){G.subVectors(t,e),H.subVectors(n,e),j.crossVectors(G,H);let o,s=this.direction.dot(j);if(s>0){if(r)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}z.subVectors(this.origin,e);const a=o*this.direction.dot(H.crossVectors(z,H));if(a<0)return null;const l=o*this.direction.dot(G.cross(z));if(l<0)return null;if(a+l>s)return null;const c=-o*z.dot(j);return c<0?null:this.at(c/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}class W{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(e,t,n,r,i,o,s,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,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 W).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/X.setFromMatrixColumn(e,0).length(),i=1/X.setFromMatrixColumn(e,1).length(),o=1/X.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===e.order){const e=o*c,n=o*h,r=s*c,i=s*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*a,t[2]=i-e*l,t[6]=r+n*l,t[10]=o*a}else if("YXZ"===e.order){const e=a*c,n=a*h,r=l*c,i=l*h;t[0]=e+i*s,t[4]=r*s-n,t[8]=o*l,t[1]=o*h,t[5]=o*c,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=o*a}else if("ZXY"===e.order){const e=a*c,n=a*h,r=l*c,i=l*h;t[0]=e-i*s,t[4]=-o*h,t[8]=r+n*s,t[1]=n+r*s,t[5]=o*c,t[9]=i-e*s,t[2]=-o*l,t[6]=s,t[10]=o*a}else if("ZYX"===e.order){const e=o*c,n=o*h,r=s*c,i=s*h;t[0]=a*c,t[4]=r*l-n,t[8]=e*l+i,t[1]=a*h,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*a,t[10]=o*a}else if("YZX"===e.order){const e=o*a,n=o*l,r=s*a,i=s*l;t[0]=a*c,t[4]=i-e*h,t[8]=r*h+n,t[1]=h,t[5]=o*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*h+r,t[10]=e-i*h}else if("XZY"===e.order){const e=o*a,n=o*l,r=s*a,i=s*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+i,t[5]=o*c,t[9]=n*h-r,t[2]=r*h-n,t[6]=s*c,t[10]=i*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(q,e,Q)}lookAt(e,t,n){const r=this.elements;return K.subVectors(e,t),0===K.lengthSq()&&(K.z=1),K.normalize(),Z.crossVectors(n,K),0===Z.lengthSq()&&(1===Math.abs(n.z)?K.x+=1e-4:K.z+=1e-4,K.normalize(),Z.crossVectors(n,K)),Z.normalize(),J.crossVectors(K,Z),r[0]=Z.x,r[4]=J.x,r[8]=K.x,r[1]=Z.y,r[5]=J.y,r[9]=K.y,r[2]=Z.z,r[6]=J.z,r[10]=K.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=r[0],w=r[4],M=r[8],S=r[12],T=r[1],A=r[5],E=r[9],P=r[13],L=r[2],C=r[6],R=r[10],I=r[14],F=r[3],O=r[7],N=r[11],D=r[15];return i[0]=o*_+s*T+a*L+l*F,i[4]=o*w+s*A+a*C+l*O,i[8]=o*M+s*E+a*R+l*N,i[12]=o*S+s*P+a*I+l*D,i[1]=c*_+h*T+u*L+d*F,i[5]=c*w+h*A+u*C+d*O,i[9]=c*M+h*E+u*R+d*N,i[13]=c*S+h*P+u*I+d*D,i[2]=p*_+f*T+m*L+g*F,i[6]=p*w+f*A+m*C+g*O,i[10]=p*M+f*E+m*R+g*N,i[14]=p*S+f*P+m*I+g*D,i[3]=v*_+y*T+x*L+b*F,i[7]=v*w+y*A+x*C+b*O,i[11]=v*M+y*E+x*R+b*N,i[15]=v*S+y*P+x*I+b*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],s=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+i*a*h-r*l*h-i*s*u+n*l*u+r*s*d-n*a*d)+e[7]*(+t*a*d-t*l*u+i*o*u-r*o*d+r*l*c-i*a*c)+e[11]*(+t*l*h-t*s*d-i*o*h+n*o*d+i*s*c-n*l*c)+e[15]*(-r*s*c-t*a*h+t*s*u+r*o*h-n*o*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*u*l+f*a*d-s*m*d-h*a*g+s*u*g,y=p*u*l-c*m*l-p*a*d+o*m*d+c*a*g-o*u*g,x=c*f*l-p*h*l+p*s*d-o*f*d-c*s*g+o*h*g,b=p*h*a-c*f*a-p*s*u+o*f*u+c*s*m-o*h*m,_=t*v+n*y+r*x+i*b;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=v*w,e[1]=(f*u*i-h*m*i-f*r*d+n*m*d+h*r*g-n*u*g)*w,e[2]=(s*m*i-f*a*i+f*r*l-n*m*l-s*r*g+n*a*g)*w,e[3]=(h*a*i-s*u*i-h*r*l+n*u*l+s*r*d-n*a*d)*w,e[4]=y*w,e[5]=(c*m*i-p*u*i+p*r*d-t*m*d-c*r*g+t*u*g)*w,e[6]=(p*a*i-o*m*i-p*r*l+t*m*l+o*r*g-t*a*g)*w,e[7]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*d+t*a*d)*w,e[8]=x*w,e[9]=(p*h*i-c*f*i-p*n*d+t*f*d+c*n*g-t*h*g)*w,e[10]=(o*f*i-p*s*i+p*n*l-t*f*l-o*n*g+t*s*g)*w,e[11]=(c*s*i-o*h*i-c*n*l+t*h*l+o*n*d-t*s*d)*w,e[12]=b*w,e[13]=(c*f*r-p*h*r+p*n*u-t*f*u-c*n*m+t*h*m)*w,e[14]=(p*s*r-o*f*r-p*n*a+t*f*a+o*n*m-t*s*m)*w,e[15]=(o*h*r-c*s*r+c*n*a-t*h*a-o*n*u+t*s*u)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,s=e.y,a=e.z,l=i*o,c=i*s;return this.set(l*o+n,l*s-r*a,l*a+r*s,0,l*s+r*a,c*s+n,c*a-r*o,0,l*a-r*s,c*a+r*o,i*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,i=t._x,o=t._y,s=t._z,a=t._w,l=i+i,c=o+o,h=s+s,u=i*l,d=i*c,p=i*h,f=o*c,m=o*h,g=s*h,v=a*l,y=a*c,x=a*h,b=n.x,_=n.y,w=n.z;return r[0]=(1-(f+g))*b,r[1]=(d+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(d-x)*_,r[5]=(1-(u+g))*_,r[6]=(m+v)*_,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(u+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let i=X.set(r[0],r[1],r[2]).length();const o=X.set(r[4],r[5],r[6]).length(),s=X.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Y.copy(this);const a=1/i,l=1/o,c=1/s;return Y.elements[0]*=a,Y.elements[1]*=a,Y.elements[2]*=a,Y.elements[4]*=l,Y.elements[5]*=l,Y.elements[6]*=l,Y.elements[8]*=c,Y.elements[9]*=c,Y.elements[10]*=c,t.setFromRotationMatrix(Y),n.x=i,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,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*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),h=(n+r)/(n-r),u=-(o+i)/(o-i),d=-2*o*i/(o-i);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,o){const s=this.elements,a=1/(t-e),l=1/(n-r),c=1/(o-i),h=(t+e)*a,u=(n+r)*l,d=(o+i)*c;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const X=new v,Y=new W,q=new v(0,0,0),Q=new v(1,1,1),Z=new v,J=new v,K=new v;class ${constructor(e=0,t=0,n=0,r=$.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t,n){const r=o.clamp,i=e.elements,s=i[0],a=i[4],l=i[8],c=i[1],h=i[5],u=i[9],d=i[2],p=i[6],f=i[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,f),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(l,f));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ee.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ee,t,n)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return te.setFromEuler(this),this.setFromQuaternion(te,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new v(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}$.DefaultOrder="XYZ",$.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const ee=new W,te=new g;class ne{constructor(){this.mask=1}set(e){this.mask=1<<e|0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return 0!=(this.mask&e.mask)}}let re=0;const ie=new v,oe=new g,se=new W,ae=new v,le=new v,ce=new v,he=new g,ue=new v(1,0,0),de=new v(0,1,0),pe=new v(0,0,1),fe={type:"added"},me={type:"removed"};function ge(){Object.defineProperty(this,"id",{value:re++}),this.uuid=o.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ge.DefaultUp.clone();const e=new v,t=new $,n=new g,r=new v(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new W},normalMatrix:{value:new a}}),this.matrix=new W,this.matrixWorld=new W,this.matrixAutoUpdate=ge.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ne,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}ge.DefaultUp=new v(0,1,0),ge.DefaultMatrixAutoUpdate=!0,ge.prototype=Object.assign(Object.create(n.prototype),{constructor:ge,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return oe.setFromAxisAngle(e,t),this.quaternion.multiply(oe),this},rotateOnWorldAxis:function(e,t){return oe.setFromAxisAngle(e,t),this.quaternion.premultiply(oe),this},rotateX:function(e){return this.rotateOnAxis(ue,e)},rotateY:function(e){return this.rotateOnAxis(de,e)},rotateZ:function(e){return this.rotateOnAxis(pe,e)},translateOnAxis:function(e,t){return ie.copy(e).applyQuaternion(this.quaternion),this.position.add(ie.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(ue,e)},translateY:function(e){return this.translateOnAxis(de,e)},translateZ:function(e){return this.translateOnAxis(pe,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(se.copy(this.matrixWorld).invert())},lookAt:function(e,t,n){e.isVector3?ae.copy(e):ae.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),le.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?se.lookAt(le,ae,this.up):se.lookAt(ae,le,this.up),this.quaternion.setFromRotationMatrix(se),r&&(se.extractRotation(r.matrixWorld),oe.setFromRotationMatrix(se),this.quaternion.premultiply(oe.invert()))},add:function(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(fe)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(me)),this},clear:function(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(me)}return this.children.length=0,this},attach:function(e){return this.updateWorldMatrix(!0,!1),se.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),se.multiply(e.parent.matrixWorld)),e.applyMatrix4(se),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new v),this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new g),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(le,e,ce),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new v),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(le,he,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new v),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)},traverseAncestors:function(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}},toJSON:function(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){const t=o(e.geometries),r=o(e.materials),i=o(e.textures),s=o(e.images),a=o(e.shapes),l=o(e.skeletons),c=o(e.animations);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function o(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}});const ve=new v,ye=new v,xe=new a;class be{constructor(e,t){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==e?e:new v(1,0,0),this.constant=void 0!==t?t:0}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=ve.subVectors(n,t).cross(ye.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new v),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new v);const n=e.delta(ve),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;const i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:t.copy(n).multiplyScalar(i).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new v),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||xe.getNormalMatrix(e),r=this.coplanarPoint(ve).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}const _e=new v,we=new v,Me=new v,Se=new v,Te=new v,Ae=new v,Ee=new v,Pe=new v,Le=new v,Ce=new v;class Re{constructor(e,t,n){this.a=void 0!==e?e:new v,this.b=void 0!==t?t:new v,this.c=void 0!==n?n:new v}static getNormal(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new v),r.subVectors(n,t),_e.subVectors(e,t),r.cross(_e);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){_e.subVectors(r,t),we.subVectors(n,t),Me.subVectors(e,t);const o=_e.dot(_e),s=_e.dot(we),a=_e.dot(Me),l=we.dot(we),c=we.dot(Me),h=o*l-s*s;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new v),0===h)return i.set(-2,-1,-1);const u=1/h,d=(l*a-s*c)*u,p=(o*c-s*a)*u;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Se),Se.x>=0&&Se.y>=0&&Se.x+Se.y<=1}static getUV(e,t,n,r,i,o,s,a){return this.getBarycoord(e,t,n,r,Se),a.set(0,0),a.addScaledVector(i,Se.x),a.addScaledVector(o,Se.y),a.addScaledVector(s,Se.z),a}static isFrontFacing(e,t,n,r){return _e.subVectors(n,t),we.subVectors(e,t),_e.cross(we).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _e.subVectors(this.c,this.b),we.subVectors(this.a,this.b),.5*_e.cross(we).length()}getMidpoint(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new v),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Re.getNormal(this.a,this.b,this.c,e)}getPlane(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new be),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Re.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,i){return Re.getUV(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return Re.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Re.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new v);const n=this.a,r=this.b,i=this.c;let o,s;Te.subVectors(r,n),Ae.subVectors(i,n),Pe.subVectors(e,n);const a=Te.dot(Pe),l=Ae.dot(Pe);if(a<=0&&l<=0)return t.copy(n);Le.subVectors(e,r);const c=Te.dot(Le),h=Ae.dot(Le);if(c>=0&&h<=c)return t.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return o=a/(a-c),t.copy(n).addScaledVector(Te,o);Ce.subVectors(e,i);const d=Te.dot(Ce),p=Ae.dot(Ce);if(p>=0&&d<=p)return t.copy(i);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(n).addScaledVector(Ae,s);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return Ee.subVectors(i,r),s=(h-c)/(h-c+(d-p)),t.copy(r).addScaledVector(Ee,s);const g=1/(m+f+u);return o=f*g,s=u*g,t.copy(n).addScaledVector(Te,o).addScaledVector(Ae,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ie={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},Fe={h:0,s:0,l:0},Oe={h:0,s:0,l:0};function Ne(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function De(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Be(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Ue{constructor(e,t,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=o.euclideanModulo(e,1),t=o.clamp(t,0,1),n=o.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Ne(i,r,e+1/3),this.g=Ne(i,r,e),this.b=Ne(i,r,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){let e;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(e=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Ie[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){const n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=De(e.r),this.g=De(e.g),this.b=De(e.b),this}copyLinearToSRGB(e){return this.r=Be(e.r),this.g=Be(e.g),this.b=Be(e.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(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});const t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),o=Math.min(t,n,r);let s,a;const l=(o+i)/2;if(o===i)s=0,a=0;else{const e=i-o;switch(a=l<=.5?e/(i+o):e/(2-i-o),i){case t:s=(n-r)/e+(n<r?6:0);break;case n:s=(r-t)/e+2;break;case r:s=(t-n)/e+4}s/=6}return e.h=s,e.s=a,e.l=l,e}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(e,t,n){return this.getHSL(Fe),Fe.h+=e,Fe.s+=t,Fe.l+=n,this.setHSL(Fe.h,Fe.s,Fe.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpHSL(e,t){this.getHSL(Fe),e.getHSL(Oe);const n=o.lerp(Fe.h,Oe.h,t),r=o.lerp(Fe.s,Oe.s,t),i=o.lerp(Fe.l,Oe.l,t);return this.setHSL(n,r,i),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),!0===e.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Ue.NAMES=Ie,Ue.prototype.r=1,Ue.prototype.g=1,Ue.prototype.b=1;class ke{constructor(e,t,n,r,i,o=0){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new v,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new Ue,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=o}clone(){return(new this.constructor).copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}let ze=0;function Ge(){Object.defineProperty(this,"id",{value:ze++}),this.uuid=o.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function He(e){Ge.call(this),this.type="MeshBasicMaterial",this.color=new Ue(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}Ge.prototype=Object.assign(Object.create(n.prototype),{constructor:Ge,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}},toJSON:function(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(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),t){const t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ge.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),He.prototype=Object.create(Ge.prototype),He.prototype.constructor=He,He.prototype.isMeshBasicMaterial=!0,He.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};const je=new v,Ve=new s;function We(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function Xe(e,t,n){We.call(this,new Int8Array(e),t,n)}function Ye(e,t,n){We.call(this,new Uint8Array(e),t,n)}function qe(e,t,n){We.call(this,new Uint8ClampedArray(e),t,n)}function Qe(e,t,n){We.call(this,new Int16Array(e),t,n)}function Ze(e,t,n){We.call(this,new Uint16Array(e),t,n)}function Je(e,t,n){We.call(this,new Int32Array(e),t,n)}function Ke(e,t,n){We.call(this,new Uint32Array(e),t,n)}function $e(e,t,n){We.call(this,new Uint16Array(e),t,n)}function et(e,t,n){We.call(this,new Float32Array(e),t,n)}function tt(e,t,n){We.call(this,new Float64Array(e),t,n)}Object.defineProperty(We.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(We.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new Ue),t[n++]=i.r,t[n++]=i.g,t[n++]=i.b}return this},copyVector2sArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new s),t[n++]=i.x,t[n++]=i.y}return this},copyVector3sArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new v),t[n++]=i.x,t[n++]=i.y,t[n++]=i.z}return this},copyVector4sArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new p),t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n++]=i.w}return this},applyMatrix3:function(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)Ve.fromBufferAttribute(this,t),Ve.applyMatrix3(e),this.setXY(t,Ve.x,Ve.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)je.fromBufferAttribute(this,t),je.applyMatrix3(e),this.setXYZ(t,je.x,je.y,je.z);return this},applyMatrix4:function(e){for(let t=0,n=this.count;t<n;t++)je.x=this.getX(t),je.y=this.getY(t),je.z=this.getZ(t),je.applyMatrix4(e),this.setXYZ(t,je.x,je.y,je.z);return this},applyNormalMatrix:function(e){for(let t=0,n=this.count;t<n;t++)je.x=this.getX(t),je.y=this.getY(t),je.z=this.getZ(t),je.applyNormalMatrix(e),this.setXYZ(t,je.x,je.y,je.z);return this},transformDirection:function(e){for(let t=0,n=this.count;t<n;t++)je.x=this.getX(t),je.y=this.getY(t),je.z=this.getZ(t),je.transformDirection(e),this.setXYZ(t,je.x,je.y,je.z);return this},set:function(e,t=0){return this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Xe.prototype=Object.create(We.prototype),Xe.prototype.constructor=Xe,Ye.prototype=Object.create(We.prototype),Ye.prototype.constructor=Ye,qe.prototype=Object.create(We.prototype),qe.prototype.constructor=qe,Qe.prototype=Object.create(We.prototype),Qe.prototype.constructor=Qe,Ze.prototype=Object.create(We.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(We.prototype),Je.prototype.constructor=Je,Ke.prototype=Object.create(We.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(We.prototype),$e.prototype.constructor=$e,$e.prototype.isFloat16BufferAttribute=!0,et.prototype=Object.create(We.prototype),et.prototype.constructor=et,tt.prototype=Object.create(We.prototype),tt.prototype.constructor=tt;class nt{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let n,r,i;const o=e.faces;for(r=0;r<o.length;r++){const e=o[r];e.materialIndex!==i&&(i=e.materialIndex,void 0!==n&&(n.count=3*r-n.start,t.push(n)),n={start:3*r,materialIndex:i})}void 0!==n&&(n.count=3*r-n.start,t.push(n)),this.groups=t}fromGeometry(e){const t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,a=e.morphTargets,l=a.length;let c;if(l>0){c=[];for(let e=0;e<l;e++)c[e]={name:a[e].name,data:[]};this.morphTargets.position=c}const h=e.morphNormals,u=h.length;let d;if(u>0){d=[];for(let e=0;e<u;e++)d[e]={name:h[e].name,data:[]};this.morphTargets.normal=d}const p=e.skinIndices,f=e.skinWeights,m=p.length===n.length,g=f.length===n.length;n.length>0&&0===t.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let e=0;e<t.length;e++){const v=t[e];this.vertices.push(n[v.a],n[v.b],n[v.c]);const y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{const e=v.normal;this.normals.push(e,e,e)}const x=v.vertexColors;if(3===x.length)this.colors.push(x[0],x[1],x[2]);else{const e=v.color;this.colors.push(e,e,e)}if(!0===i){const t=r[0][e];void 0!==t?this.uvs.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",e),this.uvs.push(new s,new s,new s))}if(!0===o){const t=r[1][e];void 0!==t?this.uvs2.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",e),this.uvs2.push(new s,new s,new s))}for(let e=0;e<l;e++){const t=a[e].vertices;c[e].data.push(t[v.a],t[v.b],t[v.c])}for(let t=0;t<u;t++){const n=h[t].vertexNormals[e];d[t].data.push(n.a,n.b,n.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}}function rt(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}const it={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ot(e,t){return new it[e](t)}let st=1;const at=new W,lt=new ge,ct=new v,ht=new b,ut=new b,dt=new v;function pt(){Object.defineProperty(this,"id",{value:st+=2}),this.uuid=o.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={}}pt.prototype=Object.assign(Object.create(n.prototype),{constructor:pt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(rt(e)>65535?Ke:Ze)(e,1):this.index=e,this},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},hasAttribute:function(e){return void 0!==this.attributes[e]},addGroup:function(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new a).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return at.makeRotationX(e),this.applyMatrix4(at),this},rotateY:function(e){return at.makeRotationY(e),this.applyMatrix4(at),this},rotateZ:function(e){return at.makeRotationZ(e),this.applyMatrix4(at),this},translate:function(e,t,n){return at.makeTranslation(e,t,n),this.applyMatrix4(at),this},scale:function(e,t,n){return at.makeScale(e,t,n),this.applyMatrix4(at),this},lookAt:function(e){return lt.lookAt(e),lt.updateMatrix(),this.applyMatrix4(lt.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ct).negate(),this.translate(ct.x,ct.y,ct.z),this},setFromObject:function(e){const t=e.geometry;if(e.isPoints||e.isLine){const e=new et(3*t.vertices.length,3),n=new et(3*t.colors.length,3);if(this.setAttribute("position",e.copyVector3sArray(t.vertices)),this.setAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){const e=new et(t.lineDistances.length,1);this.setAttribute("lineDistance",e.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new et(t,3)),this},updateFromObject:function(e){let t=e.geometry;if(e.isMesh){let e=t.__directGeometry;if(!0===t.elementsNeedUpdate&&(e=void 0,t.elementsNeedUpdate=!1),void 0===e)return this.fromGeometry(t);e.verticesNeedUpdate=t.verticesNeedUpdate,e.normalsNeedUpdate=t.normalsNeedUpdate,e.colorsNeedUpdate=t.colorsNeedUpdate,e.uvsNeedUpdate=t.uvsNeedUpdate,e.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=e}if(!0===t.verticesNeedUpdate){const e=this.attributes.position;void 0!==e&&(e.copyVector3sArray(t.vertices),e.needsUpdate=!0),t.verticesNeedUpdate=!1}if(!0===t.normalsNeedUpdate){const e=this.attributes.normal;void 0!==e&&(e.copyVector3sArray(t.normals),e.needsUpdate=!0),t.normalsNeedUpdate=!1}if(!0===t.colorsNeedUpdate){const e=this.attributes.color;void 0!==e&&(e.copyColorsArray(t.colors),e.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){const e=this.attributes.uv;void 0!==e&&(e.copyVector2sArray(t.uvs),e.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){const e=this.attributes.lineDistance;void 0!==e&&(e.copyArray(t.lineDistances),e.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new nt).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){const t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new We(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){const t=new Float32Array(3*e.normals.length);this.setAttribute("normal",new We(t,3).copyVector3sArray(e.normals))}if(e.colors.length>0){const t=new Float32Array(3*e.colors.length);this.setAttribute("color",new We(t,3).copyColorsArray(e.colors))}if(e.uvs.length>0){const t=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new We(t,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){const t=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new We(t,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(const t in e.morphTargets){const n=[],r=e.morphTargets[t];for(let e=0,t=r.length;e<t;e++){const t=r[e],i=new et(3*t.data.length,3);i.name=t.name,n.push(i.copyVector3sArray(t.data))}this.morphAttributes[t]=n}if(e.skinIndices.length>0){const t=new et(4*e.skinIndices.length,4);this.setAttribute("skinIndex",t.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){const t=new et(4*e.skinWeights.length,4);this.setAttribute("skinWeight",t.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new b);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.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 v(-1/0,-1/0,-1/0),new v(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ht.setFromBufferAttribute(n),this.morphTargetsRelative?(dt.addVectors(this.boundingBox.min,ht.min),this.boundingBox.expandByPoint(dt),dt.addVectors(this.boundingBox.max,ht.max),this.boundingBox.expandByPoint(dt)):(this.boundingBox.expandByPoint(ht.min),this.boundingBox.expandByPoint(ht.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new D);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new v,1/0);if(e){const n=this.boundingSphere.center;if(ht.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ut.setFromBufferAttribute(n),this.morphTargetsRelative?(dt.addVectors(ht.min,ut.min),ht.expandByPoint(dt),dt.addVectors(ht.max,ut.max),ht.expandByPoint(dt)):(ht.expandByPoint(ut.min),ht.expandByPoint(ut.max))}ht.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)dt.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(dt));if(t)for(let i=0,o=t.length;i<o;i++){const o=t[i],s=this.morphTargetsRelative;for(let t=0,i=o.count;t<i;t++)dt.fromBufferAttribute(o,t),s&&(ct.fromBufferAttribute(e,t),dt.add(ct)),r=Math.max(r,n.distanceToSquared(dt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new We(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const r=new v,i=new v,o=new v,s=new v,a=new v,l=new v,c=new v,h=new v;if(e)for(let u=0,d=e.count;u<d;u+=3){const d=e.getX(u+0),p=e.getX(u+1),f=e.getX(u+2);r.fromBufferAttribute(t,d),i.fromBufferAttribute(t,p),o.fromBufferAttribute(t,f),c.subVectors(o,i),h.subVectors(r,i),c.cross(h),s.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(c),a.add(c),l.add(c),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),o.fromBufferAttribute(t,e+2),c.subVectors(o,i),h.subVectors(r,i),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(e,t){if(!e||!e.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(void 0===e.attributes[r])continue;const i=n[r].array,o=e.attributes[r],s=o.array,a=o.itemSize*t,l=Math.min(s.length,i.length-a);for(let e=0,t=a;e<l;e++,t++)i[t]=s[e]}return this},normalizeNormals:function(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)dt.fromBufferAttribute(e,t),dt.normalize(),e.setXYZ(t,dt.x,dt.y,dt.z)},toNonIndexed:function(){function e(e,t){const n=e.array,r=e.itemSize,i=e.normalized,o=new n.constructor(t.length*r);let s=0,a=0;for(let e=0,i=t.length;e<i;e++){s=t[e]*r;for(let e=0;e<r;e++)o[a++]=n[s++]}return new We(o,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;const t=new pt,n=this.index.array,r=this.attributes;for(const i in r){const o=e(r[i],n);t.setAttribute(i,o)}const i=this.morphAttributes;for(const r in i){const o=[],s=i[r];for(let t=0,r=s.length;t<r;t++){const r=e(s[t],n);o.push(r)}t.morphAttributes[r]=o}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let e=0,n=o.length;e<n;e++){const n=o[e];t.addGroup(n.start,n.count,n.materialIndex)}return t},toJSON:function(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const r=n[t],i=r.toJSON(e.data);""!==r.name&&(i.name=r.name),e.data.attributes[t]=i}const r={};let i=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],o=[];for(let t=0,r=n.length;t<r;t++){const r=n[t],i=r.toJSON(e.data);""!==r.name&&(i.name=r.name),o.push(i)}o.length>0&&(r[t]=o,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e},clone:function(){return(new pt).copy(this)},copy:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const r=e.attributes;for(const e in r){const n=r[e];this.setAttribute(e,n.clone(t))}const i=e.morphAttributes;for(const e in i){const n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let e=0,t=o.length;e<t;e++){const t=o[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=e.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const ft=new W,mt=new V,gt=new D,vt=new v,yt=new v,xt=new v,bt=new v,_t=new v,wt=new v,Mt=new v,St=new v,Tt=new v,At=new s,Et=new s,Pt=new s,Lt=new v,Ct=new v;function Rt(e=new pt,t=new He){ge.call(this),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}function It(e,t,n,r,i,o,s,a){let l;if(l=1===t.side?r.intersectTriangle(s,o,i,!0,a):r.intersectTriangle(i,o,s,2!==t.side,a),null===l)return null;Ct.copy(a),Ct.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Ct);return c<n.near||c>n.far?null:{distance:c,point:Ct.clone(),object:e}}function Ft(e,t,n,r,i,o,a,l,c,h,u,d){vt.fromBufferAttribute(i,h),yt.fromBufferAttribute(i,u),xt.fromBufferAttribute(i,d);const p=e.morphTargetInfluences;if(t.morphTargets&&o&&p){Mt.set(0,0,0),St.set(0,0,0),Tt.set(0,0,0);for(let e=0,t=o.length;e<t;e++){const t=p[e],n=o[e];0!==t&&(bt.fromBufferAttribute(n,h),_t.fromBufferAttribute(n,u),wt.fromBufferAttribute(n,d),a?(Mt.addScaledVector(bt,t),St.addScaledVector(_t,t),Tt.addScaledVector(wt,t)):(Mt.addScaledVector(bt.sub(vt),t),St.addScaledVector(_t.sub(yt),t),Tt.addScaledVector(wt.sub(xt),t)))}vt.add(Mt),yt.add(St),xt.add(Tt)}e.isSkinnedMesh&&(e.boneTransform(h,vt),e.boneTransform(u,yt),e.boneTransform(d,xt));const f=It(e,t,n,r,vt,yt,xt,Lt);if(f){l&&(At.fromBufferAttribute(l,h),Et.fromBufferAttribute(l,u),Pt.fromBufferAttribute(l,d),f.uv=Re.getUV(Lt,vt,yt,xt,At,Et,Pt,new s)),c&&(At.fromBufferAttribute(c,h),Et.fromBufferAttribute(c,u),Pt.fromBufferAttribute(c,d),f.uv2=Re.getUV(Lt,vt,yt,xt,At,Et,Pt,new s));const e=new ke(h,u,d);Re.getNormal(vt,yt,xt,e.normal),f.face=e}return f}Rt.prototype=Object.assign(Object.create(ge.prototype),{constructor:Rt,isMesh:!0,copy:function(e){return ge.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this},updateMorphTargets:function(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){const n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{const t=e.morphTargets;void 0!==t&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),gt.copy(n.boundingSphere),gt.applyMatrix4(i),!1===e.ray.intersectsSphere(gt))return;if(ft.copy(i).invert(),mt.copy(e.ray).applyMatrix4(ft),null!==n.boundingBox&&!1===mt.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,p=u.length;n<p;n++){const p=u[n],f=r[p.materialIndex];for(let n=Math.max(p.start,d.start),r=Math.min(p.start+p.count,d.start+d.count);n<r;n+=3){const r=i.getX(n),u=i.getX(n+1),d=i.getX(n+2);o=Ft(this,f,e,mt,s,a,l,c,h,r,u,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,t.push(o))}}else{for(let n=Math.max(0,d.start),u=Math.min(i.count,d.start+d.count);n<u;n+=3){const u=i.getX(n),d=i.getX(n+1),p=i.getX(n+2);o=Ft(this,r,e,mt,s,a,l,c,h,u,d,p),o&&(o.faceIndex=Math.floor(n/3),t.push(o))}}else if(void 0!==s)if(Array.isArray(r))for(let n=0,i=u.length;n<i;n++){const i=u[n],p=r[i.materialIndex];for(let n=Math.max(i.start,d.start),r=Math.min(i.start+i.count,d.start+d.count);n<r;n+=3){o=Ft(this,p,e,mt,s,a,l,c,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,t.push(o))}}else{for(let n=Math.max(0,d.start),i=Math.min(s.count,d.start+d.count);n<i;n+=3){o=Ft(this,r,e,mt,s,a,l,c,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),t.push(o))}}}else if(n.isGeometry){const i=Array.isArray(r),a=n.vertices,l=n.faces;let c;const h=n.faceVertexUvs[0];h.length>0&&(c=h);for(let n=0,h=l.length;n<h;n++){const h=l[n],u=i?r[h.materialIndex]:r;if(void 0===u)continue;const d=a[h.a],p=a[h.b],f=a[h.c];if(o=It(this,u,e,mt,d,p,f,Lt),o){if(c&&c[n]){const e=c[n];At.copy(e[0]),Et.copy(e[1]),Pt.copy(e[2]),o.uv=Re.getUV(Lt,d,p,f,At,Et,Pt,new s)}o.face=h,o.faceIndex=n,t.push(o)}}}}});class Ot extends pt{constructor(e=1,t=1,n=1,r=1,i=1,o=1){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const s=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,n,r,i,o,p,f,m,g,y){const x=o/m,b=p/g,_=o/2,w=p/2,M=f/2,S=m+1,T=g+1;let A=0,E=0;const P=new v;for(let o=0;o<T;o++){const s=o*b-w;for(let a=0;a<S;a++){const u=a*x-_;P[e]=u*r,P[t]=s*i,P[n]=M,l.push(P.x,P.y,P.z),P[e]=0,P[t]=0,P[n]=f>0?1:-1,c.push(P.x,P.y,P.z),h.push(a/m),h.push(1-o/g),A+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const n=u+t+S*e,r=u+t+S*(e+1),i=u+(t+1)+S*(e+1),o=u+(t+1)+S*e;a.push(n,r,o),a.push(r,i,o),E+=6}s.addGroup(d,E,y),d+=E,u+=A}p("z","y","x",-1,-1,n,t,e,o,i,0),p("z","y","x",1,-1,n,t,-e,o,i,1),p("x","z","y",1,1,e,n,t,r,o,2),p("x","z","y",1,-1,e,n,-t,r,o,3),p("x","y","z",1,-1,e,t,n,r,i,4),p("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(a),this.setAttribute("position",new et(l,3)),this.setAttribute("normal",new et(c,3)),this.setAttribute("uv",new et(h,2))}}function Nt(e){const t={};for(const n in e){t[n]={};for(const r in e[n]){const i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function Dt(e){const t={};for(let n=0;n<e.length;n++){const r=Nt(e[n]);for(const e in r)t[e]=r[e]}return t}const Bt={clone:Nt,merge:Dt};function Ut(e){Ge.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function kt(){ge.call(this),this.type="Camera",this.matrixWorldInverse=new W,this.projectionMatrix=new W,this.projectionMatrixInverse=new W}function zt(e=50,t=1,n=.1,r=2e3){kt.call(this),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Ut.prototype=Object.create(Ge.prototype),Ut.prototype.constructor=Ut,Ut.prototype.isShaderMaterial=!0,Ut.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nt(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this},Ut.prototype.toJSON=function(e){const t=Ge.prototype.toJSON.call(this,e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t},kt.prototype=Object.assign(Object.create(ge.prototype),{constructor:kt,isCamera:!0,copy:function(e,t){return ge.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new v),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){ge.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(e,t){ge.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),zt.prototype=Object.assign(Object.create(kt.prototype),{constructor:zt,isPerspectiveCamera:!0,copy:function(e,t){return kt.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){const t=.5*this.getFilmHeight()/e;this.fov=2*o.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){const e=Math.tan(.5*o.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*o.RAD2DEG*Math.atan(Math.tan(.5*o.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(e,t,n,r,i,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const e=this.near;let t=e*Math.tan(.5*o.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/e,t-=s.offsetY*n/o,r*=s.width/e,n*=s.height/o}const a=this.filmOffset;0!==a&&(i+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function Gt(e,t,n){if(ge.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 r=new zt(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new v(1,0,0)),this.add(r);const i=new zt(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new v(-1,0,0)),this.add(i);const o=new zt(90,1,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new v(0,1,0)),this.add(o);const s=new zt(90,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new v(0,-1,0)),this.add(s);const a=new zt(90,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new v(0,0,1)),this.add(a);const l=new zt(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new v(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();const c=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=c}}function Ht(e,t,n,r,i,o,s,a,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,s=void 0!==s?s:1022,u.call(this,e,t,n,r,i,o,s,a,l,c),this.flipY=!1,this._needsFlipEnvMap=!0}function jt(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),f.call(this,e,e,t),t=t||{},this.texture=new Ht(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture._needsFlipEnvMap=!1}function Vt(e,t,n,r,i,o,s,a,l,c,h,d){u.call(this,null,o,s,a,l,c,r,i,h,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Gt.prototype=Object.create(ge.prototype),Gt.prototype.constructor=Gt,Ht.prototype=Object.create(u.prototype),Ht.prototype.constructor=Ht,Ht.prototype.isCubeTexture=!0,Object.defineProperty(Ht.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),jt.prototype=Object.create(f.prototype),jt.prototype.constructor=jt,jt.prototype.isWebGLCubeRenderTarget=!0,jt.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=1023,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.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 <begin_vertex>\n\t\t\t\t#include <project_vertex>\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 <common>\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"},r=new Ot(5,5,5),i=new Ut({name:"CubemapFromEquirect",uniforms:Nt(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;const o=new Rt(r,i),s=t.minFilter;1008===t.minFilter&&(t.minFilter=1006);return new Gt(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this},jt.prototype.clear=function(e,t,n,r){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)},Vt.prototype=Object.create(u.prototype),Vt.prototype.constructor=Vt,Vt.prototype.isDataTexture=!0;const Wt=new D,Xt=new v;class Yt{constructor(e,t,n,r,i,o){this.planes=[void 0!==e?e:new be,void 0!==t?t:new be,void 0!==n?n:new be,void 0!==r?r:new be,void 0!==i?i:new be,void 0!==o?o:new be]}set(e,t,n,r,i,o){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(o),this}clone(){return(new this.constructor).copy(this)}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(s-r,h-a,f-u,y-m).normalize(),t[1].setComponents(s+r,h+a,f+u,y+m).normalize(),t[2].setComponents(s+i,h+l,f+d,y+g).normalize(),t[3].setComponents(s-i,h-l,f-d,y-g).normalize(),t[4].setComponents(s-o,h-c,f-p,y-v).normalize(),t[5].setComponents(s+o,h+c,f+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Wt.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Wt)}intersectsSprite(e){return Wt.center.set(0,0,0),Wt.radius=.7071067811865476,Wt.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wt)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)<r)return!1}return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Xt.x=r.normal.x>0?e.max.x:e.min.x,Xt.y=r.normal.y>0?e.max.y:e.min.y,Xt.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Xt)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}function qt(){let e=null,t=!1,n=null,r=null;function i(t,o){n(t,o),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Qt(e,t){const n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){const e=r.get(t);return void((!e||e.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}))}t.isInterleavedBufferAttribute&&(t=t.data);const o=r.get(t);void 0===o?r.set(t,function(t,r){const i=t.array,o=t.usage,s=e.createBuffer();e.bindBuffer(r,s),e.bufferData(r,i,o),t.onUploadCallback();let a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?t.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:i instanceof Uint8Array&&(a=5121),{buffer:s,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(!function(t,r,i){const o=r.array,s=r.updateRange;e.bindBuffer(i,t),-1===s.count?e.bufferSubData(i,0,o):(n?e.bufferSubData(i,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):e.bufferSubData(i,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,t,i),o.version=t.version)}}}class Zt extends pt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const i=e/2,o=t/2,s=Math.floor(n),a=Math.floor(r),l=s+1,c=a+1,h=e/s,u=t/a,d=[],p=[],f=[],m=[];for(let e=0;e<c;e++){const t=e*u-o;for(let n=0;n<l;n++){const r=n*h-i;p.push(r,-t,0),f.push(0,0,1),m.push(n/s),m.push(1-e/a)}}for(let e=0;e<a;e++)for(let t=0;t<s;t++){const n=t+l*e,r=t+l*(e+1),i=t+1+l*(e+1),o=t+1+l*e;d.push(n,r,o),d.push(r,i,o)}this.setIndex(d),this.setAttribute("position",new et(p,3)),this.setAttribute("normal",new et(f,3)),this.setAttribute("uv",new et(m,2))}}const Jt={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Kt={common:{diffuse:{value:new Ue(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new a},uv2Transform:{value:new a},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new s(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ue(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ue(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new a}},sprite:{diffuse:{value:new Ue(15658734)},opacity:{value:1},center:{value:new s(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new a}}},$t={basic:{uniforms:Dt([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.fog]),vertexShader:Jt.meshbasic_vert,fragmentShader:Jt.meshbasic_frag},lambert:{uniforms:Dt([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)}}]),vertexShader:Jt.meshlambert_vert,fragmentShader:Jt.meshlambert_frag},phong:{uniforms:Dt([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)},specular:{value:new Ue(1118481)},shininess:{value:30}}]),vertexShader:Jt.meshphong_vert,fragmentShader:Jt.meshphong_frag},standard:{uniforms:Dt([Kt.common,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.roughnessmap,Kt.metalnessmap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},toon:{uniforms:Dt([Kt.common,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.gradientmap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)}}]),vertexShader:Jt.meshtoon_vert,fragmentShader:Jt.meshtoon_frag},matcap:{uniforms:Dt([Kt.common,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,{matcap:{value:null}}]),vertexShader:Jt.meshmatcap_vert,fragmentShader:Jt.meshmatcap_frag},points:{uniforms:Dt([Kt.points,Kt.fog]),vertexShader:Jt.points_vert,fragmentShader:Jt.points_frag},dashed:{uniforms:Dt([Kt.common,Kt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Jt.linedashed_vert,fragmentShader:Jt.linedashed_frag},depth:{uniforms:Dt([Kt.common,Kt.displacementmap]),vertexShader:Jt.depth_vert,fragmentShader:Jt.depth_frag},normal:{uniforms:Dt([Kt.common,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,{opacity:{value:1}}]),vertexShader:Jt.normal_vert,fragmentShader:Jt.normal_frag},sprite:{uniforms:Dt([Kt.sprite,Kt.fog]),vertexShader:Jt.sprite_vert,fragmentShader:Jt.sprite_frag},background:{uniforms:{uvTransform:{value:new a},t2D:{value:null}},vertexShader:Jt.background_vert,fragmentShader:Jt.background_frag},cube:{uniforms:Dt([Kt.envmap,{opacity:{value:1}}]),vertexShader:Jt.cube_vert,fragmentShader:Jt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Jt.equirect_vert,fragmentShader:Jt.equirect_frag},distanceRGBA:{uniforms:Dt([Kt.common,Kt.displacementmap,{referencePosition:{value:new v},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Jt.distanceRGBA_vert,fragmentShader:Jt.distanceRGBA_frag},shadow:{uniforms:Dt([Kt.lights,Kt.fog,{color:{value:new Ue(0)},opacity:{value:1}}]),vertexShader:Jt.shadow_vert,fragmentShader:Jt.shadow_frag}};function en(e,t,n,r,i){const o=new Ue(0);let s,a,l=0,c=null,h=0,u=null;function d(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),l=t,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(e){l=e,d(o,l)},render:function(n,i,p,f){let m=!0===i.isScene?i.background:null;m&&m.isTexture&&(m=t.get(m));const g=e.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?d(o,l):m&&m.isColor&&(d(m,1),f=!0),(e.autoClear||f)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||306===m.mapping)?(void 0===a&&(a=new Rt(new Ot(1,1,1),new Ut({name:"BackgroundCubeMaterial",uniforms:Nt($t.cube.uniforms),vertexShader:$t.cube.vertexShader,fragmentShader:$t.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(a)),m.isWebGLCubeRenderTarget&&(m=m.texture),a.material.uniforms.envMap.value=m,a.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m._needsFlipEnvMap?-1:1,c===m&&h===m.version&&u===e.toneMapping||(a.material.needsUpdate=!0,c=m,h=m.version,u=e.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):m&&m.isTexture&&(void 0===s&&(s=new Rt(new Zt(2,2),new Ut({name:"BackgroundMaterial",uniforms:Nt($t.background.uniforms),vertexShader:$t.background.vertexShader,fragmentShader:$t.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),s.material.uniforms.uvTransform.value.copy(m.matrix),c===m&&h===m.version&&u===e.toneMapping||(s.material.needsUpdate=!0,c=m,h=m.version,u=e.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function tn(e,t,n,r){const i=e.getParameter(34921),o=r.isWebGL2?null:t.get("OES_vertex_array_object"),s=r.isWebGL2||null!==o,a={},l=d(null);let c=l;function h(t){return r.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function u(t){return r.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function d(e){const t=[],n=[],r=[];for(let e=0;e<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function p(){const e=c.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function f(e){m(e,0)}function m(n,i){const o=c.newAttributes,s=c.enabledAttributes,a=c.attributeDivisors;if(o[n]=1,0===s[n]&&(e.enableVertexAttribArray(n),s[n]=1),a[n]!==i){(r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),a[n]=i}}function g(){const t=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function v(t,n,i,o,s,a){!0!==r.isWebGL2||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,o,s,a):e.vertexAttribIPointer(t,n,i,s,a)}function y(){x(),c!==l&&(c=l,h(c.object))}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,u,y,x){let b=!1;if(s){const t=function(t,n,i){const s=!0===i.wireframe;let l=a[t.id];void 0===l&&(l={},a[t.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let h=c[s];void 0===h&&(h=d(r.isWebGL2?e.createVertexArray():o.createVertexArrayOES()),c[s]=h);return h}(y,u,l);c!==t&&(c=t,h(c.object)),b=function(e,t){const n=c.attributes,r=e.attributes;let i=0;for(const e in r){const t=n[e],o=r[e];if(void 0===t)return!0;if(t.attribute!==o)return!0;if(t.data!==o.data)return!0;i++}return c.attributesNum!==i||c.index!==t}(y,x),b&&function(e,t){const n={},r=e.attributes;let i=0;for(const e in r){const t=r[e],o={};o.attribute=t,t.data&&(o.data=t.data),n[e]=o,i++}c.attributes=n,c.attributesNum=i,c.index=t}(y,x)}else{const e=!0===l.wireframe;c.geometry===y.id&&c.program===u.id&&c.wireframe===e||(c.geometry=y.id,c.program=u.id,c.wireframe=e,b=!0)}!0===i.isInstancedMesh&&(b=!0),null!==x&&n.update(x,34963),b&&(!function(i,o,s,a){if(!1===r.isWebGL2&&(i.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,c=s.getAttributes(),h=o.defaultAttributeValues;for(const t in c){const r=c[t];if(r>=0){const o=l[t];if(void 0!==o){const t=o.normalized,i=o.itemSize,s=n.get(o);if(void 0===s)continue;const l=s.buffer,c=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,u=o.offset;n&&n.isInstancedInterleavedBuffer?(m(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(r),e.bindBuffer(34962,l),v(r,i,c,t,s*h,u*h)}else o.isInstancedBufferAttribute?(m(r,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(r),e.bindBuffer(34962,l),v(r,i,c,t,0,0)}else if("instanceMatrix"===t){const t=n.get(i.instanceMatrix);if(void 0===t)continue;const o=t.buffer,s=t.type;m(r+0,1),m(r+1,1),m(r+2,1),m(r+3,1),e.bindBuffer(34962,o),e.vertexAttribPointer(r+0,4,s,!1,64,0),e.vertexAttribPointer(r+1,4,s,!1,64,16),e.vertexAttribPointer(r+2,4,s,!1,64,32),e.vertexAttribPointer(r+3,4,s,!1,64,48)}else if("instanceColor"===t){const t=n.get(i.instanceColor);if(void 0===t)continue;const o=t.buffer,s=t.type;m(r,1),e.bindBuffer(34962,o),e.vertexAttribPointer(r,3,s,!1,12,0)}else if(void 0!==h){const n=h[t];if(void 0!==n)switch(n.length){case 2:e.vertexAttrib2fv(r,n);break;case 3:e.vertexAttrib3fv(r,n);break;case 4:e.vertexAttrib4fv(r,n);break;default:e.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,y),null!==x&&e.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const e in a){const t=a[e];for(const e in t){const n=t[e];for(const e in n)u(n[e].object),delete n[e];delete t[e]}delete a[e]}},releaseStatesOfGeometry:function(e){if(void 0===a[e.id])return;const t=a[e.id];for(const e in t){const n=t[e];for(const e in n)u(n[e].object),delete n[e];delete t[e]}delete a[e.id]},releaseStatesOfProgram:function(e){for(const t in a){const n=a[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)u(r[e].object),delete r[e];delete n[e.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function nn(e,t,n,r){const i=r.isWebGL2;let o;this.setMode=function(e){o=e},this.render=function(t,r){e.drawArrays(o,t,r),n.update(r,o,1)},this.renderInstances=function(r,s,a){if(0===a)return;let l,c;if(i)l=e,c="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,r,s,a),n.update(s,o,a)}}function rn(e,t,n){let r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=i(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=h>0,y=o||!!t.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==r)return r;const n=t.get("EXT_texture_filter_anisotropic");return r=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,r},getMaxPrecision:i,precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:o?e.getParameter(36183):0}}function on(e){const t=this;let n=null,r=0,i=!1,o=!1;const s=new be,l=new a,c={value:null,needsUpdate:!1};function h(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){const o=null!==e?e.length:0;let a=null;if(0!==o){if(a=c.value,!0!==i||null===a){const t=r+4*o,i=n.matrixWorldInverse;l.getNormalMatrix(i),(null===a||a.length<t)&&(a=new Float32Array(t));for(let t=0,n=r;t!==o;++t,n+=4)s.copy(e[t]).applyMatrix4(i,l),s.normal.toArray(a,n),a[n+3]=s.constant}c.value=a,c.needsUpdate=!0}return t.numPlanes=o,t.numIntersection=0,a}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,o){const s=0!==e.length||t||0!==r||i;return i=t,n=u(e,o,0),r=e.length,s},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,h()},this.setState=function(t,s,a){const l=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows,f=e.get(t);if(!i||null===l||0===l.length||o&&!p)o?u(null):h();else{const e=o?0:r,t=4*e;let i=f.clippingState||null;c.value=i,i=u(l,s,t,a);for(let e=0;e!==t;++e)i[e]=n[e];f.clippingState=i,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}}}function sn(e){let t=new WeakMap;function n(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const o=i.mapping;if(303===o||304===o){if(t.has(i)){return n(t.get(i).texture,i.mapping)}{const o=i.image;if(o&&o.height>0){const s=e.getRenderList(),a=e.getRenderTarget(),l=new jt(o.height/2);return l.fromEquirectangularTexture(e,i),t.set(i,l),e.setRenderTarget(a),e.setRenderList(s),i.addEventListener("dispose",r),n(l.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}function an(e){const t={};return{has:function(n){if(void 0!==t[n])return null!==t[n];let r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,null!==r},get:function(e){return this.has(e)||console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t[e]}}}function ln(e,t,n,r){const i=new WeakMap,o=new WeakMap;function s(e){const a=e.target,l=i.get(a);null!==l.index&&t.remove(l.index);for(const e in l.attributes)t.remove(l.attributes[e]);a.removeEventListener("dispose",s),i.delete(a);const c=o.get(l);c&&(t.remove(c),o.delete(l)),r.releaseStatesOfGeometry(l),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],r=e.index,i=e.attributes.position;let s=0;if(null!==r){const e=r.array;s=r.version;for(let t=0,r=e.length;t<r;t+=3){const r=e[t+0],i=e[t+1],o=e[t+2];n.push(r,i,i,o,o,r)}}else{const e=i.array;s=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){const e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}const a=new(rt(n)>65535?Ke:Ze)(n,1);a.version=s;const l=o.get(e);l&&t.remove(l),o.set(e,a)}return{get:function(e,t){let r=i.get(t);return r||(t.addEventListener("dispose",s),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new pt).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){const n=e.attributes;for(const e in n)t.update(n[e],34962);const r=e.morphAttributes;for(const e in r){const n=r[e];for(let e=0,r=n.length;e<r;e++)t.update(n[e],34962)}},getWireframeAttribute:function(e){const t=o.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return o.get(e)}}}function cn(e,t,n,r){const i=r.isWebGL2;let o,s,a;this.setMode=function(e){o=e},this.setIndex=function(e){s=e.type,a=e.bytesPerElement},this.render=function(t,r){e.drawElements(o,r,s,t*a),n.update(r,o,1)},this.renderInstances=function(r,l,c){if(0===c)return;let h,u;if(i)h=e,u="drawElementsInstanced";else if(h=t.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](o,l,s,r*a,c),n.update(l,o,c)}}function hn(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function un(e,t){return e[0]-t[0]}function dn(e,t){return Math.abs(t[1])-Math.abs(e[1])}function pn(e){const t={},n=new Float32Array(8),r=[];for(let e=0;e<8;e++)r[e]=[e,0];return{update:function(i,o,s,a){const l=i.morphTargetInfluences,c=void 0===l?0:l.length;let h=t[o.id];if(void 0===h){h=[];for(let e=0;e<c;e++)h[e]=[e,0];t[o.id]=h}for(let e=0;e<c;e++){const t=h[e];t[0]=e,t[1]=l[e]}h.sort(dn);for(let e=0;e<8;e++)e<c&&h[e][1]?(r[e][0]=h[e][0],r[e][1]=h[e][1]):(r[e][0]=Number.MAX_SAFE_INTEGER,r[e][1]=0);r.sort(un);const u=s.morphTargets&&o.morphAttributes.position,d=s.morphNormals&&o.morphAttributes.normal;let p=0;for(let e=0;e<8;e++){const t=r[e],i=t[0],s=t[1];i!==Number.MAX_SAFE_INTEGER&&s?(u&&o.getAttribute("morphTarget"+e)!==u[i]&&o.setAttribute("morphTarget"+e,u[i]),d&&o.getAttribute("morphNormal"+e)!==d[i]&&o.setAttribute("morphNormal"+e,d[i]),n[e]=s,p+=s):(u&&!0===o.hasAttribute("morphTarget"+e)&&o.deleteAttribute("morphTarget"+e),d&&!0===o.hasAttribute("morphNormal"+e)&&o.deleteAttribute("morphNormal"+e),n[e]=0)}const f=o.morphTargetsRelative?1:1-p;a.getUniforms().setValue(e,"morphTargetBaseInfluence",f),a.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function fn(e,t,n,r){let i=new WeakMap;function o(e){const t=e.target;t.removeEventListener("dispose",o),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){const s=r.render.frame,a=e.geometry,l=t.get(e,a);return i.get(l)!==s&&(a.isGeometry&&l.updateFromObject(e),t.update(l),i.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",o)&&e.addEventListener("dispose",o),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}function mn(e=null,t=1,n=1,r=1){u.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function gn(e=null,t=1,n=1,r=1){u.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}$t.physical={uniforms:Dt([$t.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new s(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Ue(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},mn.prototype=Object.create(u.prototype),mn.prototype.constructor=mn,mn.prototype.isDataTexture2DArray=!0,gn.prototype=Object.create(u.prototype),gn.prototype.constructor=gn,gn.prototype.isDataTexture3D=!0;const vn=new u,yn=new mn,xn=new gn,bn=new Ht,_n=[],wn=[],Mn=new Float32Array(16),Sn=new Float32Array(9),Tn=new Float32Array(4);function An(e,t,n){const r=e[0];if(r<=0||r>0)return e;const i=t*n;let o=_n[i];if(void 0===o&&(o=new Float32Array(i),_n[i]=o),0!==t){r.toArray(o,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(o,i)}return o}function En(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Pn(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function Ln(e,t){let n=wn[t];void 0===n&&(n=new Int32Array(t),wn[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Cn(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Rn(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(En(n,t))return;e.uniform2fv(this.addr,t),Pn(n,t)}}function In(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(En(n,t))return;e.uniform3fv(this.addr,t),Pn(n,t)}}function Fn(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(En(n,t))return;e.uniform4fv(this.addr,t),Pn(n,t)}}function On(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(En(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Pn(n,t)}else{if(En(n,r))return;Tn.set(r),e.uniformMatrix2fv(this.addr,!1,Tn),Pn(n,r)}}function Nn(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(En(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Pn(n,t)}else{if(En(n,r))return;Sn.set(r),e.uniformMatrix3fv(this.addr,!1,Sn),Pn(n,r)}}function Dn(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(En(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Pn(n,t)}else{if(En(n,r))return;Mn.set(r),e.uniformMatrix4fv(this.addr,!1,Mn),Pn(n,r)}}function Bn(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||vn,i)}function Un(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||yn,i)}function kn(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||xn,i)}function zn(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||bn,i)}function Gn(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Hn(e,t){const n=this.cache;En(n,t)||(e.uniform2iv(this.addr,t),Pn(n,t))}function jn(e,t){const n=this.cache;En(n,t)||(e.uniform3iv(this.addr,t),Pn(n,t))}function Vn(e,t){const n=this.cache;En(n,t)||(e.uniform4iv(this.addr,t),Pn(n,t))}function Wn(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Xn(e,t){e.uniform1fv(this.addr,t)}function Yn(e,t){e.uniform1iv(this.addr,t)}function qn(e,t){e.uniform2iv(this.addr,t)}function Qn(e,t){e.uniform3iv(this.addr,t)}function Zn(e,t){e.uniform4iv(this.addr,t)}function Jn(e,t){const n=An(t,this.size,2);e.uniform2fv(this.addr,n)}function Kn(e,t){const n=An(t,this.size,3);e.uniform3fv(this.addr,n)}function $n(e,t){const n=An(t,this.size,4);e.uniform4fv(this.addr,n)}function er(e,t){const n=An(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function tr(e,t){const n=An(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function nr(e,t){const n=An(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function rr(e,t,n){const r=t.length,i=Ln(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.safeSetTexture2D(t[e]||vn,i[e])}function ir(e,t,n){const r=t.length,i=Ln(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.safeSetTextureCube(t[e]||bn,i[e])}function or(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return Cn;case 35664:return Rn;case 35665:return In;case 35666:return Fn;case 35674:return On;case 35675:return Nn;case 35676:return Dn;case 5124:case 35670:return Gn;case 35667:case 35671:return Hn;case 35668:case 35672:return jn;case 35669:case 35673:return Vn;case 5125:return Wn;case 35678:case 36198:case 36298:case 36306:case 35682:return Bn;case 35679:case 36299:case 36307:return kn;case 35680:case 36300:case 36308:case 36293:return zn;case 36289:case 36303:case 36311:case 36292:return Un}}(t.type)}function sr(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Xn;case 35664:return Jn;case 35665:return Kn;case 35666:return $n;case 35674:return er;case 35675:return tr;case 35676:return nr;case 5124:case 35670:return Yn;case 35667:case 35671:return qn;case 35668:case 35672:return Qn;case 35669:case 35673:return Zn;case 35678:case 36198:case 36298:case 36306:case 35682:return rr;case 35680:case 36300:case 36308:case 36293:return ir}}(t.type)}function ar(e){this.id=e,this.seq=[],this.map={}}sr.prototype.updateCache=function(e){const t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Pn(t,e)},ar.prototype.setValue=function(e,t,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(e,t[o.id],n)}};const lr=/(\w+)(\])?(\[|\.)?/g;function cr(e,t){e.seq.push(t),e.map[t.id]=t}function hr(e,t,n){const r=e.name,i=r.length;for(lr.lastIndex=0;;){const o=lr.exec(r),s=lr.lastIndex;let a=o[1];const l="]"===o[2],c=o[3];if(l&&(a|=0),void 0===c||"["===c&&s+2===i){cr(n,void 0===c?new or(a,e,t):new sr(a,e,t));break}{let e=n.map[a];void 0===e&&(e=new ar(a),cr(n,e)),n=e}}}function ur(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,35718);for(let r=0;r<n;++r){const n=e.getActiveUniform(t,r);hr(n,e.getUniformLocation(t,n.name),this)}}function dr(e,t,n){const r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}ur.prototype.setValue=function(e,t,n,r){const i=this.map[t];void 0!==i&&i.setValue(e,n,r)},ur.prototype.setOptional=function(e,t,n){const r=t[n];void 0!==r&&this.setValue(e,n,r)},ur.upload=function(e,t,n,r){for(let i=0,o=t.length;i!==o;++i){const o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},ur.seqWithValue=function(e,t){const n=[];for(let r=0,i=e.length;r!==i;++r){const i=e[r];i.id in t&&n.push(i)}return n};let pr=0;function fr(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function mr(e,t,n){const r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(e){const t=e.split("\n");for(let e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}(e.getShaderSource(t))}function gr(e,t){const n=fr(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function vr(e,t){const n=fr(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function yr(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function xr(e){return""!==e}function br(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function _r(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const wr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Mr(e){return e.replace(wr,Sr)}function Sr(e,t){const n=Jt[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Mr(n)}const Tr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ar=/#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 Er(e){return e.replace(Ar,Lr).replace(Tr,Pr)}function Pr(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Lr(e,t,n,r)}function Lr(e,t,n,r){let i="";for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function Cr(e){let t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Rr(e,t,n,r){const i=e.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 307:t="ENVMAP_MODE_REFRACTION"}return t}(n),u=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),d=e.gammaFactor>0?e.gammaFactor:1,p=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(xr).join("\n")}(n),f=function(e){const t=[];for(const n in e){const r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(o),m=i.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(xr).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(xr).join("\n"),v.length>0&&(v+="\n")):(g=[Cr(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 "+d,"#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 "+l:"",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(xr).join("\n"),v=[p,Cr(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,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 "+c:"",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 "+l:"",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;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Jt.tonemapping_pars_fragment:"",0!==n.toneMapping?yr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Jt.encodings_pars_fragment,n.map?gr("mapTexelToLinear",n.mapEncoding):"",n.matcap?gr("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?gr("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?gr("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?gr("lightMapTexelToLinear",n.lightMapEncoding):"",vr("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(xr).join("\n")),s=Mr(s),s=br(s,n),s=_r(s,n),a=Mr(a),a=br(a,n),a=_r(a,n),s=Er(s),a=Er(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===n.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#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"+v);const x=y+v+a,b=dr(i,35633,y+g+s),_=dr(i,35632,x);if(i.attachShader(m,b),i.attachShader(m,_),void 0!==n.index0AttributeName?i.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),e.debug.checkShaderErrors){const e=i.getProgramInfoLog(m).trim(),t=i.getShaderInfoLog(b).trim(),n=i.getShaderInfoLog(_).trim();let r=!0,o=!0;if(!1===i.getProgramParameter(m,35714)){r=!1;const t=mr(i,b,"vertex"),n=mr(i,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(m,35715),"gl.getProgramInfoLog",e,t,n)}else""!==e?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e):""!==t&&""!==n||(o=!1);o&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:g},fragmentShader:{log:n,prefix:v}})}let w,M;return i.deleteShader(b),i.deleteShader(_),this.getUniforms=function(){return void 0===w&&(w=new ur(i,m)),w},this.getAttributes=function(){return void 0===M&&(M=function(e,t){const n={},r=e.getProgramParameter(t,35721);for(let i=0;i<r;i++){const r=e.getActiveAttrib(t,i).name;n[r]=e.getAttribLocation(t,r)}return n}(i,m)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=pr++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=_,this}function Ir(e,t,n,r,i,o){const s=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let d=r.precision;const p={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"},f=["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 m(e){let t;return e&&e.isTexture?t=e.encoding:e&&e.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=3e3,t}return{getParameters:function(i,s,f,g,v){const y=g.fog,x=i.isMeshStandardMaterial?g.environment:null,b=t.get(i.envMap||x),_=p[i.type],w=v.isSkinnedMesh?function(e){const t=e.skeleton.bones;if(c)return 1024;{const e=h,n=Math.floor((e-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}}(v):0;let M,S;if(null!==i.precision&&(d=r.getMaxPrecision(i.precision),d!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",d,"instead.")),_){const e=$t[_];M=e.vertexShader,S=e.fragmentShader}else M=i.vertexShader,S=i.fragmentShader;const T=e.getRenderTarget();return{isWebGL2:a,shaderID:_,shaderName:i.type,vertexShader:M,fragmentShader:S,defines:i.defines,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:d,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:u,outputEncoding:null!==T?m(T.texture):e.outputEncoding,map:!!i.map,mapEncoding:m(i.map),matcap:!!i.matcap,matcapEncoding:m(i.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:m(b),envMapCubeUV:!!b&&(306===b.mapping||307===b.mapping),lightMap:!!i.lightMap,lightMapEncoding:m(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:m(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:1===i.normalMapType,tangentSpaceNormalMap:0===i.normalMapType,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,transmissionMap:!!i.transmissionMap,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap||i.transmissionMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||i.transmissionMap||!i.displacementMap),fog:!!y,useFog:i.fog,fogExp2:y&&y.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:l,skinning:i.skinning&&w>0,maxBones:w,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.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:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&f.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.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:i.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);if(!1===t.isRawShaderMaterial){for(let e=0;e<f.length;e++)n.push(t[f[e]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=$t[t];n=Bt.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r;for(let e=0,t=s.length;e<t;e++){const t=s[e];if(t.cacheKey===n){r=t,++r.usedTimes;break}}return void 0===r&&(r=new Rr(e,n,t,i),s.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){const t=s.indexOf(e);s[t]=s[s.length-1],s.pop(),e.destroy()}},programs:s}}function Fr(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function Or(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Nr(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Dr(e){const t=[];let n=0;const r=[],i=[],o={id:-1};function s(r,i,s,a,l,c){let h=t[n];const u=e.get(s);return void 0===h?(h={id:r.id,object:r,geometry:i,material:s,program:u.program||o,groupOrder:a,renderOrder:r.renderOrder,z:l,group:c},t[n]=h):(h.id=r.id,h.object=r,h.geometry=i,h.material=s,h.program=u.program||o,h.groupOrder=a,h.renderOrder=r.renderOrder,h.z=l,h.group=c),n++,h}return{opaque:r,transparent:i,init:function(){n=0,r.length=0,i.length=0},push:function(e,t,n,o,a,l){const c=s(e,t,n,o,a,l);(!0===n.transparent?i:r).push(c)},unshift:function(e,t,n,o,a,l){const c=s(e,t,n,o,a,l);(!0===n.transparent?i:r).unshift(c)},finish:function(){for(let e=n,r=t.length;e<r;e++){const n=t[e];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(e,t){r.length>1&&r.sort(e||Or),i.length>1&&i.sort(t||Nr)}}}function Br(e){let t=new WeakMap;return{get:function(n,r){const i=t.get(n);let o;return void 0===i?(o=new Dr(e),t.set(n,new WeakMap),t.get(n).set(r,o)):(o=i.get(r),void 0===o&&(o=new Dr(e),i.set(r,o))),o},dispose:function(){t=new WeakMap}}}function Ur(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new v,color:new Ue};break;case"SpotLight":n={position:new v,direction:new v,color:new Ue,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new v,color:new Ue,distance:0,decay:0};break;case"HemisphereLight":n={direction:new v,skyColor:new Ue,groundColor:new Ue};break;case"RectAreaLight":n={color:new Ue,position:new v,halfWidth:new v,halfHeight:new v}}return e[t.id]=n,n}}}let kr=0;function zr(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Gr(e,t){const n=new Ur,r=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)i.probe.push(new v);const o=new v,a=new W,l=new W;return{setup:function(o){let s=0,a=0,l=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0;o.sort(zr);for(let e=0,t=o.length;e<t;e++){const t=o[e],v=t.color,y=t.intensity,x=t.distance,b=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)s+=v.r*y,a+=v.g*y,l+=v.b*y;else if(t.isLightProbe)for(let e=0;e<9;e++)i.probe[e].addScaledVector(t.sh.coefficients[e],y);else if(t.isDirectionalLight){const e=n.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity),t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,i.directionalShadow[c]=n,i.directionalShadowMap[c]=b,i.directionalShadowMatrix[c]=t.shadow.matrix,f++}i.directional[c]=e,c++}else if(t.isSpotLight){const e=n.get(t);if(e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(v).multiplyScalar(y),e.distance=x,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,i.spotShadow[u]=n,i.spotShadowMap[u]=b,i.spotShadowMatrix[u]=t.shadow.matrix,g++}i.spot[u]=e,u++}else if(t.isRectAreaLight){const e=n.get(t);e.color.copy(v).multiplyScalar(y),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),i.rectArea[d]=e,d++}else if(t.isPointLight){const e=n.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity),e.distance=t.distance,e.decay=t.decay,t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,n.shadowCameraNear=e.camera.near,n.shadowCameraFar=e.camera.far,i.pointShadow[h]=n,i.pointShadowMap[h]=b,i.pointShadowMatrix[h]=t.shadow.matrix,m++}i.point[h]=e,h++}else if(t.isHemisphereLight){const e=n.get(t);e.skyColor.copy(t.color).multiplyScalar(y),e.groundColor.copy(t.groundColor).multiplyScalar(y),i.hemi[p]=e,p++}}d>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Kt.LTC_FLOAT_1,i.rectAreaLTC2=Kt.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Kt.LTC_HALF_1,i.rectAreaLTC2=Kt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=l;const v=i.hash;v.directionalLength===c&&v.pointLength===h&&v.spotLength===u&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=d,i.point.length=h,i.hemi.length=p,i.directionalShadow.length=f,i.directionalShadowMap.length=f,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=f,i.pointShadowMatrix.length=m,i.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=h,v.spotLength=u,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,i.version=kr++)},setupView:function(e,t){let n=0,r=0,s=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){const d=e[t];if(d.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(u),n++}else if(d.isSpotLight){const e=i.spot[s];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(u),s++}else if(d.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),l.identity(),a.copy(d.matrixWorld),a.premultiply(u),l.extractRotation(a),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(l),e.halfHeight.applyMatrix4(l),c++}else if(d.isPointLight){const e=i.point[r];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),r++}else if(d.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),e.direction.normalize(),h++}}},state:i}}function Hr(e,t){const n=new Gr(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(){n.setup(r)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function jr(e,t){let n=new WeakMap;return{get:function(r,i=0){let o;return!1===n.has(r)?(o=new Hr(e,t),n.set(r,[]),n.get(r).push(o)):i>=n.get(r).length?(o=new Hr(e,t),n.get(r).push(o)):o=n.get(r)[i],o},dispose:function(){n=new WeakMap}}}function Vr(e){Ge.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,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(e)}function Wr(e){Ge.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new v,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(e)}Vr.prototype=Object.create(Ge.prototype),Vr.prototype.constructor=Vr,Vr.prototype.isMeshDepthMaterial=!0,Vr.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Wr.prototype=Object.create(Ge.prototype),Wr.prototype.constructor=Wr,Wr.prototype.isMeshDistanceMaterial=!0,Wr.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function Xr(e,t,n){let r=new Yt;const i=new s,o=new s,a=new p,l=[],c=[],h={},u={0:1,1:0,2:2},d=new Ut({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new s},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\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 HORIZONTAL_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}"}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const g=new pt;g.setAttribute("position",new We(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Rt(g,d),y=this;function x(n,r){const i=t.update(v);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,v,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,m,v,null)}function b(e,t,n){const r=e<<0|t<<1|n<<2;let i=l[r];return void 0===i&&(i=new Vr({depthPacking:3201,morphTargets:e,skinning:t}),l[r]=i),i}function _(e,t,n){const r=e<<0|t<<1|n<<2;let i=c[r];return void 0===i&&(i=new Wr({morphTargets:e,skinning:t}),c[r]=i),i}function w(t,n,r,i,o,s,a){let l=null,c=b,d=t.customDepthMaterial;if(!0===i.isPointLight&&(c=_,d=t.customDistanceMaterial),void 0===d){let e=!1;!0===r.morphTargets&&(e=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t));l=c(e,i,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const e=l.uuid,t=r.uuid;let n=h[e];void 0===n&&(n={},h[e]=n);let i=n[t];void 0===i&&(i=l.clone(),n[t]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=3===a?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function M(n,i,o,s,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=t.update(n),i=n.material;if(Array.isArray(i)){const t=r.groups;for(let l=0,c=t.length;l<c;l++){const c=t[l],h=i[c.materialIndex];if(h&&h.visible){const t=w(n,r,h,s,o.near,o.far,a);e.renderBufferDirect(o,null,r,t,n,c)}}}else if(i.visible){const t=w(n,r,i,s,o.near,o.far,a);e.renderBufferDirect(o,null,r,t,n,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)M(l[e],i,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===t.length)return;const c=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let c=0,h=t.length;c<h;c++){const h=t[c],u=h.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;i.copy(u.mapSize);const p=u.getFrameExtents();if(i.multiply(p),o.copy(u.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(o.x=Math.floor(n/p.x),i.x=o.x*p.x,u.mapSize.x=o.x),i.y>n&&(o.y=Math.floor(n/p.y),i.y=o.y*p.y,u.mapSize.y=o.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const e={minFilter:1006,magFilter:1006,format:1023};u.map=new f(i.x,i.y,e),u.map.texture.name=h.name+".shadowMap",u.mapPass=new f(i.x,i.y,e),u.camera.updateProjectionMatrix()}if(null===u.map){const e={minFilter:1003,magFilter:1003,format:1023};u.map=new f(i.x,i.y,e),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e<m;e++){const t=u.getViewport(e);a.set(o.x*t.x,o.y*t.y,o.x*t.z,o.y*t.w),d.viewport(a),u.updateMatrices(h,e),r=u.getFrustum(),M(s,l,u.camera,h,this.type)}u.isPointLightShadow||3!==this.type||x(u,l),u.needsUpdate=!1}y.needsUpdate=!1,e.setRenderTarget(c,h,u)}}function Yr(e,t,n){const r=n.isWebGL2;const i=new function(){let t=!1;const n=new p;let r=null;const i=new p(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,o,s,a){!0===a&&(t*=s,r*=s,o*=s),n.set(t,r,o,s),!1===i.equals(n)&&(e.clearColor(t,r,o,s),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},o=new function(){let t=!1,n=null,r=null,i=null;return{setTest:function(e){e?O(2929):N(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},s=new function(){let t=!1,n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null;return{setTest:function(e){t||(e?O(2960):N(2960))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,s){r===t&&i===n&&o===s||(e.stencilFunc(t,n,s),r=t,i=n,o=s)},setOp:function(t,n,r){s===t&&a===n&&l===r||(e.stencilOp(t,n,r),s=t,a=n,l=r)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null}}};let a={},l=null,c=null,h=null,u=null,d=null,f=null,m=null,g=null,v=null,y=!1,x=null,b=null,_=null,w=null,M=null;const S=e.getParameter(35661);let T=!1,A=0;const E=e.getParameter(7938);-1!==E.indexOf("WebGL")?(A=parseFloat(/^WebGL (\d)/.exec(E)[1]),T=A>=1):-1!==E.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(E)[1]),T=A>=2);let P=null,L={};const C=new p,R=new p;function I(t,n,r){const i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<r;t++)e.texImage2D(n+t,0,6408,1,1,0,6408,5121,i);return o}const F={};function O(t){!0!==a[t]&&(e.enable(t),a[t]=!0)}function N(t){!1!==a[t]&&(e.disable(t),a[t]=!1)}F[3553]=I(3553,3553,1),F[34067]=I(34067,34069,6),i.setClear(0,0,0,1),o.setClear(1),s.setClear(0),O(2929),o.setFunc(3),k(!1),z(1),O(2884),U(0);const D={100:32774,101:32778,102:32779};if(r)D[103]=32775,D[104]=32776;else{const e=t.get("EXT_blend_minmax");null!==e&&(D[103]=e.MIN_EXT,D[104]=e.MAX_EXT)}const B={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function U(t,n,r,i,o,s,a,l){if(0!==t){if(c||(O(3042),c=!0),5===t)o=o||n,s=s||r,a=a||i,n===u&&o===m||(e.blendEquationSeparate(D[n],D[o]),u=n,m=o),r===d&&i===f&&s===g&&a===v||(e.blendFuncSeparate(B[r],B[i],B[s],B[a]),d=r,f=i,g=s,v=a),h=t,y=null;else if(t!==h||l!==y){if(100===u&&100===m||(e.blendEquation(32774),u=100,m=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}d=null,f=null,g=null,v=null,h=t,y=l}}else c&&(N(3042),c=!1)}function k(t){x!==t&&(t?e.frontFace(2304):e.frontFace(2305),x=t)}function z(t){0!==t?(O(2884),t!==b&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):N(2884),b=t}function G(t,n,r){t?(O(32823),w===n&&M===r||(e.polygonOffset(n,r),w=n,M=r)):N(32823)}function H(t){void 0===t&&(t=33984+S-1),P!==t&&(e.activeTexture(t),P=t)}return{buffers:{color:i,depth:o,stencil:s},enable:O,disable:N,useProgram:function(t){return l!==t&&(e.useProgram(t),l=t,!0)},setBlending:U,setMaterial:function(e,t){2===e.side?N(2884):O(2884);let n=1===e.side;t&&(n=!n),k(n),1===e.blending&&!1===e.transparent?U(0):U(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),i.setMask(e.colorWrite);const r=e.stencilWrite;s.setTest(r),r&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),G(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:k,setCullFace:z,setLineWidth:function(t){t!==_&&(T&&e.lineWidth(t),_=t)},setPolygonOffset:G,setScissorTest:function(e){e?O(3089):N(3089)},activeTexture:H,bindTexture:function(t,n){null===P&&H();let r=L[P];void 0===r&&(r={type:void 0,texture:void 0},L[P]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=L[P];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===C.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),C.copy(t))},viewport:function(t){!1===R.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))},reset:function(){a={},P=null,L={},l=null,c=null,h=null,u=null,d=null,f=null,m=null,g=null,v=null,y=!1,x=null,b=null,_=null,w=null,M=null,i.reset(),o.reset(),s.reset()}}}function qr(e,t,n,r,i,s,a){const l=i.isWebGL2,c=i.maxTextures,h=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,p=new WeakMap;let f,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function g(e,t){return m?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(e,t,n,r){let i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t?o.floorPowerOfTwo:Math.floor,s=r(i*e.width),a=r(i*e.height);void 0===f&&(f=g(s,a));const l=n?g(s,a):f;l.width=s,l.height=a;return l.getContext("2d").drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function y(e){return o.isPowerOfTwo(e.width)&&o.isPowerOfTwo(e.height)}function x(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function b(t,n,i,o){e.generateMipmap(t);r.get(n).__maxMipLevel=Math.log(Math.max(i,o))*Math.LOG2E}function _(n,r,i){if(!1===l)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function w(e){return 1003===e||1004===e||1005===e?9728:9729}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=r.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),r.remove(t)}(n),n.isVideoTexture&&p.delete(n),a.memory.textures--}function S(t){const n=t.target;n.removeEventListener("dispose",S),function(t){const n=r.get(t),i=r.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}(n),a.memory.textures--}let T=0;function A(e,t){const i=r.get(e);if(e.isVideoTexture&&function(e){const t=a.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){const n=e.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void I(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function E(t,i){const o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,i){if(6!==r.image.length)return;R(t,r),n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,r.flipY);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),a=r.image[0]&&r.image[0].isDataTexture,c=[];for(let e=0;e<6;e++)c[e]=o||a?a?r.image[e].image:r.image[e]:v(r.image[e],!1,!0,h);const u=c[0],d=y(u)||l,p=s.convert(r.format),f=s.convert(r.type),m=_(r.internalFormat,p,f);let g;if(C(34067,r,d),o){for(let e=0;e<6;e++){g=c[e].mipmaps;for(let t=0;t<g.length;t++){const i=g[t];1023!==r.format&&1022!==r.format?null!==p?n.compressedTexImage2D(34069+e,t,m,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+e,t,m,i.width,i.height,0,p,f,i.data)}}t.__maxMipLevel=g.length-1}else{g=r.mipmaps;for(let e=0;e<6;e++)if(a){n.texImage2D(34069+e,0,m,c[e].width,c[e].height,0,p,f,c[e].data);for(let t=0;t<g.length;t++){const r=g[t].image[e].image;n.texImage2D(34069+e,t+1,m,r.width,r.height,0,p,f,r.data)}}else{n.texImage2D(34069+e,0,m,p,f,c[e]);for(let t=0;t<g.length;t++){const r=g[t];n.texImage2D(34069+e,t+1,m,p,f,r.image[e])}}t.__maxMipLevel=g.length}x(r,d)&&b(34067,r,u.width,u.height);t.__version=r.version,r.onUpdate&&r.onUpdate(r)}(o,t,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))}const P={1e3:10497,1001:33071,1002:33648},L={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function C(n,o,s){s?(e.texParameteri(n,10242,P[o.wrapS]),e.texParameteri(n,10243,P[o.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[o.wrapR]),e.texParameteri(n,10240,L[o.magFilter]),e.texParameteri(n,10241,L[o.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),1001===o.wrapS&&1001===o.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(o.magFilter)),e.texParameteri(n,10241,w(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));const a=t.get("EXT_texture_filter_anisotropic");if(a){if(1015===o.type&&null===t.get("OES_texture_float_linear"))return;if(1016===o.type&&null===(l||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function R(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",M),t.__webglTexture=e.createTexture(),a.memory.textures++)}function I(t,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),R(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);const a=function(e){return!l&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)}(r)&&!1===y(r.image),c=v(r.image,a,!1,u),h=y(c)||l,d=s.convert(r.format);let p,f=s.convert(r.type),m=_(r.internalFormat,d,f);C(o,r,h);const g=r.mipmaps;if(r.isDepthTexture)m=6402,l?m=1015===r.type?36012:1014===r.type?33190:1020===r.type?35056:33189:1015===r.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&6402===m&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1012,f=s.convert(r.type)),1027===r.format&&6402===m&&(m=34041,1020!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=1020,f=s.convert(r.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(r.isDataTexture)if(g.length>0&&h){for(let e=0,t=g.length;e<t;e++)p=g[e],n.texImage2D(3553,e,m,p.width,p.height,0,d,f,p.data);r.generateMipmaps=!1,t.__maxMipLevel=g.length-1}else n.texImage2D(3553,0,m,c.width,c.height,0,d,f,c.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(let e=0,t=g.length;e<t;e++)p=g[e],1023!==r.format&&1022!==r.format?null!==d?n.compressedTexImage2D(3553,e,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,e,m,p.width,p.height,0,d,f,p.data);t.__maxMipLevel=g.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,c.width,c.height,c.depth,0,d,f,c.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,c.width,c.height,c.depth,0,d,f,c.data),t.__maxMipLevel=0;else if(g.length>0&&h){for(let e=0,t=g.length;e<t;e++)p=g[e],n.texImage2D(3553,e,m,d,f,p);r.generateMipmaps=!1,t.__maxMipLevel=g.length-1}else n.texImage2D(3553,0,m,d,f,c),t.__maxMipLevel=0;x(r,h)&&b(o,r,c.width,c.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function F(t,i,o,a){const l=s.convert(i.texture.format),c=s.convert(i.texture.type),h=_(i.texture.internalFormat,l,c);n.texImage2D(a,0,h,i.width,i.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,a,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function O(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r){const t=n.depthTexture;t&&t.isDepthTexture&&(1015===t.type?i=36012:1014===t.type&&(i=33190));const r=D(n);e.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){const t=D(n);e.renderbufferStorageMultisample(36161,t,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{const t=s.convert(n.texture.format),i=s.convert(n.texture.type),o=_(n.texture.internalFormat,t,i);if(r){const t=D(n);e.renderbufferStorageMultisample(36161,t,o,n.width,n.height)}else e.renderbufferStorage(36161,o,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(t){const n=r.get(t),i=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),A(n.depthTexture,0);const i=r.get(n.depthTexture).__webglTexture;if(1026===n.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(1027!==n.depthTexture.format)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)e.bindFramebuffer(36160,n.__webglFramebuffer[r]),n.__webglDepthbuffer[r]=e.createRenderbuffer(),O(n.__webglDepthbuffer[r],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),O(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function D(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}let B=!1,U=!1;this.allocateTextureUnit=function(){const e=T;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=A,this.setTexture2DArray=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(t){const i=r.get(t),o=r.get(t.texture);t.addEventListener("dispose",S),o.__webglTexture=e.createTexture(),a.memory.textures++;const c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=y(t)||l;if(!l||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){i.__webglFramebuffer=[];for(let t=0;t<6;t++)i.__webglFramebuffer[t]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),h)if(l){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);const n=s.convert(t.texture.format),r=s.convert(t.texture.type),o=_(t.texture.internalFormat,n,r),a=D(t);e.renderbufferStorageMultisample(36161,a,o,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),O(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,o.__webglTexture),C(34067,t.texture,u);for(let e=0;e<6;e++)F(i.__webglFramebuffer[e],t,36064,34069+e);x(t.texture,u)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,o.__webglTexture),C(3553,t.texture,u),F(i.__webglFramebuffer,t,36064,3553),x(t.texture,u)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){const t=e.texture;if(x(t,y(e)||l)){const i=e.isWebGLCubeRenderTarget?34067:3553,o=r.get(t).__webglTexture;n.bindTexture(i,o),b(i,t,e.width,e.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){const n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);const i=t.width,o=t.height;let s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024),e.blitFramebuffer(0,0,i,o,0,0,i,o,s,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),A(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),U=!0),e=e.texture),E(e,t)}}function Qr(e,t,n){const r=n.isWebGL2;return{convert:function(e){let n;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return r?5131:(n=t.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(n=t.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(n=t.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return n=t.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&(n=t.get("WEBGL_compressed_texture_etc"),null!==n)){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?(n=t.get("WEBGL_compressed_texture_astc"),null!==n?e:null):36492===e?(n=t.get("EXT_texture_compression_bptc"),null!==n?e:null):1020===e?r?34042:(n=t.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Zr(e=[]){zt.call(this),this.cameras=e}function Jr(){ge.call(this),this.type="Group"}function Kr(){this._targetRay=null,this._grip=null,this._hand=null}function $r(e,t){const n=this;let r=null,i=1,o=null,s="local-floor",a=null;const l=[],c=new Map,h=new zt;h.layers.enable(1),h.viewport=new p;const u=new zt;u.layers.enable(2),u.viewport=new p;const d=[h,u],f=new Zr;f.layers.enable(1),f.layers.enable(2);let m=null,g=null;function y(e){const t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function x(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),A.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function b(e){o=e,A.setContext(r),A.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function _(e){const t=r.inputSources;for(let e=0;e<l.length;e++)c.set(t[e],l[e]);for(let t=0;t<e.removed.length;t++){const n=e.removed[t],r=c.get(n);r&&(r.dispatchEvent({type:"disconnected",data:n}),c.delete(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t],r=c.get(n);r&&r.dispatchEvent({type:"connected",data:n})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=l[e];return void 0===t&&(t=new Kr,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=l[e];return void 0===t&&(t=new Kr,l[e]=t),t.getGripSpace()},this.getHand=function(e){let t=l[e];return void 0===t&&(t=new Kr,l[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return r},this.setSession=function(e){if(r=e,null!==r){r.addEventListener("select",y),r.addEventListener("selectstart",y),r.addEventListener("selectend",y),r.addEventListener("squeeze",y),r.addEventListener("squeezestart",y),r.addEventListener("squeezeend",y),r.addEventListener("end",x);const e=t.getContextAttributes();!0!==e.xrCompatible&&t.makeXRCompatible();const n={antialias:e.antialias,alpha:e.alpha,depth:e.depth,stencil:e.stencil,framebufferScaleFactor:i},o=new XRWebGLLayer(r,t,n);r.updateRenderState({baseLayer:o}),r.requestReferenceSpace(s).then(b),r.addEventListener("inputsourceschange",_)}};const w=new v,M=new v;function S(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.getCamera=function(e){f.near=u.near=h.near=e.near,f.far=u.far=h.far=e.far,m===f.near&&g===f.far||(r.updateRenderState({depthNear:f.near,depthFar:f.far}),m=f.near,g=f.far);const t=e.parent,n=f.cameras;S(f,t);for(let e=0;e<n.length;e++)S(n[e],t);e.matrixWorld.copy(f.matrixWorld);const i=e.children;for(let e=0,t=i.length;e<t;e++)i[e].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){w.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);const r=w.distanceTo(M),i=t.projectionMatrix.elements,o=n.projectionMatrix.elements,s=i[14]/(i[10]-1),a=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],h=(i[8]-1)/i[0],u=(o[8]+1)/o[0],d=s*h,p=s*u,f=r/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=s+f,v=a+f,y=d-m,x=p+(r-m),b=l*a/v*g,_=c*a/v*g;e.projectionMatrix.makePerspective(y,x,b,_,g,v)}(f,h,u):f.projectionMatrix.copy(h.projectionMatrix),f};let T=null;const A=new qt;A.setAnimationLoop((function(t,n){if(a=n.getViewerPose(o),null!==a){const t=a.views,n=r.renderState.baseLayer;e.setFramebuffer(n.framebuffer);let i=!1;t.length!==f.cameras.length&&(f.cameras.length=0,i=!0);for(let e=0;e<t.length;e++){const r=t[e],o=n.getViewport(r),s=d[e];s.matrix.fromArray(r.transform.matrix),s.projectionMatrix.fromArray(r.projectionMatrix),s.viewport.set(o.x,o.y,o.width,o.height),0===e&&f.matrix.copy(s.matrix),!0===i&&f.cameras.push(s)}}const i=r.inputSources;for(let e=0;e<l.length;e++){const t=l[e],r=i[e];t.update(r,n,o)}T&&T(t,n)})),this.setAnimationLoop=function(e){T=e},this.dispose=function(){}}function ei(e){function t(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);const r=e.get(n).envMap;if(r){t.envMap.value=r,t.flipEnvMap.value=r.isCubeTexture&&r._needsFlipEnvMap?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio;const i=e.get(r).__maxMipLevel;void 0!==i&&(t.maxMipLevel.value=i)}let i,o;n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(i=n.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,o){r.isMeshBasicMaterial?t(e,r):r.isMeshLambertMaterial?(t(e,r),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,r)):r.isMeshToonMaterial?(t(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshPhongMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshStandardMaterial?(t(e,r),r.isMeshPhysicalMaterial?function(e,t){n(e,t),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transmission.value=t.transmission,t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap)}(e,r):n(e,r)):r.isMeshMatcapMaterial?(t(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDepthMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDistanceMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?(t(e,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);let i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);let n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ti(e){const t=void 0!==(e=e||{}).canvas?e.canvas:function(){const e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,l=void 0!==e.antialias&&e.antialias,c=void 0===e.premultipliedAlpha||e.premultipliedAlpha,h=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",d=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let f=null,m=null;const g=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const y=this;let x=!1,b=null,_=0,w=0,M=null,S=null,T=-1,A=null;const E=new p,P=new p;let L=null,C=t.width,R=t.height,I=1,F=null,O=null;const N=new p(0,0,C,R),D=new p(0,0,C,R);let B=!1;const U=new Yt;let k=!1,z=!1;const G=new W,H=new v,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function V(){return null===M?I:1}let X,Y,q,Q,Z,J,K,$,ee,te,ne,re,ie,oe,se,ae,le,ce,he,ue,de,pe=n;function fe(e,n){for(let r=0;r<e.length;r++){const i=e[r],o=t.getContext(i,n);if(null!==o)return o}return null}try{const e={alpha:r,depth:i,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:u,failIfMajorPerformanceCaveat:d};if(t.addEventListener("webglcontextlost",ye,!1),t.addEventListener("webglcontextrestored",xe,!1),null===pe){const t=["webgl2","webgl","experimental-webgl"];if(!0===y.isWebGL1Renderer&&t.shift(),pe=fe(t,e),null===pe)throw fe(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===pe.getShaderPrecisionFormat&&(pe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function me(){X=new an(pe),Y=new rn(pe,X,e),!1===Y.isWebGL2&&(X.get("WEBGL_depth_texture"),X.get("OES_texture_float"),X.get("OES_texture_half_float"),X.get("OES_texture_half_float_linear"),X.get("OES_standard_derivatives"),X.get("OES_element_index_uint"),X.get("OES_vertex_array_object"),X.get("ANGLE_instanced_arrays")),X.get("OES_texture_float_linear"),ue=new Qr(pe,X,Y),q=new Yr(pe,X,Y),q.scissor(P.copy(D).multiplyScalar(I).floor()),q.viewport(E.copy(N).multiplyScalar(I).floor()),Q=new hn(pe),Z=new Fr,J=new qr(pe,X,q,Z,Y,ue,Q),K=new sn(y),$=new Qt(pe,Y),de=new tn(pe,X,$,Y),ee=new ln(pe,$,Q,de),te=new fn(pe,ee,$,Q),le=new pn(pe),se=new on(Z),ne=new Ir(y,K,X,Y,de,se),re=new ei(Z),ie=new Br(Z),oe=new jr(X,Y),ae=new en(y,K,q,te,c),ce=new nn(pe,X,Q,Y),he=new cn(pe,X,Q,Y),Q.programs=ne.programs,y.capabilities=Y,y.extensions=X,y.properties=Z,y.renderLists=ie,y.state=q,y.info=Q}me();const ge=new $r(y,pe);this.xr=ge;const ve=new Xr(y,te,Y.maxTextureSize);function ye(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1,me()}function be(e){const t=e.target;t.removeEventListener("dispose",be),function(e){_e(e),Z.remove(e)}(t)}function _e(e){const t=Z.get(e).program;void 0!==t&&ne.releaseProgram(t)}this.shadowMap=ve,this.getContext=function(){return pe},this.getContextAttributes=function(){return pe.getContextAttributes()},this.forceContextLoss=function(){const e=X.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=X.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(e){void 0!==e&&(I=e,this.setSize(C,R,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new s),e.set(C,R)},this.setSize=function(e,n,r){ge.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(C=e,R=n,t.width=Math.floor(e*I),t.height=Math.floor(n*I),!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new s),e.set(C*I,R*I).floor()},this.setDrawingBufferSize=function(e,n,r){C=e,R=n,I=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new p),e.copy(E)},this.getViewport=function(e){return e.copy(N)},this.setViewport=function(e,t,n,r){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,n,r),q.viewport(E.copy(N).multiplyScalar(I).floor())},this.getScissor=function(e){return e.copy(D)},this.setScissor=function(e,t,n,r){e.isVector4?D.set(e.x,e.y,e.z,e.w):D.set(e,t,n,r),q.scissor(P.copy(D).multiplyScalar(I).floor())},this.getScissorTest=function(){return B},this.setScissorTest=function(e){q.setScissorTest(B=e)},this.setOpaqueSort=function(e){F=e},this.setTransparentSort=function(e){O=e},this.getClearColor=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),e=new Ue),e.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(e,t,n){let r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),pe.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ye,!1),t.removeEventListener("webglcontextrestored",xe,!1),ie.dispose(),oe.dispose(),Z.dispose(),K.dispose(),te.dispose(),de.dispose(),ge.dispose(),Me.stop()},this.renderBufferImmediate=function(e,t){de.initAttributes();const n=Z.get(e);e.hasPositions&&!n.position&&(n.position=pe.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=pe.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=pe.createBuffer()),e.hasColors&&!n.color&&(n.color=pe.createBuffer());const r=t.getAttributes();e.hasPositions&&(pe.bindBuffer(34962,n.position),pe.bufferData(34962,e.positionArray,35048),de.enableAttribute(r.position),pe.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(pe.bindBuffer(34962,n.normal),pe.bufferData(34962,e.normalArray,35048),de.enableAttribute(r.normal),pe.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(pe.bindBuffer(34962,n.uv),pe.bufferData(34962,e.uvArray,35048),de.enableAttribute(r.uv),pe.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(pe.bindBuffer(34962,n.color),pe.bufferData(34962,e.colorArray,35048),de.enableAttribute(r.color),pe.vertexAttribPointer(r.color,3,5126,!1,0,0)),de.disableUnusedAttributes(),pe.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,o){null===t&&(t=j);const s=i.isMesh&&i.matrixWorld.determinant()<0,a=Pe(e,t,r,i);q.setMaterial(r,s);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===r.wireframe&&(l=ee.getWireframeAttribute(n),u=2),(r.morphTargets||r.morphNormals)&&le.update(i,n,r,a),de.setup(i,r,a,n,l);let d=ce;null!==l&&(h=$.get(l),d=he,d.setIndex(h));const p=null!==l?l.count:c.count,f=n.drawRange.start*u,m=n.drawRange.count*u,g=null!==o?o.start*u:0,v=null!==o?o.count*u:1/0,y=Math.max(f,g),x=Math.min(p,f+m,g+v)-1,b=Math.max(0,x-y+1);if(0!==b){if(i.isMesh)!0===r.wireframe?(q.setLineWidth(r.wireframeLinewidth*V()),d.setMode(1)):d.setMode(4);else if(i.isLine){let e=r.linewidth;void 0===e&&(e=1),q.setLineWidth(e*V()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,b,i.count);else if(n.isInstancedBufferGeometry){const e=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,b,e)}else d.render(y,b)}},this.compile=function(e,t){m=oe.get(e),m.init(),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(m.pushLight(e),e.castShadow&&m.pushShadow(e))})),m.setupLights();const n=new WeakMap;e.traverse((function(t){const r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){const o=r[i];!1===n.has(o)&&(Ee(o,e,t),n.set(o))}else!1===n.has(r)&&(Ee(r,e,t),n.set(r))}))};let we=null;const Me=new qt;function Se(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)m.pushLight(e),e.castShadow&&m.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||U.intersectsSprite(e)){r&&H.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=te.update(e),i=e.material;i.visible&&f.push(e,t,i,n,H.z,null)}}else if(e.isImmediateRenderObject)r&&H.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G),f.push(e,null,e.material,n,H.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Q.render.frame&&(e.skeleton.update(),e.skeleton.frame=Q.render.frame),!e.frustumCulled||U.intersectsObject(e))){r&&H.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=te.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=i[s.materialIndex];a&&a.visible&&f.push(e,t,a,n,H.z,s)}}else i.visible&&f.push(e,t,i,n,H.z,null)}const i=e.children;for(let e=0,o=i.length;e<o;e++)Se(i[e],t,n,r)}function Te(e,t,n){const r=!0===t.isScene?t.overrideMaterial:null;for(let i=0,o=e.length;i<o;i++){const o=e[i],s=o.object,a=o.geometry,l=null===r?o.material:r,c=o.group;if(n.isArrayCamera){const e=n.cameras;for(let n=0,r=e.length;n<r;n++){const r=e[n];s.layers.test(r.layers)&&(q.viewport(E.copy(r.viewport)),m.setupLightsView(r),Ae(s,t,r,a,l,c))}}else Ae(s,t,n,a,l,c)}}function Ae(e,t,n,r,i,o){if(e.onBeforeRender(y,t,n,r,i,o),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){const r=Pe(n,t,i,e);q.setMaterial(i),de.reset(),function(e,t){e.render((function(e){y.renderBufferImmediate(e,t)}))}(e,r)}else y.renderBufferDirect(n,t,r,i,e,o);e.onAfterRender(y,t,n,r,i,o)}function Ee(e,t,n){!0!==t.isScene&&(t=j);const r=Z.get(e),i=m.state.lights,o=m.state.shadowsArray,s=i.state.version,a=ne.getParameters(e,i.state,o,t,n),l=ne.getProgramCacheKey(a);let c=r.program,h=!0;if(void 0===c)e.addEventListener("dispose",be);else if(c.cacheKey!==l)_e(e);else if(r.lightsStateVersion!==s)h=!1;else{if(void 0!==a.shaderID){const n=e.isMeshStandardMaterial?t.environment:null;return void(r.envMap=K.get(e.envMap||n))}h=!1}h&&(a.uniforms=ne.getUniforms(e),e.onBeforeCompile(a,y),c=ne.acquireProgram(a,l),r.program=c,r.uniforms=a.uniforms,r.outputEncoding=a.outputEncoding);const u=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=se.numPlanes,r.numIntersection=se.numIntersection,u.clippingPlanes=se.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=K.get(e.envMap||r.environment),r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=s,r.needsLights&&(u.ambientLightColor.value=i.state.ambient,u.lightProbe.value=i.state.probe,u.directionalLights.value=i.state.directional,u.directionalLightShadows.value=i.state.directionalShadow,u.spotLights.value=i.state.spot,u.spotLightShadows.value=i.state.spotShadow,u.rectAreaLights.value=i.state.rectArea,u.ltc_1.value=i.state.rectAreaLTC1,u.ltc_2.value=i.state.rectAreaLTC2,u.pointLights.value=i.state.point,u.pointLightShadows.value=i.state.pointShadow,u.hemisphereLights.value=i.state.hemi,u.directionalShadowMap.value=i.state.directionalShadowMap,u.directionalShadowMatrix.value=i.state.directionalShadowMatrix,u.spotShadowMap.value=i.state.spotShadowMap,u.spotShadowMatrix.value=i.state.spotShadowMatrix,u.pointShadowMap.value=i.state.pointShadowMap,u.pointShadowMatrix.value=i.state.pointShadowMatrix);const d=r.program.getUniforms(),p=ur.seqWithValue(d.seq,u);r.uniformsList=p}function Pe(e,t,n,r){!0!==t.isScene&&(t=j),J.resetTextureUnits();const i=t.fog,s=n.isMeshStandardMaterial?t.environment:null,a=null===M?y.outputEncoding:M.texture.encoding,l=K.get(n.envMap||s),c=Z.get(n),h=m.state.lights;if(!0===k&&(!0===z||e!==A)){const t=e===A&&n.id===T;se.setState(n,e,t)}n.version===c.__version?n.fog&&c.fog!==i||c.environment!==s||c.needsLights&&c.lightsStateVersion!==h.state.version?Ee(n,t,r):void 0===c.numClippingPlanes||c.numClippingPlanes===se.numPlanes&&c.numIntersection===se.numIntersection?(c.outputEncoding!==a||c.envMap!==l)&&Ee(n,t,r):Ee(n,t,r):(Ee(n,t,r),c.__version=n.version);let u=!1,d=!1,p=!1;const f=c.program,g=f.getUniforms(),v=c.uniforms;if(q.useProgram(f.program)&&(u=!0,d=!0,p=!0),n.id!==T&&(T=n.id,d=!0),u||A!==e){if(g.setValue(pe,"projectionMatrix",e.projectionMatrix),Y.logarithmicDepthBuffer&&g.setValue(pe,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),A!==e&&(A=e,d=!0,p=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const t=g.map.cameraPosition;void 0!==t&&t.setValue(pe,H.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(pe,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&g.setValue(pe,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){g.setOptional(pe,r,"bindMatrix"),g.setOptional(pe,r,"bindMatrixInverse");const e=r.skeleton;if(e){const t=e.bones;if(Y.floatVertexTextures){if(null===e.boneTexture){let n=Math.sqrt(4*t.length);n=o.ceilPowerOfTwo(n),n=Math.max(n,4);const r=new Float32Array(n*n*4);r.set(e.boneMatrices);const i=new Vt(r,n,n,1023,1015);e.boneMatrices=r,e.boneTexture=i,e.boneTextureSize=n}g.setValue(pe,"boneTexture",e.boneTexture,J),g.setValue(pe,"boneTextureSize",e.boneTextureSize)}else g.setOptional(pe,e,"boneMatrices")}}var x,b;return(d||c.receiveShadow!==r.receiveShadow)&&(c.receiveShadow=r.receiveShadow,g.setValue(pe,"receiveShadow",r.receiveShadow)),d&&(g.setValue(pe,"toneMappingExposure",y.toneMappingExposure),c.needsLights&&(b=p,(x=v).ambientLightColor.needsUpdate=b,x.lightProbe.needsUpdate=b,x.directionalLights.needsUpdate=b,x.directionalLightShadows.needsUpdate=b,x.pointLights.needsUpdate=b,x.pointLightShadows.needsUpdate=b,x.spotLights.needsUpdate=b,x.spotLightShadows.needsUpdate=b,x.rectAreaLights.needsUpdate=b,x.hemisphereLights.needsUpdate=b),i&&n.fog&&re.refreshFogUniforms(v,i),re.refreshMaterialUniforms(v,n,I,R),ur.upload(pe,c.uniformsList,v,J)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(ur.upload(pe,c.uniformsList,v,J),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(pe,"center",r.center),g.setValue(pe,"modelViewMatrix",r.modelViewMatrix),g.setValue(pe,"normalMatrix",r.normalMatrix),g.setValue(pe,"modelMatrix",r.matrixWorld),f}Me.setAnimationLoop((function(e){ge.isPresenting||we&&we(e)})),"undefined"!=typeof window&&Me.setContext(window),this.setAnimationLoop=function(e){we=e,ge.setAnimationLoop(e),null===e?Me.stop():Me.start()},this.render=function(e,t){let n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;de.resetDefaultState(),T=-1,A=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===ge.enabled&&!0===ge.isPresenting&&(t=ge.getCamera(t)),!0===e.isScene&&e.onBeforeRender(y,e,t,n||M),m=oe.get(e,g.length),m.init(),g.push(m),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),U.setFromProjectionMatrix(G),z=this.localClippingEnabled,k=se.init(this.clippingPlanes,z,t),f=ie.get(e,t),f.init(),Se(e,t,0,y.sortObjects),f.finish(),!0===y.sortObjects&&f.sort(F,O),!0===k&&se.beginShadows();const i=m.state.shadowsArray;ve.render(i,e,t),m.setupLights(),m.setupLightsView(t),!0===k&&se.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),ae.render(f,e,t,r);const o=f.opaque,s=f.transparent;o.length>0&&Te(o,e,t),s.length>0&&Te(s,e,t),!0===e.isScene&&e.onAfterRender(y,e,t),null!==M&&(J.updateRenderTargetMipmap(M),J.updateMultisampleRenderTarget(M)),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),g.pop(),m=g.length>0?g[g.length-1]:null,f=null},this.setFramebuffer=function(e){b!==e&&null===M&&pe.bindFramebuffer(36160,e),b=e},this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return w},this.getRenderList=function(){return f},this.setRenderList=function(e){f=e},this.getRenderTarget=function(){return M},this.setRenderTarget=function(e,t=0,n=0){M=e,_=t,w=n,e&&void 0===Z.get(e).__webglFramebuffer&&J.setupRenderTarget(e);let r=b,i=!1;if(e){const n=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=n[t],i=!0):r=e.isWebGLMultisampleRenderTarget?Z.get(e).__webglMultisampledFramebuffer:n,E.copy(e.viewport),P.copy(e.scissor),L=e.scissorTest}else E.copy(N).multiplyScalar(I).floor(),P.copy(D).multiplyScalar(I).floor(),L=B;if(S!==r&&(pe.bindFramebuffer(36160,r),S=r),q.viewport(E),q.scissor(P),q.setScissorTest(L),i){const r=Z.get(e.texture);pe.framebufferTexture2D(36160,36064,34069+t,r.__webglTexture,n)}},this.readRenderTargetPixels=function(e,t,n,r,i,o,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){let s=!1;a!==S&&(pe.bindFramebuffer(36160,a),s=!0);try{const a=e.texture,l=a.format,c=a.type;if(1023!==l&&ue.convert(l)!==pe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===c||ue.convert(c)===pe.getParameter(35738)||1015===c&&(Y.isWebGL2||X.get("OES_texture_float")||X.get("WEBGL_color_buffer_float"))||1016===c&&(Y.isWebGL2?X.get("EXT_color_buffer_float"):X.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===pe.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&pe.readPixels(t,n,r,i,ue.convert(l),ue.convert(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&pe.bindFramebuffer(36160,S)}}},this.copyFramebufferToTexture=function(e,t,n=0){const r=Math.pow(2,-n),i=Math.floor(t.image.width*r),o=Math.floor(t.image.height*r),s=ue.convert(t.format);J.setTexture2D(t,0),pe.copyTexImage2D(3553,n,s,e.x,e.y,i,o,0),q.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r=0){const i=t.image.width,o=t.image.height,s=ue.convert(n.format),a=ue.convert(n.type);J.setTexture2D(n,0),pe.pixelStorei(37440,n.flipY),pe.pixelStorei(37441,n.premultiplyAlpha),pe.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?pe.texSubImage2D(3553,r,e.x,e.y,i,o,s,a,t.image.data):t.isCompressedTexture?pe.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):pe.texSubImage2D(3553,r,e.x,e.y,s,a,t.image),0===r&&n.generateMipmaps&&pe.generateMipmap(3553),q.unbindTexture()},this.initTexture=function(e){J.setTexture2D(e,0),q.unbindTexture()},this.resetState=function(){q.reset(),de.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ni(e){ti.call(this,e)}Zr.prototype=Object.assign(Object.create(zt.prototype),{constructor:Zr,isArrayCamera:!0}),Jr.prototype=Object.assign(Object.create(ge.prototype),{constructor:Jr,isGroup:!0}),Object.assign(Kr.prototype,{constructor:Kr,getHandSpace:function(){if(null===this._hand&&(this._hand=new Jr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let e=0;e<=window.XRHand.LITTLE_PHALANX_TIP;e++){const e=new Jr;e.matrixAutoUpdate=!1,e.visible=!1,this._hand.joints.push(e),this._hand.add(e)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Jr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Jr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(e,t,n){let r=null,i=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(l&&e.hand){o=!0;for(let r=0;r<=window.XRHand.LITTLE_PHALANX_TIP;r++)if(e.hand[r]){const i=t.getJointPose(e.hand[r],n),o=l.joints[r];null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.jointRadius=i.radius),o.visible=null!==i;const s=l.joints[window.XRHand.INDEX_PHALANX_TIP],a=l.joints[window.XRHand.THUMB_PHALANX_TIP],c=s.position.distanceTo(a.position),h=.02,u=.005;l.inputState.pinching&&c>h+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&c<=h-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}}else null!==s&&(r=t.getPose(e.targetRaySpace,n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale))),null!==a&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return null!==s&&(s.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==o),this}}),Object.assign($r.prototype,n.prototype),ni.prototype=Object.assign(Object.create(ti.prototype),{constructor:ni,isWebGL1Renderer:!0});class ri{constructor(e,t){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new Ue(e),this.density=void 0!==t?t:25e-5}clone(){return new ri(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class ii{constructor(e,t,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new Ue(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}clone(){return new ii(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class oi extends ge{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(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}function si(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=o.generateUUID()}Object.defineProperty(si.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(si.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t=0){return this.array.set(e,t),this},clone:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o.generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new si(new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),this.stride);return t.setUsage(this.usage),t},onUpload:function(e){return this.onUploadCallback=e,this},toJSON:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o.generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const ai=new v;function li(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function ci(e){Ge.call(this),this.type="SpriteMaterial",this.color=new Ue(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}let hi;Object.defineProperties(li.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(e){this.data.needsUpdate=e}}}),Object.assign(li.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(let t=0,n=this.data.count;t<n;t++)ai.x=this.getX(t),ai.y=this.getY(t),ai.z=this.getZ(t),ai.applyMatrix4(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new We(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new li(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}),ci.prototype=Object.create(Ge.prototype),ci.prototype.constructor=ci,ci.prototype.isSpriteMaterial=!0,ci.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};const ui=new v,di=new v,pi=new v,fi=new s,mi=new s,gi=new W,vi=new v,yi=new v,xi=new v,bi=new s,_i=new s,wi=new s;function Mi(e){if(ge.call(this),this.type="Sprite",void 0===hi){hi=new pt;const e=new si(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);hi.setIndex([0,1,2,0,2,3]),hi.setAttribute("position",new li(e,3,0,!1)),hi.setAttribute("uv",new li(e,2,3,!1))}this.geometry=hi,this.material=void 0!==e?e:new ci,this.center=new s(.5,.5)}function Si(e,t,n,r,i,o){fi.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(mi.x=o*fi.x-i*fi.y,mi.y=i*fi.x+o*fi.y):mi.copy(fi),e.copy(t),e.x+=mi.x,e.y+=mi.y,e.applyMatrix4(gi)}Mi.prototype=Object.assign(Object.create(ge.prototype),{constructor:Mi,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),di.setFromMatrixScale(this.matrixWorld),gi.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),pi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&di.multiplyScalar(-pi.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;Si(vi.set(-.5,-.5,0),pi,o,di,r,i),Si(yi.set(.5,-.5,0),pi,o,di,r,i),Si(xi.set(.5,.5,0),pi,o,di,r,i),bi.set(0,0),_i.set(1,0),wi.set(1,1);let a=e.ray.intersectTriangle(vi,yi,xi,!1,ui);if(null===a&&(Si(yi.set(-.5,.5,0),pi,o,di,r,i),_i.set(0,1),a=e.ray.intersectTriangle(vi,xi,yi,!1,ui),null===a))return;const l=e.ray.origin.distanceTo(ui);l<e.near||l>e.far||t.push({distance:l,point:ui.clone(),uv:Re.getUV(ui,vi,yi,xi,bi,_i,wi,new s),face:null,object:this})},copy:function(e){return ge.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});const Ti=new v,Ai=new v;function Ei(){ge.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}Ei.prototype=Object.assign(Object.create(ge.prototype),{constructor:Ei,isLOD:!0,copy:function(e){ge.prototype.copy.call(this,e,!1);const t=e.levels;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t=0){t=Math.abs(t);const n=this.levels;let r;for(r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Ti.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ti);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){const t=this.levels;if(t.length>1){Ti.setFromMatrixPosition(e.matrixWorld),Ai.setFromMatrixPosition(this.matrixWorld);const n=Ti.distanceTo(Ai)/e.zoom;let r,i;for(t[0].object.visible=!0,r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,r=n.length;e<r;e++){const r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance})}return t}});const Pi=new v,Li=new p,Ci=new p,Ri=new v,Ii=new W;function Fi(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Rt.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new W,this.bindMatrixInverse=new W}function Oi(){ge.call(this),this.type="Bone"}Fi.prototype=Object.assign(Object.create(Rt.prototype),{constructor:Fi,isSkinnedMesh:!0,copy:function(e){return Rt.prototype.copy.call(this,e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this},bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const e=new p,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Rt.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(e,t){const n=this.skeleton,r=this.geometry;Li.fromBufferAttribute(r.attributes.skinIndex,e),Ci.fromBufferAttribute(r.attributes.skinWeight,e),Pi.fromBufferAttribute(r.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const r=Ci.getComponent(e);if(0!==r){const i=Li.getComponent(e);Ii.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Ri.copy(Pi).applyMatrix4(Ii),r)}}return t.applyMatrix4(this.bindMatrixInverse)}}),Oi.prototype=Object.assign(Object.create(ge.prototype),{constructor:Oi,isBone:!0});const Ni=new W,Di=new W;function Bi(e=[],t=[]){this.uuid=o.generateUUID(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}Object.assign(Bi.prototype,{init:function(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new W)}},calculateInverses:function(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new W;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}},pose:function(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}},update:function(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){const i=e[r]?e[r].matrixWorld:Di;Ni.multiplyMatrices(i,t[r]),Ni.toArray(n,16*r)}null!==r&&(r.needsUpdate=!0)},clone:function(){return new Bi(this.bones,this.boneInverses)},getBoneByName:function(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}},dispose:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)},fromJSON:function(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const r=e.bones[n];let i=t[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new Oi),this.bones.push(i),this.boneInverses.push((new W).fromArray(e.boneInverses[n]))}return this.init(),this},toJSON:function(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){const i=t[r];e.bones.push(i.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}});const Ui=new W,ki=new W,zi=[],Gi=new Rt;function Hi(e,t,n){Rt.call(this,e,t),this.instanceMatrix=new We(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}function ji(e){Ge.call(this),this.type="LineBasicMaterial",this.color=new Ue(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}Hi.prototype=Object.assign(Object.create(Rt.prototype),{constructor:Hi,isInstancedMesh:!0,copy:function(e){return Rt.prototype.copy.call(this,e),this.instanceMatrix.copy(e.instanceMatrix),this.count=e.count,this},getColorAt:function(e,t){t.fromArray(this.instanceColor.array,3*e)},getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){const n=this.matrixWorld,r=this.count;if(Gi.geometry=this.geometry,Gi.material=this.material,void 0!==Gi.material)for(let i=0;i<r;i++){this.getMatrixAt(i,Ui),ki.multiplyMatrices(n,Ui),Gi.matrixWorld=ki,Gi.raycast(e,zi);for(let e=0,n=zi.length;e<n;e++){const n=zi[e];n.instanceId=i,n.object=this,t.push(n)}zi.length=0}},setColorAt:function(e,t){null===this.instanceColor&&(this.instanceColor=new We(new Float32Array(3*this.count),3)),t.toArray(this.instanceColor.array,3*e)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ji.prototype=Object.create(Ge.prototype),ji.prototype.constructor=ji,ji.prototype.isLineBasicMaterial=!0,ji.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};const Vi=new v,Wi=new v,Xi=new W,Yi=new V,qi=new D;function Qi(e=new pt,t=new ji){ge.call(this),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}Qi.prototype=Object.assign(Object.create(ge.prototype),{constructor:Qi,isLine:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},computeLineDistances:function(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)Vi.fromBufferAttribute(t,e-1),Wi.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Vi.distanceTo(Wi);e.setAttribute("lineDistance",new et(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){const t=e.vertices,n=e.lineDistances;n[0]=0;for(let e=1,r=t.length;e<r;e++)n[e]=n[e-1],n[e]+=t[e-1].distanceTo(t[e])}return this},raycast:function(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),qi.copy(n.boundingSphere),qi.applyMatrix4(r),qi.radius+=i,!1===e.ray.intersectsSphere(qi))return;Xi.copy(r).invert(),Yi.copy(e.ray).applyMatrix4(Xi);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,a=new v,l=new v,c=new v,h=new v,u=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,o=n.length-1;r<o;r+=u){const o=n[r],u=n[r+1];a.fromBufferAttribute(i,o),l.fromBufferAttribute(i,u);if(Yi.distanceSqToSegment(a,l,h,c)>s)continue;h.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(h);d<e.near||d>e.far||t.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,r=i.count-1;n<r;n+=u){a.fromBufferAttribute(i,n),l.fromBufferAttribute(i,n+1);if(Yi.distanceSqToSegment(a,l,h,c)>s)continue;h.applyMatrix4(this.matrixWorld);const r=e.ray.origin.distanceTo(h);r<e.near||r>e.far||t.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){const r=n.vertices,i=r.length;for(let n=0;n<i-1;n+=u){if(Yi.distanceSqToSegment(r[n],r[n+1],h,c)>s)continue;h.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(h);i<e.near||i>e.far||t.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){const n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{const t=e.morphTargets;void 0!==t&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Zi=new v,Ji=new v;function Ki(e,t){Qi.call(this,e,t),this.type="LineSegments"}function $i(e,t){Qi.call(this,e,t),this.type="LineLoop"}function eo(e){Ge.call(this),this.type="PointsMaterial",this.color=new Ue(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Ki.prototype=Object.assign(Object.create(Qi.prototype),{constructor:Ki,isLineSegments:!0,computeLineDistances:function(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)Zi.fromBufferAttribute(t,e),Ji.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Zi.distanceTo(Ji);e.setAttribute("lineDistance",new et(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){const t=e.vertices,n=e.lineDistances;for(let e=0,r=t.length;e<r;e+=2)Zi.copy(t[e]),Ji.copy(t[e+1]),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Zi.distanceTo(Ji)}return this}}),$i.prototype=Object.assign(Object.create(Qi.prototype),{constructor:$i,isLineLoop:!0}),eo.prototype=Object.create(Ge.prototype),eo.prototype.constructor=eo,eo.prototype.isPointsMaterial=!0,eo.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};const to=new W,no=new V,ro=new D,io=new v;function oo(e=new pt,t=new eo){ge.call(this),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}function so(e,t,n,r,i,o,s){const a=no.distanceSqToPoint(e);if(a<n){const n=new v;no.closestPointToPoint(e,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:s})}}function ao(e,t,n,r,i,o,s,a,l){u.call(this,e,t,n,r,i,o,s,a,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==i?i:1006,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}function lo(e,t,n,r,i,o,s,a,l,c,h,d){u.call(this,null,o,s,a,l,c,r,i,h,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function co(e,t,n,r,i,o,s,a,l){u.call(this,e,t,n,r,i,o,s,a,l),this.needsUpdate=!0}function ho(e,t,n,r,i,o,s,a,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===c&&(n=1012),void 0===n&&1027===c&&(n=1020),u.call(this,null,r,i,o,s,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==a?a:1003,this.flipY=!1,this.generateMipmaps=!1}oo.prototype=Object.assign(Object.create(ge.prototype),{constructor:oo,isPoints:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},raycast:function(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),ro.copy(n.boundingSphere),ro.applyMatrix4(r),ro.radius+=i,!1===e.ray.intersectsSphere(ro))return;to.copy(r).invert(),no.copy(e.ray).applyMatrix4(to);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i<a;i++){const a=n[i];io.fromBufferAttribute(o,a),so(io,a,s,r,e,t,this)}}else for(let n=0,i=o.count;n<i;n++)io.fromBufferAttribute(o,n),so(io,n,s,r,e,t,this)}else{const i=n.vertices;for(let n=0,o=i.length;n<o;n++)so(i[n],n,s,r,e,t,this)}},updateMorphTargets:function(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){const n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{const t=e.morphTargets;void 0!==t&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),ao.prototype=Object.assign(Object.create(u.prototype),{constructor:ao,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),lo.prototype=Object.create(u.prototype),lo.prototype.constructor=lo,lo.prototype.isCompressedTexture=!0,co.prototype=Object.create(u.prototype),co.prototype.constructor=co,co.prototype.isCanvasTexture=!0,ho.prototype=Object.create(u.prototype),ho.prototype.constructor=ho,ho.prototype.isDepthTexture=!0;let uo=0;const po=new W,fo=new ge,mo=new v;function go(){Object.defineProperty(this,"id",{value:uo+=2}),this.uuid=o.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}go.prototype=Object.assign(Object.create(n.prototype),{constructor:go,isGeometry:!0,applyMatrix4:function(e){const t=(new a).getNormalMatrix(e);for(let t=0,n=this.vertices.length;t<n;t++){this.vertices[t].applyMatrix4(e)}for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e];n.normal.applyMatrix3(t).normalize();for(let e=0,r=n.vertexNormals.length;e<r;e++)n.vertexNormals[e].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return po.makeRotationX(e),this.applyMatrix4(po),this},rotateY:function(e){return po.makeRotationY(e),this.applyMatrix4(po),this},rotateZ:function(e){return po.makeRotationZ(e),this.applyMatrix4(po),this},translate:function(e,t,n){return po.makeTranslation(e,t,n),this.applyMatrix4(po),this},scale:function(e,t,n){return po.makeScale(e,t,n),this.applyMatrix4(po),this},lookAt:function(e){return fo.lookAt(e),fo.updateMatrix(),this.applyMatrix4(fo.matrix),this},fromBufferGeometry:function(e){const t=this,n=null!==e.index?e.index:void 0,r=e.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const i=r.position,o=r.normal,a=r.color,l=r.uv,c=r.uv2;void 0!==c&&(this.faceVertexUvs[1]=[]);for(let e=0;e<i.count;e++)t.vertices.push((new v).fromBufferAttribute(i,e)),void 0!==a&&t.colors.push((new Ue).fromBufferAttribute(a,e));function h(e,n,r,i){const h=void 0===a?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=void 0===o?[]:[(new v).fromBufferAttribute(o,e),(new v).fromBufferAttribute(o,n),(new v).fromBufferAttribute(o,r)],d=new ke(e,n,r,u,h,i);t.faces.push(d),void 0!==l&&t.faceVertexUvs[0].push([(new s).fromBufferAttribute(l,e),(new s).fromBufferAttribute(l,n),(new s).fromBufferAttribute(l,r)]),void 0!==c&&t.faceVertexUvs[1].push([(new s).fromBufferAttribute(c,e),(new s).fromBufferAttribute(c,n),(new s).fromBufferAttribute(c,r)])}const u=e.groups;if(u.length>0)for(let e=0;e<u.length;e++){const t=u[e],r=t.start;for(let e=r,i=r+t.count;e<i;e+=3)void 0!==n?h(n.getX(e),n.getX(e+1),n.getX(e+2),t.materialIndex):h(e,e+1,e+2,t.materialIndex)}else if(void 0!==n)for(let e=0;e<n.count;e+=3)h(n.getX(e),n.getX(e+1),n.getX(e+2));else for(let e=0;e<i.count;e+=3)h(e,e+1,e+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(mo).negate(),this.translate(mo.x,mo.y,mo.z),this},normalize:function(){this.computeBoundingSphere();const e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new W;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){const e=new v,t=new v;for(let n=0,r=this.faces.length;n<r;n++){const r=this.faces[n],i=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(i,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e=!0){const t=new Array(this.vertices.length);for(let e=0,n=this.vertices.length;e<n;e++)t[e]=new v;if(e){const e=new v,n=new v;for(let r=0,i=this.faces.length;r<i;r++){const i=this.faces[r],o=this.vertices[i.a],s=this.vertices[i.b],a=this.vertices[i.c];e.subVectors(a,s),n.subVectors(o,s),e.cross(n),t[i.a].add(e),t[i.b].add(e),t[i.c].add(e)}}else{this.computeFaceNormals();for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e];t[n.a].add(n.normal),t[n.b].add(n.normal),t[n.c].add(n.normal)}}for(let e=0,n=this.vertices.length;e<n;e++)t[e].normalize();for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e],r=n.vertexNormals;3===r.length?(r[0].copy(t[n.a]),r[1].copy(t[n.b]),r[2].copy(t[n.c])):(r[0]=t[n.a].clone(),r[1]=t[n.b].clone(),r[2]=t[n.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],n=t.vertexNormals;3===n.length?(n[0].copy(t.normal),n[1].copy(t.normal),n[2].copy(t.normal)):(n[0]=t.normal.clone(),n[1]=t.normal.clone(),n[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||(t.__originalVertexNormals=[]);for(let e=0,n=t.vertexNormals.length;e<n;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}const e=new go;e.faces=this.faces;for(let t=0,n=this.morphTargets.length;t<n;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];const e=this.morphNormals[t].faceNormals,n=this.morphNormals[t].vertexNormals;for(let t=0,r=this.faces.length;t<r;t++){const t=new v,r={a:new v,b:new v,c:new v};e.push(t),n.push(r)}}const n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],r=n.faceNormals[e],i=n.vertexNormals[e];r.copy(t.normal),i.a.copy(t.vertexNormals[0]),i.b.copy(t.vertexNormals[1]),i.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new b),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new D),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n=0){if(!e||!e.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);let r;const i=this.vertices.length,o=this.vertices,s=e.vertices,l=this.faces,c=e.faces,h=this.colors,u=e.colors;void 0!==t&&(r=(new a).getNormalMatrix(t));for(let e=0,n=s.length;e<n;e++){const n=s[e].clone();void 0!==t&&n.applyMatrix4(t),o.push(n)}for(let e=0,t=u.length;e<t;e++)h.push(u[e].clone());for(let e=0,t=c.length;e<t;e++){const t=c[e];let o,s;const a=t.vertexNormals,h=t.vertexColors,u=new ke(t.a+i,t.b+i,t.c+i);u.normal.copy(t.normal),void 0!==r&&u.normal.applyMatrix3(r).normalize();for(let e=0,t=a.length;e<t;e++)o=a[e].clone(),void 0!==r&&o.applyMatrix3(r).normalize(),u.vertexNormals.push(o);u.color.copy(t.color);for(let e=0,t=h.length;e<t;e++)s=h[e],u.vertexColors.push(s.clone());u.materialIndex=t.materialIndex+n,l.push(u)}for(let t=0,n=e.faceVertexUvs.length;t<n;t++){const n=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){const r=n[e],i=[];for(let e=0,t=r.length;e<t;e++)i.push(r[e].clone());this.faceVertexUvs[t].push(i)}}},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(e=4){const t={},n=[],r=[],i=Math.pow(10,e);for(let e=0,o=this.vertices.length;e<o;e++){const o=this.vertices[e],s=Math.round(o.x*i)+"_"+Math.round(o.y*i)+"_"+Math.round(o.z*i);void 0===t[s]?(t[s]=e,n.push(this.vertices[e]),r[e]=n.length-1):r[e]=r[t[s]]}const o=[];for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];const n=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(n[t]===n[(t+1)%3]){o.push(e);break}}for(let e=o.length-1;e>=0;e--){const t=o[e];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e<n;e++)this.faceVertexUvs[e].splice(t,1)}const s=this.vertices.length-n.length;return this.vertices=n,s},setFromPoints:function(e){this.vertices=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];this.vertices.push(new v(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){const e=this.faces,t=e.length;for(let n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));const n=this.faceVertexUvs[0],r=this.faceVertexUvs[1];let i,o;n&&n.length===t&&(i=[]),r&&r.length===t&&(o=[]);for(let s=0;s<t;s++){const t=e[s]._id;i&&i.push(n[t]),o&&o.push(r[t])}i&&(this.faceVertexUvs[0]=i),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){const e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}const t=[];for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];t.push(n.x,n.y,n.z)}const n=[],r=[],i={},o=[],s={},a=[],l={};for(let e=0;e<this.faces.length;e++){const t=this.faces[e],r=!0,i=!1,o=void 0!==this.faceVertexUvs[0][e],s=t.normal.length()>0,a=t.vertexNormals.length>0,l=1!==t.color.r||1!==t.color.g||1!==t.color.b,p=t.vertexColors.length>0;let f=0;if(f=c(f,0,0),f=c(f,1,r),f=c(f,2,i),f=c(f,3,o),f=c(f,4,s),f=c(f,5,a),f=c(f,6,l),f=c(f,7,p),n.push(f),n.push(t.a,t.b,t.c),n.push(t.materialIndex),o){const t=this.faceVertexUvs[0][e];n.push(d(t[0]),d(t[1]),d(t[2]))}if(s&&n.push(h(t.normal)),a){const e=t.vertexNormals;n.push(h(e[0]),h(e[1]),h(e[2]))}if(l&&n.push(u(t.color)),p){const e=t.vertexColors;n.push(u(e[0]),u(e[1]),u(e[2]))}}function c(e,t,n){return n?e|1<<t:e&~(1<<t)}function h(e){const t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==i[t]||(i[t]=r.length/3,r.push(e.x,e.y,e.z)),i[t]}function u(e){const t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==s[t]||(s[t]=o.length,o.push(e.getHex())),s[t]}function d(e){const t=e.x.toString()+e.y.toString();return void 0!==l[t]||(l[t]=a.length/2,a.push(e.x,e.y)),l[t]}return e.data={},e.data.vertices=t,e.data.normals=r,o.length>0&&(e.data.colors=o),a.length>0&&(e.data.uvs=[a]),e.data.faces=n,e},clone:function(){return(new go).copy(this)},copy:function(e){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=e.name;const t=e.vertices;for(let e=0,n=t.length;e<n;e++)this.vertices.push(t[e].clone());const n=e.colors;for(let e=0,t=n.length;e<t;e++)this.colors.push(n[e].clone());const r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,n=e.faceVertexUvs.length;t<n;t++){const n=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){const r=n[e],i=[];for(let e=0,t=r.length;e<t;e++){const t=r[e];i.push(t.clone())}this.faceVertexUvs[t].push(i)}}const i=e.morphTargets;for(let e=0,t=i.length;e<t;e++){const t={};if(t.name=i[e].name,void 0!==i[e].vertices){t.vertices=[];for(let n=0,r=i[e].vertices.length;n<r;n++)t.vertices.push(i[e].vertices[n].clone())}if(void 0!==i[e].normals){t.normals=[];for(let n=0,r=i[e].normals.length;n<r;n++)t.normals.push(i[e].normals[n].clone())}this.morphTargets.push(t)}const o=e.morphNormals;for(let e=0,t=o.length;e<t;e++){const t={};if(void 0!==o[e].vertexNormals){t.vertexNormals=[];for(let n=0,r=o[e].vertexNormals.length;n<r;n++){const r=o[e].vertexNormals[n],i={};i.a=r.a.clone(),i.b=r.b.clone(),i.c=r.c.clone(),t.vertexNormals.push(i)}}if(void 0!==o[e].faceNormals){t.faceNormals=[];for(let n=0,r=o[e].faceNormals.length;n<r;n++)t.faceNormals.push(o[e].faceNormals[n].clone())}this.morphNormals.push(t)}const s=e.skinWeights;for(let e=0,t=s.length;e<t;e++)this.skinWeights.push(s[e].clone());const a=e.skinIndices;for(let e=0,t=a.length;e<t;e++)this.skinIndices.push(a[e].clone());const l=e.lineDistances;for(let e=0,t=l.length;e<t;e++)this.lineDistances.push(l[e]);const c=e.boundingBox;null!==c&&(this.boundingBox=c.clone());const h=e.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class vo extends go{constructor(e,t,n,r,i,o){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Ot(e,t,n,r,i,o)),this.mergeVertices()}}class yo extends pt{constructor(e=1,t=8,n=0,r=2*Math.PI){super(),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const i=[],o=[],a=[],l=[],c=new v,h=new s;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let i=0,s=3;i<=t;i++,s+=3){const u=n+i/t*r;c.x=e*Math.cos(u),c.y=e*Math.sin(u),o.push(c.x,c.y,c.z),a.push(0,0,1),h.x=(o[s]/e+1)/2,h.y=(o[s+1]/e+1)/2,l.push(h.x,h.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new et(o,3)),this.setAttribute("normal",new et(a,3)),this.setAttribute("uv",new et(l,2))}}class xo extends go{constructor(e,t,n,r){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new yo(e,t,n,r)),this.mergeVertices()}}class bo extends pt{constructor(e=1,t=1,n=1,r=8,i=1,o=!1,a=0,l=2*Math.PI){super(),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),i=Math.floor(i);const h=[],u=[],d=[],p=[];let f=0;const m=[],g=n/2;let y=0;function x(n){const i=f,o=new s,m=new v;let x=0;const b=!0===n?e:t,_=!0===n?1:-1;for(let e=1;e<=r;e++)u.push(0,g*_,0),d.push(0,_,0),p.push(.5,.5),f++;const w=f;for(let e=0;e<=r;e++){const t=e/r*l+a,n=Math.cos(t),i=Math.sin(t);m.x=b*i,m.y=g*_,m.z=b*n,u.push(m.x,m.y,m.z),d.push(0,_,0),o.x=.5*n+.5,o.y=.5*i*_+.5,p.push(o.x,o.y),f++}for(let e=0;e<r;e++){const t=i+e,r=w+e;!0===n?h.push(r,r+1,t):h.push(r+1,r,t),x+=3}c.addGroup(y,x,!0===n?1:2),y+=x}!function(){const o=new v,s=new v;let x=0;const b=(t-e)/n;for(let c=0;c<=i;c++){const h=[],v=c/i,y=v*(t-e)+e;for(let e=0;e<=r;e++){const t=e/r,i=t*l+a,c=Math.sin(i),m=Math.cos(i);s.x=y*c,s.y=-v*n+g,s.z=y*m,u.push(s.x,s.y,s.z),o.set(c,b,m).normalize(),d.push(o.x,o.y,o.z),p.push(t,1-v),h.push(f++)}m.push(h)}for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=m[t][e],r=m[t+1][e],i=m[t+1][e+1],o=m[t][e+1];h.push(n,r,o),h.push(r,i,o),x+=6}c.addGroup(y,x,0),y+=x}(),!1===o&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new et(u,3)),this.setAttribute("normal",new et(d,3)),this.setAttribute("uv",new et(p,2))}}class _o extends go{constructor(e,t,n,r,i,o,s,a){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new bo(e,t,n,r,i,o,s,a)),this.mergeVertices()}}class wo extends _o{constructor(e,t,n,r,i,o,s){super(0,e,t,n,r,i,o,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:s}}}class Mo extends bo{constructor(e=1,t=1,n=8,r=1,i=!1,o=0,s=2*Math.PI){super(0,e,t,n,r,i,o,s),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:s}}}class So extends pt{constructor(e,t,n=1,r=0){super(),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const i=[],o=[];function a(e,t,n,r){const i=r+1,o=[];for(let r=0;r<=i;r++){o[r]=[];const s=e.clone().lerp(n,r/i),a=t.clone().lerp(n,r/i),l=i-r;for(let e=0;e<=l;e++)o[r][e]=0===e&&r===i?s:s.clone().lerp(a,e/l)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){const n=Math.floor(t/2);t%2==0?(l(o[e][n+1]),l(o[e+1][n]),l(o[e][n])):(l(o[e][n+1]),l(o[e+1][n+1]),l(o[e+1][n]))}}function l(e){i.push(e.x,e.y,e.z)}function c(t,n){const r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function h(e,t,n,r){r<0&&1===e.x&&(o[t]=e.x-1),0===n.x&&0===n.z&&(o[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}function d(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){const n=new v,r=new v,i=new v;for(let o=0;o<t.length;o+=3)c(t[o+0],n),c(t[o+1],r),c(t[o+2],i),a(n,r,i,e)}(r),function(e){const t=new v;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){const e=new v;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];const n=u(e)/2/Math.PI+.5,r=d(e)/Math.PI+.5;o.push(n,1-r)}(function(){const e=new v,t=new v,n=new v,r=new v,a=new s,l=new s,c=new s;for(let s=0,d=0;s<i.length;s+=9,d+=6){e.set(i[s+0],i[s+1],i[s+2]),t.set(i[s+3],i[s+4],i[s+5]),n.set(i[s+6],i[s+7],i[s+8]),a.set(o[d+0],o[d+1]),l.set(o[d+2],o[d+3]),c.set(o[d+4],o[d+5]),r.copy(e).add(t).add(n).divideScalar(3);const p=u(r);h(a,d+0,e,p),h(l,d+2,t,p),h(c,d+4,n,p)}})(),function(){for(let e=0;e<o.length;e+=6){const t=o[e+0],n=o[e+2],r=o[e+4],i=Math.max(t,n,r),s=Math.min(t,n,r);i>.9&&s<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new et(i,3)),this.setAttribute("normal",new et(i.slice(),3)),this.setAttribute("uv",new et(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}class To extends So{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class Ao extends go{constructor(e,t){super(),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new To(e,t)),this.mergeVertices()}}const Eo=new v,Po=new v,Lo=new v,Co=new Re;class Ro extends pt{constructor(e,t){super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1,e.isGeometry&&(e=(new pt).fromGeometry(e));const n=Math.pow(10,4),r=Math.cos(o.DEG2RAD*t),i=e.getIndex(),s=e.getAttribute("position"),a=i?i.count:s.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let e=0;e<a;e+=3){i?(l[0]=i.getX(e),l[1]=i.getX(e+1),l[2]=i.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:o,c:a}=Co;if(t.fromBufferAttribute(s,l[0]),o.fromBufferAttribute(s,l[1]),a.fromBufferAttribute(s,l[2]),Co.getNormal(Lo),h[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,h[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,h[2]=`${Math.round(a.x*n)},${Math.round(a.y*n)},${Math.round(a.z*n)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=h[e],i=h[t],o=Co[c[e]],s=Co[c[t]],a=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(Lo.dot(u[p].normal)<=r&&(d.push(o.x,o.y,o.z),d.push(s.x,s.y,s.z)),u[p]=null):a in u||(u[a]={index0:l[e],index1:l[t],normal:Lo.clone()})}}for(const e in u)if(u[e]){const{index0:t,index1:n}=u[e];Eo.fromBufferAttribute(s,t),Po.fromBufferAttribute(s,n),d.push(Eo.x,Eo.y,Eo.z),d.push(Po.x,Po.y,Po.z)}this.setAttribute("position",new et(d,3))}}const Io=function(e,t,n){n=n||2;const r=t&&t.length,i=r?t[0]*n:e.length;let o=Fo(e,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c,h,u,d,p;if(r&&(o=function(e,t,n,r){const i=[];let o,s,a,l,c;for(o=0,s=t.length;o<s;o++)a=t[o]*r,l=o<s-1?t[o+1]*r:e.length,c=Fo(e,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Vo(c));for(i.sort(zo),o=0;o<i.length;o++)Go(i[o],n),n=Oo(n,n.next);return n}(e,t,o,n)),e.length>80*n){a=c=e[0],l=h=e[1];for(let t=n;t<i;t+=n)u=e[t],d=e[t+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return No(o,s,n,a,l,p),s};function Fo(e,t,n,r,i){let o,s;if(i===function(e,t,n,r){let i=0;for(let o=t,s=n-r;o<n;o+=r)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}(e,t,n,r)>0)for(o=t;o<n;o+=r)s=es(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=es(o,e[o],e[o+1],s);return s&&qo(s,s.next)&&(ts(s),s=s.next),s}function Oo(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!qo(r,r.next)&&0!==Yo(r.prev,r,r.next))r=r.next;else{if(ts(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function No(e,t,n,r,i,o,s){if(!e)return;!s&&o&&function(e,t,n,r){let i=e;do{null===i.z&&(i.z=jo(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n,r,i,o,s,a,l,c=1;do{for(n=e,e=null,o=null,s=0;n;){for(s++,r=n,a=0,t=0;t<c&&(a++,r=r.nextZ,r);t++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(s>1)}(i)}(e,r,i,o);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,o?Bo(e,r,i,o):Do(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),ts(e),e=l.next,c=l.next;else if((e=l)===c){s?1===s?No(e=Uo(Oo(e),t,n),t,n,r,i,o,2):2===s&&ko(e,t,n,r,i,o):No(Oo(e),t,n,r,i,o,1);break}}function Do(e){const t=e.prev,n=e,r=e.next;if(Yo(t,n,r)>=0)return!1;let i=e.next.next;for(;i!==e.prev;){if(Wo(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Yo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Bo(e,t,n,r){const i=e.prev,o=e,s=e.next;if(Yo(i,o,s)>=0)return!1;const a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,c=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,u=jo(a,l,t,n,r),d=jo(c,h,t,n,r);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Yo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Yo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Yo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Yo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Uo(e,t,n){let r=e;do{const i=r.prev,o=r.next.next;!qo(i,o)&&Qo(i,r,r.next,o)&&Ko(i,o)&&Ko(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),ts(r),ts(r.next),r=e=o),r=r.next}while(r!==e);return Oo(r)}function ko(e,t,n,r,i,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Xo(s,e)){let a=$o(s,e);return s=Oo(s,s.next),a=Oo(a,a.next),No(s,t,n,r,i,o),void No(a,t,n,r,i,o)}e=e.next}s=s.next}while(s!==e)}function zo(e,t){return e.x-t.x}function Go(e,t){if(t=function(e,t){let n=t;const r=e.x,i=e.y;let o,s=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>s){if(s=e,e===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===s)return o;const a=o,l=o.x,c=o.y;let h,u=1/0;n=o;do{r>=n.x&&n.x>=l&&r!==n.x&&Wo(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)&&(h=Math.abs(i-n.y)/(r-n.x),Ko(n,e)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&Ho(o,n)))&&(o=n,u=h)),n=n.next}while(n!==a);return o}(e,t)){const n=$o(t,e);Oo(t,t.next),Oo(n,n.next)}}function Ho(e,t){return Yo(e.prev,e,t.prev)<0&&Yo(t.next,e,e.next)<0}function jo(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Vo(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Wo(e,t,n,r,i,o,s,a){return(i-s)*(t-a)-(e-s)*(o-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function Xo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Qo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ko(e,t)&&Ko(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Yo(e.prev,e,t.prev)||Yo(e,t.prev,t))||qo(e,t)&&Yo(e.prev,e,e.next)>0&&Yo(t.prev,t,t.next)>0)}function Yo(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function qo(e,t){return e.x===t.x&&e.y===t.y}function Qo(e,t,n,r){const i=Jo(Yo(e,t,n)),o=Jo(Yo(e,t,r)),s=Jo(Yo(n,r,e)),a=Jo(Yo(n,r,t));return i!==o&&s!==a||(!(0!==i||!Zo(e,n,t))||(!(0!==o||!Zo(e,r,t))||(!(0!==s||!Zo(n,e,r))||!(0!==a||!Zo(n,t,r)))))}function Zo(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Jo(e){return e>0?1:e<0?-1:0}function Ko(e,t){return Yo(e.prev,e,e.next)<0?Yo(e,t,e.next)>=0&&Yo(e,e.prev,t)>=0:Yo(e,t,e.prev)<0||Yo(e,e.next,t)<0}function $o(e,t){const n=new ns(e.i,e.x,e.y),r=new ns(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function es(e,t,n,r){const i=new ns(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ts(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ns(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}const rs={area:function(e){const t=e.length;let n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return rs.area(e)<0},triangulateShape:function(e,t){const n=[],r=[],i=[];is(e),os(n,e);let o=e.length;t.forEach(is);for(let e=0;e<t.length;e++)r.push(o),o+=t[e].length,os(n,t[e]);const s=Io(n,r);for(let e=0;e<s.length;e+=3)i.push(s.slice(e,e+3));return i}};function is(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function os(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class ss extends pt{constructor(e,t){super(),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){o(e[t])}function o(e){const o=[],a=void 0!==t.curveSegments?t.curveSegments:12,l=void 0!==t.steps?t.steps:1;let c=void 0!==t.depth?t.depth:100,h=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,d=void 0!==t.bevelSize?t.bevelSize:u-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,f=void 0!==t.bevelSegments?t.bevelSegments:3;const m=t.extrudePath,g=void 0!==t.UVGenerator?t.UVGenerator:as;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);let y,x,b,_,w,M=!1;m&&(y=m.getSpacedPoints(l),M=!0,h=!1,x=m.computeFrenetFrames(l,!1),b=new v,_=new v,w=new v),h||(f=0,u=0,d=0,p=0);const S=e.extractPoints(a);let T=S.shape;const A=S.holes;if(!rs.isClockWise(T)){T=T.reverse();for(let e=0,t=A.length;e<t;e++){const t=A[e];rs.isClockWise(t)&&(A[e]=t.reverse())}}const E=rs.triangulateShape(T,A),P=T;for(let e=0,t=A.length;e<t;e++){const t=A[e];T=T.concat(t)}function L(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}const C=T.length,R=E.length;function I(e,t,n){let r,i,o;const a=e.x-t.x,l=e.y-t.y,c=n.x-e.x,h=n.y-e.y,u=a*a+l*l,d=a*h-l*c;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(u),p=Math.sqrt(c*c+h*h),f=t.x-l/d,m=t.y+a/d,g=((n.x-h/p-f)*h-(n.y+c/p-m)*c)/(a*h-l*c);r=f+a*g-e.x,i=m+l*g-e.y;const v=r*r+i*i;if(v<=2)return new s(r,i);o=Math.sqrt(v/2)}else{let e=!1;a>Number.EPSILON?c>Number.EPSILON&&(e=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(e=!0):Math.sign(l)===Math.sign(h)&&(e=!0),e?(r=-l,i=a,o=Math.sqrt(u)):(r=a,i=l,o=Math.sqrt(u/2))}return new s(r/o,i/o)}const F=[];for(let e=0,t=P.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),F[e]=I(P[e],P[n],P[r]);const O=[];let N,D=F.concat();for(let e=0,t=A.length;e<t;e++){const t=A[e];N=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),N[e]=I(t[e],t[r],t[i]);O.push(N),D=D.concat(N)}for(let e=0;e<f;e++){const t=e/f,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+p;for(let e=0,t=P.length;e<t;e++){const t=L(P[e],F[e],r);k(t.x,t.y,-n)}for(let e=0,t=A.length;e<t;e++){const t=A[e];N=O[e];for(let e=0,i=t.length;e<i;e++){const i=L(t[e],N[e],r);k(i.x,i.y,-n)}}}const B=d+p;for(let e=0;e<C;e++){const t=h?L(T[e],D[e],B):T[e];M?(_.copy(x.normals[0]).multiplyScalar(t.x),b.copy(x.binormals[0]).multiplyScalar(t.y),w.copy(y[0]).add(_).add(b),k(w.x,w.y,w.z)):k(t.x,t.y,0)}for(let e=1;e<=l;e++)for(let t=0;t<C;t++){const n=h?L(T[t],D[t],B):T[t];M?(_.copy(x.normals[e]).multiplyScalar(n.x),b.copy(x.binormals[e]).multiplyScalar(n.y),w.copy(y[e]).add(_).add(b),k(w.x,w.y,w.z)):k(n.x,n.y,c/l*e)}for(let e=f-1;e>=0;e--){const t=e/f,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+p;for(let e=0,t=P.length;e<t;e++){const t=L(P[e],F[e],r);k(t.x,t.y,c+n)}for(let e=0,t=A.length;e<t;e++){const t=A[e];N=O[e];for(let e=0,i=t.length;e<i;e++){const i=L(t[e],N[e],r);M?k(i.x,i.y+y[l-1].y,y[l-1].x+n):k(i.x,i.y,c+n)}}}function U(e,t){let n=e.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=e.length-1);for(let e=0,n=l+2*f;e<n;e++){const n=C*e,o=C*(e+1);G(t+r+n,t+i+n,t+i+o,t+r+o)}}}function k(e,t,n){o.push(e),o.push(t),o.push(n)}function z(e,t,i){H(e),H(t),H(i);const o=r.length/3,s=g.generateTopUV(n,r,o-3,o-2,o-1);j(s[0]),j(s[1]),j(s[2])}function G(e,t,i,o){H(e),H(t),H(o),H(t),H(i),H(o);const s=r.length/3,a=g.generateSideWallUV(n,r,s-6,s-3,s-2,s-1);j(a[0]),j(a[1]),j(a[3]),j(a[1]),j(a[2]),j(a[3])}function H(e){r.push(o[3*e+0]),r.push(o[3*e+1]),r.push(o[3*e+2])}function j(e){i.push(e.x),i.push(e.y)}!function(){const e=r.length/3;if(h){let e=0,t=C*e;for(let e=0;e<R;e++){const n=E[e];z(n[2]+t,n[1]+t,n[0]+t)}e=l+2*f,t=C*e;for(let e=0;e<R;e++){const n=E[e];z(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<R;e++){const t=E[e];z(t[2],t[1],t[0])}for(let e=0;e<R;e++){const t=E[e];z(t[0]+C*l,t[1]+C*l,t[2]+C*l)}}n.addGroup(e,r.length/3-e,0)}(),function(){const e=r.length/3;let t=0;U(P,t),t+=P.length;for(let e=0,n=A.length;e<n;e++){const n=A[e];U(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}()}this.setAttribute("position",new et(r,3)),this.setAttribute("uv",new et(i,2)),this.computeVertexNormals()}toJSON(){const e=pt.prototype.toJSON.call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){const r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}const as={generateTopUV:function(e,t,n,r,i){const o=t[3*n],a=t[3*n+1],l=t[3*r],c=t[3*r+1],h=t[3*i],u=t[3*i+1];return[new s(o,a),new s(l,c),new s(h,u)]},generateSideWallUV:function(e,t,n,r,i,o){const a=t[3*n],l=t[3*n+1],c=t[3*n+2],h=t[3*r],u=t[3*r+1],d=t[3*r+2],p=t[3*i],f=t[3*i+1],m=t[3*i+2],g=t[3*o],v=t[3*o+1],y=t[3*o+2];return Math.abs(l-u)<.01?[new s(a,1-c),new s(h,1-d),new s(p,1-m),new s(g,1-y)]:[new s(l,1-c),new s(u,1-d),new s(f,1-m),new s(v,1-y)]}};class ls extends go{constructor(e,t){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new ss(e,t)),this.mergeVertices()}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){const r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}class cs extends So{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class hs extends go{constructor(e,t){super(),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new cs(e,t)),this.mergeVertices()}}class us extends pt{constructor(e,t=12,n=0,r=2*Math.PI){super(),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=o.clamp(r,0,2*Math.PI);const i=[],a=[],l=[],c=1/t,h=new v,u=new s;for(let i=0;i<=t;i++){const o=n+i*c*r,s=Math.sin(o),d=Math.cos(o);for(let n=0;n<=e.length-1;n++)h.x=e[n].x*s,h.y=e[n].y,h.z=e[n].x*d,a.push(h.x,h.y,h.z),u.x=i/t,u.y=n/(e.length-1),l.push(u.x,u.y)}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const r=t+n*e.length,o=r,s=r+e.length,a=r+e.length+1,l=r+1;i.push(o,s,l),i.push(s,a,l)}if(this.setIndex(i),this.setAttribute("position",new et(a,3)),this.setAttribute("uv",new et(l,2)),this.computeVertexNormals(),r===2*Math.PI){const n=this.attributes.normal.array,r=new v,i=new v,o=new v,s=t*e.length*3;for(let t=0,a=0;t<e.length;t++,a+=3)r.x=n[a+0],r.y=n[a+1],r.z=n[a+2],i.x=n[s+a+0],i.y=n[s+a+1],i.z=n[s+a+2],o.addVectors(r,i).normalize(),n[a+0]=n[s+a+0]=o.x,n[a+1]=n[s+a+1]=o.y,n[a+2]=n[s+a+2]=o.z}}}class ds extends go{constructor(e,t,n,r){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new us(e,t,n,r)),this.mergeVertices()}}class ps extends So{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class fs extends go{constructor(e,t){super(),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ps(e,t)),this.mergeVertices()}}function ms(e,t,n){pt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};const r=[],i=[],o=[],s=[],a=1e-5,l=new v,c=new v,h=new v,u=new v,d=new v;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=t+1;for(let r=0;r<=n;r++){const p=r/n;for(let n=0;n<=t;n++){const r=n/t;e(r,p,c),i.push(c.x,c.y,c.z),r-a>=0?(e(r-a,p,h),u.subVectors(c,h)):(e(r+a,p,h),u.subVectors(h,c)),p-a>=0?(e(r,p-a,h),d.subVectors(c,h)):(e(r,p+a,h),d.subVectors(h,c)),l.crossVectors(u,d).normalize(),o.push(l.x,l.y,l.z),s.push(r,p)}}for(let e=0;e<n;e++)for(let n=0;n<t;n++){const t=e*p+n,i=e*p+n+1,o=(e+1)*p+n+1,s=(e+1)*p+n;r.push(t,i,s),r.push(i,o,s)}this.setIndex(r),this.setAttribute("position",new et(i,3)),this.setAttribute("normal",new et(o,3)),this.setAttribute("uv",new et(s,2))}function gs(e,t,n){go.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new ms(e,t,n)),this.mergeVertices()}ms.prototype=Object.create(pt.prototype),ms.prototype.constructor=ms,gs.prototype=Object.create(go.prototype),gs.prototype.constructor=gs;class vs extends go{constructor(e,t,n,r){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Zt(e,t,n,r)),this.mergeVertices()}}class ys extends go{constructor(e,t,n,r){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new So(e,t,n,r)),this.mergeVertices()}}class xs extends pt{constructor(e=.5,t=1,n=8,r=1,i=0,o=2*Math.PI){super(),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},n=Math.max(3,n);const a=[],l=[],c=[],h=[];let u=e;const d=(t-e)/(r=Math.max(1,r)),p=new v,f=new s;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){const r=i+e/n*o;p.x=u*Math.cos(r),p.y=u*Math.sin(r),l.push(p.x,p.y,p.z),c.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,h.push(f.x,f.y)}u+=d}for(let e=0;e<r;e++){const t=e*(n+1);for(let e=0;e<n;e++){const r=e+t,i=r,o=r+n+1,s=r+n+2,l=r+1;a.push(i,o,l),a.push(o,s,l)}}this.setIndex(a),this.setAttribute("position",new et(l,3)),this.setAttribute("normal",new et(c,3)),this.setAttribute("uv",new et(h,2))}}class bs extends go{constructor(e,t,n,r,i,o){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new xs(e,t,n,r,i,o)),this.mergeVertices()}}class _s extends pt{constructor(e,t=12){super(),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],i=[],o=[];let s=0,a=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,a,t),s+=a,a=0;function l(e){const s=r.length/3,l=e.extractPoints(t);let c=l.shape;const h=l.holes;!1===rs.isClockWise(c)&&(c=c.reverse());for(let e=0,t=h.length;e<t;e++){const t=h[e];!0===rs.isClockWise(t)&&(h[e]=t.reverse())}const u=rs.triangulateShape(c,h);for(let e=0,t=h.length;e<t;e++){const t=h[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];r.push(t.x,t.y,0),i.push(0,0,1),o.push(t.x,t.y)}for(let e=0,t=u.length;e<t;e++){const t=u[e],r=t[0]+s,i=t[1]+s,o=t[2]+s;n.push(r,i,o),a+=3}}this.setIndex(n),this.setAttribute("position",new et(r,3)),this.setAttribute("normal",new et(i,3)),this.setAttribute("uv",new et(o,2))}toJSON(){const e=pt.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}class ws extends go{constructor(e,t){super(),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new _s(e,t)),this.mergeVertices()}toJSON(){const e=go.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}class Ms extends pt{constructor(e=1,t=8,n=6,r=0,i=2*Math.PI,o=0,s=Math.PI){super(),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const a=Math.min(o+s,Math.PI);let l=0;const c=[],h=new v,u=new v,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let y=0;0==d&&0==o?y=.5/t:d==n&&a==Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const a=n/t;h.x=-e*Math.cos(r+a*i)*Math.sin(o+v*s),h.y=e*Math.cos(o+v*s),h.z=e*Math.sin(r+a*i)*Math.sin(o+v*s),p.push(h.x,h.y,h.z),u.copy(h).normalize(),f.push(u.x,u.y,u.z),m.push(a+y,1-v),g.push(l++)}c.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){const t=c[e][r+1],i=c[e][r],s=c[e+1][r],l=c[e+1][r+1];(0!==e||o>0)&&d.push(t,i,l),(e!==n-1||a<Math.PI)&&d.push(i,s,l)}this.setIndex(d),this.setAttribute("position",new et(p,3)),this.setAttribute("normal",new et(f,3)),this.setAttribute("uv",new et(m,2))}}class Ss extends go{constructor(e,t,n,r,i,o,s){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Ms(e,t,n,r,i,o,s)),this.mergeVertices()}}class Ts extends So{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class As extends go{constructor(e,t){super(),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ts(e,t)),this.mergeVertices()}}class Es extends ss{constructor(e,t={}){const n=t.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new pt;const r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),super(r,t),this.type="TextBufferGeometry"}}class Ps extends go{constructor(e,t){super(),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Es(e,t)),this.mergeVertices()}}class Ls extends pt{constructor(e=1,t=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const o=[],s=[],a=[],l=[],c=new v,h=new v,u=new v;for(let o=0;o<=n;o++)for(let d=0;d<=r;d++){const p=d/r*i,f=o/n*Math.PI*2;h.x=(e+t*Math.cos(f))*Math.cos(p),h.y=(e+t*Math.cos(f))*Math.sin(p),h.z=t*Math.sin(f),s.push(h.x,h.y,h.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),u.subVectors(h,c).normalize(),a.push(u.x,u.y,u.z),l.push(d/r),l.push(o/n)}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,s=(r+1)*(e-1)+t,a=(r+1)*e+t;o.push(n,i,a),o.push(i,s,a)}this.setIndex(o),this.setAttribute("position",new et(s,3)),this.setAttribute("normal",new et(a,3)),this.setAttribute("uv",new et(l,2))}}class Cs extends go{constructor(e,t,n,r,i){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Ls(e,t,n,r,i)),this.mergeVertices()}}class Rs extends pt{constructor(e=1,t=.4,n=64,r=8,i=2,o=3){super(),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},n=Math.floor(n),r=Math.floor(r);const s=[],a=[],l=[],c=[],h=new v,u=new v,d=new v,p=new v,f=new v,m=new v,g=new v;for(let s=0;s<=n;++s){const v=s/n*i*Math.PI*2;y(v,i,o,e,d),y(v+.01,i,o,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=r;++e){const i=e/r*Math.PI*2,o=-t*Math.cos(i),p=t*Math.sin(i);h.x=d.x+(o*g.x+p*f.x),h.y=d.y+(o*g.y+p*f.y),h.z=d.z+(o*g.z+p*f.z),a.push(h.x,h.y,h.z),u.subVectors(h,d).normalize(),l.push(u.x,u.y,u.z),c.push(s/n),c.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,a=(r+1)*(e-1)+t;s.push(n,i,a),s.push(i,o,a)}function y(e,t,n,r,i){const o=Math.cos(e),s=Math.sin(e),a=n/t*e,l=Math.cos(a);i.x=r*(2+l)*.5*o,i.y=r*(2+l)*s*.5,i.z=r*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new et(a,3)),this.setAttribute("normal",new et(l,3)),this.setAttribute("uv",new et(c,2))}}class Is extends go{constructor(e,t,n,r,i,o,s){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==s&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Rs(e,t,n,r,i,o)),this.mergeVertices()}}class Fs extends pt{constructor(e,t=64,n=1,r=8,i=!1){super(),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};const o=e.computeFrenetFrames(t,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new v,l=new v,c=new s;let h=new v;const u=[],d=[],p=[],f=[];function m(i){h=e.getPointAt(i/t,h);const s=o.normals[i],c=o.binormals[i];for(let e=0;e<=r;e++){const t=e/r*Math.PI*2,i=Math.sin(t),o=-Math.cos(t);l.x=o*s.x+i*c.x,l.y=o*s.y+i*c.y,l.z=o*s.z+i*c.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=h.x+n*l.x,a.y=h.y+n*l.y,a.z=h.z+n*l.z,u.push(a.x,a.y,a.z)}}!function(){for(let e=0;e<t;e++)m(e);m(!1===i?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,p.push(c.x,c.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,s=(r+1)*(e-1)+t;f.push(n,i,s),f.push(i,o,s)}}()}(),this.setIndex(f),this.setAttribute("position",new et(u,3)),this.setAttribute("normal",new et(d,3)),this.setAttribute("uv",new et(p,2))}toJSON(){const e=pt.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e}}class Os extends go{constructor(e,t,n,r,i,o){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");const s=new Fs(e,t,n,r,i);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals,this.fromBufferGeometry(s),this.mergeVertices()}}class Ns extends pt{constructor(e){super(),this.type="WireframeGeometry";const t=[],n=[0,0],r={},i=["a","b","c"];if(e&&e.isGeometry){const o=e.faces;for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0;e<3;e++){const o=t[i[e]],s=t[i[(e+1)%3]];n[0]=Math.min(o,s),n[1]=Math.max(o,s);const a=n[0]+","+n[1];void 0===r[a]&&(r[a]={index1:n[0],index2:n[1]})}}for(const n in r){const i=r[n];let o=e.vertices[i.index1];t.push(o.x,o.y,o.z),o=e.vertices[i.index2],t.push(o.x,o.y,o.z)}}else if(e&&e.isBufferGeometry){const i=new v;if(null!==e.index){const o=e.attributes.position,s=e.index;let a=e.groups;0===a.length&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,t=a.length;e<t;++e){const t=a[e],i=t.start;for(let e=i,o=i+t.count;e<o;e+=3)for(let t=0;t<3;t++){const i=s.getX(e+t),o=s.getX(e+(t+1)%3);n[0]=Math.min(i,o),n[1]=Math.max(i,o);const a=n[0]+","+n[1];void 0===r[a]&&(r[a]={index1:n[0],index2:n[1]})}}for(const e in r){const n=r[e];i.fromBufferAttribute(o,n.index1),t.push(i.x,i.y,i.z),i.fromBufferAttribute(o,n.index2),t.push(i.x,i.y,i.z)}}else{const n=e.attributes.position;for(let e=0,r=n.count/3;e<r;e++)for(let r=0;r<3;r++){const o=3*e+r;i.fromBufferAttribute(n,o),t.push(i.x,i.y,i.z);const s=3*e+(r+1)%3;i.fromBufferAttribute(n,s),t.push(i.x,i.y,i.z)}}}this.setAttribute("position",new et(t,3))}}var Ds=Object.freeze({__proto__:null,BoxGeometry:vo,BoxBufferGeometry:Ot,CircleGeometry:xo,CircleBufferGeometry:yo,ConeGeometry:wo,ConeBufferGeometry:Mo,CylinderGeometry:_o,CylinderBufferGeometry:bo,DodecahedronGeometry:Ao,DodecahedronBufferGeometry:To,EdgesGeometry:Ro,ExtrudeGeometry:ls,ExtrudeBufferGeometry:ss,IcosahedronGeometry:hs,IcosahedronBufferGeometry:cs,LatheGeometry:ds,LatheBufferGeometry:us,OctahedronGeometry:fs,OctahedronBufferGeometry:ps,ParametricGeometry:gs,ParametricBufferGeometry:ms,PlaneGeometry:vs,PlaneBufferGeometry:Zt,PolyhedronGeometry:ys,PolyhedronBufferGeometry:So,RingGeometry:bs,RingBufferGeometry:xs,ShapeGeometry:ws,ShapeBufferGeometry:_s,SphereGeometry:Ss,SphereBufferGeometry:Ms,TetrahedronGeometry:As,TetrahedronBufferGeometry:Ts,TextGeometry:Ps,TextBufferGeometry:Es,TorusGeometry:Cs,TorusBufferGeometry:Ls,TorusKnotGeometry:Is,TorusKnotBufferGeometry:Rs,TubeGeometry:Os,TubeBufferGeometry:Fs,WireframeGeometry:Ns});function Bs(e){Ge.call(this),this.type="ShadowMaterial",this.color=new Ue(0),this.transparent=!0,this.setValues(e)}function Us(e){Ut.call(this,e),this.type="RawShaderMaterial"}function ks(e){Ge.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ue(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function zs(e){ks.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new s(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(e){this.reflectivity=o.clamp(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(e)}function Gs(e){Ge.call(this),this.type="MeshPhongMaterial",this.color=new Ue(16777215),this.specular=new Ue(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Hs(e){Ge.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ue(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function js(e){Ge.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Vs(e){Ge.call(this),this.type="MeshLambertMaterial",this.color=new Ue(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ws(e){Ge.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ue(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Xs(e){ji.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Bs.prototype=Object.create(Ge.prototype),Bs.prototype.constructor=Bs,Bs.prototype.isShadowMaterial=!0,Bs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this},Us.prototype=Object.create(Ut.prototype),Us.prototype.constructor=Us,Us.prototype.isRawShaderMaterial=!0,ks.prototype=Object.create(Ge.prototype),ks.prototype.constructor=ks,ks.prototype.isMeshStandardMaterial=!0,ks.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},zs.prototype=Object.create(ks.prototype),zs.prototype.constructor=zs,zs.prototype.isMeshPhysicalMaterial=!0,zs.prototype.copy=function(e){return ks.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new Ue).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this},Gs.prototype=Object.create(Ge.prototype),Gs.prototype.constructor=Gs,Gs.prototype.isMeshPhongMaterial=!0,Gs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Hs.prototype=Object.create(Ge.prototype),Hs.prototype.constructor=Hs,Hs.prototype.isMeshToonMaterial=!0,Hs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},js.prototype=Object.create(Ge.prototype),js.prototype.constructor=js,js.prototype.isMeshNormalMaterial=!0,js.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Vs.prototype=Object.create(Ge.prototype),Vs.prototype.constructor=Vs,Vs.prototype.isMeshLambertMaterial=!0,Vs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Ws.prototype=Object.create(Ge.prototype),Ws.prototype.constructor=Ws,Ws.prototype.isMeshMatcapMaterial=!0,Ws.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Xs.prototype=Object.create(ji.prototype),Xs.prototype.constructor=Xs,Xs.prototype.isLineDashedMaterial=!0,Xs.prototype.copy=function(e){return ji.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Ys=Object.freeze({__proto__:null,ShadowMaterial:Bs,SpriteMaterial:ci,RawShaderMaterial:Us,ShaderMaterial:Ut,PointsMaterial:eo,MeshPhysicalMaterial:zs,MeshStandardMaterial:ks,MeshPhongMaterial:Gs,MeshToonMaterial:Hs,MeshNormalMaterial:js,MeshLambertMaterial:Vs,MeshDepthMaterial:Vr,MeshDistanceMaterial:Wr,MeshBasicMaterial:He,MeshMatcapMaterial:Ws,LineDashedMaterial:Xs,LineBasicMaterial:ji,Material:Ge});const qs={arraySlice:function(e,t,n){return qs.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const r=e.length,i=new e.constructor(r);for(let o=0,s=0;s!==r;++o){const r=n[o]*t;for(let n=0;n!==t;++n)i[s++]=e[r+n]}return i},flattenJSON:function(e,t,n,r){let i=1,o=e[0];for(;void 0!==o&&void 0===o[r];)o=e[i++];if(void 0===o)return;let s=o[r];if(void 0!==s)if(Array.isArray(s))do{s=o[r],void 0!==s&&(t.push(o.time),n.push.apply(n,s)),o=e[i++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[r],void 0!==s&&(t.push(o.time),s.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{s=o[r],void 0!==s&&(t.push(o.time),n.push(s)),o=e[i++]}while(void 0!==o)},subclip:function(e,t,n,r,i=30){const o=e.clone();o.name=t;const s=[];for(let e=0;e<o.tracks.length;++e){const t=o.tracks[e],a=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const o=t.times[e]*i;if(!(o<n||o>=r)){l.push(t.times[e]);for(let n=0;n<a;++n)c.push(t.values[e*a+n])}}0!==l.length&&(t.times=qs.convertArray(l,t.times.constructor),t.values=qs.convertArray(c,t.values.constructor),s.push(t))}o.tracks=s;let a=1/0;for(let e=0;e<o.tracks.length;++e)a>o.tracks[e].times[0]&&(a=o.tracks[e].times[0]);for(let e=0;e<o.tracks.length;++e)o.tracks[e].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(e,t=0,n=e,r=30){r<=0&&(r=30);const i=n.tracks.length,o=t/r;for(let t=0;t<i;++t){const r=n.tracks[t],i=r.ValueTypeName;if("bool"===i||"string"===i)continue;const s=e.tracks.find((function(e){return e.name===r.name&&e.ValueTypeName===i}));if(void 0===s)continue;let a=0;const l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=r.times.length-1;let d;if(o<=r.times[0]){const e=a,t=l-a;d=qs.arraySlice(r.values,e,t)}else if(o>=r.times[u]){const e=u*l+a,t=e+l-a;d=qs.arraySlice(r.values,e,t)}else{const e=r.createInterpolant(),t=a,n=l-a;e.evaluate(o),d=qs.arraySlice(e.resultBuffer,t,n)}if("quaternion"===i){(new g).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let e=0;e<p;++e){const t=e*h+c;if("quaternion"===i)g.multiplyQuaternionsFlat(s.values,t,d,0,s.values,t);else{const e=h-2*c;for(let n=0;n<e;++n)s.values[t+n]-=d[n]}}}return e.blendMode=2501,e}};function Qs(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Zs(e,t,n,r){Qs.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Js(e,t,n,r){Qs.call(this,e,t,n,r)}function Ks(e,t,n,r){Qs.call(this,e,t,n,r)}function $s(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=qs.convertArray(t,this.TimeBufferType),this.values=qs.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function ea(e,t,n){$s.call(this,e,t,n)}function ta(e,t,n,r){$s.call(this,e,t,n,r)}function na(e,t,n,r){$s.call(this,e,t,n,r)}function ra(e,t,n,r){Qs.call(this,e,t,n,r)}function ia(e,t,n,r){$s.call(this,e,t,n,r)}function oa(e,t,n,r){$s.call(this,e,t,n,r)}function sa(e,t,n,r){$s.call(this,e,t,n,r)}function aa(e,t=-1,n,r=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=o.generateUUID(),this.duration<0&&this.resetDuration()}function la(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return na;case"vector":case"vector2":case"vector3":case"vector4":return sa;case"color":return ta;case"quaternion":return ia;case"bool":case"boolean":return ea;case"string":return oa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];qs.flattenJSON(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(Qs.prototype,{evaluate:function(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{let o;n:{r:if(!(e<r)){for(let o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break t}o=t.length;break n}if(e>=i)break e;{const s=t[1];e<s&&(n=2,i=s);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}o=n,n=0}}for(;n<o;){const r=n+o>>>1;e<t[r]?o=r:n=r+1}if(r=t[n],i=t[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Qs.prototype,{beforeStart_:Qs.prototype.copySampleValue_,afterEnd_:Qs.prototype.copySampleValue_}),Zs.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Zs,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,n){const r=this.parameterPositions;let i=e-2,o=e+1,s=r[i],a=r[o];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:i=e,s=2*t-n;break;case 2402:i=r.length-2,s=t+r[i]-r[i+1];break;default:i=e,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:o=e,a=2*n-t;break;case 2402:o=1,a=n+r[1]-r[0];break;default:o=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(a-n),this._offsetPrev=i*c,this._offsetNext=o*c},interpolate_:function(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=e*s,l=a-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let e=0;e!==s;++e)i[e]=g*o[c+e]+v*o[l+e]+y*o[a+e]+x*o[h+e];return i}}),Js.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Js,interpolate_:function(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=e*s,l=a-s,c=(n-t)/(r-t),h=1-c;for(let e=0;e!==s;++e)i[e]=o[l+e]*h+o[a+e]*c;return i}}),Ks.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Ks,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign($s,{toJSON:function(e){const t=e.constructor;let n;if(void 0!==t.toJSON)n=t.toJSON(e);else{n={name:e.name,times:qs.convertArray(e.times,Array),values:qs.convertArray(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}}),Object.assign($s.prototype,{constructor:$s,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new Ks(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Js(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Zs(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this},scale:function(e){if(1!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this},trim:function(e,t){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<e;)++i;for(;-1!==o&&n[o]>t;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);const e=this.getValueSize();this.times=qs.arraySlice(n,i,o),this.values=qs.arraySlice(this.values,i*e,o*e)}return this},validate:function(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let t=0;t!==i;t++){const r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,o),e=!1;break}o=r}if(void 0!==r&&qs.isTypedArray(r))for(let t=0,n=r.length;t!==n;++t){const n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e},optimize:function(){const e=qs.arraySlice(this.times),t=qs.arraySlice(this.values),n=this.getValueSize(),r=2302===this.getInterpolation(),i=e.length-1;let o=1;for(let s=1;s<i;++s){let i=!1;const a=e[s];if(a!==e[s+1]&&(1!==s||a!==a[0]))if(r)i=!0;else{const e=s*n,r=e-n,o=e+n;for(let s=0;s!==n;++s){const n=t[e+s];if(n!==t[r+s]||n!==t[o+s]){i=!0;break}}}if(i){if(s!==o){e[o]=e[s];const r=s*n,i=o*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++o}}if(i>0){e[o]=e[i];for(let e=i*n,r=o*n,s=0;s!==n;++s)t[r+s]=t[e+s];++o}return o!==e.length?(this.times=qs.arraySlice(e,0,o),this.values=qs.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this},clone:function(){const e=qs.arraySlice(this.times,0),t=qs.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),ea.prototype=Object.assign(Object.create($s.prototype),{constructor:ea,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ta.prototype=Object.assign(Object.create($s.prototype),{constructor:ta,ValueTypeName:"color"}),na.prototype=Object.assign(Object.create($s.prototype),{constructor:na,ValueTypeName:"number"}),ra.prototype=Object.assign(Object.create(Qs.prototype),{constructor:ra,interpolate_:function(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-t)/(r-t);let l=e*s;for(let e=l+s;l!==e;l+=4)g.slerpFlat(i,0,o,l-s,o,l,a);return i}}),ia.prototype=Object.assign(Object.create($s.prototype),{constructor:ia,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new ra(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),oa.prototype=Object.assign(Object.create($s.prototype),{constructor:oa,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),sa.prototype=Object.assign(Object.create($s.prototype),{constructor:sa,ValueTypeName:"vector"}),Object.assign(aa,{parse:function(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(la(n[e]).scale(r));const i=new aa(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i},toJSON:function(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push($s.toJSON(n[e]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){const i=t.length,o=[];for(let e=0;e<i;e++){let s=[],a=[];s.push((e+i-1)%i,e,(e+1)%i),a.push(0,1,0);const l=qs.getKeyframeOrder(s);s=qs.sortedArray(s,1,l),a=qs.sortedArray(a,1,l),r||0!==s[0]||(s.push(i),a.push(a[0])),o.push(new na(".morphTargetInfluences["+t[e].name+"]",s,a).scale(1/n))}return new aa(e,-1,o)},findByName:function(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],o=n.name.match(i);if(o&&o.length>1){const e=o[1];let t=r[e];t||(r[e]=t=[]),t.push(n)}}const o=[];for(const e in r)o.push(aa.CreateFromMorphTargetSequence(e,r[e],t,n));return o},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,r,i){if(0!==n.length){const o=[],s=[];qs.flattenJSON(n,o,s,r),0!==o.length&&i.push(new e(t,o,s))}},r=[],i=e.name||"default",o=e.fps||30,s=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const i=l[e].keys;if(i&&0!==i.length)if(i[0].morphTargets){const e={};let t;for(t=0;t<i.length;t++)if(i[t].morphTargets)for(let n=0;n<i[t].morphTargets.length;n++)e[i[t].morphTargets[n]]=-1;for(const n in e){const e=[],o=[];for(let r=0;r!==i[t].morphTargets.length;++r){const r=i[t];e.push(r.time),o.push(r.morphTarget===n?1:0)}r.push(new na(".morphTargetInfluence["+n+"]",e,o))}a=e.length*(o||1)}else{const o=".bones["+t[e].name+"]";n(sa,o+".position",i,"pos",r),n(ia,o+".quaternion",i,"rot",r),n(sa,o+".scale",i,"scl",r)}}if(0===r.length)return null;return new aa(i,a,r,s)}}),Object.assign(aa.prototype,{resetDuration:function(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this},trim:function(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new aa(this.name,this.duration,e,this.blendMode)},toJSON:function(){return aa.toJSON(this)}});const ca={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function ha(e,t,n){const r=this;let i,o=!1,s=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===o&&void 0!==r.onStart&&r.onStart(e,s,a),o=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,a),s===a&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],r=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null}}const ua=new ha;function da(e){this.manager=void 0!==e?e:ua,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(da.prototype,{load:function(){},loadAsync:function(e,t){const n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});const pa={};function fa(e){da.call(this,e)}function ma(e){da.call(this,e)}function ga(e){da.call(this,e)}function va(e){da.call(this,e)}function ya(e){da.call(this,e)}function xa(e){da.call(this,e)}function ba(e){da.call(this,e)}function _a(){this.type="Curve",this.arcLengthDivisions=200}function wa(e,t,n,r,i,o,s,a){_a.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=s||!1,this.aRotation=a||0}function Ma(e,t,n,r,i,o){wa.call(this,e,t,n,n,r,i,o),this.type="ArcCurve"}function Sa(){let e=0,t=0,n=0,r=0;function i(i,o,s,a){e=i,t=s,n=-3*i+3*o-2*s-a,r=2*i-2*o+s+a}return{initCatmullRom:function(e,t,n,r,o){i(t,n,o*(n-e),o*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,o,s,a){let l=(t-e)/o-(n-e)/(o+s)+(n-t)/s,c=(n-t)/s-(r-t)/(s+a)+(r-n)/a;l*=s,c*=s,i(t,n,l,c)},calc:function(i){const o=i*i;return e+t*i+n*o+r*(o*i)}}}fa.prototype=Object.assign(Object.create(da.prototype),{constructor:fa,load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=ca.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;if(void 0!==pa[e])return void pa[e].push({onLoad:t,onProgress:n,onError:r});const s=e.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const n=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let r;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const e=new Uint8Array(a.length);for(let t=0;t<a.length;t++)e[t]=a.charCodeAt(t);r="blob"===o?new Blob([e.buffer],{type:n}):e.buffer;break;case"document":const t=new DOMParser;r=t.parseFromString(a,n);break;case"json":r=JSON.parse(a);break;default:r=a}setTimeout((function(){t&&t(r),i.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{pa[e]=[],pa[e].push({onLoad:t,onProgress:n,onError:r}),a=new XMLHttpRequest,a.open("GET",e,!0),a.addEventListener("load",(function(t){const n=this.response,r=pa[e];if(delete pa[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ca.add(e,n);for(let e=0,t=r.length;e<t;e++){const t=r[e];t.onLoad&&t.onLoad(n)}i.manager.itemEnd(e)}else{for(let e=0,n=r.length;e<n;e++){const n=r[e];n.onError&&n.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),a.addEventListener("progress",(function(t){const n=pa[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onProgress&&r.onProgress(t)}}),!1),a.addEventListener("error",(function(t){const n=pa[e];delete pa[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onError&&r.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),a.addEventListener("abort",(function(t){const n=pa[e];delete pa[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onError&&r.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const e in this.requestHeader)a.setRequestHeader(e,this.requestHeader[e]);a.send(null)}return i.manager.itemStart(e),a},setResponseType:function(e){return this.responseType=e,this},setMimeType:function(e){return this.mimeType=e,this}}),ma.prototype=Object.assign(Object.create(da.prototype),{constructor:ma,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){const t=[];for(let n=0;n<e.length;n++){const r=aa.parse(e[n]);t.push(r)}return t}}),ga.prototype=Object.assign(Object.create(da.prototype),{constructor:ga,load:function(e,t,n,r){const i=this,o=[],s=new lo,a=new fa(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials);let l=0;function c(c){a.load(e[c],(function(e){const n=i.parse(e,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(s.minFilter=1006),s.image=o,s.format=n.format,s.needsUpdate=!0,t&&t(s))}),n,r)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else a.load(e,(function(e){const n=i.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){o[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)o[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),o[t].format=n.format,o[t].width=n.width,o[t].height=n.height}s.image=o}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=1006),s.format=n.format,s.needsUpdate=!0,t&&t(s)}),n,r);return s}}),va.prototype=Object.assign(Object.create(da.prototype),{constructor:va,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=ca.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),ca.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),i.manager.itemStart(e),s.src=e,s}}),ya.prototype=Object.assign(Object.create(da.prototype),{constructor:ya,load:function(e,t,n,r){const i=new Ht,o=new va(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(e[n],(function(e){i.images[n]=e,s++,6===s&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(let t=0;t<e.length;++t)a(t);return i}}),xa.prototype=Object.assign(Object.create(da.prototype),{constructor:xa,load:function(e,t,n,r){const i=this,o=new Vt,s=new fa(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(i.withCredentials),s.load(e,(function(e){const n=i.parse(e);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:1001,o.wrapT=void 0!==n.wrapT?n.wrapT:1001,o.magFilter=void 0!==n.magFilter?n.magFilter:1006,o.minFilter=void 0!==n.minFilter?n.minFilter:1006,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=1008),1===n.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,t&&t(o,n))}),n,r),o}}),ba.prototype=Object.assign(Object.create(da.prototype),{constructor:ba,load:function(e,t,n,r){const i=new u,o=new va(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,(function(n){i.image=n;const r=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=r?1022:1023,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}),Object.assign(_a.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){const e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),i=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){const n=this.getLengths();let r=0;const i=n.length;let o;o=t||e*n[i-1];let s,a=0,l=i-1;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),s=n[r]-o,s<0)a=r+1;else{if(!(s>0)){l=r;break}l=r-1}if(r=l,n[r]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)},getTangent:function(e,t){const n=1e-4;let r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);const o=this.getPoint(r),a=this.getPoint(i),l=t||(o.isVector2?new s:new v);return l.copy(a).sub(o).normalize(),l},getTangentAt:function(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){const n=new v,r=[],i=[],s=[],a=new v,l=new W;for(let t=0;t<=e;t++){const n=t/e;r[t]=this.getTangentAt(n,new v),r[t].normalize()}i[0]=new v,s[0]=new v;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),s[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(r[t-1],r[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(o.clamp(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(l.makeRotationAxis(a,e))}s[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(o.clamp(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(a.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(l.makeRotationAxis(r[n],t*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),wa.prototype=Object.create(_a.prototype),wa.prototype.constructor=wa,wa.prototype.isEllipseCurve=!0,wa.prototype.getPoint=function(e,t){const n=t||new s,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const a=this.aStartAngle+e*i;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=l-this.aX,r=c-this.aY;l=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(l,c)},wa.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},wa.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},wa.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ma.prototype=Object.create(wa.prototype),Ma.prototype.constructor=Ma,Ma.prototype.isArcCurve=!0;const Ta=new v,Aa=new Sa,Ea=new Sa,Pa=new Sa;function La(e=[],t=!1,n="centripetal",r=.5){_a.call(this),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}function Ca(e,t,n,r,i){const o=.5*(r-t),s=.5*(i-n),a=e*e;return(2*n-2*r+o+s)*(e*a)+(-3*n+3*r-2*o-s)*a+o*e+n}function Ra(e,t,n,r){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function Ia(e,t,n,r,i){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}function Fa(e=new s,t=new s,n=new s,r=new s){_a.call(this),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}function Oa(e=new v,t=new v,n=new v,r=new v){_a.call(this),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}function Na(e=new s,t=new s){_a.call(this),this.type="LineCurve",this.v1=e,this.v2=t}function Da(e=new v,t=new v){_a.call(this),this.type="LineCurve3",this.v1=e,this.v2=t}function Ba(e=new s,t=new s,n=new s){_a.call(this),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}function Ua(e=new v,t=new v,n=new v){_a.call(this),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}function ka(e=[]){_a.call(this),this.type="SplineCurve",this.points=e}La.prototype=Object.create(_a.prototype),La.prototype.constructor=La,La.prototype.isCatmullRomCurve3=!0,La.prototype.getPoint=function(e,t=new v){const n=t,r=this.points,i=r.length,o=(i-(this.closed?0:1))*e;let s,a,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?s=r[(l-1)%i]:(Ta.subVectors(r[0],r[1]).add(r[0]),s=Ta);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2<i?a=r[(l+2)%i]:(Ta.subVectors(r[i-1],r[i-2]).add(r[i-1]),a=Ta),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(s.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(u),e),r=Math.pow(u.distanceToSquared(a),e);n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),Aa.initNonuniformCatmullRom(s.x,h.x,u.x,a.x,t,n,r),Ea.initNonuniformCatmullRom(s.y,h.y,u.y,a.y,t,n,r),Pa.initNonuniformCatmullRom(s.z,h.z,u.z,a.z,t,n,r)}else"catmullrom"===this.curveType&&(Aa.initCatmullRom(s.x,h.x,u.x,a.x,this.tension),Ea.initCatmullRom(s.y,h.y,u.y,a.y,this.tension),Pa.initCatmullRom(s.z,h.z,u.z,a.z,this.tension));return n.set(Aa.calc(c),Ea.calc(c),Pa.calc(c)),n},La.prototype.copy=function(e){_a.prototype.copy.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},La.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},La.prototype.fromJSON=function(e){_a.prototype.fromJSON.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new v).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Fa.prototype=Object.create(_a.prototype),Fa.prototype.constructor=Fa,Fa.prototype.isCubicBezierCurve=!0,Fa.prototype.getPoint=function(e,t=new s){const n=t,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(Ia(e,r.x,i.x,o.x,a.x),Ia(e,r.y,i.y,o.y,a.y)),n},Fa.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Fa.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Fa.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Oa.prototype=Object.create(_a.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isCubicBezierCurve3=!0,Oa.prototype.getPoint=function(e,t=new v){const n=t,r=this.v0,i=this.v1,o=this.v2,s=this.v3;return n.set(Ia(e,r.x,i.x,o.x,s.x),Ia(e,r.y,i.y,o.y,s.y),Ia(e,r.z,i.z,o.z,s.z)),n},Oa.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Oa.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Oa.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Na.prototype=Object.create(_a.prototype),Na.prototype.constructor=Na,Na.prototype.isLineCurve=!0,Na.prototype.getPoint=function(e,t=new s){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Na.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Na.prototype.getTangent=function(e,t){const n=t||new s;return n.copy(this.v2).sub(this.v1).normalize(),n},Na.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Na.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Na.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Da.prototype=Object.create(_a.prototype),Da.prototype.constructor=Da,Da.prototype.isLineCurve3=!0,Da.prototype.getPoint=function(e,t=new v){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Da.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Da.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Da.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Da.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ba.prototype=Object.create(_a.prototype),Ba.prototype.constructor=Ba,Ba.prototype.isQuadraticBezierCurve=!0,Ba.prototype.getPoint=function(e,t=new s){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(Ra(e,r.x,i.x,o.x),Ra(e,r.y,i.y,o.y)),n},Ba.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ba.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ba.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ua.prototype=Object.create(_a.prototype),Ua.prototype.constructor=Ua,Ua.prototype.isQuadraticBezierCurve3=!0,Ua.prototype.getPoint=function(e,t=new v){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(Ra(e,r.x,i.x,o.x),Ra(e,r.y,i.y,o.y),Ra(e,r.z,i.z,o.z)),n},Ua.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ua.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ua.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ka.prototype=Object.create(_a.prototype),ka.prototype.constructor=ka,ka.prototype.isSplineCurve=!0,ka.prototype.getPoint=function(e,t=new s){const n=t,r=this.points,i=(r.length-1)*e,o=Math.floor(i),a=i-o,l=r[0===o?o:o-1],c=r[o],h=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(Ca(a,l.x,c.x,h.x,u.x),Ca(a,l.y,c.y,h.y,u.y)),n},ka.prototype.copy=function(e){_a.prototype.copy.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this},ka.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e},ka.prototype.fromJSON=function(e){_a.prototype.fromJSON.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new s).fromArray(n))}return this};var za=Object.freeze({__proto__:null,ArcCurve:Ma,CatmullRomCurve3:La,CubicBezierCurve:Fa,CubicBezierCurve3:Oa,EllipseCurve:wa,LineCurve:Na,LineCurve3:Da,QuadraticBezierCurve:Ba,QuadraticBezierCurve3:Ua,SplineCurve:ka});function Ga(){_a.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Ha(e){Ga.call(this),this.type="Path",this.currentPoint=new s,e&&this.setFromPoints(e)}function ja(e){Ha.call(this,e),this.uuid=o.generateUUID(),this.type="Shape",this.holes=[]}function Va(e,t=1){ge.call(this),this.type="Light",this.color=new Ue(e),this.intensity=t}function Wa(e,t,n){Va.call(this,e,n),this.type="HemisphereLight",this.position.copy(ge.DefaultUp),this.updateMatrix(),this.groundColor=new Ue(t)}function Xa(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new s(512,512),this.map=null,this.mapPass=null,this.matrix=new W,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yt,this._frameExtents=new s(1,1),this._viewportCount=1,this._viewports=[new p(0,0,1,1)]}function Ya(){Xa.call(this,new zt(50,1,.5,500)),this.focus=1}function qa(e,t,n,r,i,o){Va.call(this,e,t),this.type="SpotLight",this.position.copy(ge.DefaultUp),this.updateMatrix(),this.target=new ge,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Ya}function Qa(){Xa.call(this,new zt(90,1,.5,500)),this._frameExtents=new s(4,2),this._viewportCount=6,this._viewports=[new p(2,1,1,1),new p(0,1,1,1),new p(3,1,1,1),new p(1,1,1,1),new p(3,0,1,1),new p(1,0,1,1)],this._cubeDirections=[new v(1,0,0),new v(-1,0,0),new v(0,0,1),new v(0,0,-1),new v(0,1,0),new v(0,-1,0)],this._cubeUps=[new v(0,1,0),new v(0,1,0),new v(0,1,0),new v(0,1,0),new v(0,0,1),new v(0,0,-1)]}function Za(e,t,n,r){Va.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new Qa}function Ja(e=-1,t=1,n=1,r=-1,i=.1,o=2e3){kt.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=o,this.updateProjectionMatrix()}function Ka(){Xa.call(this,new Ja(-5,5,5,-5,.5,500))}function $a(e,t){Va.call(this,e,t),this.type="DirectionalLight",this.position.copy(ge.DefaultUp),this.updateMatrix(),this.target=new ge,this.shadow=new Ka}function el(e,t){Va.call(this,e,t),this.type="AmbientLight"}function tl(e,t,n,r){Va.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}Ga.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ga,add:function(e){this.curves.push(e)},closePath:function(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Na(t,e))},getPoint:function(e){const t=e*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=t){const e=n[r]-t,i=this.curves[r],o=i.getLength(),s=0===o?0:1-e/o;return i.getPointAt(s)}r++}return null},getLength:function(){const e=this.getCurveLengths();return e[e.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 e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e=12){const t=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],s=o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,a=o.getPoints(s);for(let e=0;e<a.length;e++){const r=a[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){_a.prototype.copy.call(this,e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){const e=_a.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e},fromJSON:function(e){_a.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new za[n.type]).fromJSON(n))}return this}}),Ha.prototype=Object.assign(Object.create(Ga.prototype),{constructor:Ha,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){const n=new Na(this.currentPoint.clone(),new s(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){const i=new Ba(this.currentPoint.clone(),new s(e,t),new s(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,o){const a=new Fa(this.currentPoint.clone(),new s(e,t),new s(n,r),new s(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this},splineThru:function(e){const t=new ka([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(e+s,t+a,n,r,i,o),this},absarc:function(e,t,n,r,i,o){return this.absellipse(e,t,n,n,r,i,o),this},ellipse:function(e,t,n,r,i,o,s,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,r,i,o,s,a),this},absellipse:function(e,t,n,r,i,o,s,a){const l=new wa(e,t,n,r,i,o,s,a);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this},copy:function(e){return Ga.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){const e=Ga.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Ga.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ja.prototype=Object.assign(Object.create(Ha.prototype),{constructor:ja,getPointsHoles:function(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Ha.prototype.copy.call(this,e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this},toJSON:function(){const e=Ha.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e},fromJSON:function(e){Ha.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new Ha).fromJSON(n))}return this}}),Va.prototype=Object.assign(Object.create(ge.prototype),{constructor:Va,isLight:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Wa.prototype=Object.assign(Object.create(Va.prototype),{constructor:Wa,isHemisphereLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Xa.prototype,{_projScreenMatrix:new W,_lightPositionWorld:new v,_lookTarget:new v,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){const t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(e.matrixWorld),t.position.copy(o),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ya.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Ya,isSpotLightShadow:!0,updateMatrices:function(e){const t=this.camera,n=2*o.RAD2DEG*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),Xa.prototype.updateMatrices.call(this,e)}}),qa.prototype=Object.assign(Object.create(Va.prototype),{constructor:qa,isSpotLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Qa.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Qa,isPointLightShadow:!0,updateMatrices:function(e,t=0){const n=this.camera,r=this.matrix,i=this._lightPositionWorld,o=this._lookTarget,s=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),o.copy(n.position),o.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(o),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),s.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(s)}}),Za.prototype=Object.assign(Object.create(Va.prototype),{constructor:Za,isPointLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Ja.prototype=Object.assign(Object.create(kt.prototype),{constructor:Ja,isOrthographicCamera:!0,copy:function(e,t){return kt.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,o){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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-e,o=n+e,s=r+t,a=r-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,o=i+e*this.view.width,s-=t*this.view.offsetY,a=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),Ka.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Ka,isDirectionalLightShadow:!0,updateMatrices:function(e){Xa.prototype.updateMatrices.call(this,e)}}),$a.prototype=Object.assign(Object.create(Va.prototype),{constructor:$a,isDirectionalLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),el.prototype=Object.assign(Object.create(Va.prototype),{constructor:el,isAmbientLight:!0}),tl.prototype=Object.assign(Object.create(Va.prototype),{constructor:tl,isRectAreaLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){const t=Va.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});class nl{constructor(){Object.defineProperty(this,"isSphericalHarmonics3",{value:!0}),this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new v)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*i),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],n*r*1.092548),t.addScaledVector(o[5],r*i*1.092548),t.addScaledVector(o[6],.315392*(3*i*i-1)),t.addScaledVector(o[7],n*i*1.092548),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*r),t.addScaledVector(o[2],1.023328*i),t.addScaledVector(o[3],1.023328*n),t.addScaledVector(o[4],.858086*n*r),t.addScaledVector(o[5],.858086*r*i),t.addScaledVector(o[6],.743125*i*i-.247708),t.addScaledVector(o[7],.858086*n*i),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){const n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}function rl(e,t){Va.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new nl}function il(e){da.call(this,e),this.textures={}}rl.prototype=Object.assign(Object.create(Va.prototype),{constructor:rl,isLightProbe:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){const t=Va.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),il.prototype=Object.assign(Object.create(da.prototype),{constructor:il,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const r=new Ys[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=(new Ue).setHex(e.sheen)),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(r.morphNormals=e.morphNormals),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.vertexTangents&&(r.vertexTangents=e.vertexTangents),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=n(i.value);break;case"c":r.uniforms[t].value=(new Ue).setHex(i.value);break;case"v2":r.uniforms[t].value=(new s).fromArray(i.value);break;case"v3":r.uniforms[t].value=(new v).fromArray(i.value);break;case"v4":r.uniforms[t].value=(new p).fromArray(i.value);break;case"m3":r.uniforms[t].value=(new a).fromArray(i.value);break;case"m4":r.uniforms[t].value=(new W).fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=(new s).fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new s).fromArray(e.clearcoatNormalScale)),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),r},setTextures:function(e){return this.textures=e,this}});const ol={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){const t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function sl(){pt.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function al(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),We.call(this,e,t,n),this.meshPerAttribute=r||1}function ll(e){da.call(this,e)}sl.prototype=Object.assign(Object.create(pt.prototype),{constructor:sl,isInstancedBufferGeometry:!0,copy:function(e){return pt.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const e=pt.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),al.prototype=Object.assign(Object.create(We.prototype),{constructor:al,isInstancedBufferAttribute:!0,copy:function(e){return We.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){const e=We.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),ll.prototype=Object.assign(Object.create(da.prototype),{constructor:ll,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){const t={},n={};function r(e,r){if(void 0!==t[r])return t[r];const i=e.interleavedBuffers[r],o=function(e,t){if(void 0!==n[t])return n[t];const r=e.arrayBuffers[t],i=new Uint32Array(r).buffer;return n[t]=i,i}(e,i.buffer),s=new si(ot(i.type,o),i.stride);return s.uuid=i.uuid,t[r]=s,s}const i=e.isInstancedBufferGeometry?new sl:new pt,o=e.data.index;if(void 0!==o){const e=ot(o.type,o.array);i.setIndex(new We(e,1))}const s=e.data.attributes;for(const t in s){const n=s[t];let o;if(n.isInterleavedBufferAttribute){o=new li(r(e.data,n.data),n.itemSize,n.offset,n.normalized)}else{const e=ot(n.type,n.array);o=new(n.isInstancedBufferAttribute?al:We)(e,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),i.setAttribute(t,o)}const a=e.data.morphAttributes;if(a)for(const t in a){const n=a[t],o=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];let s;if(i.isInterleavedBufferAttribute){s=new li(r(e.data,i.data),i.itemSize,i.offset,i.normalized)}else{s=new We(ot(i.type,i.array),i.itemSize,i.normalized)}void 0!==i.name&&(s.name=i.name),o.push(s)}i.morphAttributes[t]=o}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];i.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new v;void 0!==c.center&&e.fromArray(c.center),i.boundingSphere=new D(e,c.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}});const cl={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},hl={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},ul={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};function dl(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),da.call(this,e),this.options={premultiplyAlpha:"none"}}function pl(){this.type="ShapePath",this.color=new Ue,this.subPaths=[],this.currentPath=null}function fl(e){this.type="Font",this.data=e}function ml(e,t,n,r,i){const o=i.glyphs[e]||i.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".");const s=new pl;let a,l,c,h,u,d,p,f;if(o.o){const e=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let i=0,o=e.length;i<o;){switch(e[i++]){case"m":a=e[i++]*t+n,l=e[i++]*t+r,s.moveTo(a,l);break;case"l":a=e[i++]*t+n,l=e[i++]*t+r,s.lineTo(a,l);break;case"q":c=e[i++]*t+n,h=e[i++]*t+r,u=e[i++]*t+n,d=e[i++]*t+r,s.quadraticCurveTo(u,d,c,h);break;case"b":c=e[i++]*t+n,h=e[i++]*t+r,u=e[i++]*t+n,d=e[i++]*t+r,p=e[i++]*t+n,f=e[i++]*t+r,s.bezierCurveTo(u,d,p,f,c,h)}}}return{offsetX:o.ha*t,path:s}}function gl(e){da.call(this,e)}let vl;dl.prototype=Object.assign(Object.create(da.prototype),{constructor:dl,isImageBitmapLoader:!0,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=ca.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,i.options)})).then((function(n){ca.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}),Object.assign(pl.prototype,{moveTo:function(e,t){return this.currentPath=new Ha,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,o){return this.currentPath.bezierCurveTo(e,t,n,r,i,o),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n],i=new ja;i.curves=r.curves,t.push(i)}return t}function r(e,t){const n=t.length;let r=!1;for(let i=n-1,o=0;o<n;i=o++){let n=t[i],s=t[o],a=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[o],a=-a,s=t[i],l=-l),e.y<n.y||e.y>s.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return r}const i=rs.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);let s,a,l;const c=[];if(1===o.length)return a=o[0],l=new ja,l.curves=a.curves,c.push(l),c;let h=!i(o[0].getPoints());h=e?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=o.length;t<n;t++)a=o[t],p=a.getPoints(),s=i(p),s=e?!s:s,s?(!h&&d[g]&&g++,d[g]={s:new ja,p:p},d[g].s.curves=a.curves,h&&g++,m[g]=[]):m[g].push({h:a,p:p[0]});if(!d[0])return n(o);if(d.length>1){let e=!1;const t=[];for(let e=0,t=d.length;e<t;e++)u[e]=[];for(let n=0,i=d.length;n<i;n++){const i=m[n];for(let o=0;o<i.length;o++){const s=i[o];let a=!0;for(let i=0;i<d.length;i++)r(s.p,d[i].p)&&(n!==i&&t.push({froms:n,tos:i,hole:o}),a?(a=!1,u[i].push(s)):e=!0);a&&u[n].push(s)}}t.length>0&&(e||(m=u))}for(let e=0,t=d.length;e<t;e++){l=d[e].s,c.push(l),f=m[e];for(let e=0,t=f.length;e<t;e++)l.holes.push(f[e].h)}return c}}),Object.assign(fl.prototype,{isFont:!0,generateShapes:function(e,t=100){const n=[],r=function(e,t,n){const r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,s=[];let a=0,l=0;for(let e=0;e<r.length;e++){const t=r[e];if("\n"===t)a=0,l-=o;else{const e=ml(t,i,a,l,n);a+=e.offsetX,s.push(e.path)}}return s}(e,t,this.data);for(let e=0,t=r.length;e<t;e++)Array.prototype.push.apply(n,r[e].toShapes());return n}}),gl.prototype=Object.assign(Object.create(da.prototype),{constructor:gl,load:function(e,t,n,r){const i=this,o=new fa(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){let n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}const r=i.parse(n);t&&t(r)}),n,r)},parse:function(e){return new fl(e)}});const yl={getContext:function(){return void 0===vl&&(vl=new(window.AudioContext||window.webkitAudioContext)),vl},setContext:function(e){vl=e}};function xl(e){da.call(this,e)}function bl(e,t,n){rl.call(this,void 0,n);const r=(new Ue).set(e),i=(new Ue).set(t),o=new v(r.r,r.g,r.b),s=new v(i.r,i.g,i.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}function _l(e,t){rl.call(this,void 0,t);const n=(new Ue).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}xl.prototype=Object.assign(Object.create(da.prototype),{constructor:xl,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setResponseType("arraybuffer"),o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{const e=n.slice(0);yl.getContext().decodeAudioData(e,(function(e){t(e)}))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}}),bl.prototype=Object.assign(Object.create(rl.prototype),{constructor:bl,isHemisphereLightProbe:!0,copy:function(e){return rl.prototype.copy.call(this,e),this},toJSON:function(e){return rl.prototype.toJSON.call(this,e)}}),_l.prototype=Object.assign(Object.create(rl.prototype),{constructor:_l,isAmbientLightProbe:!0,copy:function(e){return rl.prototype.copy.call(this,e),this},toJSON:function(e){return rl.prototype.toJSON.call(this,e)}});const wl=new W,Ml=new W;function Sl(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}Object.assign(Sl.prototype,{update:function(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;const n=e.projectionMatrix.clone(),r=t.eyeSep/2,i=r*t.near/t.focus,s=t.near*Math.tan(o.DEG2RAD*t.fov*.5)/t.zoom;let a,l;Ml.elements[12]=-r,wl.elements[12]=r,a=-s*t.aspect+i,l=s*t.aspect+i,n.elements[0]=2*t.near/(l-a),n.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(n),a=-s*t.aspect-i,l=s*t.aspect-i,n.elements[0]=2*t.near/(l-a),n.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ml),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(wl)}});class Tl{constructor(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Al(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Al();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Al(){return("undefined"==typeof performance?Date:performance).now()}const El=new v,Pl=new g,Ll=new v,Cl=new v;class Rl extends ge{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Il=new v,Fl=new g,Ol=new v,Nl=new v;class Dl{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}function Bl(e,t,n){let r,i,o;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Object.assign(Bl.prototype,{accumulate:function(e,t){const n=this.buffer,r=this.valueSize,i=e*r+r;let o=this.cumulativeWeight;if(0===o){for(let e=0;e!==r;++e)n[i+e]=n[e];o=t}else{o+=t;const e=t/o;this._mixBufferRegion(n,i,0,e,r)}this.cumulativeWeight=o},accumulateAdditive:function(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){const t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const e=t*this._origIndex;this._mixBufferRegion(n,r,e,1-i,t)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){s.setValue(n,r);break}},saveOriginalState:function(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n,i=r;e!==i;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},_setAdditiveIdentityOther:function(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]},_slerp:function(e,t,n,r){g.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){const o=this._workIndex*i;g.multiplyQuaternionsFlat(e,o,e,t,e,n),g.slerpFlat(e,t,e,t,e,o,r)},_lerp:function(e,t,n,r,i){const o=1-r;for(let s=0;s!==i;++s){const i=t+s;e[i]=e[i]*o+e[n+s]*r}},_lerpAdditive:function(e,t,n,r,i){for(let o=0;o!==i;++o){const i=t+o;e[i]=e[i]+e[n+o]*r}}});const Ul=new RegExp("[\\[\\]\\.:\\/]","g"),kl="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",zl=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Gl=/(WCOD+)?/.source.replace("WCOD",kl),Hl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),jl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Vl=new RegExp("^"+zl+Gl+Hl+jl+"$"),Wl=["material","materials","bones"];function Xl(e,t,n){const r=n||Yl.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Yl(e,t,n){this.path=t,this.parsedPath=n||Yl.parseTrackName(t),this.node=Yl.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function ql(){this.uuid=o.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}Object.assign(Xl.prototype,{getValue:function(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Yl,{Composite:Xl,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Yl.Composite(e,t,n):new Yl(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(Ul,"")},parseTrackName:function(e){const t=Vl.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const e=n.nodeName.substring(r+1);-1!==Wl.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let r=0;r<e.length;r++){const i=e[r];if(i.name===t||i.uuid===t)return i;const o=n(i.children);if(o)return o}return null},r=n(e.children);if(r)return r}return null}}),Object.assign(Yl.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let i=t.propertyIndex;if(e||(e=Yl.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==r){if(void 0===e[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}const o=e[r];if(void 0===o){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",e)}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Yl.prototype,{_getValue_unbound:Yl.prototype.getValue,_setValue_unbound:Yl.prototype.setValue}),Object.assign(ql.prototype,{isAnimationObjectGroup:!0,add:function(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,o=i.length;let s,a=e.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=t[u];if(void 0===d){d=a++,t[u]=d,e.push(h);for(let e=0,t=o;e!==t;++e)i[e].push(new Yl(h,n[e],r[e]))}else if(d<l){s=e[d];const a=--l,c=e[a];t[c.uuid]=d,e[d]=c,t[u]=a,e[a]=h;for(let e=0,t=o;e!==t;++e){const t=i[e],o=t[a];let s=t[d];t[d]=o,void 0===s&&(s=new Yl(h,n[e],r[e])),t[a]=s}}else e[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l},remove:function(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=t[a];if(void 0!==l&&l>=i){const o=i++,c=e[o];t[c.uuid]=l,e[l]=c,t[a]=o,e[o]=s;for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[o],i=t[l];t[l]=r,t[o]=i}}}this.nCachedObjects_=i},uncache:function(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,o=e.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=t[a];if(void 0!==l)if(delete t[a],l<i){const s=--i,a=e[s],c=--o,h=e[c];t[a.uuid]=l,e[l]=a,t[h.uuid]=s,e[s]=h,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[s],i=t[c];t[l]=r,t[s]=i,t.pop()}}else{const i=--o,s=e[i];i>0&&(t[s.uuid]=l),e[l]=s,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e];t[l]=t[i],t.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const i=this._bindings;if(void 0!==r)return i[r];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[e]=r,o.push(e),s.push(t),i.push(h);for(let n=c,r=a.length;n!==r;++n){const r=a[n];h[n]=new Yl(r,e,t)}return h},unsubscribe_:function(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const r=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];t[e[s]]=n,o[n]=a,o.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}});class Ql{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const i=t.tracks,o=i.length,s=new Array(o),a={endingStart:2400,endingEnd:2400};for(let e=0;e!==o;++e){const t=i[e].createInterpolant(null);s[e]=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=2201,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(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,r=e._clip.duration,i=r/n,o=n/r;e.warp(1,i,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,i=r.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=i,a[1]=i+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);const i=this._startTime;if(null!==i){const r=(e-i)*n;if(r<0||0===n)return;this._startTime=null,t=n*r}t*=this._updateTimeScale(e);const o=this._updateTime(t),s=this._updateWeight(e);if(s>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case 2501:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(o),t[n].accumulateAdditive(s);break;case 2500:default:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(o),t[n].accumulate(r,s)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,i=this._loopCount;const o=2202===n;if(0===e)return-1===i?r:o&&1==(1&i)?t-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=t||r<0){const n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){const t=e<0;this._setEndings(t,!t,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&1==(1&i))return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(e,t,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=i,a[0]=t,s[1]=i+e,a[1]=n,this}}function Zl(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}Zl.prototype=Object.assign(Object.create(n.prototype),{constructor:Zl,_bindAction:function(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,s=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==i;++e){const i=r[e],l=i.name;let h=c[l];if(void 0!==h)o[e]=h;else{if(h=o[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const r=t&&t._propertyBindings[e].binding.parsedPath;h=new Bl(Yl.create(n,l,r),i.ValueTypeName,i.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),o[e]=h}s[e].resultBuffer=h.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){const r=this._actions,i=this._actionsByClip;let o=i[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o;else{const t=o.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[n]=e},_removeInactiveAction:function(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const i=e._clip.uuid,o=this._actionsByClip,s=o[i],a=s.knownActions,l=a[a.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),e._byClipCacheIndex=null;delete s.actionByRoot[(e._localRoot||this._root).uuid],0===a.length&&delete o[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[t];void 0===o&&(o={},r[t]=o),o[n]=e,e._cacheIndex=i.length,i.push(e)},_removeInactiveBinding:function(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,s=o[r],a=t[t.length-1],l=e._cacheIndex;a._cacheIndex=l,t[l]=a,t.pop(),delete s[i],0===Object.keys(s).length&&delete o[r]},_lendBinding:function(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new Js(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){const r=t||this._root,i=r.uuid;let o="string"==typeof e?aa.findByName(r,e):e;const s=null!==o?o.uuid:e,a=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:2500),void 0!==a){const e=a.actionByRoot[i];if(void 0!==e&&e.blendMode===n)return e;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new Ql(this,o,t,n);return this._bindAction(c,l),this._addInactiveAction(c,s,i),c},existingAction:function(e,t){const n=t||this._root,r=n.uuid,i="string"==typeof e?aa.findByName(n,e):e,o=i?i.uuid:e,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[r]||null},stopAllAction:function(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1;for(let s=0;s!==n;++s){t[s]._update(r,e,i,o)}const s=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)s[e].apply(o);return this},setTime:function(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const e=i.knownActions;for(let n=0,r=e.length;n!==r;++n){const r=e[n];this._deactivateAction(r);const i=r._cacheIndex,o=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,t[i]=o,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}},uncacheRoot:function(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const r=n[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName[t];if(void 0!==r)for(const e in r){const t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}},uncacheAction:function(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}});class Jl{constructor(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Jl(void 0===this.value.clone?this.value:this.value.clone())}}function Kl(e,t,n){si.call(this,e,t),this.meshPerAttribute=n||1}function $l(e,t,n,r,i){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}function ec(e,t,n,r){this.ray=new V(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new ne,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function tc(e,t){return e.distance-t.distance}function nc(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r){const r=e.children;for(let e=0,i=r.length;e<i;e++)nc(r[e],t,n,!0)}}Kl.prototype=Object.assign(Object.create(si.prototype),{constructor:Kl,isInstancedInterleavedBuffer:!0,copy:function(e){return si.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},clone:function(e){const t=si.prototype.clone.call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t},toJSON:function(e){const t=si.prototype.toJSON.call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}),Object.defineProperty($l.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign($l.prototype,{isGLBufferAttribute:!0,setBuffer:function(e){return this.buffer=e,this},setType:function(e,t){return this.type=e,this.elementSize=t,this},setItemSize:function(e){return this.itemSize=e,this},setCount:function(e){return this.count=e,this}}),Object.assign(ec.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)},intersectObject:function(e,t,n){const r=n||[];return nc(e,this,r,t),r.sort(tc),r},intersectObjects:function(e,t,n){const r=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(let n=0,i=e.length;n<i;n++)nc(e[n],this,r,t);return r.sort(tc),r}});const rc=new s;class ic{constructor(e,t){Object.defineProperty(this,"isBox2",{value:!0}),this.min=void 0!==e?e:new s(1/0,1/0),this.max=void 0!==t?t:new s(-1/0,-1/0)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=rc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new s),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new s),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new s),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new s),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return rc.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const oc=new v,sc=new v;class ac{constructor(e,t){this.start=void 0!==e?e:new v,this.end=void 0!==t?t:new v}set(e,t){return this.start.copy(e),this.end.copy(t),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new v),e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new v),e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new v),this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){oc.subVectors(e,this.start),sc.subVectors(this.end,this.start);const n=sc.dot(sc);let r=sc.dot(oc)/n;return t&&(r=o.clamp(r,0,1)),r}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new v),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}function lc(e){ge.call(this),this.material=e,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}lc.prototype=Object.create(ge.prototype),lc.prototype.constructor=lc,lc.prototype.isImmediateRenderObject=!0;const cc=new v;class hc extends ge{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new pt,r=[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 e=0,t=1,n=32;e<n;e++,t++){const i=e/n*Math.PI*2,o=t/n*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new et(r,3));const i=new ji({fog:!1,toneMapped:!1});this.cone=new Ki(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),cc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const uc=new v,dc=new W,pc=new W;class fc extends Ki{constructor(e){const t=mc(e),n=new pt,r=[],i=[],o=new Ue(0,0,1),s=new Ue(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(s.r,s.g,s.b))}n.setAttribute("position",new et(r,3)),n.setAttribute("color",new et(i,3));super(n,new ji({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");pc.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const i=t[e];i.parent&&i.parent.isBone&&(dc.multiplyMatrices(pc,i.matrixWorld),uc.setFromMatrixPosition(dc),r.setXYZ(n,uc.x,uc.y,uc.z),dc.multiplyMatrices(pc,i.parent.matrixWorld),uc.setFromMatrixPosition(dc),r.setXYZ(n+1,uc.x,uc.y,uc.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function mc(e){const t=[];e&&e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,mc(e.children[n]));return t}class gc extends Rt{constructor(e,t,n){super(new Ms(t,4,2),new He({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const vc=new v,yc=new Ue,xc=new Ue;class bc extends ge{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new ps(t);r.rotateY(.5*Math.PI),this.material=new He({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),o=new Float32Array(3*i.count);r.setAttribute("color",new We(o,3)),this.add(new Rt(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");yc.copy(this.light.color),xc.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const r=e<n/2?yc:xc;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(vc.setFromMatrixPosition(this.light.matrixWorld).negate())}}class _c extends Ki{constructor(e=10,t=10,n=4473924,r=8947848){n=new Ue(n),r=new Ue(r);const i=t/2,o=e/t,s=e/2,a=[],l=[];for(let e=0,c=0,h=-s;e<=t;e++,h+=o){a.push(-s,0,h,s,0,h),a.push(h,0,-s,h,0,s);const t=e===i?n:r;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new pt;c.setAttribute("position",new et(a,3)),c.setAttribute("color",new et(l,3));super(c,new ji({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}const wc=new v,Mc=new v,Sc=new v;class Tc extends ge{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);let r=new pt;r.setAttribute("position",new et([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const i=new ji({fog:!1,toneMapped:!1});this.lightPlane=new Qi(r,i),this.add(this.lightPlane),r=new pt,r.setAttribute("position",new et([0,0,0,0,0,1],3)),this.targetLine=new Qi(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){wc.setFromMatrixPosition(this.light.matrixWorld),Mc.setFromMatrixPosition(this.light.target.matrixWorld),Sc.subVectors(Mc,wc),this.lightPlane.lookAt(Mc),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Mc),this.targetLine.scale.z=Sc.length()}}const Ac=new v,Ec=new kt;function Pc(e,t,n,r,i,o,s){Ac.set(i,o,s).unproject(r);const a=t[e];if(void 0!==a){const e=n.getAttribute("position");for(let t=0,n=a.length;t<n;t++)e.setXYZ(a[t],Ac.x,Ac.y,Ac.z)}}const Lc=new b;class Cc extends Ki{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new pt;i.setIndex(new We(n,1)),i.setAttribute("position",new We(r,3)),super(i,new ji({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Lc.setFromObject(this.object),Lc.isEmpty())return;const t=Lc.min,n=Lc.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Ki.prototype.copy.call(this,e),this.object=e.object,this}}class Rc extends Ki{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new pt;r.setIndex(new We(n,1)),r.setAttribute("position",new et([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new ji({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}const Ic=new v;let Fc,Oc;class Nc extends Ki{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new pt;n.setAttribute("position",new et(t,3)),n.setAttribute("color",new et([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new ji({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}const Dc=new Float32Array(1),Bc=new Int32Array(Dc.buffer),Uc={toHalfFloat:function(e){Dc[0]=e;const t=Bc[0];let n=t>>16&32768,r=t>>12&2047;const i=t>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&t,n):i<113?(r|=2048,n|=(r>>114-i)+(r>>113-i&1),n):(n|=i-112<<10|r>>1,n+=1&r,n)}},kc=Math.pow(2,8),zc=[.125,.215,.35,.446,.526,.582],Gc=5+zc.length,Hc={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},jc=new Ja,{_lodPlanes:Vc,_sizeLods:Wc,_sigmas:Xc}=$c(),Yc=new Ue;let qc=null;const Qc=(1+Math.sqrt(5))/2,Zc=1/Qc,Jc=[new v(1,1,1),new v(-1,1,1),new v(1,1,-1),new v(-1,1,-1),new v(0,Qc,Zc),new v(0,Qc,-Zc),new v(Zc,0,Qc),new v(-Zc,0,Qc),new v(Qc,Zc,0),new v(-Qc,Zc,0)];function Kc(e){return void 0!==e&&1009===e.type&&(3e3===e.encoding||3001===e.encoding||3007===e.encoding)}function $c(){const e=[],t=[],n=[];let r=8;for(let i=0;i<Gc;i++){const o=Math.pow(2,r);t.push(o);let s=1/o;i>4?s=zc[i-8+4-1]:0==i&&(s=0),n.push(s);const a=1/(o-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*u),v=new Float32Array(f*d*u),y=new Float32Array(m*d*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(r,p*d*e),v.set(h,f*d*e);const i=[e,e,e,e,e,e];y.set(i,m*d*e)}const x=new pt;x.setAttribute("position",new We(g,p)),x.setAttribute("uv",new We(v,f)),x.setAttribute("faceIndex",new We(y,m)),e.push(x),r>4&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function eh(e){const t=new f(3*kc,3*kc,e);return t.texture.mapping=306,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function th(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function nh(){return new Us({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new s(1,1)},inputEncoding:{value:Hc[3e3]},outputEncoding:{value:Hc[3e3]}},vertexShader:ih(),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${oh()}\n\n\t\t\t#include <common>\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:0,depthTest:!1,depthWrite:!1})}function rh(){return new Us({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Hc[3e3]},outputEncoding:{value:Hc[3e3]}},vertexShader:ih(),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${oh()}\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:0,depthTest:!1,depthWrite:!1})}function ih(){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 oh(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\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 sh(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),La.call(this,e),this.type="catmullrom",this.closed=!0}function ah(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),La.call(this,e),this.type="catmullrom"}function lh(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),La.call(this,e),this.type="catmullrom"}_a.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(_a.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(Ga.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const t=new go;for(let n=0,r=e.length;n<r;n++){const r=e[n];t.vertices.push(new v(r.x,r.y,r.z||0))}return t}}),Object.assign(Ha.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),sh.prototype=Object.create(La.prototype),ah.prototype=Object.create(La.prototype),lh.prototype=Object.create(La.prototype),Object.assign(lh.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),_c.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},fc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(da.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ol.extractUrlBase(e)}}),da.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(ic.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(b.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(D.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Yt.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},ac.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(o,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),o.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),o.ceilPowerOfTwo(e)}}),Object.assign(a.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},getInverse:function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()}}),Object.assign(W.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new v).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,o)},getInverse:function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()}}),be.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Object.assign(g.prototype,{multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},inverse:function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()}}),Object.assign(V.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Re.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Re,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Re.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Re.getNormal(e,t,n,r)}}),Object.assign(ja.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ls(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ws(this,e)}}),Object.assign(s.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(v.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(p.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(go.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(ge.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(ge.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(Rt.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(Rt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Ei.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Bi.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Fi.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(_a.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),zt.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Va.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(We.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Object.assign(We.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(pt.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new We(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(pt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(sl.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(ec.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(si.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(si.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(ss.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.assign(oi.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}}),Object.defineProperties(Jl.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Ge.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Ue}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(Gs.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(zs.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(e){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=e}}}),Object.defineProperties(Ut.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(ti.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(ti.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Xr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(f.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Rl.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new xl).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Dl.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Gt.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Gt.prototype.clear=function(e,t,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,r)};const ch={merge:function(e,t,n){let r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};c.crossOrigin=void 0,c.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new ba;i.setCrossOrigin(this.crossOrigin);const o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},c.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new ya;i.setCrossOrigin(this.crossOrigin);const o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},c.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},c.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const hh={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"124"}}));var uh=Object.freeze({__proto__:null,ACESFilmicToneMapping:4,AddEquation:100,AddOperation:2,AdditiveAnimationBlendMode:2501,AdditiveBlending:2,AlphaFormat:1021,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:el,AmbientLightProbe:_l,AnimationClip:aa,AnimationLoader:ma,AnimationMixer:Zl,AnimationObjectGroup:ql,AnimationUtils:qs,ArcCurve:Ma,ArrayCamera:Zr,ArrowHelper:class extends ge{constructor(e,t,n,r,i,o){super(),this.type="ArrowHelper",void 0===e&&(e=new v(0,0,1)),void 0===t&&(t=new v(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===o&&(o=.2*i),void 0===Fc&&(Fc=new pt,Fc.setAttribute("position",new et([0,0,0,0,1,0],3)),Oc=new bo(0,.5,1,5,1),Oc.translate(0,-.5,0)),this.position.copy(t),this.line=new Qi(Fc,new ji({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Rt(Oc,new He({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Ic.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ic,t)}}setLength(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},Audio:Rl,AudioAnalyser:Dl,AudioContext:yl,AudioListener:class extends ge{constructor(){super(),this.type="AudioListener",this.context=yl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Tl}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(El,Pl,Ll),Cl.set(0,0,-1).applyQuaternion(Pl),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(El.x,e),t.positionY.linearRampToValueAtTime(El.y,e),t.positionZ.linearRampToValueAtTime(El.z,e),t.forwardX.linearRampToValueAtTime(Cl.x,e),t.forwardY.linearRampToValueAtTime(Cl.y,e),t.forwardZ.linearRampToValueAtTime(Cl.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition(El.x,El.y,El.z),t.setOrientation(Cl.x,Cl.y,Cl.z,n.x,n.y,n.z)}},AudioLoader:xl,AxesHelper:Nc,AxisHelper:function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Nc(e)},BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BinaryTextureLoader:function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xa(e)},Bone:Oi,BooleanKeyframeTrack:ea,BoundingBoxHelper:function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Cc(e,t)},Box2:ic,Box3:b,Box3Helper:Rc,BoxBufferGeometry:Ot,BoxGeometry:vo,BoxHelper:Cc,BufferAttribute:We,BufferGeometry:pt,BufferGeometryLoader:ll,ByteType:1010,Cache:ca,Camera:kt,CameraHelper:class extends Ki{constructor(e){const t=new pt,n=new ji({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={},s=new Ue(16755200),a=new Ue(16711680),l=new Ue(43775),c=new Ue(16777215),h=new Ue(3355443);function u(e,t,n){d(e,n),d(t,n)}function d(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}u("n1","n2",s),u("n2","n4",s),u("n4","n3",s),u("n3","n1",s),u("f1","f2",s),u("f2","f4",s),u("f4","f3",s),u("f3","f1",s),u("n1","f1",s),u("n2","f2",s),u("n3","f3",s),u("n4","f4",s),u("p","n1",a),u("p","n2",a),u("p","n3",a),u("p","n4",a),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new et(r,3)),t.setAttribute("color",new et(i,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const e=this.geometry,t=this.pointMap;Ec.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Pc("c",t,e,Ec,0,0,-1),Pc("t",t,e,Ec,0,0,1),Pc("n1",t,e,Ec,-1,-1,-1),Pc("n2",t,e,Ec,1,-1,-1),Pc("n3",t,e,Ec,-1,1,-1),Pc("n4",t,e,Ec,1,1,-1),Pc("f1",t,e,Ec,-1,-1,1),Pc("f2",t,e,Ec,1,-1,1),Pc("f3",t,e,Ec,-1,1,1),Pc("f4",t,e,Ec,1,1,1),Pc("u1",t,e,Ec,.7,1.1,-1),Pc("u2",t,e,Ec,-.7,1.1,-1),Pc("u3",t,e,Ec,0,2,-1),Pc("cf1",t,e,Ec,-1,0,1),Pc("cf2",t,e,Ec,1,0,1),Pc("cf3",t,e,Ec,0,-1,1),Pc("cf4",t,e,Ec,0,1,1),Pc("cn1",t,e,Ec,-1,0,-1),Pc("cn2",t,e,Ec,1,0,-1),Pc("cn3",t,e,Ec,0,-1,-1),Pc("cn4",t,e,Ec,0,1,-1),e.getAttribute("position").needsUpdate=!0}},CanvasRenderer:function(){console.error("THREE.CanvasRenderer has been removed")},CanvasTexture:co,CatmullRomCurve3:La,CineonToneMapping:3,CircleBufferGeometry:yo,CircleGeometry:xo,ClampToEdgeWrapping:1001,Clock:Tl,ClosedSplineCurve3:sh,Color:Ue,ColorKeyframeTrack:ta,CompressedTexture:lo,CompressedTextureLoader:ga,ConeBufferGeometry:Mo,ConeGeometry:wo,CubeCamera:Gt,CubeGeometry:vo,CubeReflectionMapping:301,CubeRefractionMapping:302,CubeTexture:Ht,CubeTextureLoader:ya,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307,CubicBezierCurve:Fa,CubicBezierCurve3:Oa,CubicInterpolant:Zs,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:_a,CurvePath:Ga,CustomBlending:5,CustomToneMapping:5,CylinderBufferGeometry:bo,CylinderGeometry:_o,Cylindrical:class{constructor(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}clone(){return(new this.constructor).copy(this)}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},DataTexture:Vt,DataTexture2DArray:mn,DataTexture3D:gn,DataTextureLoader:xa,DataUtils:Uc,DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:ua,DepthFormat:1026,DepthStencilFormat:1027,DepthTexture:ho,DirectionalLight:$a,DirectionalLightHelper:Tc,DiscreteInterpolant:Ks,DodecahedronBufferGeometry:To,DodecahedronGeometry:Ao,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicBufferAttribute:function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new We(e,t).setUsage(35048)},DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:Ro,EdgesHelper:function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ki(new Ro(e.geometry),new ji({color:void 0!==t?t:16777215}))},EllipseCurve:wa,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,Euler:$,EventDispatcher:n,ExtrudeBufferGeometry:ss,ExtrudeGeometry:ls,Face3:ke,Face4:function(e,t,n,r,i,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ke(e,t,n,i,o,s)},FaceColors:1,FileLoader:fa,FlatShading:1,Float16BufferAttribute:$e,Float32Attribute:function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new et(e,t)},Float32BufferAttribute:et,Float64Attribute:function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new tt(e,t)},Float64BufferAttribute:tt,FloatType:1015,Fog:ii,FogExp2:ri,Font:fl,FontLoader:gl,FrontSide:0,Frustum:Yt,GLBufferAttribute:$l,GLSL1:"100",GLSL3:"300 es",GammaEncoding:3007,Geometry:go,GeometryUtils:ch,GreaterDepth:6,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:_c,Group:Jr,HalfFloatType:1016,HemisphereLight:Wa,HemisphereLightHelper:bc,HemisphereLightProbe:bl,IcosahedronBufferGeometry:cs,IcosahedronGeometry:hs,ImageBitmapLoader:dl,ImageLoader:va,ImageUtils:c,ImmediateRenderObject:lc,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:al,InstancedBufferGeometry:sl,InstancedInterleavedBuffer:Kl,InstancedMesh:Hi,Int16Attribute:function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Qe(e,t)},Int16BufferAttribute:Qe,Int32Attribute:function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Je(e,t)},Int32BufferAttribute:Je,Int8Attribute:function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Xe(e,t)},Int8BufferAttribute:Xe,IntType:1013,InterleavedBuffer:si,InterleavedBufferAttribute:li,Interpolant:Qs,InterpolateDiscrete:2300,InterpolateLinear:2301,InterpolateSmooth:2302,InvertStencilOp:5386,JSONLoader:function(){console.error("THREE.JSONLoader has been removed.")},KeepStencilOp:7680,KeyframeTrack:$s,LOD:Ei,LatheBufferGeometry:us,LatheGeometry:ds,Layers:ne,LensFlare:function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},LessDepth:2,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Va,LightProbe:rl,Line:Qi,Line3:ac,LineBasicMaterial:ji,LineCurve:Na,LineCurve3:Da,LineDashedMaterial:Xs,LineLoop:$i,LinePieces:1,LineSegments:Ki,LineStrip:0,LinearEncoding:3e3,LinearFilter:1006,LinearInterpolant:Js,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:1008,LinearMipmapNearestFilter:1007,LinearToneMapping:1,Loader:da,LoaderUtils:ol,LoadingManager:ha,LogLuvEncoding:3003,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,LuminanceAlphaFormat:1025,LuminanceFormat:1024,MOUSE:{LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Material:Ge,MaterialLoader:il,Math:o,MathUtils:o,Matrix3:a,Matrix4:W,MaxEquation:104,Mesh:Rt,MeshBasicMaterial:He,MeshDepthMaterial:Vr,MeshDistanceMaterial:Wr,MeshFaceMaterial:function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},MeshLambertMaterial:Vs,MeshMatcapMaterial:Ws,MeshNormalMaterial:js,MeshPhongMaterial:Gs,MeshPhysicalMaterial:zs,MeshStandardMaterial:ks,MeshToonMaterial:Hs,MinEquation:103,MirroredRepeatWrapping:1002,MixOperation:1,MultiMaterial:function(e=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e},MultiplyBlending:4,MultiplyOperation:0,NearestFilter:1003,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:1005,NearestMipmapNearestFilter:1004,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColors:0,NoToneMapping:0,NormalAnimationBlendMode:2500,NormalBlending:1,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:na,Object3D:ge,ObjectLoader:class extends da{constructor(e){super(e)}load(e,t,n,r){const i=this,o=""===this.path?ol.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const s=new fa(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){let o=null;try{o=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const s=o.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?i.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),s=this.parseTextures(e.textures,o),a=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,i,a,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),void 0!==t){let e=!1;for(const t in o)if(o[t]instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}parseShapes(e){const t={};if(void 0!==e)for(let n=0,r=e.length;n<r;n++){const r=(new ja).fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(let t=0,i=e.length;t<i;t++){const i=(new Bi).fromJSON(e[t],r);n[i.uuid]=i}return n}parseGeometries(e,t){const n={};let r;if(void 0!==e){const i=new ll;for(let o=0,s=e.length;o<s;o++){let s;const a=e[o];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Ds[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Ds[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Ds[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Ds[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Ds[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Ds[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Ds[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Ds[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Ds[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Ds[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"TubeGeometry":case"TubeBufferGeometry":s=new Ds[a.type]((new za[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Ds[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Ds[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":r=[];for(let e=0,n=a.shapes.length;e<n;e++){const n=t[a.shapes[e]];r.push(n)}s=new Ds[a.type](r,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":r=[];for(let e=0,n=a.shapes.length;e<n;e++){const n=t[a.shapes[e]];r.push(n)}const e=a.options.extrudePath;void 0!==e&&(a.options.extrudePath=(new za[e.type]).fromJSON(e)),s=new Ds[a.type](r,a.options);break;case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(a);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),!0===s.isBufferGeometry&&void 0!==a.userData&&(s.userData=a.userData),n[a.uuid]=s}}return n}parseMaterials(e,t){const n={},r={};if(void 0!==e){const i=new il;i.setTextures(t);for(let t=0,o=e.length;t<o;t++){const o=e[t];if("MultiMaterial"===o.type){const e=[];for(let t=0;t<o.materials.length;t++){const r=o.materials[t];void 0===n[r.uuid]&&(n[r.uuid]=i.parse(r)),e.push(n[r.uuid])}r[o.uuid]=e}else void 0===n[o.uuid]&&(n[o.uuid]=i.parse(o)),r[o.uuid]=n[o.uuid]}}return r}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const r=e[n],i=aa.parse(r);t[i.uuid]=i}return t}parseImages(e,t){const n=this,r={};let i;function o(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),i.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:ot(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new ha(t);i=new va(n),i.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.url;if(Array.isArray(i)){r[n.uuid]=[];for(let e=0,t=i.length;e<t;e++){const t=o(i[e]);null!==t&&(t instanceof HTMLImageElement?r[n.uuid].push(t):r[n.uuid].push(new Vt(t.data,t.width,t.height)))}}else{const e=o(n.url);null!==e&&(r[n.uuid]=e)}}}return r}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const r={};if(void 0!==e)for(let i=0,o=e.length;i<o;i++){const o=e[i];let s;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const a=t[o.image];Array.isArray(a)?(s=new Ht(a),6===a.length&&(s.needsUpdate=!0)):(s=a&&a.data?new Vt(a.data,a.width,a.height):new u(a),a&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,cl)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],hl),s.wrapT=n(o.wrap[1],hl)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,ul)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,ul)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r}parseObject(e,t,n,r){let i,o,s;function a(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function l(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),t.push(n[i])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":i=new oi,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new Ue(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new ii(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new ri(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new zt(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new Ja(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new el(e.color,e.intensity);break;case"DirectionalLight":i=new $a(e.color,e.intensity);break;case"PointLight":i=new Za(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new tl(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new qa(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new Wa(e.color,e.groundColor,e.intensity);break;case"LightProbe":i=(new rl).fromJSON(e);break;case"SkinnedMesh":o=a(e.geometry),s=l(e.material),i=new Fi(o,s),void 0!==e.bindMode&&(i.bindMode=e.bindMode),void 0!==e.bindMatrix&&i.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(i.skeleton=e.skeleton);break;case"Mesh":o=a(e.geometry),s=l(e.material),i=new Rt(o,s);break;case"InstancedMesh":o=a(e.geometry),s=l(e.material);const t=e.count,n=e.instanceMatrix;i=new Hi(o,s,t),i.instanceMatrix=new We(new Float32Array(n.array),16);break;case"LOD":i=new Ei;break;case"Line":i=new Qi(a(e.geometry),l(e.material));break;case"LineLoop":i=new $i(a(e.geometry),l(e.material));break;case"LineSegments":i=new Ki(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":i=new oo(a(e.geometry),l(e.material));break;case"Sprite":i=new Mi(l(e.material));break;case"Group":i=new Jr;break;case"Bone":i=new Oi;break;default:i=new ge}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(i.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children){const o=e.children;for(let e=0;e<o.length;e++)i.add(this.parseObject(o[e],t,n,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];i.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],r=i.getObjectByProperty("uuid",n.object);void 0!==r&&i.addLevel(r,n.distance)}}return i}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}},ObjectSpaceNormalMap:1,OctahedronBufferGeometry:ps,OctahedronGeometry:fs,OneFactor:201,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:205,OneMinusSrcColorFactor:203,OrthographicCamera:Ja,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(e),n=new v(0,1,0);return new Us({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Hc[3e3]},outputEncoding:{value:Hc[3e3]}},vertexShader:ih(),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${oh()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\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:0,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){qc=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=rh(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=nh(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e<Vc.length;e++)Vc[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(qc),e.scissorTest=!1,th(e,0,0,e.width,e.height)}_fromTexture(e){qc=this._renderer.getRenderTarget();const t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){const t={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:Kc(e)?e.encoding:3002,depthBuffer:!1},n=eh(t);return n.depthBuffer=!e,this._pingPongRenderTarget=eh(t),n}_compileMaterial(e){const t=new Rt(Vc[0],e);this._renderer.compile(t,jc)}_sceneToCubeUV(e,t,n,r){const i=new zt(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.outputEncoding,c=a.toneMapping;a.getClearColor(Yc);const h=a.getClearAlpha();a.toneMapping=0,a.outputEncoding=3e3;let u=e.background;if(u&&u.isColor){u.convertSRGBToLinear();const t=Math.max(u.r,u.g,u.b),n=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);u=u.multiplyScalar(Math.pow(2,-n));const r=(n+128)/255;a.setClearColor(u,r),e.background=null}for(let t=0;t<6;t++){const n=t%3;0==n?(i.up.set(0,o[t],0),i.lookAt(s[t],0,0)):1==n?(i.up.set(0,0,o[t]),i.lookAt(0,s[t],0)):(i.up.set(0,o[t],0),i.lookAt(0,0,s[t])),th(r,n*kc,t>2?kc:0,kc,kc),a.setRenderTarget(r),a.render(e,i)}a.toneMapping=c,a.outputEncoding=l,a.setClearColor(Yc,h)}_textureToCubeUV(e,t){const n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=rh()):null==this._equirectShader&&(this._equirectShader=nh());const r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new Rt(Vc[0],r),o=r.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=Hc[e.encoding],o.outputEncoding.value=Hc[t.texture.encoding],th(t,0,0,3*kc,2*kc),n.setRenderTarget(t),n.render(i,jc)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t<Gc;t++){const n=Math.sqrt(Xc[t]*Xc[t]-Xc[t-1]*Xc[t-1]),r=Jc[(t-1)%Jc.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",i),this._halfBlur(o,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,o,s){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Rt(Vc[r],l),h=l.uniforms,u=Wc[n]-1,d=isFinite(i)?Math.PI/(2*u):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0==e?g+=n:e<f&&(g+=2*n)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===o,s&&(h.poleAxis.value=s),h.dTheta.value=d,h.mipInt.value=8-n,h.inputEncoding.value=Hc[e.texture.encoding],h.outputEncoding.value=Hc[e.texture.encoding];const v=Wc[r];th(t,3*Math.max(0,kc-2*v),(0===r?0:2*kc)+2*v*(r>4?r-8+4:0),3*v,2*v),a.setRenderTarget(t),a.render(c,jc)}},ParametricBufferGeometry:ms,ParametricGeometry:gs,Particle:function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Mi(e)},ParticleBasicMaterial:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new eo(e)},ParticleSystem:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new oo(e,t)},ParticleSystemMaterial:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new eo(e)},Path:Ha,PerspectiveCamera:zt,Plane:be,PlaneBufferGeometry:Zt,PlaneGeometry:vs,PlaneHelper:class extends Qi{constructor(e,t=1,n=16776960){const r=n,i=new pt;i.setAttribute("position",new et([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),super(i,new ji({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=new pt;o.setAttribute("position",new et([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new Rt(o,new He({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}},PointCloud:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new oo(e,t)},PointCloudMaterial:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new eo(e)},PointLight:Za,PointLightHelper:gc,Points:oo,PointsMaterial:eo,PolarGridHelper:class extends Ki{constructor(e=10,t=16,n=8,r=64,i=4473924,o=8947848){i=new Ue(i),o=new Ue(o);const s=[],a=[];for(let n=0;n<=t;n++){const r=n/t*(2*Math.PI),l=Math.sin(r)*e,c=Math.cos(r)*e;s.push(0,0,0),s.push(l,0,c);const h=1&n?i:o;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let t=0;t<=n;t++){const l=1&t?i:o,c=e-e/n*t;for(let e=0;e<r;e++){let t=e/r*(2*Math.PI),n=Math.sin(t)*c,i=Math.cos(t)*c;s.push(n,0,i),a.push(l.r,l.g,l.b),t=(e+1)/r*(2*Math.PI),n=Math.sin(t)*c,i=Math.cos(t)*c,s.push(n,0,i),a.push(l.r,l.g,l.b)}}const l=new pt;l.setAttribute("position",new et(s,3)),l.setAttribute("color",new et(a,3));super(l,new ji({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}},PolyhedronBufferGeometry:So,PolyhedronGeometry:ys,PositionalAudio:class extends Rl{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Il,Fl,Ol),Nl.set(0,0,1).applyQuaternion(Fl);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Il.x,e),t.positionY.linearRampToValueAtTime(Il.y,e),t.positionZ.linearRampToValueAtTime(Il.z,e),t.orientationX.linearRampToValueAtTime(Nl.x,e),t.orientationY.linearRampToValueAtTime(Nl.y,e),t.orientationZ.linearRampToValueAtTime(Nl.z,e)}else t.setPosition(Il.x,Il.y,Il.z),t.setOrientation(Nl.x,Nl.y,Nl.z)}},PropertyBinding:Yl,PropertyMixer:Bl,QuadraticBezierCurve:Ba,QuadraticBezierCurve3:Ua,Quaternion:g,QuaternionKeyframeTrack:ia,QuaternionLinearInterpolant:ra,REVISION:"124",RGBADepthPacking:3201,RGBAFormat:1023,RGBAIntegerFormat:1033,RGBA_ASTC_10x10_Format:37819,RGBA_ASTC_10x5_Format:37816,RGBA_ASTC_10x6_Format:37817,RGBA_ASTC_10x8_Format:37818,RGBA_ASTC_12x10_Format:37820,RGBA_ASTC_12x12_Format:37821,RGBA_ASTC_4x4_Format:37808,RGBA_ASTC_5x4_Format:37809,RGBA_ASTC_5x5_Format:37810,RGBA_ASTC_6x5_Format:37811,RGBA_ASTC_6x6_Format:37812,RGBA_ASTC_8x5_Format:37813,RGBA_ASTC_8x6_Format:37814,RGBA_ASTC_8x8_Format:37815,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_2BPPV1_Format:35843,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT1_Format:33777,RGBA_S3TC_DXT3_Format:33778,RGBA_S3TC_DXT5_Format:33779,RGBDEncoding:3006,RGBEEncoding:3002,RGBEFormat:1023,RGBFormat:1022,RGBIntegerFormat:1032,RGBM16Encoding:3005,RGBM7Encoding:3004,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_2BPPV1_Format:35841,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776,RGFormat:1030,RGIntegerFormat:1031,RawShaderMaterial:Us,Ray:V,Raycaster:ec,RectAreaLight:tl,RedFormat:1028,RedIntegerFormat:1029,ReinhardToneMapping:2,RepeatWrapping:1e3,ReplaceStencilOp:7681,ReverseSubtractEquation:102,RingBufferGeometry:xs,RingGeometry:bs,SRGB8_ALPHA8_ASTC_10x10_Format:37851,SRGB8_ALPHA8_ASTC_10x5_Format:37848,SRGB8_ALPHA8_ASTC_10x6_Format:37849,SRGB8_ALPHA8_ASTC_10x8_Format:37850,SRGB8_ALPHA8_ASTC_12x10_Format:37852,SRGB8_ALPHA8_ASTC_12x12_Format:37853,SRGB8_ALPHA8_ASTC_4x4_Format:37840,SRGB8_ALPHA8_ASTC_5x4_Format:37841,SRGB8_ALPHA8_ASTC_5x5_Format:37842,SRGB8_ALPHA8_ASTC_6x5_Format:37843,SRGB8_ALPHA8_ASTC_6x6_Format:37844,SRGB8_ALPHA8_ASTC_8x5_Format:37845,SRGB8_ALPHA8_ASTC_8x6_Format:37846,SRGB8_ALPHA8_ASTC_8x8_Format:37847,Scene:oi,SceneUtils:hh,ShaderChunk:Jt,ShaderLib:$t,ShaderMaterial:Ut,ShadowMaterial:Bs,Shape:ja,ShapeBufferGeometry:_s,ShapeGeometry:ws,ShapePath:pl,ShapeUtils:rs,ShortType:1011,Skeleton:Bi,SkeletonHelper:fc,SkinnedMesh:Fi,SmoothShading:2,Sphere:D,SphereBufferGeometry:Ms,SphereGeometry:Ss,Spherical:class{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}clone(){return(new this.constructor).copy(this)}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(o.clamp(t/this.radius,-1,1))),this}},SphericalHarmonics3:nl,Spline:lh,SplineCurve:ka,SplineCurve3:ah,SpotLight:qa,SpotLightHelper:hc,Sprite:Mi,SpriteMaterial:ci,SrcAlphaFactor:204,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:35044,StaticReadUsage:35045,StereoCamera:Sl,StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:oa,SubtractEquation:101,SubtractiveBlending:3,TOUCH:{ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},TangentSpaceNormalMap:0,TetrahedronBufferGeometry:Ts,TetrahedronGeometry:As,TextBufferGeometry:Es,TextGeometry:Ps,Texture:u,TextureLoader:ba,TorusBufferGeometry:Ls,TorusGeometry:Cs,TorusKnotBufferGeometry:Rs,TorusKnotGeometry:Is,Triangle:Re,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeBufferGeometry:Fs,TubeGeometry:Os,UVMapping:300,Uint16Attribute:function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ze(e,t)},Uint16BufferAttribute:Ze,Uint32Attribute:function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Ke(e,t)},Uint32BufferAttribute:Ke,Uint8Attribute:function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ye(e,t)},Uint8BufferAttribute:Ye,Uint8ClampedAttribute:function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new qe(e,t)},Uint8ClampedBufferAttribute:qe,Uniform:Jl,UniformsLib:Kt,UniformsUtils:Bt,UnsignedByteType:1009,UnsignedInt248Type:1020,UnsignedIntType:1014,UnsignedShort4444Type:1017,UnsignedShort5551Type:1018,UnsignedShort565Type:1019,UnsignedShortType:1012,VSMShadowMap:3,Vector2:s,Vector3:v,Vector4:p,VectorKeyframeTrack:sa,Vertex:function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new v(e,t,n)},VertexColors:2,VideoTexture:ao,WebGL1Renderer:ni,WebGLCubeRenderTarget:jt,WebGLMultisampleRenderTarget:m,WebGLRenderTarget:f,WebGLRenderTargetCube:function(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new jt(e,n)},WebGLRenderer:ti,WebGLUtils:Qr,WireframeGeometry:Ns,WireframeHelper:function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Ki(new Ns(e.geometry),new ji({color:void 0!==t?t:16777215}))},WrapAroundEnding:2402,XHRLoader:function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new fa(e)},ZeroCurvatureEnding:2400,ZeroFactor:200,ZeroSlopeEnding:2401,ZeroStencilOp:0,sRGBEncoding:3001});const dh=(e,t)=>{let n="";for(let e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)};function ph(e){return e instanceof v?e:new v(e.x,e.y,e.z)}function fh(e){return e instanceof $?e:new $(e.x,e.y,e.z)}function mh(e){return new b(new v(0,0,0),new v(500,500,500)).setFromObject(e)}function gh(e,t,n){const r=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?r[e]+=2*Math.PI:r[e]-=2*Math.PI),r}function vh(e,t){const n=gh("x",e,t),r=gh("y",e,t),i=gh("z",e,t);return new $(n.x,r.y,i.z,t.order)}function yh(e){return Math.PI/180*e}function xh(e){return e/(Math.PI/180)}function bh(e,t=!0){return t?{position:e.getWorldPosition(new v),rotation:(new $).setFromQuaternion(e.getWorldQuaternion(new g)),scale:e.getWorldScale(new v)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function _h(e,t,n=!0){const r=bh(t,n);e.position.copy(r.position),e.rotation.copy(r.rotation),e.scale.copy(r.scale)}class wh{constructor(){this.min=null,this.roots=[],this.nodes=[]}shift(){const e=this.min;if(null==e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],r=this.getDistance(n);r<t&&(t=r,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let r=0;r<n;r++){const n=this.roots[r],i=this.nodes[n].depth;i<t&&e[i].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const r=e[n].shift(),i=e[n].shift(),o=n+1;let s=-1;this.nodes[r].distance<this.nodes[i].distance?(this.nodes[r].depth=o,this.nodes[r].children.push(i),this.nodes[i].parent=r,o<=t&&e[o].push(r),s=this.roots.indexOf(i)):(this.nodes[i].depth=o,this.nodes[i].children.push(r),this.nodes[r].parent=i,o<=t&&e[o].push(i),s=this.roots.indexOf(r)),s>-1&&this.roots.splice(s,1)}}add(e,t){this.nodes[e]={nodeIndex:e,distance:t,depth:0,parent:null,children:[]},(!this.min||t<this.nodes[this.min].distance)&&(this.min=e),this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){if(!this.nodes[e])return;const t=this.nodes[e].children.length;if(t>0)for(let n=0;n<t;n++){const t=this.nodes[e].children[n];this.nodes[t].parent=this.nodes[e].parent,null==this.nodes[t].parent&&this.roots.push(t)}let n=this.nodes[e].parent;if(null==n){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;n;)this.nodes[n].depth--,n=this.nodes[n].parent}getDistance(e){return this.nodes[e]?this.nodes[e].distance:1/0}}function Mh(e,t=["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]){return new Promise((n=>{(new ya).setPath(e).load(t,(e=>{e.format=1022,n(e)}))}))}const Sh=e=>{let t=kh(e,0,8);if("SBMG----"!==t)throw new TypeError("This format file ("+t+") is not supported by the SoonSpace.js");const n=new DataView(e.slice(8));for(let e=0;e<n.byteLength;e++){const t=n.getUint8(e),r=(t>>4&15)+(t<<4&240);n.setUint8(e,r)}return n.buffer},Th=Object.prototype.hasOwnProperty,Ah=(e,t)=>Th.call(e,t),Eh=e=>"string"==typeof e,Ph=e=>"boolean"==typeof e,Lh=e=>"number"==typeof e,Ch=e=>null===e,Rh=e=>"symbol"==typeof e,Ih=e=>e instanceof Date,Fh=Array.isArray,Oh=e=>null!==e&&"object"==typeof e,Nh=e=>"function"==typeof e,Dh=e=>Oh(e)&&Nh(e.then)&&Nh(e.catch),Bh=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),Uh=e=>new Promise((t=>setTimeout((()=>t()),e))),kh=(e,t,n)=>String.fromCharCode(...new Uint8Array(e,t,n));var zh,Gh=Object.freeze({__proto__:null,hasOwn:Ah,isString:Eh,isBoolean:Ph,isNumber:Lh,isNull:Ch,isSymbol:Rh,isDate:Ih,isArray:Fh,isObject:Oh,isFunction:Nh,isPromise:Dh,typeJudge:Bh,sleep:Uh,getAsciiString:kh,log:dh,IVector3ToVector3:ph,IVector3ToEuler:fh,getBoundingBox:mh,rotationAxisFix:gh,rotationAFix:vh,deg2Euler:yh,euler2Deg:xh,getSpaceAttributeFromObject:bh,syncSpaceAttributeToObject:_h,MinHeap:wh,getCubeTexture:Mh,parseSbmx:Sh}),Hh={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Hh.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Hh.Bounce.In(2*e):.5*Hh.Bounce.Out(2*e-1)+.5}}},jh="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Vh=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=jh()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],o=!t;i&&!1===i.update(e,o)&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),Wh={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Wh.Utils.Linear;return t<0?o(e[0],e[1],r):t>1?o(e[n],e[n-1],n-r):o(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,o=Wh.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-t,r-s)*i(t,s)*e[s]*o(r,s);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Wh.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),o(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(o(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):o(e[i?i-1:0],e[i],e[n<i+1?n:i+1],e[n<i+2?n:i+2],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=Wh.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(zh=[1],function(e){var t=1;if(zh[e])return zh[e];for(var n=e;n>1;n--)t*=n;return zh[e]=t,t}),CatmullRom:function(e,t,n,r,i){var o=.5*(n-e),s=.5*(r-t),a=i*i;return(2*t-2*n+o+s)*(i*a)+(-3*t+3*n-2*o-s)*a+o*i+t}}},Xh=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Yh=new Vh,qh=function(){function e(e,t){void 0===t&&(t=Yh),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Hh.Linear.None,this._interpolationFunction=Wh.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Xh.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?jh()+parseFloat(e):e:jh(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,r){for(var i in n){var o=e[i],s=Array.isArray(o),a=s?"array":typeof o,l=!s&&Array.isArray(n[i]);if("undefined"!==a&&"function"!==a){if(l){var c=n[i];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,o)),n[i]=[o].concat(c)}if("object"!==a&&!s||!o||l)void 0===t[i]&&(t[i]=o),s||(t[i]*=1),r[i]=l?n[i].slice().reverse():t[i]||0;else{for(var h in t[i]=s?[]:{},o)t[i][h]=o[h];r[i]=s?[]:{},this._setupProperties(o,t[i],n[i],r[i])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=jh()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=jh()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=jh()),void 0===t&&(t=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var o=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,a=this._chainedTweens.length;s<a;s++)this._chainedTweens[s].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,r){for(var i in n)if(void 0!==t[i]){var o=t[i]||0,s=n[i],a=Array.isArray(e[i]),l=Array.isArray(s);!a&&l?e[i]=this._interpolationFunction(s,r):"object"==typeof s&&s?this._updateProperties(e[i],o,s,r):"number"==typeof(s=this._handleRelativeValue(o,s))&&(e[i]=o+(s-o)*r)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),Qh=Xh.nextId,Zh=Yh,Jh=Zh.getAll.bind(Zh),Kh=Zh.removeAll.bind(Zh),$h=Zh.add.bind(Zh),eu=Zh.remove.bind(Zh),tu=Zh.update.bind(Zh),nu={Easing:Hh,Group:Vh,Interpolation:Wh,now:jh,Sequence:Xh,nextId:Qh,Tween:qh,VERSION:"18.6.4",getAll:Jh,removeAll:Kh,add:$h,remove:eu,update:tu};const ru={"Linear.None":Hh.Linear.None,"Quadratic.In":Hh.Quadratic.In,"Quadratic.Out":Hh.Quadratic.Out,"Quadratic.InOut":Hh.Quadratic.InOut,"Cubic.In":Hh.Cubic.In,"Cubic.Out":Hh.Cubic.Out,"Cubic.InOut":Hh.Cubic.InOut,"Quartic.In":Hh.Quartic.In,"Quartic.Out":Hh.Quartic.Out,"Quartic.InOut":Hh.Quartic.InOut,"Quintic.In":Hh.Quintic.In,"Quintic.Out":Hh.Quintic.Out,"Quintic.InOut":Hh.Quintic.InOut,"Sinusoidal.In":Hh.Sinusoidal.In,"Sinusoidal.Out":Hh.Sinusoidal.Out,"Sinusoidal.InOut":Hh.Sinusoidal.InOut,"Exponential.In":Hh.Exponential.In,"Exponential.Out":Hh.Exponential.Out,"Exponential.InOut":Hh.Exponential.InOut,"Circular.In":Hh.Circular.In,"Circular.Out":Hh.Circular.Out,"Circular.InOut":Hh.Circular.InOut,"Elastic.In":Hh.Elastic.In,"Elastic.Out":Hh.Elastic.Out,"Elastic.InOut":Hh.Elastic.InOut,"Back.In":Hh.Back.In,"Back.Out":Hh.Back.Out,"Back.InOut":Hh.Back.InOut,"Bounce.In":Hh.Bounce.In,"Bounce.Out":Hh.Bounce.Out,"Bounce.InOut":Hh.Bounce.InOut};function iu(e,t,n={},r,i){return new Promise((o=>{const{duration:s=1e3,delay:a=0,repeat:l=!1,mode:c="Linear.None"}=n,h=ru[c],u=new qh(e).to(t,s).easing(h).delay(a).onUpdate((n=>{e instanceof $&&t instanceof $&&n instanceof $&&(n.order=t.order),r&&r(n,u)})).onComplete((()=>{u.stop(),o()}));Lh(l)?u.repeat(l):Ph(l)&&l&&u.repeat(1/0),u.start(),u.onStart((()=>{i&&i(u)}))}))}class ou extends Rt{constructor(e,t,n,r="BaseMesh"){super(e,t);const{id:i,name:o="",level:s={max:null,min:null},visible:a=!0,position:l={x:0,y:0,z:0},rotation:c={x:0,y:0,z:0},scale:h={x:1,y:1,z:1},userData:u={}}=n;if(void 0===i)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=i,this.name=o,this.stype=r,this.level=s,this.visible=null==a||a,this.handleHide=!a,this.position.set(l.x,l.y,l.z),this.rotation.set(c.x,c.y,c.z),this.scale.set(h.x,h.y,h.z),this.castShadow=!0,this.receiveShadow=!0,this.renderOrder=1,this.userData=u,this.isEventPropagation=!1,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}setMove(e,t){return iu(this.position,ph(e),t)}setRotate(e,t){return iu(this.rotation,fh(e),t)}setScale(e,t){return iu(this.scale,ph(e),t)}getBoundingBox(){return new b(new v,new v).setFromObject(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new ou(this.geometry,this.material,{id:`${this.sid}_clone`}).sCopy(this,e)}sCopy(e,t=!0){if(this.name=e.name,this.sid=e.sid,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.geometry=e.geometry.clone(),Fh(e.material)?this.material=e.material.map((e=>e.clone())):this.material=e.material.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++)e.children[t]instanceof su||e.children[t]instanceof ou?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}class su extends ge{constructor(e,t="BaseObject3D"){super();const{id:n,name:r="",level:i={max:null,min:null},visible:o=!0,position:s={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},userData:c={}}=e;if(void 0===n)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=n,this.name=r,this.stype=t,this.level=i,this.visible=null==o||o,this.handleHide=!o,this.position.set(s.x,s.y,s.z),this.rotation.set(a.x,a.y,a.z),this.scale.set(l.x,l.y,l.z),this.castShadow=!0,this.receiveShadow=!0,this.renderOrder=1,this.userData=c,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}setMove(e,t,n,r){return iu(this.position,ph(e),t,n,r)}setRotate(e,t,n,r){return iu(this.rotation,fh(e),t,n,r)}setScale(e,t,n,r){return iu(this.scale,ph(e),t,n,r)}sClone(e){return new su({id:`${this.sid}_clone`}).sCopy(this,e)}sCopy(e,t=!0){if(this.name=e.name,this.sid=e.sid,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];n instanceof su||n instanceof ou?this.add(n.sClone()):this.add(n.clone())}return this}getSpaceAttribute(e=!0){return bh(this,e)}syncSpaceAttribute(e,t=!0){e instanceof su?_h(this,e,t):console.warn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!",e)}}class au extends su{constructor(e){super(e,"SceneManage"),this.name=e.id.toString(),this.isSceneManage=!0}}class lu extends su{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof su&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof su&&e.hide()}))}}class cu extends su{constructor(e){super(e,"PluginObject")}}class hu extends ge{constructor(e){super(),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof hu&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}}let uu,du;const pu=new v,fu=new W,mu=new W,gu={objects:new WeakMap};function vu(){const e=new v,t=new v;return function(n,r){return e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(r.matrixWorld),e.distanceToSquared(t)}}function yu(e){const t=function(e){var t=[];return e.traverse((function(e){e instanceof hu&&t.push(e)})),t}(e).sort((function(e,t){return gu.objects.get(e).distanceToCameraSquared-gu.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,r=t.length;e<r;e++)t[e].element.style.zIndex=""+(n-e)}class xu{constructor(e){e||(e=document.createElement("div")),e.style.overflow="hidden",this.domElement=e}setSize(e,t){uu=e/2,du=t/2,this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"}renderObject(e,t,n){if(e instanceof hu){pu.setFromMatrixPosition(e.matrixWorld),pu.applyMatrix4(mu);const t=e.element,r="translate(-50%,-100%) translate("+(pu.x*uu+uu)+"px,"+(-pu.y*du+du)+"px)";t.style.transform=r,t.style.display=e.visible&&pu.z>=-1&&pu.z<=1?e.userData.elDisplay||"":"none";const i={distanceToCameraSquared:vu()(n,e)};gu.objects.set(e,i),t.parentNode!==this.domElement&&this.domElement.appendChild(t)}for(var r=0,i=e.children.length;r<i;r++)this.renderObject(e.children[r],t,n)}render(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),fu.copy(t.matrixWorldInverse),mu.multiplyMatrices(t.projectionMatrix,fu),this.renderObject(e,e,t),yu(e)}}class bu extends ge{constructor(e){super(),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof bu&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}}let _u,wu;const Mu={camera:{fov:0,style:""},objects:new WeakMap};function Su(e){return Math.abs(e)<1e-10?0:e}function Tu(e){const t=e.elements;return"matrix3d("+Su(t[0])+","+Su(-t[1])+","+Su(t[2])+","+Su(t[3])+","+Su(t[4])+","+Su(-t[5])+","+Su(t[6])+","+Su(t[7])+","+Su(t[8])+","+Su(-t[9])+","+Su(t[10])+","+Su(t[11])+","+Su(t[12])+","+Su(-t[13])+","+Su(t[14])+","+Su(t[15])+")"}class Au{constructor(e,t){e||(e=document.createElement("div")),e.style.overflow="hidden",e.style.pointerEvents="auto",this.domElement=e,t||(t=document.createElement("div")),t.style.transformStyle="preserve-3d",t.style.pointerEvents="auto",t.style.position="absolute",t.style.top="0",e.appendChild(t),this.cameraElement=t}setSize(e,t){_u=e/2,wu=t/2,this.domElement.style.width=e+"px",this.domElement.style.height=t+"px",this.cameraElement.style.width=e+"px",this.cameraElement.style.height=t+"px"}renderObject(e,t,n,r){if(e instanceof bu){const t=function(e,t){const n=e.elements;return"translateX(-50%)matrix3d("+Su(n[0])+","+Su(n[1])+","+Su(n[2])+","+Su(n[3])+","+Su(-n[4])+","+Su(-n[5])+","+Su(-n[6])+","+Su(-n[7])+","+Su(n[8])+","+Su(n[9])+","+Su(n[10])+","+Su(n[11])+","+Su(n[12])+","+Su(n[13])+","+Su(n[14])+","+Su(n[15])+")"}(e.matrixWorld),n=e.element;n.style.transform=t;let r={style:t,distanceToCameraSquared:0};Mu.objects.set(e,r),n.parentNode!==this.cameraElement&&this.cameraElement.appendChild(n)}for(var i=0,o=e.children.length;i<o;i++)this.renderObject(e.children[i],t,n,r)}render(e,t){var n=t.projectionMatrix.elements[5]*wu;Mu.camera.fov!==n&&(this.domElement.style.perspective=t instanceof zt?n+"px":"",Mu.camera.fov=n),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld();let r="";if(t instanceof Ja){r+="scale("+n+")translateX("+Su(-(t.right+t.left)/2)+"px)"+Tu(t.matrixWorldInverse)}else r+="translateZ("+n+"px)"+Tu(t.matrixWorldInverse);const i=r+"translate("+_u+"px,"+wu+"px)";this.cameraElement.style.transform=i,Mu.camera.style=i,this.renderObject(e,e,t,r)}}class Eu extends ge{constructor(e){super(),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Eu&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}}let Pu,Lu;const Cu={camera:{fov:0,style:""},objects:new WeakMap};function Ru(e){return Math.abs(e)<1e-10?0:e}function Iu(e){const t=e.elements;return"matrix3d("+Ru(t[0])+","+Ru(-t[1])+","+Ru(t[2])+","+Ru(t[3])+","+Ru(t[4])+","+Ru(-t[5])+","+Ru(t[6])+","+Ru(t[7])+","+Ru(t[8])+","+Ru(-t[9])+","+Ru(t[10])+","+Ru(t[11])+","+Ru(t[12])+","+Ru(-t[13])+","+Ru(t[14])+","+Ru(t[15])+")"}class Fu{constructor(e,t){e||(e=document.createElement("div")),e.style.overflow="hidden",e.style.pointerEvents="auto",this.domElement=e,t||(t=document.createElement("div")),t.style.transformStyle="preserve-3d",t.style.pointerEvents="auto",t.style.position="absolute",t.style.top="0",e.appendChild(t),this.cameraElement=t}setSize(e,t){Pu=e/2,Lu=t/2,this.domElement.style.width=e+"px",this.domElement.style.height=t+"px",this.cameraElement.style.width=e+"px",this.cameraElement.style.height=t+"px"}renderObject(e,t,n,r){if(e instanceof Eu){const t=n.quaternion.clone();t.x=-n.quaternion.x,t.z=-n.quaternion.z;const r=function(e,t){const n=e.elements;return"translateX(-50%)matrix3d("+Ru(n[0])+","+Ru(-n[1])+","+Ru(n[2])+","+Ru(n[3])+","+Ru(n[4])+","+Ru(-n[5])+","+Ru(n[6])+","+Ru(n[7])+","+Ru(n[8])+","+Ru(-n[9])+","+Ru(n[10])+","+Ru(n[11])+","+Ru(n[12])+","+Ru(n[13])+","+Ru(n[14])+","+Ru(n[15])+")"}((new W).compose(e.parent.getWorldPosition(new v(0,0,0)),t,e.parent.scale)),i=e.element;i.style.transform=r;const o={style:r,distanceToCameraSquared:0};Cu.objects.set(e,o),i.parentNode!==this.cameraElement&&this.cameraElement.appendChild(i)}for(let i=0,o=e.children.length;i<o;i++)this.renderObject(e.children[i],t,n,r)}render(e,t){const n=t.projectionMatrix.elements[5]*Lu;Cu.camera.fov!==n&&(this.domElement.style.perspective=t instanceof zt?n+"px":"",Cu.camera.fov=n),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld();let r="";if(t instanceof Ja){r+="scale("+n+")translateX("+Ru(-(t.right+t.left)/2)+"px)"+Iu(t.matrixWorldInverse)}else r+="translateZ("+n+"px)"+Iu(t.matrixWorldInverse);const i=r+"translate("+Pu+"px,"+Lu+"px)";this.cameraElement.style.transform=i,Cu.camera.style=i,this.renderObject(e,e,t,r)}}class Ou extends su{constructor(e){super(e,"PoiNode");const{type:t,element:n}=e;this.elementType=t,this.element=n,this.create(t)}create(e){"2D"===e||"2d"===e?this._create2D():"2.5D"===e||"2.5d"===e?this._create2DHalf():"3D"!==e&&"3d"!==e||this._create3D()}show(){this.visible=!0,this.handleHide=!1,this._setElementDisplay(!0),this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this._setElementDisplay(!1),this.autoUpdate=!0}getBoundingBox(e=50){e=e<=0?50:e;let t=new v,n=new v,r=new v(e,e,e);return t.copy(this.position),n.copy(this.position),t.sub(r),n.add(r),new b(t,n)}_create2D(){this.add(new hu(this.element))}_create2DHalf(){this.add(new Eu(this.element))}_create3D(){this.add(new bu(this.element))}_setElementDisplay(e){this.children.forEach((t=>{(t instanceof hu||t instanceof Eu||t instanceof bu)&&("2D"===this.elementType||"2d"===this.elementType?t.visible=e:e&&"none"===t.element.style.display?t.element.style.display=t.userData.elDisplay||"block":e||"none"===t.element.style.display||(t.userData.elDisplay=t.element.style.display,t.element.style.display="none"))}))}}
1
+ var e="soonspacejs",t="2.2.39";function n(){}Object.assign(n.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}},dispatchEvent:function(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,r=n.length;t<r;t++)n[t].call(this,e)}}});const r=[];for(let e=0;e<256;e++)r[e]=(e<16?"0":"")+e.toString(16);let i=1234567;const o={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(r[255&e]+r[e>>8&255]+r[e>>16&255]+r[e>>24&255]+"-"+r[255&t]+r[t>>8&255]+"-"+r[t>>16&15|64]+r[t>>24&255]+"-"+r[63&n|128]+r[n>>8&255]+"-"+r[n>>16&255]+r[n>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(i=e%2147483647),i=16807*i%2147483647,(i-1)/2147483646},degToRad:function(e){return e*o.DEG2RAD},radToDeg:function(e){return e*o.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),c=o((t+r)/2),h=s((t+r)/2),u=o((t-r)/2),d=s((t-r)/2),p=o((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(a*h,l*u,l*d,a*c);break;case"YZY":e.set(l*d,a*h,l*u,a*c);break;case"ZXZ":e.set(l*u,l*d,a*h,a*c);break;case"XZX":e.set(a*h,l*f,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*f,a*c);break;case"ZYZ":e.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};class s{constructor(e=0,t=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}class a{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(e,t,n,r,i,o,s,a,l){const c=this.elements;return c[0]=e,c[1]=r,c[2]=s,c[3]=t,c[4]=i,c[5]=a,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],_=r[5],w=r[8];return i[0]=o*f+s*v+a*b,i[3]=o*m+s*y+a*_,i[6]=o*g+s*x+a*w,i[1]=l*f+c*v+h*b,i[4]=l*m+c*y+h*_,i[7]=l*g+c*x+h*w,i[2]=u*f+d*v+p*b,i[5]=u*m+d*y+p*_,i[8]=u*g+d*x+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8];return t*o*c-t*s*l-n*i*c+n*s*a+r*i*l-r*o*a}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=c*o-s*l,u=s*a-c*i,d=l*i-o*a,p=t*h+n*u+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(r*l-c*n)*f,e[2]=(s*n-r*o)*f,e[3]=u*f,e[4]=(c*t-r*a)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*a-l*t)*f,e[8]=(o*t-n*i)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).copy(this).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,o,s){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*o+l*s)+o+e,-r*l,r*a,-r*(-l*o+a*s)+s+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],o=r[3],s=r[6],a=r[1],l=r[4],c=r[7];return r[0]=t*i+n*a,r[3]=t*o+n*l,r[6]=t*s+n*c,r[1]=-n*i+t*a,r[4]=-n*o+t*l,r[7]=-n*s+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}let l;const c={getDataURL:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===l&&(l=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),l.width=e.width,l.height=e.height;const n=l.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=l}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}};let h=0;function u(e=u.DEFAULT_IMAGE,t=u.DEFAULT_MAPPING,n=1001,r=1001,i=1006,l=1008,c=1023,d=1009,p=1,f=3e3){Object.defineProperty(this,"id",{value:h++}),this.uuid=o.generateUUID(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=l,this.anisotropy=p,this.format=c,this.internalFormat=null,this.type=d,this.offset=new s(0,0),this.repeat=new s(1,1),this.center=new s(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new a,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=f,this.version=0,this.onUpdate=null}function d(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?c.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}u.DEFAULT_IMAGE=void 0,u.DEFAULT_MAPPING=300,u.prototype=Object.assign(Object.create(n.prototype),{constructor:u,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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=o.generateUUID()),!t&&void 0===e.images[r.uuid]){let t;if(Array.isArray(r)){t=[];for(let e=0,n=r.length;e<n;e++)r[e].isDataTexture?t.push(d(r[e].image)):t.push(d(r[e]))}else t=d(r);e.images[r.uuid]={uuid:r.uuid,url:t}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(u.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});class p{constructor(e=0,t=0,n=0,r=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i;const o=.01,s=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)<o&&Math.abs(h-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+u)<s&&Math.abs(h+f)<s&&Math.abs(p+m)<s&&Math.abs(l+d+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,a=(d+1)/2,v=(g+1)/2,y=(c+u)/4,x=(h+f)/4,b=(p+m)/4;return e>a&&e>v?e<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=y/n,i=x/n):a>v?a<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(a),n=y/r,i=b/r):v<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=x/i,r=b/i),this.set(n,r,i,t),this}let v=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(u-c)*(u-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(h-f)/v,this.z=(u-c)/v,this.w=Math.acos((l+d+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}function f(e,t,n){this.width=e,this.height=t,this.scissor=new p(0,0,e,t),this.scissorTest=!1,this.viewport=new p(0,0,e,t),n=n||{},this.texture=new u(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=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,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 m(e,t,n){f.call(this,e,t,n),this.samples=4}f.prototype=Object.assign(Object.create(n.prototype),{constructor:f,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),m.prototype=Object.assign(Object.create(f.prototype),{constructor:m,isWebGLMultisampleRenderTarget:!0,copy:function(e){return f.prototype.copy.call(this,e),this.samples=e.samples,this}});class g{constructor(e=0,t=0,n=0,r=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=e,this._y=t,this._z=n,this._w=r}static slerp(e,t,n,r){return n.copy(e).slerp(t,r)}static slerpFlat(e,t,n,r,i,o,s){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[o+0],d=i[o+1],p=i[o+2],f=i[o+3];if(h!==f||a!==u||l!==d||c!==p){let e=1-s;const t=a*u+l*d+c*p+h*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){const i=Math.sqrt(r),o=Math.atan2(i,t*n);e=Math.sin(e*o)/i,s=Math.sin(s*o)/i}const i=s*n;if(a=a*e+u*i,l=l*e+d*i,c=c*e+p*i,h=h*e+f*i,e===1-s){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,i,o){const s=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[o],u=i[o+1],d=i[o+2],p=i[o+3];return e[t]=s*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-s*d,e[t+2]=l*p+c*d+s*u-a*h,e[t+3]=c*p-s*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,r=e._y,i=e._z,o=e._order,s=Math.cos,a=Math.sin,l=s(n/2),c=s(r/2),h=s(i/2),u=a(n/2),d=a(r/2),p=a(i/2);switch(o){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],s=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+s+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(i-l)*e,this._z=(o-r)*e}else if(n>s&&n>h){const e=2*Math.sqrt(1+n-s-h);this._w=(c-a)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(i+l)/e}else if(s>h){const e=2*Math.sqrt(1+s-n-h);this._w=(i-l)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-s);this._w=(o-r)/e,this._x=(i+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(o.clamp(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,i=e._z,o=e._w,s=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+o*s+r*l-i*a,this._y=r*c+o*a+i*s-n*l,this._z=i*c+o*l+n*a-r*s,this._w=o*c-n*s-r*a-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,r=this._y,i=this._z,o=this._w;let s=o*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;const a=1-s*s;if(a<=Number.EPSILON){const e=1-t;return this._w=e*o+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}class v{constructor(e=0,t=0,n=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(x.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(x.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,s=e.z,a=e.w,l=a*t+o*r-s*n,c=a*n+s*t-i*r,h=a*r+i*n-o*t,u=-i*t-o*n-s*r;return this.x=l*a+u*-i+c*-s-h*-o,this.y=c*a+u*-o+h*-i-l*-s,this.z=h*a+u*-s+l*-o-c*-i,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,i=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return y.copy(this).projectOnVector(e),this.sub(y)}reflect(e){return this.sub(y.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(o.clamp(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}const y=new v,x=new g;class b{constructor(e,t){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==e?e:new v(1/0,1/0,1/0),this.max=void 0!==t?t:new v(-1/0,-1/0,-1/0)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;for(let a=0,l=e.length;a<l;a+=3){const l=e[a],c=e[a+1],h=e[a+2];l<t&&(t=l),c<n&&(n=c),h<r&&(r=h),l>i&&(i=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(t,n,r),this.max.set(i,o,s),this}setFromBufferAttribute(e){let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;for(let a=0,l=e.count;a<l;a++){const l=e.getX(a),c=e.getY(a),h=e.getZ(a);l<t&&(t=l),c<n&&(n=c),h<r&&(r=h),l>i&&(i=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(t,n,r),this.max.set(i,o,s),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=M.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new v),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new v),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);const t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),S.copy(t.boundingBox),S.applyMatrix4(e.matrixWorld),this.union(S));const n=e.children;for(let e=0,t=n.length;e<t;e++)this.expandByObject(n[e]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new v),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,M),M.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(R),I.subVectors(this.max,R),T.subVectors(e.a,R),A.subVectors(e.b,R),E.subVectors(e.c,R),P.subVectors(A,T),L.subVectors(E,A),C.subVectors(T,E);let t=[0,-P.z,P.y,0,-L.z,L.y,0,-C.z,C.y,P.z,0,-P.x,L.z,0,-L.x,C.z,0,-C.x,-P.y,P.x,0,-L.y,L.x,0,-C.y,C.x,0];return!!_(t,T,A,E,I)&&(t=[1,0,0,0,1,0,0,0,1],!!_(t,T,A,E,I)&&(F.crossVectors(P,L),t=[F.x,F.y,F.z],_(t,T,A,E,I)))}clampPoint(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new v),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return M.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(M).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(w[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),w[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),w[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),w[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),w[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),w[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),w[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),w[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(w)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}function _(e,t,n,r,i){for(let o=0,s=e.length-3;o<=s;o+=3){O.fromArray(e,o);const s=i.x*Math.abs(O.x)+i.y*Math.abs(O.y)+i.z*Math.abs(O.z),a=t.dot(O),l=n.dot(O),c=r.dot(O);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>s)return!1}return!0}const w=[new v,new v,new v,new v,new v,new v,new v,new v],M=new v,S=new b,T=new v,A=new v,E=new v,P=new v,L=new v,C=new v,R=new v,I=new v,F=new v,O=new v,N=new b;class D{constructor(e,t){this.center=void 0!==e?e:new v,this.radius=void 0!==t?t:-1}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):N.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new v),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new b),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}}const B=new v,U=new v,k=new v,z=new v,G=new v,H=new v,j=new v;class V{constructor(e,t){this.origin=void 0!==e?e:new v,this.direction=void 0!==t?t:new v(0,0,-1)}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new v),t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,B)),this}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new v),t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=B.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(B.copy(this.direction).multiplyScalar(t).add(this.origin),B.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){U.copy(e).add(t).multiplyScalar(.5),k.copy(t).sub(e).normalize(),z.copy(this.origin).sub(U);const i=.5*e.distanceTo(t),o=-this.direction.dot(k),s=z.dot(this.direction),a=-z.dot(k),l=z.lengthSq(),c=Math.abs(1-o*o);let h,u,d,p;if(c>0)if(h=o*a-s,u=o*s-a,p=i*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+o*u+2*s)+u*(o*h+u+2*a)+l}else u=i,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u=-i,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-o*i+s)),u=h>0?-i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-i,-a),i),d=u*(u+2*a)+l):(h=Math.max(0,-(o*i+s)),u=h>0?i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l);else u=o>0?-i:i,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(k).multiplyScalar(u).add(U),d}intersectSphere(e,t){B.subVectors(e.center,this.origin);const n=B.dot(this.direction),r=B.dot(B)-n*n,i=e.radius*e.radius;if(r>i)return null;const o=Math.sqrt(i-r),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,o,s,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),c>=0?(i=(e.min.y-u.y)*c,o=(e.max.y-u.y)*c):(i=(e.max.y-u.y)*c,o=(e.min.y-u.y)*c),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),h>=0?(s=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(s=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||s>r?null:((s>n||n!=n)&&(n=s),(a<r||r!=r)&&(r=a),r<0?null:this.at(n>=0?n:r,t)))}intersectsBox(e){return null!==this.intersectBox(e,B)}intersectTriangle(e,t,n,r,i){G.subVectors(t,e),H.subVectors(n,e),j.crossVectors(G,H);let o,s=this.direction.dot(j);if(s>0){if(r)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}z.subVectors(this.origin,e);const a=o*this.direction.dot(H.crossVectors(z,H));if(a<0)return null;const l=o*this.direction.dot(G.cross(z));if(l<0)return null;if(a+l>s)return null;const c=-o*z.dot(j);return c<0?null:this.at(c/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}class W{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(e,t,n,r,i,o,s,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,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 W).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/X.setFromMatrixColumn(e,0).length(),i=1/X.setFromMatrixColumn(e,1).length(),o=1/X.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===e.order){const e=o*c,n=o*h,r=s*c,i=s*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*a,t[2]=i-e*l,t[6]=r+n*l,t[10]=o*a}else if("YXZ"===e.order){const e=a*c,n=a*h,r=l*c,i=l*h;t[0]=e+i*s,t[4]=r*s-n,t[8]=o*l,t[1]=o*h,t[5]=o*c,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=o*a}else if("ZXY"===e.order){const e=a*c,n=a*h,r=l*c,i=l*h;t[0]=e-i*s,t[4]=-o*h,t[8]=r+n*s,t[1]=n+r*s,t[5]=o*c,t[9]=i-e*s,t[2]=-o*l,t[6]=s,t[10]=o*a}else if("ZYX"===e.order){const e=o*c,n=o*h,r=s*c,i=s*h;t[0]=a*c,t[4]=r*l-n,t[8]=e*l+i,t[1]=a*h,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*a,t[10]=o*a}else if("YZX"===e.order){const e=o*a,n=o*l,r=s*a,i=s*l;t[0]=a*c,t[4]=i-e*h,t[8]=r*h+n,t[1]=h,t[5]=o*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*h+r,t[10]=e-i*h}else if("XZY"===e.order){const e=o*a,n=o*l,r=s*a,i=s*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+i,t[5]=o*c,t[9]=n*h-r,t[2]=r*h-n,t[6]=s*c,t[10]=i*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(q,e,Q)}lookAt(e,t,n){const r=this.elements;return K.subVectors(e,t),0===K.lengthSq()&&(K.z=1),K.normalize(),Z.crossVectors(n,K),0===Z.lengthSq()&&(1===Math.abs(n.z)?K.x+=1e-4:K.z+=1e-4,K.normalize(),Z.crossVectors(n,K)),Z.normalize(),J.crossVectors(K,Z),r[0]=Z.x,r[4]=J.x,r[8]=K.x,r[1]=Z.y,r[5]=J.y,r[9]=K.y,r[2]=Z.z,r[6]=J.z,r[10]=K.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=r[0],w=r[4],M=r[8],S=r[12],T=r[1],A=r[5],E=r[9],P=r[13],L=r[2],C=r[6],R=r[10],I=r[14],F=r[3],O=r[7],N=r[11],D=r[15];return i[0]=o*_+s*T+a*L+l*F,i[4]=o*w+s*A+a*C+l*O,i[8]=o*M+s*E+a*R+l*N,i[12]=o*S+s*P+a*I+l*D,i[1]=c*_+h*T+u*L+d*F,i[5]=c*w+h*A+u*C+d*O,i[9]=c*M+h*E+u*R+d*N,i[13]=c*S+h*P+u*I+d*D,i[2]=p*_+f*T+m*L+g*F,i[6]=p*w+f*A+m*C+g*O,i[10]=p*M+f*E+m*R+g*N,i[14]=p*S+f*P+m*I+g*D,i[3]=v*_+y*T+x*L+b*F,i[7]=v*w+y*A+x*C+b*O,i[11]=v*M+y*E+x*R+b*N,i[15]=v*S+y*P+x*I+b*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],s=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+i*a*h-r*l*h-i*s*u+n*l*u+r*s*d-n*a*d)+e[7]*(+t*a*d-t*l*u+i*o*u-r*o*d+r*l*c-i*a*c)+e[11]*(+t*l*h-t*s*d-i*o*h+n*o*d+i*s*c-n*l*c)+e[15]*(-r*s*c-t*a*h+t*s*u+r*o*h-n*o*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*u*l+f*a*d-s*m*d-h*a*g+s*u*g,y=p*u*l-c*m*l-p*a*d+o*m*d+c*a*g-o*u*g,x=c*f*l-p*h*l+p*s*d-o*f*d-c*s*g+o*h*g,b=p*h*a-c*f*a-p*s*u+o*f*u+c*s*m-o*h*m,_=t*v+n*y+r*x+i*b;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=v*w,e[1]=(f*u*i-h*m*i-f*r*d+n*m*d+h*r*g-n*u*g)*w,e[2]=(s*m*i-f*a*i+f*r*l-n*m*l-s*r*g+n*a*g)*w,e[3]=(h*a*i-s*u*i-h*r*l+n*u*l+s*r*d-n*a*d)*w,e[4]=y*w,e[5]=(c*m*i-p*u*i+p*r*d-t*m*d-c*r*g+t*u*g)*w,e[6]=(p*a*i-o*m*i-p*r*l+t*m*l+o*r*g-t*a*g)*w,e[7]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*d+t*a*d)*w,e[8]=x*w,e[9]=(p*h*i-c*f*i-p*n*d+t*f*d+c*n*g-t*h*g)*w,e[10]=(o*f*i-p*s*i+p*n*l-t*f*l-o*n*g+t*s*g)*w,e[11]=(c*s*i-o*h*i-c*n*l+t*h*l+o*n*d-t*s*d)*w,e[12]=b*w,e[13]=(c*f*r-p*h*r+p*n*u-t*f*u-c*n*m+t*h*m)*w,e[14]=(p*s*r-o*f*r-p*n*a+t*f*a+o*n*m-t*s*m)*w,e[15]=(o*h*r-c*s*r+c*n*a-t*h*a-o*n*u+t*s*u)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,s=e.y,a=e.z,l=i*o,c=i*s;return this.set(l*o+n,l*s-r*a,l*a+r*s,0,l*s+r*a,c*s+n,c*a-r*o,0,l*a-r*s,c*a+r*o,i*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,i=t._x,o=t._y,s=t._z,a=t._w,l=i+i,c=o+o,h=s+s,u=i*l,d=i*c,p=i*h,f=o*c,m=o*h,g=s*h,v=a*l,y=a*c,x=a*h,b=n.x,_=n.y,w=n.z;return r[0]=(1-(f+g))*b,r[1]=(d+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(d-x)*_,r[5]=(1-(u+g))*_,r[6]=(m+v)*_,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(u+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let i=X.set(r[0],r[1],r[2]).length();const o=X.set(r[4],r[5],r[6]).length(),s=X.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Y.copy(this);const a=1/i,l=1/o,c=1/s;return Y.elements[0]*=a,Y.elements[1]*=a,Y.elements[2]*=a,Y.elements[4]*=l,Y.elements[5]*=l,Y.elements[6]*=l,Y.elements[8]*=c,Y.elements[9]*=c,Y.elements[10]*=c,t.setFromRotationMatrix(Y),n.x=i,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,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*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),h=(n+r)/(n-r),u=-(o+i)/(o-i),d=-2*o*i/(o-i);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,o){const s=this.elements,a=1/(t-e),l=1/(n-r),c=1/(o-i),h=(t+e)*a,u=(n+r)*l,d=(o+i)*c;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const X=new v,Y=new W,q=new v(0,0,0),Q=new v(1,1,1),Z=new v,J=new v,K=new v;class ${constructor(e=0,t=0,n=0,r=$.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t,n){const r=o.clamp,i=e.elements,s=i[0],a=i[4],l=i[8],c=i[1],h=i[5],u=i[9],d=i[2],p=i[6],f=i[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,f),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(l,f));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ee.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ee,t,n)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return te.setFromEuler(this),this.setFromQuaternion(te,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new v(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}$.DefaultOrder="XYZ",$.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const ee=new W,te=new g;class ne{constructor(){this.mask=1}set(e){this.mask=1<<e|0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return 0!=(this.mask&e.mask)}}let re=0;const ie=new v,oe=new g,se=new W,ae=new v,le=new v,ce=new v,he=new g,ue=new v(1,0,0),de=new v(0,1,0),pe=new v(0,0,1),fe={type:"added"},me={type:"removed"};function ge(){Object.defineProperty(this,"id",{value:re++}),this.uuid=o.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ge.DefaultUp.clone();const e=new v,t=new $,n=new g,r=new v(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new W},normalMatrix:{value:new a}}),this.matrix=new W,this.matrixWorld=new W,this.matrixAutoUpdate=ge.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ne,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}ge.DefaultUp=new v(0,1,0),ge.DefaultMatrixAutoUpdate=!0,ge.prototype=Object.assign(Object.create(n.prototype),{constructor:ge,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return oe.setFromAxisAngle(e,t),this.quaternion.multiply(oe),this},rotateOnWorldAxis:function(e,t){return oe.setFromAxisAngle(e,t),this.quaternion.premultiply(oe),this},rotateX:function(e){return this.rotateOnAxis(ue,e)},rotateY:function(e){return this.rotateOnAxis(de,e)},rotateZ:function(e){return this.rotateOnAxis(pe,e)},translateOnAxis:function(e,t){return ie.copy(e).applyQuaternion(this.quaternion),this.position.add(ie.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(ue,e)},translateY:function(e){return this.translateOnAxis(de,e)},translateZ:function(e){return this.translateOnAxis(pe,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(se.copy(this.matrixWorld).invert())},lookAt:function(e,t,n){e.isVector3?ae.copy(e):ae.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),le.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?se.lookAt(le,ae,this.up):se.lookAt(ae,le,this.up),this.quaternion.setFromRotationMatrix(se),r&&(se.extractRotation(r.matrixWorld),oe.setFromRotationMatrix(se),this.quaternion.premultiply(oe.invert()))},add:function(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(fe)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(me)),this},clear:function(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(me)}return this.children.length=0,this},attach:function(e){return this.updateWorldMatrix(!0,!1),se.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),se.multiply(e.parent.matrixWorld)),e.applyMatrix4(se),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new v),this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new g),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(le,e,ce),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new v),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(le,he,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new v),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)},traverseAncestors:function(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}},toJSON:function(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){const t=o(e.geometries),r=o(e.materials),i=o(e.textures),s=o(e.images),a=o(e.shapes),l=o(e.skeletons),c=o(e.animations);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function o(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}});const ve=new v,ye=new v,xe=new a;class be{constructor(e,t){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==e?e:new v(1,0,0),this.constant=void 0!==t?t:0}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=ve.subVectors(n,t).cross(ye.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new v),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new v);const n=e.delta(ve),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;const i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:t.copy(n).multiplyScalar(i).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new v),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||xe.getNormalMatrix(e),r=this.coplanarPoint(ve).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}const _e=new v,we=new v,Me=new v,Se=new v,Te=new v,Ae=new v,Ee=new v,Pe=new v,Le=new v,Ce=new v;class Re{constructor(e,t,n){this.a=void 0!==e?e:new v,this.b=void 0!==t?t:new v,this.c=void 0!==n?n:new v}static getNormal(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new v),r.subVectors(n,t),_e.subVectors(e,t),r.cross(_e);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){_e.subVectors(r,t),we.subVectors(n,t),Me.subVectors(e,t);const o=_e.dot(_e),s=_e.dot(we),a=_e.dot(Me),l=we.dot(we),c=we.dot(Me),h=o*l-s*s;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new v),0===h)return i.set(-2,-1,-1);const u=1/h,d=(l*a-s*c)*u,p=(o*c-s*a)*u;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Se),Se.x>=0&&Se.y>=0&&Se.x+Se.y<=1}static getUV(e,t,n,r,i,o,s,a){return this.getBarycoord(e,t,n,r,Se),a.set(0,0),a.addScaledVector(i,Se.x),a.addScaledVector(o,Se.y),a.addScaledVector(s,Se.z),a}static isFrontFacing(e,t,n,r){return _e.subVectors(n,t),we.subVectors(e,t),_e.cross(we).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _e.subVectors(this.c,this.b),we.subVectors(this.a,this.b),.5*_e.cross(we).length()}getMidpoint(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new v),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Re.getNormal(this.a,this.b,this.c,e)}getPlane(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new be),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Re.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,i){return Re.getUV(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return Re.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Re.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new v);const n=this.a,r=this.b,i=this.c;let o,s;Te.subVectors(r,n),Ae.subVectors(i,n),Pe.subVectors(e,n);const a=Te.dot(Pe),l=Ae.dot(Pe);if(a<=0&&l<=0)return t.copy(n);Le.subVectors(e,r);const c=Te.dot(Le),h=Ae.dot(Le);if(c>=0&&h<=c)return t.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return o=a/(a-c),t.copy(n).addScaledVector(Te,o);Ce.subVectors(e,i);const d=Te.dot(Ce),p=Ae.dot(Ce);if(p>=0&&d<=p)return t.copy(i);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(n).addScaledVector(Ae,s);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return Ee.subVectors(i,r),s=(h-c)/(h-c+(d-p)),t.copy(r).addScaledVector(Ee,s);const g=1/(m+f+u);return o=f*g,s=u*g,t.copy(n).addScaledVector(Te,o).addScaledVector(Ae,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ie={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},Fe={h:0,s:0,l:0},Oe={h:0,s:0,l:0};function Ne(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function De(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Be(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Ue{constructor(e,t,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=o.euclideanModulo(e,1),t=o.clamp(t,0,1),n=o.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Ne(i,r,e+1/3),this.g=Ne(i,r,e),this.b=Ne(i,r,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){let e;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(e=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Ie[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){const n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=De(e.r),this.g=De(e.g),this.b=De(e.b),this}copyLinearToSRGB(e){return this.r=Be(e.r),this.g=Be(e.g),this.b=Be(e.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(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});const t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),o=Math.min(t,n,r);let s,a;const l=(o+i)/2;if(o===i)s=0,a=0;else{const e=i-o;switch(a=l<=.5?e/(i+o):e/(2-i-o),i){case t:s=(n-r)/e+(n<r?6:0);break;case n:s=(r-t)/e+2;break;case r:s=(t-n)/e+4}s/=6}return e.h=s,e.s=a,e.l=l,e}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(e,t,n){return this.getHSL(Fe),Fe.h+=e,Fe.s+=t,Fe.l+=n,this.setHSL(Fe.h,Fe.s,Fe.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpHSL(e,t){this.getHSL(Fe),e.getHSL(Oe);const n=o.lerp(Fe.h,Oe.h,t),r=o.lerp(Fe.s,Oe.s,t),i=o.lerp(Fe.l,Oe.l,t);return this.setHSL(n,r,i),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),!0===e.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Ue.NAMES=Ie,Ue.prototype.r=1,Ue.prototype.g=1,Ue.prototype.b=1;class ke{constructor(e,t,n,r,i,o=0){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new v,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new Ue,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=o}clone(){return(new this.constructor).copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}let ze=0;function Ge(){Object.defineProperty(this,"id",{value:ze++}),this.uuid=o.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function He(e){Ge.call(this),this.type="MeshBasicMaterial",this.color=new Ue(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}Ge.prototype=Object.assign(Object.create(n.prototype),{constructor:Ge,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}},toJSON:function(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(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),t){const t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ge.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),He.prototype=Object.create(Ge.prototype),He.prototype.constructor=He,He.prototype.isMeshBasicMaterial=!0,He.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};const je=new v,Ve=new s;function We(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function Xe(e,t,n){We.call(this,new Int8Array(e),t,n)}function Ye(e,t,n){We.call(this,new Uint8Array(e),t,n)}function qe(e,t,n){We.call(this,new Uint8ClampedArray(e),t,n)}function Qe(e,t,n){We.call(this,new Int16Array(e),t,n)}function Ze(e,t,n){We.call(this,new Uint16Array(e),t,n)}function Je(e,t,n){We.call(this,new Int32Array(e),t,n)}function Ke(e,t,n){We.call(this,new Uint32Array(e),t,n)}function $e(e,t,n){We.call(this,new Uint16Array(e),t,n)}function et(e,t,n){We.call(this,new Float32Array(e),t,n)}function tt(e,t,n){We.call(this,new Float64Array(e),t,n)}Object.defineProperty(We.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(We.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new Ue),t[n++]=i.r,t[n++]=i.g,t[n++]=i.b}return this},copyVector2sArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new s),t[n++]=i.x,t[n++]=i.y}return this},copyVector3sArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new v),t[n++]=i.x,t[n++]=i.y,t[n++]=i.z}return this},copyVector4sArray:function(e){const t=this.array;let n=0;for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new p),t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n++]=i.w}return this},applyMatrix3:function(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)Ve.fromBufferAttribute(this,t),Ve.applyMatrix3(e),this.setXY(t,Ve.x,Ve.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)je.fromBufferAttribute(this,t),je.applyMatrix3(e),this.setXYZ(t,je.x,je.y,je.z);return this},applyMatrix4:function(e){for(let t=0,n=this.count;t<n;t++)je.x=this.getX(t),je.y=this.getY(t),je.z=this.getZ(t),je.applyMatrix4(e),this.setXYZ(t,je.x,je.y,je.z);return this},applyNormalMatrix:function(e){for(let t=0,n=this.count;t<n;t++)je.x=this.getX(t),je.y=this.getY(t),je.z=this.getZ(t),je.applyNormalMatrix(e),this.setXYZ(t,je.x,je.y,je.z);return this},transformDirection:function(e){for(let t=0,n=this.count;t<n;t++)je.x=this.getX(t),je.y=this.getY(t),je.z=this.getZ(t),je.transformDirection(e),this.setXYZ(t,je.x,je.y,je.z);return this},set:function(e,t=0){return this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Xe.prototype=Object.create(We.prototype),Xe.prototype.constructor=Xe,Ye.prototype=Object.create(We.prototype),Ye.prototype.constructor=Ye,qe.prototype=Object.create(We.prototype),qe.prototype.constructor=qe,Qe.prototype=Object.create(We.prototype),Qe.prototype.constructor=Qe,Ze.prototype=Object.create(We.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(We.prototype),Je.prototype.constructor=Je,Ke.prototype=Object.create(We.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(We.prototype),$e.prototype.constructor=$e,$e.prototype.isFloat16BufferAttribute=!0,et.prototype=Object.create(We.prototype),et.prototype.constructor=et,tt.prototype=Object.create(We.prototype),tt.prototype.constructor=tt;class nt{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let n,r,i;const o=e.faces;for(r=0;r<o.length;r++){const e=o[r];e.materialIndex!==i&&(i=e.materialIndex,void 0!==n&&(n.count=3*r-n.start,t.push(n)),n={start:3*r,materialIndex:i})}void 0!==n&&(n.count=3*r-n.start,t.push(n)),this.groups=t}fromGeometry(e){const t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,a=e.morphTargets,l=a.length;let c;if(l>0){c=[];for(let e=0;e<l;e++)c[e]={name:a[e].name,data:[]};this.morphTargets.position=c}const h=e.morphNormals,u=h.length;let d;if(u>0){d=[];for(let e=0;e<u;e++)d[e]={name:h[e].name,data:[]};this.morphTargets.normal=d}const p=e.skinIndices,f=e.skinWeights,m=p.length===n.length,g=f.length===n.length;n.length>0&&0===t.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let e=0;e<t.length;e++){const v=t[e];this.vertices.push(n[v.a],n[v.b],n[v.c]);const y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{const e=v.normal;this.normals.push(e,e,e)}const x=v.vertexColors;if(3===x.length)this.colors.push(x[0],x[1],x[2]);else{const e=v.color;this.colors.push(e,e,e)}if(!0===i){const t=r[0][e];void 0!==t?this.uvs.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",e),this.uvs.push(new s,new s,new s))}if(!0===o){const t=r[1][e];void 0!==t?this.uvs2.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",e),this.uvs2.push(new s,new s,new s))}for(let e=0;e<l;e++){const t=a[e].vertices;c[e].data.push(t[v.a],t[v.b],t[v.c])}for(let t=0;t<u;t++){const n=h[t].vertexNormals[e];d[t].data.push(n.a,n.b,n.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}}function rt(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}const it={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ot(e,t){return new it[e](t)}let st=1;const at=new W,lt=new ge,ct=new v,ht=new b,ut=new b,dt=new v;function pt(){Object.defineProperty(this,"id",{value:st+=2}),this.uuid=o.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={}}pt.prototype=Object.assign(Object.create(n.prototype),{constructor:pt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(rt(e)>65535?Ke:Ze)(e,1):this.index=e,this},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},hasAttribute:function(e){return void 0!==this.attributes[e]},addGroup:function(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new a).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return at.makeRotationX(e),this.applyMatrix4(at),this},rotateY:function(e){return at.makeRotationY(e),this.applyMatrix4(at),this},rotateZ:function(e){return at.makeRotationZ(e),this.applyMatrix4(at),this},translate:function(e,t,n){return at.makeTranslation(e,t,n),this.applyMatrix4(at),this},scale:function(e,t,n){return at.makeScale(e,t,n),this.applyMatrix4(at),this},lookAt:function(e){return lt.lookAt(e),lt.updateMatrix(),this.applyMatrix4(lt.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ct).negate(),this.translate(ct.x,ct.y,ct.z),this},setFromObject:function(e){const t=e.geometry;if(e.isPoints||e.isLine){const e=new et(3*t.vertices.length,3),n=new et(3*t.colors.length,3);if(this.setAttribute("position",e.copyVector3sArray(t.vertices)),this.setAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){const e=new et(t.lineDistances.length,1);this.setAttribute("lineDistance",e.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new et(t,3)),this},updateFromObject:function(e){let t=e.geometry;if(e.isMesh){let e=t.__directGeometry;if(!0===t.elementsNeedUpdate&&(e=void 0,t.elementsNeedUpdate=!1),void 0===e)return this.fromGeometry(t);e.verticesNeedUpdate=t.verticesNeedUpdate,e.normalsNeedUpdate=t.normalsNeedUpdate,e.colorsNeedUpdate=t.colorsNeedUpdate,e.uvsNeedUpdate=t.uvsNeedUpdate,e.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=e}if(!0===t.verticesNeedUpdate){const e=this.attributes.position;void 0!==e&&(e.copyVector3sArray(t.vertices),e.needsUpdate=!0),t.verticesNeedUpdate=!1}if(!0===t.normalsNeedUpdate){const e=this.attributes.normal;void 0!==e&&(e.copyVector3sArray(t.normals),e.needsUpdate=!0),t.normalsNeedUpdate=!1}if(!0===t.colorsNeedUpdate){const e=this.attributes.color;void 0!==e&&(e.copyColorsArray(t.colors),e.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){const e=this.attributes.uv;void 0!==e&&(e.copyVector2sArray(t.uvs),e.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){const e=this.attributes.lineDistance;void 0!==e&&(e.copyArray(t.lineDistances),e.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new nt).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){const t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new We(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){const t=new Float32Array(3*e.normals.length);this.setAttribute("normal",new We(t,3).copyVector3sArray(e.normals))}if(e.colors.length>0){const t=new Float32Array(3*e.colors.length);this.setAttribute("color",new We(t,3).copyColorsArray(e.colors))}if(e.uvs.length>0){const t=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new We(t,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){const t=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new We(t,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(const t in e.morphTargets){const n=[],r=e.morphTargets[t];for(let e=0,t=r.length;e<t;e++){const t=r[e],i=new et(3*t.data.length,3);i.name=t.name,n.push(i.copyVector3sArray(t.data))}this.morphAttributes[t]=n}if(e.skinIndices.length>0){const t=new et(4*e.skinIndices.length,4);this.setAttribute("skinIndex",t.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){const t=new et(4*e.skinWeights.length,4);this.setAttribute("skinWeight",t.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new b);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.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 v(-1/0,-1/0,-1/0),new v(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ht.setFromBufferAttribute(n),this.morphTargetsRelative?(dt.addVectors(this.boundingBox.min,ht.min),this.boundingBox.expandByPoint(dt),dt.addVectors(this.boundingBox.max,ht.max),this.boundingBox.expandByPoint(dt)):(this.boundingBox.expandByPoint(ht.min),this.boundingBox.expandByPoint(ht.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new D);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new v,1/0);if(e){const n=this.boundingSphere.center;if(ht.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];ut.setFromBufferAttribute(n),this.morphTargetsRelative?(dt.addVectors(ht.min,ut.min),ht.expandByPoint(dt),dt.addVectors(ht.max,ut.max),ht.expandByPoint(dt)):(ht.expandByPoint(ut.min),ht.expandByPoint(ut.max))}ht.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)dt.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(dt));if(t)for(let i=0,o=t.length;i<o;i++){const o=t[i],s=this.morphTargetsRelative;for(let t=0,i=o.count;t<i;t++)dt.fromBufferAttribute(o,t),s&&(ct.fromBufferAttribute(e,t),dt.add(ct)),r=Math.max(r,n.distanceToSquared(dt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new We(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const r=new v,i=new v,o=new v,s=new v,a=new v,l=new v,c=new v,h=new v;if(e)for(let u=0,d=e.count;u<d;u+=3){const d=e.getX(u+0),p=e.getX(u+1),f=e.getX(u+2);r.fromBufferAttribute(t,d),i.fromBufferAttribute(t,p),o.fromBufferAttribute(t,f),c.subVectors(o,i),h.subVectors(r,i),c.cross(h),s.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(c),a.add(c),l.add(c),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),o.fromBufferAttribute(t,e+2),c.subVectors(o,i),h.subVectors(r,i),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(e,t){if(!e||!e.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(void 0===e.attributes[r])continue;const i=n[r].array,o=e.attributes[r],s=o.array,a=o.itemSize*t,l=Math.min(s.length,i.length-a);for(let e=0,t=a;e<l;e++,t++)i[t]=s[e]}return this},normalizeNormals:function(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)dt.fromBufferAttribute(e,t),dt.normalize(),e.setXYZ(t,dt.x,dt.y,dt.z)},toNonIndexed:function(){function e(e,t){const n=e.array,r=e.itemSize,i=e.normalized,o=new n.constructor(t.length*r);let s=0,a=0;for(let e=0,i=t.length;e<i;e++){s=t[e]*r;for(let e=0;e<r;e++)o[a++]=n[s++]}return new We(o,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;const t=new pt,n=this.index.array,r=this.attributes;for(const i in r){const o=e(r[i],n);t.setAttribute(i,o)}const i=this.morphAttributes;for(const r in i){const o=[],s=i[r];for(let t=0,r=s.length;t<r;t++){const r=e(s[t],n);o.push(r)}t.morphAttributes[r]=o}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let e=0,n=o.length;e<n;e++){const n=o[e];t.addGroup(n.start,n.count,n.materialIndex)}return t},toJSON:function(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const r=n[t],i=r.toJSON(e.data);""!==r.name&&(i.name=r.name),e.data.attributes[t]=i}const r={};let i=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],o=[];for(let t=0,r=n.length;t<r;t++){const r=n[t],i=r.toJSON(e.data);""!==r.name&&(i.name=r.name),o.push(i)}o.length>0&&(r[t]=o,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e},clone:function(){return(new pt).copy(this)},copy:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const r=e.attributes;for(const e in r){const n=r[e];this.setAttribute(e,n.clone(t))}const i=e.morphAttributes;for(const e in i){const n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let e=0,t=o.length;e<t;e++){const t=o[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=e.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const ft=new W,mt=new V,gt=new D,vt=new v,yt=new v,xt=new v,bt=new v,_t=new v,wt=new v,Mt=new v,St=new v,Tt=new v,At=new s,Et=new s,Pt=new s,Lt=new v,Ct=new v;function Rt(e=new pt,t=new He){ge.call(this),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}function It(e,t,n,r,i,o,s,a){let l;if(l=1===t.side?r.intersectTriangle(s,o,i,!0,a):r.intersectTriangle(i,o,s,2!==t.side,a),null===l)return null;Ct.copy(a),Ct.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Ct);return c<n.near||c>n.far?null:{distance:c,point:Ct.clone(),object:e}}function Ft(e,t,n,r,i,o,a,l,c,h,u,d){vt.fromBufferAttribute(i,h),yt.fromBufferAttribute(i,u),xt.fromBufferAttribute(i,d);const p=e.morphTargetInfluences;if(t.morphTargets&&o&&p){Mt.set(0,0,0),St.set(0,0,0),Tt.set(0,0,0);for(let e=0,t=o.length;e<t;e++){const t=p[e],n=o[e];0!==t&&(bt.fromBufferAttribute(n,h),_t.fromBufferAttribute(n,u),wt.fromBufferAttribute(n,d),a?(Mt.addScaledVector(bt,t),St.addScaledVector(_t,t),Tt.addScaledVector(wt,t)):(Mt.addScaledVector(bt.sub(vt),t),St.addScaledVector(_t.sub(yt),t),Tt.addScaledVector(wt.sub(xt),t)))}vt.add(Mt),yt.add(St),xt.add(Tt)}e.isSkinnedMesh&&(e.boneTransform(h,vt),e.boneTransform(u,yt),e.boneTransform(d,xt));const f=It(e,t,n,r,vt,yt,xt,Lt);if(f){l&&(At.fromBufferAttribute(l,h),Et.fromBufferAttribute(l,u),Pt.fromBufferAttribute(l,d),f.uv=Re.getUV(Lt,vt,yt,xt,At,Et,Pt,new s)),c&&(At.fromBufferAttribute(c,h),Et.fromBufferAttribute(c,u),Pt.fromBufferAttribute(c,d),f.uv2=Re.getUV(Lt,vt,yt,xt,At,Et,Pt,new s));const e=new ke(h,u,d);Re.getNormal(vt,yt,xt,e.normal),f.face=e}return f}Rt.prototype=Object.assign(Object.create(ge.prototype),{constructor:Rt,isMesh:!0,copy:function(e){return ge.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this},updateMorphTargets:function(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){const n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{const t=e.morphTargets;void 0!==t&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),gt.copy(n.boundingSphere),gt.applyMatrix4(i),!1===e.ray.intersectsSphere(gt))return;if(ft.copy(i).invert(),mt.copy(e.ray).applyMatrix4(ft),null!==n.boundingBox&&!1===mt.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,p=u.length;n<p;n++){const p=u[n],f=r[p.materialIndex];for(let n=Math.max(p.start,d.start),r=Math.min(p.start+p.count,d.start+d.count);n<r;n+=3){const r=i.getX(n),u=i.getX(n+1),d=i.getX(n+2);o=Ft(this,f,e,mt,s,a,l,c,h,r,u,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,t.push(o))}}else{for(let n=Math.max(0,d.start),u=Math.min(i.count,d.start+d.count);n<u;n+=3){const u=i.getX(n),d=i.getX(n+1),p=i.getX(n+2);o=Ft(this,r,e,mt,s,a,l,c,h,u,d,p),o&&(o.faceIndex=Math.floor(n/3),t.push(o))}}else if(void 0!==s)if(Array.isArray(r))for(let n=0,i=u.length;n<i;n++){const i=u[n],p=r[i.materialIndex];for(let n=Math.max(i.start,d.start),r=Math.min(i.start+i.count,d.start+d.count);n<r;n+=3){o=Ft(this,p,e,mt,s,a,l,c,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,t.push(o))}}else{for(let n=Math.max(0,d.start),i=Math.min(s.count,d.start+d.count);n<i;n+=3){o=Ft(this,r,e,mt,s,a,l,c,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),t.push(o))}}}else if(n.isGeometry){const i=Array.isArray(r),a=n.vertices,l=n.faces;let c;const h=n.faceVertexUvs[0];h.length>0&&(c=h);for(let n=0,h=l.length;n<h;n++){const h=l[n],u=i?r[h.materialIndex]:r;if(void 0===u)continue;const d=a[h.a],p=a[h.b],f=a[h.c];if(o=It(this,u,e,mt,d,p,f,Lt),o){if(c&&c[n]){const e=c[n];At.copy(e[0]),Et.copy(e[1]),Pt.copy(e[2]),o.uv=Re.getUV(Lt,d,p,f,At,Et,Pt,new s)}o.face=h,o.faceIndex=n,t.push(o)}}}}});class Ot extends pt{constructor(e=1,t=1,n=1,r=1,i=1,o=1){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const s=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,n,r,i,o,p,f,m,g,y){const x=o/m,b=p/g,_=o/2,w=p/2,M=f/2,S=m+1,T=g+1;let A=0,E=0;const P=new v;for(let o=0;o<T;o++){const s=o*b-w;for(let a=0;a<S;a++){const u=a*x-_;P[e]=u*r,P[t]=s*i,P[n]=M,l.push(P.x,P.y,P.z),P[e]=0,P[t]=0,P[n]=f>0?1:-1,c.push(P.x,P.y,P.z),h.push(a/m),h.push(1-o/g),A+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const n=u+t+S*e,r=u+t+S*(e+1),i=u+(t+1)+S*(e+1),o=u+(t+1)+S*e;a.push(n,r,o),a.push(r,i,o),E+=6}s.addGroup(d,E,y),d+=E,u+=A}p("z","y","x",-1,-1,n,t,e,o,i,0),p("z","y","x",1,-1,n,t,-e,o,i,1),p("x","z","y",1,1,e,n,t,r,o,2),p("x","z","y",1,-1,e,n,-t,r,o,3),p("x","y","z",1,-1,e,t,n,r,i,4),p("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(a),this.setAttribute("position",new et(l,3)),this.setAttribute("normal",new et(c,3)),this.setAttribute("uv",new et(h,2))}}function Nt(e){const t={};for(const n in e){t[n]={};for(const r in e[n]){const i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function Dt(e){const t={};for(let n=0;n<e.length;n++){const r=Nt(e[n]);for(const e in r)t[e]=r[e]}return t}const Bt={clone:Nt,merge:Dt};function Ut(e){Ge.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function kt(){ge.call(this),this.type="Camera",this.matrixWorldInverse=new W,this.projectionMatrix=new W,this.projectionMatrixInverse=new W}function zt(e=50,t=1,n=.1,r=2e3){kt.call(this),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Ut.prototype=Object.create(Ge.prototype),Ut.prototype.constructor=Ut,Ut.prototype.isShaderMaterial=!0,Ut.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nt(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this},Ut.prototype.toJSON=function(e){const t=Ge.prototype.toJSON.call(this,e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t},kt.prototype=Object.assign(Object.create(ge.prototype),{constructor:kt,isCamera:!0,copy:function(e,t){return ge.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new v),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){ge.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(e,t){ge.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),zt.prototype=Object.assign(Object.create(kt.prototype),{constructor:zt,isPerspectiveCamera:!0,copy:function(e,t){return kt.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){const t=.5*this.getFilmHeight()/e;this.fov=2*o.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){const e=Math.tan(.5*o.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*o.RAD2DEG*Math.atan(Math.tan(.5*o.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(e,t,n,r,i,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const e=this.near;let t=e*Math.tan(.5*o.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/e,t-=s.offsetY*n/o,r*=s.width/e,n*=s.height/o}const a=this.filmOffset;0!==a&&(i+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function Gt(e,t,n){if(ge.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 r=new zt(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new v(1,0,0)),this.add(r);const i=new zt(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new v(-1,0,0)),this.add(i);const o=new zt(90,1,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new v(0,1,0)),this.add(o);const s=new zt(90,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new v(0,-1,0)),this.add(s);const a=new zt(90,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new v(0,0,1)),this.add(a);const l=new zt(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new v(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();const c=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=c}}function Ht(e,t,n,r,i,o,s,a,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,s=void 0!==s?s:1022,u.call(this,e,t,n,r,i,o,s,a,l,c),this.flipY=!1,this._needsFlipEnvMap=!0}function jt(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),f.call(this,e,e,t),t=t||{},this.texture=new Ht(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture._needsFlipEnvMap=!1}function Vt(e,t,n,r,i,o,s,a,l,c,h,d){u.call(this,null,o,s,a,l,c,r,i,h,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Gt.prototype=Object.create(ge.prototype),Gt.prototype.constructor=Gt,Ht.prototype=Object.create(u.prototype),Ht.prototype.constructor=Ht,Ht.prototype.isCubeTexture=!0,Object.defineProperty(Ht.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),jt.prototype=Object.create(f.prototype),jt.prototype.constructor=jt,jt.prototype.isWebGLCubeRenderTarget=!0,jt.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=1023,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.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 <begin_vertex>\n\t\t\t\t#include <project_vertex>\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 <common>\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"},r=new Ot(5,5,5),i=new Ut({name:"CubemapFromEquirect",uniforms:Nt(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;const o=new Rt(r,i),s=t.minFilter;1008===t.minFilter&&(t.minFilter=1006);return new Gt(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this},jt.prototype.clear=function(e,t,n,r){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)},Vt.prototype=Object.create(u.prototype),Vt.prototype.constructor=Vt,Vt.prototype.isDataTexture=!0;const Wt=new D,Xt=new v;class Yt{constructor(e,t,n,r,i,o){this.planes=[void 0!==e?e:new be,void 0!==t?t:new be,void 0!==n?n:new be,void 0!==r?r:new be,void 0!==i?i:new be,void 0!==o?o:new be]}set(e,t,n,r,i,o){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(o),this}clone(){return(new this.constructor).copy(this)}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(s-r,h-a,f-u,y-m).normalize(),t[1].setComponents(s+r,h+a,f+u,y+m).normalize(),t[2].setComponents(s+i,h+l,f+d,y+g).normalize(),t[3].setComponents(s-i,h-l,f-d,y-g).normalize(),t[4].setComponents(s-o,h-c,f-p,y-v).normalize(),t[5].setComponents(s+o,h+c,f+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Wt.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Wt)}intersectsSprite(e){return Wt.center.set(0,0,0),Wt.radius=.7071067811865476,Wt.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wt)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)<r)return!1}return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Xt.x=r.normal.x>0?e.max.x:e.min.x,Xt.y=r.normal.y>0?e.max.y:e.min.y,Xt.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Xt)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}function qt(){let e=null,t=!1,n=null,r=null;function i(t,o){n(t,o),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Qt(e,t){const n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){const e=r.get(t);return void((!e||e.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}))}t.isInterleavedBufferAttribute&&(t=t.data);const o=r.get(t);void 0===o?r.set(t,function(t,r){const i=t.array,o=t.usage,s=e.createBuffer();e.bindBuffer(r,s),e.bufferData(r,i,o),t.onUploadCallback();let a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?t.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:i instanceof Uint8Array&&(a=5121),{buffer:s,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(!function(t,r,i){const o=r.array,s=r.updateRange;e.bindBuffer(i,t),-1===s.count?e.bufferSubData(i,0,o):(n?e.bufferSubData(i,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):e.bufferSubData(i,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,t,i),o.version=t.version)}}}class Zt extends pt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const i=e/2,o=t/2,s=Math.floor(n),a=Math.floor(r),l=s+1,c=a+1,h=e/s,u=t/a,d=[],p=[],f=[],m=[];for(let e=0;e<c;e++){const t=e*u-o;for(let n=0;n<l;n++){const r=n*h-i;p.push(r,-t,0),f.push(0,0,1),m.push(n/s),m.push(1-e/a)}}for(let e=0;e<a;e++)for(let t=0;t<s;t++){const n=t+l*e,r=t+l*(e+1),i=t+1+l*(e+1),o=t+1+l*e;d.push(n,r,o),d.push(r,i,o)}this.setIndex(d),this.setAttribute("position",new et(p,3)),this.setAttribute("normal",new et(f,3)),this.setAttribute("uv",new et(m,2))}}const Jt={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Kt={common:{diffuse:{value:new Ue(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new a},uv2Transform:{value:new a},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new s(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ue(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ue(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new a}},sprite:{diffuse:{value:new Ue(15658734)},opacity:{value:1},center:{value:new s(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new a}}},$t={basic:{uniforms:Dt([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.fog]),vertexShader:Jt.meshbasic_vert,fragmentShader:Jt.meshbasic_frag},lambert:{uniforms:Dt([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)}}]),vertexShader:Jt.meshlambert_vert,fragmentShader:Jt.meshlambert_frag},phong:{uniforms:Dt([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)},specular:{value:new Ue(1118481)},shininess:{value:30}}]),vertexShader:Jt.meshphong_vert,fragmentShader:Jt.meshphong_frag},standard:{uniforms:Dt([Kt.common,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.roughnessmap,Kt.metalnessmap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},toon:{uniforms:Dt([Kt.common,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.gradientmap,Kt.fog,Kt.lights,{emissive:{value:new Ue(0)}}]),vertexShader:Jt.meshtoon_vert,fragmentShader:Jt.meshtoon_frag},matcap:{uniforms:Dt([Kt.common,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,{matcap:{value:null}}]),vertexShader:Jt.meshmatcap_vert,fragmentShader:Jt.meshmatcap_frag},points:{uniforms:Dt([Kt.points,Kt.fog]),vertexShader:Jt.points_vert,fragmentShader:Jt.points_frag},dashed:{uniforms:Dt([Kt.common,Kt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Jt.linedashed_vert,fragmentShader:Jt.linedashed_frag},depth:{uniforms:Dt([Kt.common,Kt.displacementmap]),vertexShader:Jt.depth_vert,fragmentShader:Jt.depth_frag},normal:{uniforms:Dt([Kt.common,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,{opacity:{value:1}}]),vertexShader:Jt.normal_vert,fragmentShader:Jt.normal_frag},sprite:{uniforms:Dt([Kt.sprite,Kt.fog]),vertexShader:Jt.sprite_vert,fragmentShader:Jt.sprite_frag},background:{uniforms:{uvTransform:{value:new a},t2D:{value:null}},vertexShader:Jt.background_vert,fragmentShader:Jt.background_frag},cube:{uniforms:Dt([Kt.envmap,{opacity:{value:1}}]),vertexShader:Jt.cube_vert,fragmentShader:Jt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Jt.equirect_vert,fragmentShader:Jt.equirect_frag},distanceRGBA:{uniforms:Dt([Kt.common,Kt.displacementmap,{referencePosition:{value:new v},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Jt.distanceRGBA_vert,fragmentShader:Jt.distanceRGBA_frag},shadow:{uniforms:Dt([Kt.lights,Kt.fog,{color:{value:new Ue(0)},opacity:{value:1}}]),vertexShader:Jt.shadow_vert,fragmentShader:Jt.shadow_frag}};function en(e,t,n,r,i){const o=new Ue(0);let s,a,l=0,c=null,h=0,u=null;function d(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),l=t,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(e){l=e,d(o,l)},render:function(n,i,p,f){let m=!0===i.isScene?i.background:null;m&&m.isTexture&&(m=t.get(m));const g=e.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?d(o,l):m&&m.isColor&&(d(m,1),f=!0),(e.autoClear||f)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||306===m.mapping)?(void 0===a&&(a=new Rt(new Ot(1,1,1),new Ut({name:"BackgroundCubeMaterial",uniforms:Nt($t.cube.uniforms),vertexShader:$t.cube.vertexShader,fragmentShader:$t.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(a)),m.isWebGLCubeRenderTarget&&(m=m.texture),a.material.uniforms.envMap.value=m,a.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m._needsFlipEnvMap?-1:1,c===m&&h===m.version&&u===e.toneMapping||(a.material.needsUpdate=!0,c=m,h=m.version,u=e.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):m&&m.isTexture&&(void 0===s&&(s=new Rt(new Zt(2,2),new Ut({name:"BackgroundMaterial",uniforms:Nt($t.background.uniforms),vertexShader:$t.background.vertexShader,fragmentShader:$t.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),s.material.uniforms.uvTransform.value.copy(m.matrix),c===m&&h===m.version&&u===e.toneMapping||(s.material.needsUpdate=!0,c=m,h=m.version,u=e.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function tn(e,t,n,r){const i=e.getParameter(34921),o=r.isWebGL2?null:t.get("OES_vertex_array_object"),s=r.isWebGL2||null!==o,a={},l=d(null);let c=l;function h(t){return r.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function u(t){return r.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function d(e){const t=[],n=[],r=[];for(let e=0;e<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function p(){const e=c.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function f(e){m(e,0)}function m(n,i){const o=c.newAttributes,s=c.enabledAttributes,a=c.attributeDivisors;if(o[n]=1,0===s[n]&&(e.enableVertexAttribArray(n),s[n]=1),a[n]!==i){(r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),a[n]=i}}function g(){const t=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function v(t,n,i,o,s,a){!0!==r.isWebGL2||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,o,s,a):e.vertexAttribIPointer(t,n,i,s,a)}function y(){x(),c!==l&&(c=l,h(c.object))}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,u,y,x){let b=!1;if(s){const t=function(t,n,i){const s=!0===i.wireframe;let l=a[t.id];void 0===l&&(l={},a[t.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let h=c[s];void 0===h&&(h=d(r.isWebGL2?e.createVertexArray():o.createVertexArrayOES()),c[s]=h);return h}(y,u,l);c!==t&&(c=t,h(c.object)),b=function(e,t){const n=c.attributes,r=e.attributes;let i=0;for(const e in r){const t=n[e],o=r[e];if(void 0===t)return!0;if(t.attribute!==o)return!0;if(t.data!==o.data)return!0;i++}return c.attributesNum!==i||c.index!==t}(y,x),b&&function(e,t){const n={},r=e.attributes;let i=0;for(const e in r){const t=r[e],o={};o.attribute=t,t.data&&(o.data=t.data),n[e]=o,i++}c.attributes=n,c.attributesNum=i,c.index=t}(y,x)}else{const e=!0===l.wireframe;c.geometry===y.id&&c.program===u.id&&c.wireframe===e||(c.geometry=y.id,c.program=u.id,c.wireframe=e,b=!0)}!0===i.isInstancedMesh&&(b=!0),null!==x&&n.update(x,34963),b&&(!function(i,o,s,a){if(!1===r.isWebGL2&&(i.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,c=s.getAttributes(),h=o.defaultAttributeValues;for(const t in c){const r=c[t];if(r>=0){const o=l[t];if(void 0!==o){const t=o.normalized,i=o.itemSize,s=n.get(o);if(void 0===s)continue;const l=s.buffer,c=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,u=o.offset;n&&n.isInstancedInterleavedBuffer?(m(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(r),e.bindBuffer(34962,l),v(r,i,c,t,s*h,u*h)}else o.isInstancedBufferAttribute?(m(r,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(r),e.bindBuffer(34962,l),v(r,i,c,t,0,0)}else if("instanceMatrix"===t){const t=n.get(i.instanceMatrix);if(void 0===t)continue;const o=t.buffer,s=t.type;m(r+0,1),m(r+1,1),m(r+2,1),m(r+3,1),e.bindBuffer(34962,o),e.vertexAttribPointer(r+0,4,s,!1,64,0),e.vertexAttribPointer(r+1,4,s,!1,64,16),e.vertexAttribPointer(r+2,4,s,!1,64,32),e.vertexAttribPointer(r+3,4,s,!1,64,48)}else if("instanceColor"===t){const t=n.get(i.instanceColor);if(void 0===t)continue;const o=t.buffer,s=t.type;m(r,1),e.bindBuffer(34962,o),e.vertexAttribPointer(r,3,s,!1,12,0)}else if(void 0!==h){const n=h[t];if(void 0!==n)switch(n.length){case 2:e.vertexAttrib2fv(r,n);break;case 3:e.vertexAttrib3fv(r,n);break;case 4:e.vertexAttrib4fv(r,n);break;default:e.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,y),null!==x&&e.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const e in a){const t=a[e];for(const e in t){const n=t[e];for(const e in n)u(n[e].object),delete n[e];delete t[e]}delete a[e]}},releaseStatesOfGeometry:function(e){if(void 0===a[e.id])return;const t=a[e.id];for(const e in t){const n=t[e];for(const e in n)u(n[e].object),delete n[e];delete t[e]}delete a[e.id]},releaseStatesOfProgram:function(e){for(const t in a){const n=a[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)u(r[e].object),delete r[e];delete n[e.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function nn(e,t,n,r){const i=r.isWebGL2;let o;this.setMode=function(e){o=e},this.render=function(t,r){e.drawArrays(o,t,r),n.update(r,o,1)},this.renderInstances=function(r,s,a){if(0===a)return;let l,c;if(i)l=e,c="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,r,s,a),n.update(s,o,a)}}function rn(e,t,n){let r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=i(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=h>0,y=o||!!t.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==r)return r;const n=t.get("EXT_texture_filter_anisotropic");return r=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,r},getMaxPrecision:i,precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:o?e.getParameter(36183):0}}function on(e){const t=this;let n=null,r=0,i=!1,o=!1;const s=new be,l=new a,c={value:null,needsUpdate:!1};function h(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){const o=null!==e?e.length:0;let a=null;if(0!==o){if(a=c.value,!0!==i||null===a){const t=r+4*o,i=n.matrixWorldInverse;l.getNormalMatrix(i),(null===a||a.length<t)&&(a=new Float32Array(t));for(let t=0,n=r;t!==o;++t,n+=4)s.copy(e[t]).applyMatrix4(i,l),s.normal.toArray(a,n),a[n+3]=s.constant}c.value=a,c.needsUpdate=!0}return t.numPlanes=o,t.numIntersection=0,a}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,o){const s=0!==e.length||t||0!==r||i;return i=t,n=u(e,o,0),r=e.length,s},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,h()},this.setState=function(t,s,a){const l=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows,f=e.get(t);if(!i||null===l||0===l.length||o&&!p)o?u(null):h();else{const e=o?0:r,t=4*e;let i=f.clippingState||null;c.value=i,i=u(l,s,t,a);for(let e=0;e!==t;++e)i[e]=n[e];f.clippingState=i,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}}}function sn(e){let t=new WeakMap;function n(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const o=i.mapping;if(303===o||304===o){if(t.has(i)){return n(t.get(i).texture,i.mapping)}{const o=i.image;if(o&&o.height>0){const s=e.getRenderList(),a=e.getRenderTarget(),l=new jt(o.height/2);return l.fromEquirectangularTexture(e,i),t.set(i,l),e.setRenderTarget(a),e.setRenderList(s),i.addEventListener("dispose",r),n(l.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}function an(e){const t={};return{has:function(n){if(void 0!==t[n])return null!==t[n];let r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,null!==r},get:function(e){return this.has(e)||console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t[e]}}}function ln(e,t,n,r){const i=new WeakMap,o=new WeakMap;function s(e){const a=e.target,l=i.get(a);null!==l.index&&t.remove(l.index);for(const e in l.attributes)t.remove(l.attributes[e]);a.removeEventListener("dispose",s),i.delete(a);const c=o.get(l);c&&(t.remove(c),o.delete(l)),r.releaseStatesOfGeometry(l),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],r=e.index,i=e.attributes.position;let s=0;if(null!==r){const e=r.array;s=r.version;for(let t=0,r=e.length;t<r;t+=3){const r=e[t+0],i=e[t+1],o=e[t+2];n.push(r,i,i,o,o,r)}}else{const e=i.array;s=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){const e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}const a=new(rt(n)>65535?Ke:Ze)(n,1);a.version=s;const l=o.get(e);l&&t.remove(l),o.set(e,a)}return{get:function(e,t){let r=i.get(t);return r||(t.addEventListener("dispose",s),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new pt).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){const n=e.attributes;for(const e in n)t.update(n[e],34962);const r=e.morphAttributes;for(const e in r){const n=r[e];for(let e=0,r=n.length;e<r;e++)t.update(n[e],34962)}},getWireframeAttribute:function(e){const t=o.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return o.get(e)}}}function cn(e,t,n,r){const i=r.isWebGL2;let o,s,a;this.setMode=function(e){o=e},this.setIndex=function(e){s=e.type,a=e.bytesPerElement},this.render=function(t,r){e.drawElements(o,r,s,t*a),n.update(r,o,1)},this.renderInstances=function(r,l,c){if(0===c)return;let h,u;if(i)h=e,u="drawElementsInstanced";else if(h=t.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](o,l,s,r*a,c),n.update(l,o,c)}}function hn(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function un(e,t){return e[0]-t[0]}function dn(e,t){return Math.abs(t[1])-Math.abs(e[1])}function pn(e){const t={},n=new Float32Array(8),r=[];for(let e=0;e<8;e++)r[e]=[e,0];return{update:function(i,o,s,a){const l=i.morphTargetInfluences,c=void 0===l?0:l.length;let h=t[o.id];if(void 0===h){h=[];for(let e=0;e<c;e++)h[e]=[e,0];t[o.id]=h}for(let e=0;e<c;e++){const t=h[e];t[0]=e,t[1]=l[e]}h.sort(dn);for(let e=0;e<8;e++)e<c&&h[e][1]?(r[e][0]=h[e][0],r[e][1]=h[e][1]):(r[e][0]=Number.MAX_SAFE_INTEGER,r[e][1]=0);r.sort(un);const u=s.morphTargets&&o.morphAttributes.position,d=s.morphNormals&&o.morphAttributes.normal;let p=0;for(let e=0;e<8;e++){const t=r[e],i=t[0],s=t[1];i!==Number.MAX_SAFE_INTEGER&&s?(u&&o.getAttribute("morphTarget"+e)!==u[i]&&o.setAttribute("morphTarget"+e,u[i]),d&&o.getAttribute("morphNormal"+e)!==d[i]&&o.setAttribute("morphNormal"+e,d[i]),n[e]=s,p+=s):(u&&!0===o.hasAttribute("morphTarget"+e)&&o.deleteAttribute("morphTarget"+e),d&&!0===o.hasAttribute("morphNormal"+e)&&o.deleteAttribute("morphNormal"+e),n[e]=0)}const f=o.morphTargetsRelative?1:1-p;a.getUniforms().setValue(e,"morphTargetBaseInfluence",f),a.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function fn(e,t,n,r){let i=new WeakMap;function o(e){const t=e.target;t.removeEventListener("dispose",o),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){const s=r.render.frame,a=e.geometry,l=t.get(e,a);return i.get(l)!==s&&(a.isGeometry&&l.updateFromObject(e),t.update(l),i.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",o)&&e.addEventListener("dispose",o),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}function mn(e=null,t=1,n=1,r=1){u.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function gn(e=null,t=1,n=1,r=1){u.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}$t.physical={uniforms:Dt([$t.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new s(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Ue(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},mn.prototype=Object.create(u.prototype),mn.prototype.constructor=mn,mn.prototype.isDataTexture2DArray=!0,gn.prototype=Object.create(u.prototype),gn.prototype.constructor=gn,gn.prototype.isDataTexture3D=!0;const vn=new u,yn=new mn,xn=new gn,bn=new Ht,_n=[],wn=[],Mn=new Float32Array(16),Sn=new Float32Array(9),Tn=new Float32Array(4);function An(e,t,n){const r=e[0];if(r<=0||r>0)return e;const i=t*n;let o=_n[i];if(void 0===o&&(o=new Float32Array(i),_n[i]=o),0!==t){r.toArray(o,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(o,i)}return o}function En(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Pn(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function Ln(e,t){let n=wn[t];void 0===n&&(n=new Int32Array(t),wn[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Cn(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Rn(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(En(n,t))return;e.uniform2fv(this.addr,t),Pn(n,t)}}function In(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(En(n,t))return;e.uniform3fv(this.addr,t),Pn(n,t)}}function Fn(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(En(n,t))return;e.uniform4fv(this.addr,t),Pn(n,t)}}function On(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(En(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Pn(n,t)}else{if(En(n,r))return;Tn.set(r),e.uniformMatrix2fv(this.addr,!1,Tn),Pn(n,r)}}function Nn(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(En(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Pn(n,t)}else{if(En(n,r))return;Sn.set(r),e.uniformMatrix3fv(this.addr,!1,Sn),Pn(n,r)}}function Dn(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(En(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Pn(n,t)}else{if(En(n,r))return;Mn.set(r),e.uniformMatrix4fv(this.addr,!1,Mn),Pn(n,r)}}function Bn(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||vn,i)}function Un(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||yn,i)}function kn(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||xn,i)}function zn(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||bn,i)}function Gn(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Hn(e,t){const n=this.cache;En(n,t)||(e.uniform2iv(this.addr,t),Pn(n,t))}function jn(e,t){const n=this.cache;En(n,t)||(e.uniform3iv(this.addr,t),Pn(n,t))}function Vn(e,t){const n=this.cache;En(n,t)||(e.uniform4iv(this.addr,t),Pn(n,t))}function Wn(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Xn(e,t){e.uniform1fv(this.addr,t)}function Yn(e,t){e.uniform1iv(this.addr,t)}function qn(e,t){e.uniform2iv(this.addr,t)}function Qn(e,t){e.uniform3iv(this.addr,t)}function Zn(e,t){e.uniform4iv(this.addr,t)}function Jn(e,t){const n=An(t,this.size,2);e.uniform2fv(this.addr,n)}function Kn(e,t){const n=An(t,this.size,3);e.uniform3fv(this.addr,n)}function $n(e,t){const n=An(t,this.size,4);e.uniform4fv(this.addr,n)}function er(e,t){const n=An(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function tr(e,t){const n=An(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function nr(e,t){const n=An(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function rr(e,t,n){const r=t.length,i=Ln(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.safeSetTexture2D(t[e]||vn,i[e])}function ir(e,t,n){const r=t.length,i=Ln(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.safeSetTextureCube(t[e]||bn,i[e])}function or(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return Cn;case 35664:return Rn;case 35665:return In;case 35666:return Fn;case 35674:return On;case 35675:return Nn;case 35676:return Dn;case 5124:case 35670:return Gn;case 35667:case 35671:return Hn;case 35668:case 35672:return jn;case 35669:case 35673:return Vn;case 5125:return Wn;case 35678:case 36198:case 36298:case 36306:case 35682:return Bn;case 35679:case 36299:case 36307:return kn;case 35680:case 36300:case 36308:case 36293:return zn;case 36289:case 36303:case 36311:case 36292:return Un}}(t.type)}function sr(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Xn;case 35664:return Jn;case 35665:return Kn;case 35666:return $n;case 35674:return er;case 35675:return tr;case 35676:return nr;case 5124:case 35670:return Yn;case 35667:case 35671:return qn;case 35668:case 35672:return Qn;case 35669:case 35673:return Zn;case 35678:case 36198:case 36298:case 36306:case 35682:return rr;case 35680:case 36300:case 36308:case 36293:return ir}}(t.type)}function ar(e){this.id=e,this.seq=[],this.map={}}sr.prototype.updateCache=function(e){const t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Pn(t,e)},ar.prototype.setValue=function(e,t,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(e,t[o.id],n)}};const lr=/(\w+)(\])?(\[|\.)?/g;function cr(e,t){e.seq.push(t),e.map[t.id]=t}function hr(e,t,n){const r=e.name,i=r.length;for(lr.lastIndex=0;;){const o=lr.exec(r),s=lr.lastIndex;let a=o[1];const l="]"===o[2],c=o[3];if(l&&(a|=0),void 0===c||"["===c&&s+2===i){cr(n,void 0===c?new or(a,e,t):new sr(a,e,t));break}{let e=n.map[a];void 0===e&&(e=new ar(a),cr(n,e)),n=e}}}function ur(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,35718);for(let r=0;r<n;++r){const n=e.getActiveUniform(t,r);hr(n,e.getUniformLocation(t,n.name),this)}}function dr(e,t,n){const r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}ur.prototype.setValue=function(e,t,n,r){const i=this.map[t];void 0!==i&&i.setValue(e,n,r)},ur.prototype.setOptional=function(e,t,n){const r=t[n];void 0!==r&&this.setValue(e,n,r)},ur.upload=function(e,t,n,r){for(let i=0,o=t.length;i!==o;++i){const o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},ur.seqWithValue=function(e,t){const n=[];for(let r=0,i=e.length;r!==i;++r){const i=e[r];i.id in t&&n.push(i)}return n};let pr=0;function fr(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function mr(e,t,n){const r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(e){const t=e.split("\n");for(let e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}(e.getShaderSource(t))}function gr(e,t){const n=fr(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function vr(e,t){const n=fr(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function yr(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function xr(e){return""!==e}function br(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function _r(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const wr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Mr(e){return e.replace(wr,Sr)}function Sr(e,t){const n=Jt[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Mr(n)}const Tr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ar=/#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 Er(e){return e.replace(Ar,Lr).replace(Tr,Pr)}function Pr(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Lr(e,t,n,r)}function Lr(e,t,n,r){let i="";for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function Cr(e){let t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Rr(e,t,n,r){const i=e.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 307:t="ENVMAP_MODE_REFRACTION"}return t}(n),u=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),d=e.gammaFactor>0?e.gammaFactor:1,p=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(xr).join("\n")}(n),f=function(e){const t=[];for(const n in e){const r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(o),m=i.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(xr).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(xr).join("\n"),v.length>0&&(v+="\n")):(g=[Cr(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 "+d,"#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 "+l:"",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(xr).join("\n"),v=[p,Cr(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,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 "+c:"",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 "+l:"",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;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Jt.tonemapping_pars_fragment:"",0!==n.toneMapping?yr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Jt.encodings_pars_fragment,n.map?gr("mapTexelToLinear",n.mapEncoding):"",n.matcap?gr("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?gr("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?gr("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?gr("lightMapTexelToLinear",n.lightMapEncoding):"",vr("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(xr).join("\n")),s=Mr(s),s=br(s,n),s=_r(s,n),a=Mr(a),a=br(a,n),a=_r(a,n),s=Er(s),a=Er(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===n.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#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"+v);const x=y+v+a,b=dr(i,35633,y+g+s),_=dr(i,35632,x);if(i.attachShader(m,b),i.attachShader(m,_),void 0!==n.index0AttributeName?i.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),e.debug.checkShaderErrors){const e=i.getProgramInfoLog(m).trim(),t=i.getShaderInfoLog(b).trim(),n=i.getShaderInfoLog(_).trim();let r=!0,o=!0;if(!1===i.getProgramParameter(m,35714)){r=!1;const t=mr(i,b,"vertex"),n=mr(i,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(m,35715),"gl.getProgramInfoLog",e,t,n)}else""!==e?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e):""!==t&&""!==n||(o=!1);o&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:g},fragmentShader:{log:n,prefix:v}})}let w,M;return i.deleteShader(b),i.deleteShader(_),this.getUniforms=function(){return void 0===w&&(w=new ur(i,m)),w},this.getAttributes=function(){return void 0===M&&(M=function(e,t){const n={},r=e.getProgramParameter(t,35721);for(let i=0;i<r;i++){const r=e.getActiveAttrib(t,i).name;n[r]=e.getAttribLocation(t,r)}return n}(i,m)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=pr++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=_,this}function Ir(e,t,n,r,i,o){const s=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let d=r.precision;const p={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"},f=["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 m(e){let t;return e&&e.isTexture?t=e.encoding:e&&e.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=3e3,t}return{getParameters:function(i,s,f,g,v){const y=g.fog,x=i.isMeshStandardMaterial?g.environment:null,b=t.get(i.envMap||x),_=p[i.type],w=v.isSkinnedMesh?function(e){const t=e.skeleton.bones;if(c)return 1024;{const e=h,n=Math.floor((e-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}}(v):0;let M,S;if(null!==i.precision&&(d=r.getMaxPrecision(i.precision),d!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",d,"instead.")),_){const e=$t[_];M=e.vertexShader,S=e.fragmentShader}else M=i.vertexShader,S=i.fragmentShader;const T=e.getRenderTarget();return{isWebGL2:a,shaderID:_,shaderName:i.type,vertexShader:M,fragmentShader:S,defines:i.defines,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:d,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:u,outputEncoding:null!==T?m(T.texture):e.outputEncoding,map:!!i.map,mapEncoding:m(i.map),matcap:!!i.matcap,matcapEncoding:m(i.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:m(b),envMapCubeUV:!!b&&(306===b.mapping||307===b.mapping),lightMap:!!i.lightMap,lightMapEncoding:m(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:m(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:1===i.normalMapType,tangentSpaceNormalMap:0===i.normalMapType,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,transmissionMap:!!i.transmissionMap,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap||i.transmissionMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||i.transmissionMap||!i.displacementMap),fog:!!y,useFog:i.fog,fogExp2:y&&y.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:l,skinning:i.skinning&&w>0,maxBones:w,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.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:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&f.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.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:i.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);if(!1===t.isRawShaderMaterial){for(let e=0;e<f.length;e++)n.push(t[f[e]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=$t[t];n=Bt.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r;for(let e=0,t=s.length;e<t;e++){const t=s[e];if(t.cacheKey===n){r=t,++r.usedTimes;break}}return void 0===r&&(r=new Rr(e,n,t,i),s.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){const t=s.indexOf(e);s[t]=s[s.length-1],s.pop(),e.destroy()}},programs:s}}function Fr(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function Or(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Nr(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Dr(e){const t=[];let n=0;const r=[],i=[],o={id:-1};function s(r,i,s,a,l,c){let h=t[n];const u=e.get(s);return void 0===h?(h={id:r.id,object:r,geometry:i,material:s,program:u.program||o,groupOrder:a,renderOrder:r.renderOrder,z:l,group:c},t[n]=h):(h.id=r.id,h.object=r,h.geometry=i,h.material=s,h.program=u.program||o,h.groupOrder=a,h.renderOrder=r.renderOrder,h.z=l,h.group=c),n++,h}return{opaque:r,transparent:i,init:function(){n=0,r.length=0,i.length=0},push:function(e,t,n,o,a,l){const c=s(e,t,n,o,a,l);(!0===n.transparent?i:r).push(c)},unshift:function(e,t,n,o,a,l){const c=s(e,t,n,o,a,l);(!0===n.transparent?i:r).unshift(c)},finish:function(){for(let e=n,r=t.length;e<r;e++){const n=t[e];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(e,t){r.length>1&&r.sort(e||Or),i.length>1&&i.sort(t||Nr)}}}function Br(e){let t=new WeakMap;return{get:function(n,r){const i=t.get(n);let o;return void 0===i?(o=new Dr(e),t.set(n,new WeakMap),t.get(n).set(r,o)):(o=i.get(r),void 0===o&&(o=new Dr(e),i.set(r,o))),o},dispose:function(){t=new WeakMap}}}function Ur(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new v,color:new Ue};break;case"SpotLight":n={position:new v,direction:new v,color:new Ue,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new v,color:new Ue,distance:0,decay:0};break;case"HemisphereLight":n={direction:new v,skyColor:new Ue,groundColor:new Ue};break;case"RectAreaLight":n={color:new Ue,position:new v,halfWidth:new v,halfHeight:new v}}return e[t.id]=n,n}}}let kr=0;function zr(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Gr(e,t){const n=new Ur,r=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new s,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)i.probe.push(new v);const o=new v,a=new W,l=new W;return{setup:function(o){let s=0,a=0,l=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0;o.sort(zr);for(let e=0,t=o.length;e<t;e++){const t=o[e],v=t.color,y=t.intensity,x=t.distance,b=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)s+=v.r*y,a+=v.g*y,l+=v.b*y;else if(t.isLightProbe)for(let e=0;e<9;e++)i.probe[e].addScaledVector(t.sh.coefficients[e],y);else if(t.isDirectionalLight){const e=n.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity),t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,i.directionalShadow[c]=n,i.directionalShadowMap[c]=b,i.directionalShadowMatrix[c]=t.shadow.matrix,f++}i.directional[c]=e,c++}else if(t.isSpotLight){const e=n.get(t);if(e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(v).multiplyScalar(y),e.distance=x,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,i.spotShadow[u]=n,i.spotShadowMap[u]=b,i.spotShadowMatrix[u]=t.shadow.matrix,g++}i.spot[u]=e,u++}else if(t.isRectAreaLight){const e=n.get(t);e.color.copy(v).multiplyScalar(y),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),i.rectArea[d]=e,d++}else if(t.isPointLight){const e=n.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity),e.distance=t.distance,e.decay=t.decay,t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,n.shadowCameraNear=e.camera.near,n.shadowCameraFar=e.camera.far,i.pointShadow[h]=n,i.pointShadowMap[h]=b,i.pointShadowMatrix[h]=t.shadow.matrix,m++}i.point[h]=e,h++}else if(t.isHemisphereLight){const e=n.get(t);e.skyColor.copy(t.color).multiplyScalar(y),e.groundColor.copy(t.groundColor).multiplyScalar(y),i.hemi[p]=e,p++}}d>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Kt.LTC_FLOAT_1,i.rectAreaLTC2=Kt.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Kt.LTC_HALF_1,i.rectAreaLTC2=Kt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=l;const v=i.hash;v.directionalLength===c&&v.pointLength===h&&v.spotLength===u&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=d,i.point.length=h,i.hemi.length=p,i.directionalShadow.length=f,i.directionalShadowMap.length=f,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=f,i.pointShadowMatrix.length=m,i.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=h,v.spotLength=u,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,i.version=kr++)},setupView:function(e,t){let n=0,r=0,s=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){const d=e[t];if(d.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(u),n++}else if(d.isSpotLight){const e=i.spot[s];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(u),s++}else if(d.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),l.identity(),a.copy(d.matrixWorld),a.premultiply(u),l.extractRotation(a),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(l),e.halfHeight.applyMatrix4(l),c++}else if(d.isPointLight){const e=i.point[r];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),r++}else if(d.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),e.direction.normalize(),h++}}},state:i}}function Hr(e,t){const n=new Gr(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(){n.setup(r)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function jr(e,t){let n=new WeakMap;return{get:function(r,i=0){let o;return!1===n.has(r)?(o=new Hr(e,t),n.set(r,[]),n.get(r).push(o)):i>=n.get(r).length?(o=new Hr(e,t),n.get(r).push(o)):o=n.get(r)[i],o},dispose:function(){n=new WeakMap}}}function Vr(e){Ge.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,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(e)}function Wr(e){Ge.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new v,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(e)}Vr.prototype=Object.create(Ge.prototype),Vr.prototype.constructor=Vr,Vr.prototype.isMeshDepthMaterial=!0,Vr.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Wr.prototype=Object.create(Ge.prototype),Wr.prototype.constructor=Wr,Wr.prototype.isMeshDistanceMaterial=!0,Wr.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function Xr(e,t,n){let r=new Yt;const i=new s,o=new s,a=new p,l=[],c=[],h={},u={0:1,1:0,2:2},d=new Ut({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new s},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\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 HORIZONTAL_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}"}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const g=new pt;g.setAttribute("position",new We(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Rt(g,d),y=this;function x(n,r){const i=t.update(v);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,v,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,m,v,null)}function b(e,t,n){const r=e<<0|t<<1|n<<2;let i=l[r];return void 0===i&&(i=new Vr({depthPacking:3201,morphTargets:e,skinning:t}),l[r]=i),i}function _(e,t,n){const r=e<<0|t<<1|n<<2;let i=c[r];return void 0===i&&(i=new Wr({morphTargets:e,skinning:t}),c[r]=i),i}function w(t,n,r,i,o,s,a){let l=null,c=b,d=t.customDepthMaterial;if(!0===i.isPointLight&&(c=_,d=t.customDistanceMaterial),void 0===d){let e=!1;!0===r.morphTargets&&(e=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t));l=c(e,i,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const e=l.uuid,t=r.uuid;let n=h[e];void 0===n&&(n={},h[e]=n);let i=n[t];void 0===i&&(i=l.clone(),n[t]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=3===a?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function M(n,i,o,s,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=t.update(n),i=n.material;if(Array.isArray(i)){const t=r.groups;for(let l=0,c=t.length;l<c;l++){const c=t[l],h=i[c.materialIndex];if(h&&h.visible){const t=w(n,r,h,s,o.near,o.far,a);e.renderBufferDirect(o,null,r,t,n,c)}}}else if(i.visible){const t=w(n,r,i,s,o.near,o.far,a);e.renderBufferDirect(o,null,r,t,n,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)M(l[e],i,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===t.length)return;const c=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let c=0,h=t.length;c<h;c++){const h=t[c],u=h.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;i.copy(u.mapSize);const p=u.getFrameExtents();if(i.multiply(p),o.copy(u.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(o.x=Math.floor(n/p.x),i.x=o.x*p.x,u.mapSize.x=o.x),i.y>n&&(o.y=Math.floor(n/p.y),i.y=o.y*p.y,u.mapSize.y=o.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const e={minFilter:1006,magFilter:1006,format:1023};u.map=new f(i.x,i.y,e),u.map.texture.name=h.name+".shadowMap",u.mapPass=new f(i.x,i.y,e),u.camera.updateProjectionMatrix()}if(null===u.map){const e={minFilter:1003,magFilter:1003,format:1023};u.map=new f(i.x,i.y,e),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e<m;e++){const t=u.getViewport(e);a.set(o.x*t.x,o.y*t.y,o.x*t.z,o.y*t.w),d.viewport(a),u.updateMatrices(h,e),r=u.getFrustum(),M(s,l,u.camera,h,this.type)}u.isPointLightShadow||3!==this.type||x(u,l),u.needsUpdate=!1}y.needsUpdate=!1,e.setRenderTarget(c,h,u)}}function Yr(e,t,n){const r=n.isWebGL2;const i=new function(){let t=!1;const n=new p;let r=null;const i=new p(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,o,s,a){!0===a&&(t*=s,r*=s,o*=s),n.set(t,r,o,s),!1===i.equals(n)&&(e.clearColor(t,r,o,s),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},o=new function(){let t=!1,n=null,r=null,i=null;return{setTest:function(e){e?O(2929):N(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},s=new function(){let t=!1,n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null;return{setTest:function(e){t||(e?O(2960):N(2960))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,s){r===t&&i===n&&o===s||(e.stencilFunc(t,n,s),r=t,i=n,o=s)},setOp:function(t,n,r){s===t&&a===n&&l===r||(e.stencilOp(t,n,r),s=t,a=n,l=r)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null}}};let a={},l=null,c=null,h=null,u=null,d=null,f=null,m=null,g=null,v=null,y=!1,x=null,b=null,_=null,w=null,M=null;const S=e.getParameter(35661);let T=!1,A=0;const E=e.getParameter(7938);-1!==E.indexOf("WebGL")?(A=parseFloat(/^WebGL (\d)/.exec(E)[1]),T=A>=1):-1!==E.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(E)[1]),T=A>=2);let P=null,L={};const C=new p,R=new p;function I(t,n,r){const i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<r;t++)e.texImage2D(n+t,0,6408,1,1,0,6408,5121,i);return o}const F={};function O(t){!0!==a[t]&&(e.enable(t),a[t]=!0)}function N(t){!1!==a[t]&&(e.disable(t),a[t]=!1)}F[3553]=I(3553,3553,1),F[34067]=I(34067,34069,6),i.setClear(0,0,0,1),o.setClear(1),s.setClear(0),O(2929),o.setFunc(3),k(!1),z(1),O(2884),U(0);const D={100:32774,101:32778,102:32779};if(r)D[103]=32775,D[104]=32776;else{const e=t.get("EXT_blend_minmax");null!==e&&(D[103]=e.MIN_EXT,D[104]=e.MAX_EXT)}const B={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function U(t,n,r,i,o,s,a,l){if(0!==t){if(c||(O(3042),c=!0),5===t)o=o||n,s=s||r,a=a||i,n===u&&o===m||(e.blendEquationSeparate(D[n],D[o]),u=n,m=o),r===d&&i===f&&s===g&&a===v||(e.blendFuncSeparate(B[r],B[i],B[s],B[a]),d=r,f=i,g=s,v=a),h=t,y=null;else if(t!==h||l!==y){if(100===u&&100===m||(e.blendEquation(32774),u=100,m=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}d=null,f=null,g=null,v=null,h=t,y=l}}else c&&(N(3042),c=!1)}function k(t){x!==t&&(t?e.frontFace(2304):e.frontFace(2305),x=t)}function z(t){0!==t?(O(2884),t!==b&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):N(2884),b=t}function G(t,n,r){t?(O(32823),w===n&&M===r||(e.polygonOffset(n,r),w=n,M=r)):N(32823)}function H(t){void 0===t&&(t=33984+S-1),P!==t&&(e.activeTexture(t),P=t)}return{buffers:{color:i,depth:o,stencil:s},enable:O,disable:N,useProgram:function(t){return l!==t&&(e.useProgram(t),l=t,!0)},setBlending:U,setMaterial:function(e,t){2===e.side?N(2884):O(2884);let n=1===e.side;t&&(n=!n),k(n),1===e.blending&&!1===e.transparent?U(0):U(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),i.setMask(e.colorWrite);const r=e.stencilWrite;s.setTest(r),r&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),G(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:k,setCullFace:z,setLineWidth:function(t){t!==_&&(T&&e.lineWidth(t),_=t)},setPolygonOffset:G,setScissorTest:function(e){e?O(3089):N(3089)},activeTexture:H,bindTexture:function(t,n){null===P&&H();let r=L[P];void 0===r&&(r={type:void 0,texture:void 0},L[P]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=L[P];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===C.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),C.copy(t))},viewport:function(t){!1===R.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))},reset:function(){a={},P=null,L={},l=null,c=null,h=null,u=null,d=null,f=null,m=null,g=null,v=null,y=!1,x=null,b=null,_=null,w=null,M=null,i.reset(),o.reset(),s.reset()}}}function qr(e,t,n,r,i,s,a){const l=i.isWebGL2,c=i.maxTextures,h=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,p=new WeakMap;let f,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function g(e,t){return m?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(e,t,n,r){let i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t?o.floorPowerOfTwo:Math.floor,s=r(i*e.width),a=r(i*e.height);void 0===f&&(f=g(s,a));const l=n?g(s,a):f;l.width=s,l.height=a;return l.getContext("2d").drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function y(e){return o.isPowerOfTwo(e.width)&&o.isPowerOfTwo(e.height)}function x(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function b(t,n,i,o){e.generateMipmap(t);r.get(n).__maxMipLevel=Math.log(Math.max(i,o))*Math.LOG2E}function _(n,r,i){if(!1===l)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function w(e){return 1003===e||1004===e||1005===e?9728:9729}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=r.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),r.remove(t)}(n),n.isVideoTexture&&p.delete(n),a.memory.textures--}function S(t){const n=t.target;n.removeEventListener("dispose",S),function(t){const n=r.get(t),i=r.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}(n),a.memory.textures--}let T=0;function A(e,t){const i=r.get(e);if(e.isVideoTexture&&function(e){const t=a.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){const n=e.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void I(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function E(t,i){const o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,i){if(6!==r.image.length)return;R(t,r),n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,r.flipY);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),a=r.image[0]&&r.image[0].isDataTexture,c=[];for(let e=0;e<6;e++)c[e]=o||a?a?r.image[e].image:r.image[e]:v(r.image[e],!1,!0,h);const u=c[0],d=y(u)||l,p=s.convert(r.format),f=s.convert(r.type),m=_(r.internalFormat,p,f);let g;if(C(34067,r,d),o){for(let e=0;e<6;e++){g=c[e].mipmaps;for(let t=0;t<g.length;t++){const i=g[t];1023!==r.format&&1022!==r.format?null!==p?n.compressedTexImage2D(34069+e,t,m,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+e,t,m,i.width,i.height,0,p,f,i.data)}}t.__maxMipLevel=g.length-1}else{g=r.mipmaps;for(let e=0;e<6;e++)if(a){n.texImage2D(34069+e,0,m,c[e].width,c[e].height,0,p,f,c[e].data);for(let t=0;t<g.length;t++){const r=g[t].image[e].image;n.texImage2D(34069+e,t+1,m,r.width,r.height,0,p,f,r.data)}}else{n.texImage2D(34069+e,0,m,p,f,c[e]);for(let t=0;t<g.length;t++){const r=g[t];n.texImage2D(34069+e,t+1,m,p,f,r.image[e])}}t.__maxMipLevel=g.length}x(r,d)&&b(34067,r,u.width,u.height);t.__version=r.version,r.onUpdate&&r.onUpdate(r)}(o,t,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))}const P={1e3:10497,1001:33071,1002:33648},L={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function C(n,o,s){s?(e.texParameteri(n,10242,P[o.wrapS]),e.texParameteri(n,10243,P[o.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[o.wrapR]),e.texParameteri(n,10240,L[o.magFilter]),e.texParameteri(n,10241,L[o.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),1001===o.wrapS&&1001===o.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(o.magFilter)),e.texParameteri(n,10241,w(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));const a=t.get("EXT_texture_filter_anisotropic");if(a){if(1015===o.type&&null===t.get("OES_texture_float_linear"))return;if(1016===o.type&&null===(l||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function R(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",M),t.__webglTexture=e.createTexture(),a.memory.textures++)}function I(t,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),R(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);const a=function(e){return!l&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)}(r)&&!1===y(r.image),c=v(r.image,a,!1,u),h=y(c)||l,d=s.convert(r.format);let p,f=s.convert(r.type),m=_(r.internalFormat,d,f);C(o,r,h);const g=r.mipmaps;if(r.isDepthTexture)m=6402,l?m=1015===r.type?36012:1014===r.type?33190:1020===r.type?35056:33189:1015===r.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&6402===m&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1012,f=s.convert(r.type)),1027===r.format&&6402===m&&(m=34041,1020!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=1020,f=s.convert(r.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(r.isDataTexture)if(g.length>0&&h){for(let e=0,t=g.length;e<t;e++)p=g[e],n.texImage2D(3553,e,m,p.width,p.height,0,d,f,p.data);r.generateMipmaps=!1,t.__maxMipLevel=g.length-1}else n.texImage2D(3553,0,m,c.width,c.height,0,d,f,c.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(let e=0,t=g.length;e<t;e++)p=g[e],1023!==r.format&&1022!==r.format?null!==d?n.compressedTexImage2D(3553,e,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,e,m,p.width,p.height,0,d,f,p.data);t.__maxMipLevel=g.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,c.width,c.height,c.depth,0,d,f,c.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,c.width,c.height,c.depth,0,d,f,c.data),t.__maxMipLevel=0;else if(g.length>0&&h){for(let e=0,t=g.length;e<t;e++)p=g[e],n.texImage2D(3553,e,m,d,f,p);r.generateMipmaps=!1,t.__maxMipLevel=g.length-1}else n.texImage2D(3553,0,m,d,f,c),t.__maxMipLevel=0;x(r,h)&&b(o,r,c.width,c.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function F(t,i,o,a){const l=s.convert(i.texture.format),c=s.convert(i.texture.type),h=_(i.texture.internalFormat,l,c);n.texImage2D(a,0,h,i.width,i.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,a,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function O(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r){const t=n.depthTexture;t&&t.isDepthTexture&&(1015===t.type?i=36012:1014===t.type&&(i=33190));const r=D(n);e.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){const t=D(n);e.renderbufferStorageMultisample(36161,t,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{const t=s.convert(n.texture.format),i=s.convert(n.texture.type),o=_(n.texture.internalFormat,t,i);if(r){const t=D(n);e.renderbufferStorageMultisample(36161,t,o,n.width,n.height)}else e.renderbufferStorage(36161,o,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(t){const n=r.get(t),i=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),A(n.depthTexture,0);const i=r.get(n.depthTexture).__webglTexture;if(1026===n.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(1027!==n.depthTexture.format)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)e.bindFramebuffer(36160,n.__webglFramebuffer[r]),n.__webglDepthbuffer[r]=e.createRenderbuffer(),O(n.__webglDepthbuffer[r],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),O(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function D(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}let B=!1,U=!1;this.allocateTextureUnit=function(){const e=T;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=A,this.setTexture2DArray=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(t){const i=r.get(t),o=r.get(t.texture);t.addEventListener("dispose",S),o.__webglTexture=e.createTexture(),a.memory.textures++;const c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=y(t)||l;if(!l||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){i.__webglFramebuffer=[];for(let t=0;t<6;t++)i.__webglFramebuffer[t]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),h)if(l){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);const n=s.convert(t.texture.format),r=s.convert(t.texture.type),o=_(t.texture.internalFormat,n,r),a=D(t);e.renderbufferStorageMultisample(36161,a,o,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),O(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,o.__webglTexture),C(34067,t.texture,u);for(let e=0;e<6;e++)F(i.__webglFramebuffer[e],t,36064,34069+e);x(t.texture,u)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,o.__webglTexture),C(3553,t.texture,u),F(i.__webglFramebuffer,t,36064,3553),x(t.texture,u)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){const t=e.texture;if(x(t,y(e)||l)){const i=e.isWebGLCubeRenderTarget?34067:3553,o=r.get(t).__webglTexture;n.bindTexture(i,o),b(i,t,e.width,e.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){const n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);const i=t.width,o=t.height;let s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024),e.blitFramebuffer(0,0,i,o,0,0,i,o,s,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),A(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),U=!0),e=e.texture),E(e,t)}}function Qr(e,t,n){const r=n.isWebGL2;return{convert:function(e){let n;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return r?5131:(n=t.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(n=t.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(n=t.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return n=t.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&(n=t.get("WEBGL_compressed_texture_etc"),null!==n)){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?(n=t.get("WEBGL_compressed_texture_astc"),null!==n?e:null):36492===e?(n=t.get("EXT_texture_compression_bptc"),null!==n?e:null):1020===e?r?34042:(n=t.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Zr(e=[]){zt.call(this),this.cameras=e}function Jr(){ge.call(this),this.type="Group"}function Kr(){this._targetRay=null,this._grip=null,this._hand=null}function $r(e,t){const n=this;let r=null,i=1,o=null,s="local-floor",a=null;const l=[],c=new Map,h=new zt;h.layers.enable(1),h.viewport=new p;const u=new zt;u.layers.enable(2),u.viewport=new p;const d=[h,u],f=new Zr;f.layers.enable(1),f.layers.enable(2);let m=null,g=null;function y(e){const t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function x(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),A.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function b(e){o=e,A.setContext(r),A.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function _(e){const t=r.inputSources;for(let e=0;e<l.length;e++)c.set(t[e],l[e]);for(let t=0;t<e.removed.length;t++){const n=e.removed[t],r=c.get(n);r&&(r.dispatchEvent({type:"disconnected",data:n}),c.delete(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t],r=c.get(n);r&&r.dispatchEvent({type:"connected",data:n})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=l[e];return void 0===t&&(t=new Kr,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=l[e];return void 0===t&&(t=new Kr,l[e]=t),t.getGripSpace()},this.getHand=function(e){let t=l[e];return void 0===t&&(t=new Kr,l[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return r},this.setSession=function(e){if(r=e,null!==r){r.addEventListener("select",y),r.addEventListener("selectstart",y),r.addEventListener("selectend",y),r.addEventListener("squeeze",y),r.addEventListener("squeezestart",y),r.addEventListener("squeezeend",y),r.addEventListener("end",x);const e=t.getContextAttributes();!0!==e.xrCompatible&&t.makeXRCompatible();const n={antialias:e.antialias,alpha:e.alpha,depth:e.depth,stencil:e.stencil,framebufferScaleFactor:i},o=new XRWebGLLayer(r,t,n);r.updateRenderState({baseLayer:o}),r.requestReferenceSpace(s).then(b),r.addEventListener("inputsourceschange",_)}};const w=new v,M=new v;function S(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.getCamera=function(e){f.near=u.near=h.near=e.near,f.far=u.far=h.far=e.far,m===f.near&&g===f.far||(r.updateRenderState({depthNear:f.near,depthFar:f.far}),m=f.near,g=f.far);const t=e.parent,n=f.cameras;S(f,t);for(let e=0;e<n.length;e++)S(n[e],t);e.matrixWorld.copy(f.matrixWorld);const i=e.children;for(let e=0,t=i.length;e<t;e++)i[e].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){w.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);const r=w.distanceTo(M),i=t.projectionMatrix.elements,o=n.projectionMatrix.elements,s=i[14]/(i[10]-1),a=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],h=(i[8]-1)/i[0],u=(o[8]+1)/o[0],d=s*h,p=s*u,f=r/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=s+f,v=a+f,y=d-m,x=p+(r-m),b=l*a/v*g,_=c*a/v*g;e.projectionMatrix.makePerspective(y,x,b,_,g,v)}(f,h,u):f.projectionMatrix.copy(h.projectionMatrix),f};let T=null;const A=new qt;A.setAnimationLoop((function(t,n){if(a=n.getViewerPose(o),null!==a){const t=a.views,n=r.renderState.baseLayer;e.setFramebuffer(n.framebuffer);let i=!1;t.length!==f.cameras.length&&(f.cameras.length=0,i=!0);for(let e=0;e<t.length;e++){const r=t[e],o=n.getViewport(r),s=d[e];s.matrix.fromArray(r.transform.matrix),s.projectionMatrix.fromArray(r.projectionMatrix),s.viewport.set(o.x,o.y,o.width,o.height),0===e&&f.matrix.copy(s.matrix),!0===i&&f.cameras.push(s)}}const i=r.inputSources;for(let e=0;e<l.length;e++){const t=l[e],r=i[e];t.update(r,n,o)}T&&T(t,n)})),this.setAnimationLoop=function(e){T=e},this.dispose=function(){}}function ei(e){function t(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);const r=e.get(n).envMap;if(r){t.envMap.value=r,t.flipEnvMap.value=r.isCubeTexture&&r._needsFlipEnvMap?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio;const i=e.get(r).__maxMipLevel;void 0!==i&&(t.maxMipLevel.value=i)}let i,o;n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(i=n.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,o){r.isMeshBasicMaterial?t(e,r):r.isMeshLambertMaterial?(t(e,r),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,r)):r.isMeshToonMaterial?(t(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshPhongMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshStandardMaterial?(t(e,r),r.isMeshPhysicalMaterial?function(e,t){n(e,t),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transmission.value=t.transmission,t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap)}(e,r):n(e,r)):r.isMeshMatcapMaterial?(t(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDepthMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDistanceMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?(t(e,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);let i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);let n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ti(e){const t=void 0!==(e=e||{}).canvas?e.canvas:function(){const e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,l=void 0!==e.antialias&&e.antialias,c=void 0===e.premultipliedAlpha||e.premultipliedAlpha,h=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",d=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let f=null,m=null;const g=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const y=this;let x=!1,b=null,_=0,w=0,M=null,S=null,T=-1,A=null;const E=new p,P=new p;let L=null,C=t.width,R=t.height,I=1,F=null,O=null;const N=new p(0,0,C,R),D=new p(0,0,C,R);let B=!1;const U=new Yt;let k=!1,z=!1;const G=new W,H=new v,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function V(){return null===M?I:1}let X,Y,q,Q,Z,J,K,$,ee,te,ne,re,ie,oe,se,ae,le,ce,he,ue,de,pe=n;function fe(e,n){for(let r=0;r<e.length;r++){const i=e[r],o=t.getContext(i,n);if(null!==o)return o}return null}try{const e={alpha:r,depth:i,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:u,failIfMajorPerformanceCaveat:d};if(t.addEventListener("webglcontextlost",ye,!1),t.addEventListener("webglcontextrestored",xe,!1),null===pe){const t=["webgl2","webgl","experimental-webgl"];if(!0===y.isWebGL1Renderer&&t.shift(),pe=fe(t,e),null===pe)throw fe(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===pe.getShaderPrecisionFormat&&(pe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function me(){X=new an(pe),Y=new rn(pe,X,e),!1===Y.isWebGL2&&(X.get("WEBGL_depth_texture"),X.get("OES_texture_float"),X.get("OES_texture_half_float"),X.get("OES_texture_half_float_linear"),X.get("OES_standard_derivatives"),X.get("OES_element_index_uint"),X.get("OES_vertex_array_object"),X.get("ANGLE_instanced_arrays")),X.get("OES_texture_float_linear"),ue=new Qr(pe,X,Y),q=new Yr(pe,X,Y),q.scissor(P.copy(D).multiplyScalar(I).floor()),q.viewport(E.copy(N).multiplyScalar(I).floor()),Q=new hn(pe),Z=new Fr,J=new qr(pe,X,q,Z,Y,ue,Q),K=new sn(y),$=new Qt(pe,Y),de=new tn(pe,X,$,Y),ee=new ln(pe,$,Q,de),te=new fn(pe,ee,$,Q),le=new pn(pe),se=new on(Z),ne=new Ir(y,K,X,Y,de,se),re=new ei(Z),ie=new Br(Z),oe=new jr(X,Y),ae=new en(y,K,q,te,c),ce=new nn(pe,X,Q,Y),he=new cn(pe,X,Q,Y),Q.programs=ne.programs,y.capabilities=Y,y.extensions=X,y.properties=Z,y.renderLists=ie,y.state=q,y.info=Q}me();const ge=new $r(y,pe);this.xr=ge;const ve=new Xr(y,te,Y.maxTextureSize);function ye(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1,me()}function be(e){const t=e.target;t.removeEventListener("dispose",be),function(e){_e(e),Z.remove(e)}(t)}function _e(e){const t=Z.get(e).program;void 0!==t&&ne.releaseProgram(t)}this.shadowMap=ve,this.getContext=function(){return pe},this.getContextAttributes=function(){return pe.getContextAttributes()},this.forceContextLoss=function(){const e=X.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=X.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(e){void 0!==e&&(I=e,this.setSize(C,R,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new s),e.set(C,R)},this.setSize=function(e,n,r){ge.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(C=e,R=n,t.width=Math.floor(e*I),t.height=Math.floor(n*I),!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new s),e.set(C*I,R*I).floor()},this.setDrawingBufferSize=function(e,n,r){C=e,R=n,I=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new p),e.copy(E)},this.getViewport=function(e){return e.copy(N)},this.setViewport=function(e,t,n,r){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,n,r),q.viewport(E.copy(N).multiplyScalar(I).floor())},this.getScissor=function(e){return e.copy(D)},this.setScissor=function(e,t,n,r){e.isVector4?D.set(e.x,e.y,e.z,e.w):D.set(e,t,n,r),q.scissor(P.copy(D).multiplyScalar(I).floor())},this.getScissorTest=function(){return B},this.setScissorTest=function(e){q.setScissorTest(B=e)},this.setOpaqueSort=function(e){F=e},this.setTransparentSort=function(e){O=e},this.getClearColor=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),e=new Ue),e.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(e,t,n){let r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),pe.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ye,!1),t.removeEventListener("webglcontextrestored",xe,!1),ie.dispose(),oe.dispose(),Z.dispose(),K.dispose(),te.dispose(),de.dispose(),ge.dispose(),Me.stop()},this.renderBufferImmediate=function(e,t){de.initAttributes();const n=Z.get(e);e.hasPositions&&!n.position&&(n.position=pe.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=pe.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=pe.createBuffer()),e.hasColors&&!n.color&&(n.color=pe.createBuffer());const r=t.getAttributes();e.hasPositions&&(pe.bindBuffer(34962,n.position),pe.bufferData(34962,e.positionArray,35048),de.enableAttribute(r.position),pe.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(pe.bindBuffer(34962,n.normal),pe.bufferData(34962,e.normalArray,35048),de.enableAttribute(r.normal),pe.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(pe.bindBuffer(34962,n.uv),pe.bufferData(34962,e.uvArray,35048),de.enableAttribute(r.uv),pe.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(pe.bindBuffer(34962,n.color),pe.bufferData(34962,e.colorArray,35048),de.enableAttribute(r.color),pe.vertexAttribPointer(r.color,3,5126,!1,0,0)),de.disableUnusedAttributes(),pe.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,o){null===t&&(t=j);const s=i.isMesh&&i.matrixWorld.determinant()<0,a=Pe(e,t,r,i);q.setMaterial(r,s);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===r.wireframe&&(l=ee.getWireframeAttribute(n),u=2),(r.morphTargets||r.morphNormals)&&le.update(i,n,r,a),de.setup(i,r,a,n,l);let d=ce;null!==l&&(h=$.get(l),d=he,d.setIndex(h));const p=null!==l?l.count:c.count,f=n.drawRange.start*u,m=n.drawRange.count*u,g=null!==o?o.start*u:0,v=null!==o?o.count*u:1/0,y=Math.max(f,g),x=Math.min(p,f+m,g+v)-1,b=Math.max(0,x-y+1);if(0!==b){if(i.isMesh)!0===r.wireframe?(q.setLineWidth(r.wireframeLinewidth*V()),d.setMode(1)):d.setMode(4);else if(i.isLine){let e=r.linewidth;void 0===e&&(e=1),q.setLineWidth(e*V()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,b,i.count);else if(n.isInstancedBufferGeometry){const e=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,b,e)}else d.render(y,b)}},this.compile=function(e,t){m=oe.get(e),m.init(),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(m.pushLight(e),e.castShadow&&m.pushShadow(e))})),m.setupLights();const n=new WeakMap;e.traverse((function(t){const r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){const o=r[i];!1===n.has(o)&&(Ee(o,e,t),n.set(o))}else!1===n.has(r)&&(Ee(r,e,t),n.set(r))}))};let we=null;const Me=new qt;function Se(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)m.pushLight(e),e.castShadow&&m.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||U.intersectsSprite(e)){r&&H.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=te.update(e),i=e.material;i.visible&&f.push(e,t,i,n,H.z,null)}}else if(e.isImmediateRenderObject)r&&H.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G),f.push(e,null,e.material,n,H.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Q.render.frame&&(e.skeleton.update(),e.skeleton.frame=Q.render.frame),!e.frustumCulled||U.intersectsObject(e))){r&&H.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=te.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=i[s.materialIndex];a&&a.visible&&f.push(e,t,a,n,H.z,s)}}else i.visible&&f.push(e,t,i,n,H.z,null)}const i=e.children;for(let e=0,o=i.length;e<o;e++)Se(i[e],t,n,r)}function Te(e,t,n){const r=!0===t.isScene?t.overrideMaterial:null;for(let i=0,o=e.length;i<o;i++){const o=e[i],s=o.object,a=o.geometry,l=null===r?o.material:r,c=o.group;if(n.isArrayCamera){const e=n.cameras;for(let n=0,r=e.length;n<r;n++){const r=e[n];s.layers.test(r.layers)&&(q.viewport(E.copy(r.viewport)),m.setupLightsView(r),Ae(s,t,r,a,l,c))}}else Ae(s,t,n,a,l,c)}}function Ae(e,t,n,r,i,o){if(e.onBeforeRender(y,t,n,r,i,o),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){const r=Pe(n,t,i,e);q.setMaterial(i),de.reset(),function(e,t){e.render((function(e){y.renderBufferImmediate(e,t)}))}(e,r)}else y.renderBufferDirect(n,t,r,i,e,o);e.onAfterRender(y,t,n,r,i,o)}function Ee(e,t,n){!0!==t.isScene&&(t=j);const r=Z.get(e),i=m.state.lights,o=m.state.shadowsArray,s=i.state.version,a=ne.getParameters(e,i.state,o,t,n),l=ne.getProgramCacheKey(a);let c=r.program,h=!0;if(void 0===c)e.addEventListener("dispose",be);else if(c.cacheKey!==l)_e(e);else if(r.lightsStateVersion!==s)h=!1;else{if(void 0!==a.shaderID){const n=e.isMeshStandardMaterial?t.environment:null;return void(r.envMap=K.get(e.envMap||n))}h=!1}h&&(a.uniforms=ne.getUniforms(e),e.onBeforeCompile(a,y),c=ne.acquireProgram(a,l),r.program=c,r.uniforms=a.uniforms,r.outputEncoding=a.outputEncoding);const u=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=se.numPlanes,r.numIntersection=se.numIntersection,u.clippingPlanes=se.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=K.get(e.envMap||r.environment),r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=s,r.needsLights&&(u.ambientLightColor.value=i.state.ambient,u.lightProbe.value=i.state.probe,u.directionalLights.value=i.state.directional,u.directionalLightShadows.value=i.state.directionalShadow,u.spotLights.value=i.state.spot,u.spotLightShadows.value=i.state.spotShadow,u.rectAreaLights.value=i.state.rectArea,u.ltc_1.value=i.state.rectAreaLTC1,u.ltc_2.value=i.state.rectAreaLTC2,u.pointLights.value=i.state.point,u.pointLightShadows.value=i.state.pointShadow,u.hemisphereLights.value=i.state.hemi,u.directionalShadowMap.value=i.state.directionalShadowMap,u.directionalShadowMatrix.value=i.state.directionalShadowMatrix,u.spotShadowMap.value=i.state.spotShadowMap,u.spotShadowMatrix.value=i.state.spotShadowMatrix,u.pointShadowMap.value=i.state.pointShadowMap,u.pointShadowMatrix.value=i.state.pointShadowMatrix);const d=r.program.getUniforms(),p=ur.seqWithValue(d.seq,u);r.uniformsList=p}function Pe(e,t,n,r){!0!==t.isScene&&(t=j),J.resetTextureUnits();const i=t.fog,s=n.isMeshStandardMaterial?t.environment:null,a=null===M?y.outputEncoding:M.texture.encoding,l=K.get(n.envMap||s),c=Z.get(n),h=m.state.lights;if(!0===k&&(!0===z||e!==A)){const t=e===A&&n.id===T;se.setState(n,e,t)}n.version===c.__version?n.fog&&c.fog!==i||c.environment!==s||c.needsLights&&c.lightsStateVersion!==h.state.version?Ee(n,t,r):void 0===c.numClippingPlanes||c.numClippingPlanes===se.numPlanes&&c.numIntersection===se.numIntersection?(c.outputEncoding!==a||c.envMap!==l)&&Ee(n,t,r):Ee(n,t,r):(Ee(n,t,r),c.__version=n.version);let u=!1,d=!1,p=!1;const f=c.program,g=f.getUniforms(),v=c.uniforms;if(q.useProgram(f.program)&&(u=!0,d=!0,p=!0),n.id!==T&&(T=n.id,d=!0),u||A!==e){if(g.setValue(pe,"projectionMatrix",e.projectionMatrix),Y.logarithmicDepthBuffer&&g.setValue(pe,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),A!==e&&(A=e,d=!0,p=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const t=g.map.cameraPosition;void 0!==t&&t.setValue(pe,H.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(pe,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&g.setValue(pe,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){g.setOptional(pe,r,"bindMatrix"),g.setOptional(pe,r,"bindMatrixInverse");const e=r.skeleton;if(e){const t=e.bones;if(Y.floatVertexTextures){if(null===e.boneTexture){let n=Math.sqrt(4*t.length);n=o.ceilPowerOfTwo(n),n=Math.max(n,4);const r=new Float32Array(n*n*4);r.set(e.boneMatrices);const i=new Vt(r,n,n,1023,1015);e.boneMatrices=r,e.boneTexture=i,e.boneTextureSize=n}g.setValue(pe,"boneTexture",e.boneTexture,J),g.setValue(pe,"boneTextureSize",e.boneTextureSize)}else g.setOptional(pe,e,"boneMatrices")}}var x,b;return(d||c.receiveShadow!==r.receiveShadow)&&(c.receiveShadow=r.receiveShadow,g.setValue(pe,"receiveShadow",r.receiveShadow)),d&&(g.setValue(pe,"toneMappingExposure",y.toneMappingExposure),c.needsLights&&(b=p,(x=v).ambientLightColor.needsUpdate=b,x.lightProbe.needsUpdate=b,x.directionalLights.needsUpdate=b,x.directionalLightShadows.needsUpdate=b,x.pointLights.needsUpdate=b,x.pointLightShadows.needsUpdate=b,x.spotLights.needsUpdate=b,x.spotLightShadows.needsUpdate=b,x.rectAreaLights.needsUpdate=b,x.hemisphereLights.needsUpdate=b),i&&n.fog&&re.refreshFogUniforms(v,i),re.refreshMaterialUniforms(v,n,I,R),ur.upload(pe,c.uniformsList,v,J)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(ur.upload(pe,c.uniformsList,v,J),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(pe,"center",r.center),g.setValue(pe,"modelViewMatrix",r.modelViewMatrix),g.setValue(pe,"normalMatrix",r.normalMatrix),g.setValue(pe,"modelMatrix",r.matrixWorld),f}Me.setAnimationLoop((function(e){ge.isPresenting||we&&we(e)})),"undefined"!=typeof window&&Me.setContext(window),this.setAnimationLoop=function(e){we=e,ge.setAnimationLoop(e),null===e?Me.stop():Me.start()},this.render=function(e,t){let n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;de.resetDefaultState(),T=-1,A=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===ge.enabled&&!0===ge.isPresenting&&(t=ge.getCamera(t)),!0===e.isScene&&e.onBeforeRender(y,e,t,n||M),m=oe.get(e,g.length),m.init(),g.push(m),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),U.setFromProjectionMatrix(G),z=this.localClippingEnabled,k=se.init(this.clippingPlanes,z,t),f=ie.get(e,t),f.init(),Se(e,t,0,y.sortObjects),f.finish(),!0===y.sortObjects&&f.sort(F,O),!0===k&&se.beginShadows();const i=m.state.shadowsArray;ve.render(i,e,t),m.setupLights(),m.setupLightsView(t),!0===k&&se.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),ae.render(f,e,t,r);const o=f.opaque,s=f.transparent;o.length>0&&Te(o,e,t),s.length>0&&Te(s,e,t),!0===e.isScene&&e.onAfterRender(y,e,t),null!==M&&(J.updateRenderTargetMipmap(M),J.updateMultisampleRenderTarget(M)),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),g.pop(),m=g.length>0?g[g.length-1]:null,f=null},this.setFramebuffer=function(e){b!==e&&null===M&&pe.bindFramebuffer(36160,e),b=e},this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return w},this.getRenderList=function(){return f},this.setRenderList=function(e){f=e},this.getRenderTarget=function(){return M},this.setRenderTarget=function(e,t=0,n=0){M=e,_=t,w=n,e&&void 0===Z.get(e).__webglFramebuffer&&J.setupRenderTarget(e);let r=b,i=!1;if(e){const n=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=n[t],i=!0):r=e.isWebGLMultisampleRenderTarget?Z.get(e).__webglMultisampledFramebuffer:n,E.copy(e.viewport),P.copy(e.scissor),L=e.scissorTest}else E.copy(N).multiplyScalar(I).floor(),P.copy(D).multiplyScalar(I).floor(),L=B;if(S!==r&&(pe.bindFramebuffer(36160,r),S=r),q.viewport(E),q.scissor(P),q.setScissorTest(L),i){const r=Z.get(e.texture);pe.framebufferTexture2D(36160,36064,34069+t,r.__webglTexture,n)}},this.readRenderTargetPixels=function(e,t,n,r,i,o,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){let s=!1;a!==S&&(pe.bindFramebuffer(36160,a),s=!0);try{const a=e.texture,l=a.format,c=a.type;if(1023!==l&&ue.convert(l)!==pe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===c||ue.convert(c)===pe.getParameter(35738)||1015===c&&(Y.isWebGL2||X.get("OES_texture_float")||X.get("WEBGL_color_buffer_float"))||1016===c&&(Y.isWebGL2?X.get("EXT_color_buffer_float"):X.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===pe.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&pe.readPixels(t,n,r,i,ue.convert(l),ue.convert(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&pe.bindFramebuffer(36160,S)}}},this.copyFramebufferToTexture=function(e,t,n=0){const r=Math.pow(2,-n),i=Math.floor(t.image.width*r),o=Math.floor(t.image.height*r),s=ue.convert(t.format);J.setTexture2D(t,0),pe.copyTexImage2D(3553,n,s,e.x,e.y,i,o,0),q.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r=0){const i=t.image.width,o=t.image.height,s=ue.convert(n.format),a=ue.convert(n.type);J.setTexture2D(n,0),pe.pixelStorei(37440,n.flipY),pe.pixelStorei(37441,n.premultiplyAlpha),pe.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?pe.texSubImage2D(3553,r,e.x,e.y,i,o,s,a,t.image.data):t.isCompressedTexture?pe.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):pe.texSubImage2D(3553,r,e.x,e.y,s,a,t.image),0===r&&n.generateMipmaps&&pe.generateMipmap(3553),q.unbindTexture()},this.initTexture=function(e){J.setTexture2D(e,0),q.unbindTexture()},this.resetState=function(){q.reset(),de.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ni(e){ti.call(this,e)}Zr.prototype=Object.assign(Object.create(zt.prototype),{constructor:Zr,isArrayCamera:!0}),Jr.prototype=Object.assign(Object.create(ge.prototype),{constructor:Jr,isGroup:!0}),Object.assign(Kr.prototype,{constructor:Kr,getHandSpace:function(){if(null===this._hand&&(this._hand=new Jr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let e=0;e<=window.XRHand.LITTLE_PHALANX_TIP;e++){const e=new Jr;e.matrixAutoUpdate=!1,e.visible=!1,this._hand.joints.push(e),this._hand.add(e)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Jr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Jr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(e,t,n){let r=null,i=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(l&&e.hand){o=!0;for(let r=0;r<=window.XRHand.LITTLE_PHALANX_TIP;r++)if(e.hand[r]){const i=t.getJointPose(e.hand[r],n),o=l.joints[r];null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.jointRadius=i.radius),o.visible=null!==i;const s=l.joints[window.XRHand.INDEX_PHALANX_TIP],a=l.joints[window.XRHand.THUMB_PHALANX_TIP],c=s.position.distanceTo(a.position),h=.02,u=.005;l.inputState.pinching&&c>h+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&c<=h-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}}else null!==s&&(r=t.getPose(e.targetRaySpace,n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale))),null!==a&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return null!==s&&(s.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==o),this}}),Object.assign($r.prototype,n.prototype),ni.prototype=Object.assign(Object.create(ti.prototype),{constructor:ni,isWebGL1Renderer:!0});class ri{constructor(e,t){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new Ue(e),this.density=void 0!==t?t:25e-5}clone(){return new ri(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class ii{constructor(e,t,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new Ue(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}clone(){return new ii(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class oi extends ge{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(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}function si(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=o.generateUUID()}Object.defineProperty(si.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(si.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t=0){return this.array.set(e,t),this},clone:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o.generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new si(new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),this.stride);return t.setUsage(this.usage),t},onUpload:function(e){return this.onUploadCallback=e,this},toJSON:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o.generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const ai=new v;function li(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function ci(e){Ge.call(this),this.type="SpriteMaterial",this.color=new Ue(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}let hi;Object.defineProperties(li.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(e){this.data.needsUpdate=e}}}),Object.assign(li.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(let t=0,n=this.data.count;t<n;t++)ai.x=this.getX(t),ai.y=this.getY(t),ai.z=this.getZ(t),ai.applyMatrix4(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new We(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new li(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}),ci.prototype=Object.create(Ge.prototype),ci.prototype.constructor=ci,ci.prototype.isSpriteMaterial=!0,ci.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};const ui=new v,di=new v,pi=new v,fi=new s,mi=new s,gi=new W,vi=new v,yi=new v,xi=new v,bi=new s,_i=new s,wi=new s;function Mi(e){if(ge.call(this),this.type="Sprite",void 0===hi){hi=new pt;const e=new si(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);hi.setIndex([0,1,2,0,2,3]),hi.setAttribute("position",new li(e,3,0,!1)),hi.setAttribute("uv",new li(e,2,3,!1))}this.geometry=hi,this.material=void 0!==e?e:new ci,this.center=new s(.5,.5)}function Si(e,t,n,r,i,o){fi.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(mi.x=o*fi.x-i*fi.y,mi.y=i*fi.x+o*fi.y):mi.copy(fi),e.copy(t),e.x+=mi.x,e.y+=mi.y,e.applyMatrix4(gi)}Mi.prototype=Object.assign(Object.create(ge.prototype),{constructor:Mi,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),di.setFromMatrixScale(this.matrixWorld),gi.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),pi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&di.multiplyScalar(-pi.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;Si(vi.set(-.5,-.5,0),pi,o,di,r,i),Si(yi.set(.5,-.5,0),pi,o,di,r,i),Si(xi.set(.5,.5,0),pi,o,di,r,i),bi.set(0,0),_i.set(1,0),wi.set(1,1);let a=e.ray.intersectTriangle(vi,yi,xi,!1,ui);if(null===a&&(Si(yi.set(-.5,.5,0),pi,o,di,r,i),_i.set(0,1),a=e.ray.intersectTriangle(vi,xi,yi,!1,ui),null===a))return;const l=e.ray.origin.distanceTo(ui);l<e.near||l>e.far||t.push({distance:l,point:ui.clone(),uv:Re.getUV(ui,vi,yi,xi,bi,_i,wi,new s),face:null,object:this})},copy:function(e){return ge.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});const Ti=new v,Ai=new v;function Ei(){ge.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}Ei.prototype=Object.assign(Object.create(ge.prototype),{constructor:Ei,isLOD:!0,copy:function(e){ge.prototype.copy.call(this,e,!1);const t=e.levels;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t=0){t=Math.abs(t);const n=this.levels;let r;for(r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Ti.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ti);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){const t=this.levels;if(t.length>1){Ti.setFromMatrixPosition(e.matrixWorld),Ai.setFromMatrixPosition(this.matrixWorld);const n=Ti.distanceTo(Ai)/e.zoom;let r,i;for(t[0].object.visible=!0,r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,r=n.length;e<r;e++){const r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance})}return t}});const Pi=new v,Li=new p,Ci=new p,Ri=new v,Ii=new W;function Fi(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Rt.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new W,this.bindMatrixInverse=new W}function Oi(){ge.call(this),this.type="Bone"}Fi.prototype=Object.assign(Object.create(Rt.prototype),{constructor:Fi,isSkinnedMesh:!0,copy:function(e){return Rt.prototype.copy.call(this,e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this},bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const e=new p,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Rt.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(e,t){const n=this.skeleton,r=this.geometry;Li.fromBufferAttribute(r.attributes.skinIndex,e),Ci.fromBufferAttribute(r.attributes.skinWeight,e),Pi.fromBufferAttribute(r.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const r=Ci.getComponent(e);if(0!==r){const i=Li.getComponent(e);Ii.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Ri.copy(Pi).applyMatrix4(Ii),r)}}return t.applyMatrix4(this.bindMatrixInverse)}}),Oi.prototype=Object.assign(Object.create(ge.prototype),{constructor:Oi,isBone:!0});const Ni=new W,Di=new W;function Bi(e=[],t=[]){this.uuid=o.generateUUID(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}Object.assign(Bi.prototype,{init:function(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new W)}},calculateInverses:function(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new W;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}},pose:function(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}},update:function(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){const i=e[r]?e[r].matrixWorld:Di;Ni.multiplyMatrices(i,t[r]),Ni.toArray(n,16*r)}null!==r&&(r.needsUpdate=!0)},clone:function(){return new Bi(this.bones,this.boneInverses)},getBoneByName:function(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}},dispose:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)},fromJSON:function(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const r=e.bones[n];let i=t[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new Oi),this.bones.push(i),this.boneInverses.push((new W).fromArray(e.boneInverses[n]))}return this.init(),this},toJSON:function(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){const i=t[r];e.bones.push(i.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}});const Ui=new W,ki=new W,zi=[],Gi=new Rt;function Hi(e,t,n){Rt.call(this,e,t),this.instanceMatrix=new We(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}function ji(e){Ge.call(this),this.type="LineBasicMaterial",this.color=new Ue(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}Hi.prototype=Object.assign(Object.create(Rt.prototype),{constructor:Hi,isInstancedMesh:!0,copy:function(e){return Rt.prototype.copy.call(this,e),this.instanceMatrix.copy(e.instanceMatrix),this.count=e.count,this},getColorAt:function(e,t){t.fromArray(this.instanceColor.array,3*e)},getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){const n=this.matrixWorld,r=this.count;if(Gi.geometry=this.geometry,Gi.material=this.material,void 0!==Gi.material)for(let i=0;i<r;i++){this.getMatrixAt(i,Ui),ki.multiplyMatrices(n,Ui),Gi.matrixWorld=ki,Gi.raycast(e,zi);for(let e=0,n=zi.length;e<n;e++){const n=zi[e];n.instanceId=i,n.object=this,t.push(n)}zi.length=0}},setColorAt:function(e,t){null===this.instanceColor&&(this.instanceColor=new We(new Float32Array(3*this.count),3)),t.toArray(this.instanceColor.array,3*e)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ji.prototype=Object.create(Ge.prototype),ji.prototype.constructor=ji,ji.prototype.isLineBasicMaterial=!0,ji.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};const Vi=new v,Wi=new v,Xi=new W,Yi=new V,qi=new D;function Qi(e=new pt,t=new ji){ge.call(this),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}Qi.prototype=Object.assign(Object.create(ge.prototype),{constructor:Qi,isLine:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},computeLineDistances:function(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)Vi.fromBufferAttribute(t,e-1),Wi.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Vi.distanceTo(Wi);e.setAttribute("lineDistance",new et(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){const t=e.vertices,n=e.lineDistances;n[0]=0;for(let e=1,r=t.length;e<r;e++)n[e]=n[e-1],n[e]+=t[e-1].distanceTo(t[e])}return this},raycast:function(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),qi.copy(n.boundingSphere),qi.applyMatrix4(r),qi.radius+=i,!1===e.ray.intersectsSphere(qi))return;Xi.copy(r).invert(),Yi.copy(e.ray).applyMatrix4(Xi);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,a=new v,l=new v,c=new v,h=new v,u=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,o=n.length-1;r<o;r+=u){const o=n[r],u=n[r+1];a.fromBufferAttribute(i,o),l.fromBufferAttribute(i,u);if(Yi.distanceSqToSegment(a,l,h,c)>s)continue;h.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(h);d<e.near||d>e.far||t.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,r=i.count-1;n<r;n+=u){a.fromBufferAttribute(i,n),l.fromBufferAttribute(i,n+1);if(Yi.distanceSqToSegment(a,l,h,c)>s)continue;h.applyMatrix4(this.matrixWorld);const r=e.ray.origin.distanceTo(h);r<e.near||r>e.far||t.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){const r=n.vertices,i=r.length;for(let n=0;n<i-1;n+=u){if(Yi.distanceSqToSegment(r[n],r[n+1],h,c)>s)continue;h.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(h);i<e.near||i>e.far||t.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){const n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{const t=e.morphTargets;void 0!==t&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Zi=new v,Ji=new v;function Ki(e,t){Qi.call(this,e,t),this.type="LineSegments"}function $i(e,t){Qi.call(this,e,t),this.type="LineLoop"}function eo(e){Ge.call(this),this.type="PointsMaterial",this.color=new Ue(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Ki.prototype=Object.assign(Object.create(Qi.prototype),{constructor:Ki,isLineSegments:!0,computeLineDistances:function(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)Zi.fromBufferAttribute(t,e),Ji.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Zi.distanceTo(Ji);e.setAttribute("lineDistance",new et(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){const t=e.vertices,n=e.lineDistances;for(let e=0,r=t.length;e<r;e+=2)Zi.copy(t[e]),Ji.copy(t[e+1]),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Zi.distanceTo(Ji)}return this}}),$i.prototype=Object.assign(Object.create(Qi.prototype),{constructor:$i,isLineLoop:!0}),eo.prototype=Object.create(Ge.prototype),eo.prototype.constructor=eo,eo.prototype.isPointsMaterial=!0,eo.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};const to=new W,no=new V,ro=new D,io=new v;function oo(e=new pt,t=new eo){ge.call(this),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}function so(e,t,n,r,i,o,s){const a=no.distanceSqToPoint(e);if(a<n){const n=new v;no.closestPointToPoint(e,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:s})}}function ao(e,t,n,r,i,o,s,a,l){u.call(this,e,t,n,r,i,o,s,a,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==i?i:1006,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}function lo(e,t,n,r,i,o,s,a,l,c,h,d){u.call(this,null,o,s,a,l,c,r,i,h,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function co(e,t,n,r,i,o,s,a,l){u.call(this,e,t,n,r,i,o,s,a,l),this.needsUpdate=!0}function ho(e,t,n,r,i,o,s,a,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===c&&(n=1012),void 0===n&&1027===c&&(n=1020),u.call(this,null,r,i,o,s,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==a?a:1003,this.flipY=!1,this.generateMipmaps=!1}oo.prototype=Object.assign(Object.create(ge.prototype),{constructor:oo,isPoints:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},raycast:function(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),ro.copy(n.boundingSphere),ro.applyMatrix4(r),ro.radius+=i,!1===e.ray.intersectsSphere(ro))return;to.copy(r).invert(),no.copy(e.ray).applyMatrix4(to);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i<a;i++){const a=n[i];io.fromBufferAttribute(o,a),so(io,a,s,r,e,t,this)}}else for(let n=0,i=o.count;n<i;n++)io.fromBufferAttribute(o,n),so(io,n,s,r,e,t,this)}else{const i=n.vertices;for(let n=0,o=i.length;n<o;n++)so(i[n],n,s,r,e,t,this)}},updateMorphTargets:function(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){const n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{const t=e.morphTargets;void 0!==t&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),ao.prototype=Object.assign(Object.create(u.prototype),{constructor:ao,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),lo.prototype=Object.create(u.prototype),lo.prototype.constructor=lo,lo.prototype.isCompressedTexture=!0,co.prototype=Object.create(u.prototype),co.prototype.constructor=co,co.prototype.isCanvasTexture=!0,ho.prototype=Object.create(u.prototype),ho.prototype.constructor=ho,ho.prototype.isDepthTexture=!0;let uo=0;const po=new W,fo=new ge,mo=new v;function go(){Object.defineProperty(this,"id",{value:uo+=2}),this.uuid=o.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}go.prototype=Object.assign(Object.create(n.prototype),{constructor:go,isGeometry:!0,applyMatrix4:function(e){const t=(new a).getNormalMatrix(e);for(let t=0,n=this.vertices.length;t<n;t++){this.vertices[t].applyMatrix4(e)}for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e];n.normal.applyMatrix3(t).normalize();for(let e=0,r=n.vertexNormals.length;e<r;e++)n.vertexNormals[e].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return po.makeRotationX(e),this.applyMatrix4(po),this},rotateY:function(e){return po.makeRotationY(e),this.applyMatrix4(po),this},rotateZ:function(e){return po.makeRotationZ(e),this.applyMatrix4(po),this},translate:function(e,t,n){return po.makeTranslation(e,t,n),this.applyMatrix4(po),this},scale:function(e,t,n){return po.makeScale(e,t,n),this.applyMatrix4(po),this},lookAt:function(e){return fo.lookAt(e),fo.updateMatrix(),this.applyMatrix4(fo.matrix),this},fromBufferGeometry:function(e){const t=this,n=null!==e.index?e.index:void 0,r=e.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const i=r.position,o=r.normal,a=r.color,l=r.uv,c=r.uv2;void 0!==c&&(this.faceVertexUvs[1]=[]);for(let e=0;e<i.count;e++)t.vertices.push((new v).fromBufferAttribute(i,e)),void 0!==a&&t.colors.push((new Ue).fromBufferAttribute(a,e));function h(e,n,r,i){const h=void 0===a?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=void 0===o?[]:[(new v).fromBufferAttribute(o,e),(new v).fromBufferAttribute(o,n),(new v).fromBufferAttribute(o,r)],d=new ke(e,n,r,u,h,i);t.faces.push(d),void 0!==l&&t.faceVertexUvs[0].push([(new s).fromBufferAttribute(l,e),(new s).fromBufferAttribute(l,n),(new s).fromBufferAttribute(l,r)]),void 0!==c&&t.faceVertexUvs[1].push([(new s).fromBufferAttribute(c,e),(new s).fromBufferAttribute(c,n),(new s).fromBufferAttribute(c,r)])}const u=e.groups;if(u.length>0)for(let e=0;e<u.length;e++){const t=u[e],r=t.start;for(let e=r,i=r+t.count;e<i;e+=3)void 0!==n?h(n.getX(e),n.getX(e+1),n.getX(e+2),t.materialIndex):h(e,e+1,e+2,t.materialIndex)}else if(void 0!==n)for(let e=0;e<n.count;e+=3)h(n.getX(e),n.getX(e+1),n.getX(e+2));else for(let e=0;e<i.count;e+=3)h(e,e+1,e+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(mo).negate(),this.translate(mo.x,mo.y,mo.z),this},normalize:function(){this.computeBoundingSphere();const e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new W;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){const e=new v,t=new v;for(let n=0,r=this.faces.length;n<r;n++){const r=this.faces[n],i=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(i,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e=!0){const t=new Array(this.vertices.length);for(let e=0,n=this.vertices.length;e<n;e++)t[e]=new v;if(e){const e=new v,n=new v;for(let r=0,i=this.faces.length;r<i;r++){const i=this.faces[r],o=this.vertices[i.a],s=this.vertices[i.b],a=this.vertices[i.c];e.subVectors(a,s),n.subVectors(o,s),e.cross(n),t[i.a].add(e),t[i.b].add(e),t[i.c].add(e)}}else{this.computeFaceNormals();for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e];t[n.a].add(n.normal),t[n.b].add(n.normal),t[n.c].add(n.normal)}}for(let e=0,n=this.vertices.length;e<n;e++)t[e].normalize();for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e],r=n.vertexNormals;3===r.length?(r[0].copy(t[n.a]),r[1].copy(t[n.b]),r[2].copy(t[n.c])):(r[0]=t[n.a].clone(),r[1]=t[n.b].clone(),r[2]=t[n.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],n=t.vertexNormals;3===n.length?(n[0].copy(t.normal),n[1].copy(t.normal),n[2].copy(t.normal)):(n[0]=t.normal.clone(),n[1]=t.normal.clone(),n[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||(t.__originalVertexNormals=[]);for(let e=0,n=t.vertexNormals.length;e<n;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}const e=new go;e.faces=this.faces;for(let t=0,n=this.morphTargets.length;t<n;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];const e=this.morphNormals[t].faceNormals,n=this.morphNormals[t].vertexNormals;for(let t=0,r=this.faces.length;t<r;t++){const t=new v,r={a:new v,b:new v,c:new v};e.push(t),n.push(r)}}const n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],r=n.faceNormals[e],i=n.vertexNormals[e];r.copy(t.normal),i.a.copy(t.vertexNormals[0]),i.b.copy(t.vertexNormals[1]),i.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new b),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new D),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n=0){if(!e||!e.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);let r;const i=this.vertices.length,o=this.vertices,s=e.vertices,l=this.faces,c=e.faces,h=this.colors,u=e.colors;void 0!==t&&(r=(new a).getNormalMatrix(t));for(let e=0,n=s.length;e<n;e++){const n=s[e].clone();void 0!==t&&n.applyMatrix4(t),o.push(n)}for(let e=0,t=u.length;e<t;e++)h.push(u[e].clone());for(let e=0,t=c.length;e<t;e++){const t=c[e];let o,s;const a=t.vertexNormals,h=t.vertexColors,u=new ke(t.a+i,t.b+i,t.c+i);u.normal.copy(t.normal),void 0!==r&&u.normal.applyMatrix3(r).normalize();for(let e=0,t=a.length;e<t;e++)o=a[e].clone(),void 0!==r&&o.applyMatrix3(r).normalize(),u.vertexNormals.push(o);u.color.copy(t.color);for(let e=0,t=h.length;e<t;e++)s=h[e],u.vertexColors.push(s.clone());u.materialIndex=t.materialIndex+n,l.push(u)}for(let t=0,n=e.faceVertexUvs.length;t<n;t++){const n=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){const r=n[e],i=[];for(let e=0,t=r.length;e<t;e++)i.push(r[e].clone());this.faceVertexUvs[t].push(i)}}},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(e=4){const t={},n=[],r=[],i=Math.pow(10,e);for(let e=0,o=this.vertices.length;e<o;e++){const o=this.vertices[e],s=Math.round(o.x*i)+"_"+Math.round(o.y*i)+"_"+Math.round(o.z*i);void 0===t[s]?(t[s]=e,n.push(this.vertices[e]),r[e]=n.length-1):r[e]=r[t[s]]}const o=[];for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];const n=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(n[t]===n[(t+1)%3]){o.push(e);break}}for(let e=o.length-1;e>=0;e--){const t=o[e];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e<n;e++)this.faceVertexUvs[e].splice(t,1)}const s=this.vertices.length-n.length;return this.vertices=n,s},setFromPoints:function(e){this.vertices=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];this.vertices.push(new v(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){const e=this.faces,t=e.length;for(let n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));const n=this.faceVertexUvs[0],r=this.faceVertexUvs[1];let i,o;n&&n.length===t&&(i=[]),r&&r.length===t&&(o=[]);for(let s=0;s<t;s++){const t=e[s]._id;i&&i.push(n[t]),o&&o.push(r[t])}i&&(this.faceVertexUvs[0]=i),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){const e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}const t=[];for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];t.push(n.x,n.y,n.z)}const n=[],r=[],i={},o=[],s={},a=[],l={};for(let e=0;e<this.faces.length;e++){const t=this.faces[e],r=!0,i=!1,o=void 0!==this.faceVertexUvs[0][e],s=t.normal.length()>0,a=t.vertexNormals.length>0,l=1!==t.color.r||1!==t.color.g||1!==t.color.b,p=t.vertexColors.length>0;let f=0;if(f=c(f,0,0),f=c(f,1,r),f=c(f,2,i),f=c(f,3,o),f=c(f,4,s),f=c(f,5,a),f=c(f,6,l),f=c(f,7,p),n.push(f),n.push(t.a,t.b,t.c),n.push(t.materialIndex),o){const t=this.faceVertexUvs[0][e];n.push(d(t[0]),d(t[1]),d(t[2]))}if(s&&n.push(h(t.normal)),a){const e=t.vertexNormals;n.push(h(e[0]),h(e[1]),h(e[2]))}if(l&&n.push(u(t.color)),p){const e=t.vertexColors;n.push(u(e[0]),u(e[1]),u(e[2]))}}function c(e,t,n){return n?e|1<<t:e&~(1<<t)}function h(e){const t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==i[t]||(i[t]=r.length/3,r.push(e.x,e.y,e.z)),i[t]}function u(e){const t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==s[t]||(s[t]=o.length,o.push(e.getHex())),s[t]}function d(e){const t=e.x.toString()+e.y.toString();return void 0!==l[t]||(l[t]=a.length/2,a.push(e.x,e.y)),l[t]}return e.data={},e.data.vertices=t,e.data.normals=r,o.length>0&&(e.data.colors=o),a.length>0&&(e.data.uvs=[a]),e.data.faces=n,e},clone:function(){return(new go).copy(this)},copy:function(e){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=e.name;const t=e.vertices;for(let e=0,n=t.length;e<n;e++)this.vertices.push(t[e].clone());const n=e.colors;for(let e=0,t=n.length;e<t;e++)this.colors.push(n[e].clone());const r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,n=e.faceVertexUvs.length;t<n;t++){const n=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){const r=n[e],i=[];for(let e=0,t=r.length;e<t;e++){const t=r[e];i.push(t.clone())}this.faceVertexUvs[t].push(i)}}const i=e.morphTargets;for(let e=0,t=i.length;e<t;e++){const t={};if(t.name=i[e].name,void 0!==i[e].vertices){t.vertices=[];for(let n=0,r=i[e].vertices.length;n<r;n++)t.vertices.push(i[e].vertices[n].clone())}if(void 0!==i[e].normals){t.normals=[];for(let n=0,r=i[e].normals.length;n<r;n++)t.normals.push(i[e].normals[n].clone())}this.morphTargets.push(t)}const o=e.morphNormals;for(let e=0,t=o.length;e<t;e++){const t={};if(void 0!==o[e].vertexNormals){t.vertexNormals=[];for(let n=0,r=o[e].vertexNormals.length;n<r;n++){const r=o[e].vertexNormals[n],i={};i.a=r.a.clone(),i.b=r.b.clone(),i.c=r.c.clone(),t.vertexNormals.push(i)}}if(void 0!==o[e].faceNormals){t.faceNormals=[];for(let n=0,r=o[e].faceNormals.length;n<r;n++)t.faceNormals.push(o[e].faceNormals[n].clone())}this.morphNormals.push(t)}const s=e.skinWeights;for(let e=0,t=s.length;e<t;e++)this.skinWeights.push(s[e].clone());const a=e.skinIndices;for(let e=0,t=a.length;e<t;e++)this.skinIndices.push(a[e].clone());const l=e.lineDistances;for(let e=0,t=l.length;e<t;e++)this.lineDistances.push(l[e]);const c=e.boundingBox;null!==c&&(this.boundingBox=c.clone());const h=e.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class vo extends go{constructor(e,t,n,r,i,o){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Ot(e,t,n,r,i,o)),this.mergeVertices()}}class yo extends pt{constructor(e=1,t=8,n=0,r=2*Math.PI){super(),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const i=[],o=[],a=[],l=[],c=new v,h=new s;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let i=0,s=3;i<=t;i++,s+=3){const u=n+i/t*r;c.x=e*Math.cos(u),c.y=e*Math.sin(u),o.push(c.x,c.y,c.z),a.push(0,0,1),h.x=(o[s]/e+1)/2,h.y=(o[s+1]/e+1)/2,l.push(h.x,h.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new et(o,3)),this.setAttribute("normal",new et(a,3)),this.setAttribute("uv",new et(l,2))}}class xo extends go{constructor(e,t,n,r){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new yo(e,t,n,r)),this.mergeVertices()}}class bo extends pt{constructor(e=1,t=1,n=1,r=8,i=1,o=!1,a=0,l=2*Math.PI){super(),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),i=Math.floor(i);const h=[],u=[],d=[],p=[];let f=0;const m=[],g=n/2;let y=0;function x(n){const i=f,o=new s,m=new v;let x=0;const b=!0===n?e:t,_=!0===n?1:-1;for(let e=1;e<=r;e++)u.push(0,g*_,0),d.push(0,_,0),p.push(.5,.5),f++;const w=f;for(let e=0;e<=r;e++){const t=e/r*l+a,n=Math.cos(t),i=Math.sin(t);m.x=b*i,m.y=g*_,m.z=b*n,u.push(m.x,m.y,m.z),d.push(0,_,0),o.x=.5*n+.5,o.y=.5*i*_+.5,p.push(o.x,o.y),f++}for(let e=0;e<r;e++){const t=i+e,r=w+e;!0===n?h.push(r,r+1,t):h.push(r+1,r,t),x+=3}c.addGroup(y,x,!0===n?1:2),y+=x}!function(){const o=new v,s=new v;let x=0;const b=(t-e)/n;for(let c=0;c<=i;c++){const h=[],v=c/i,y=v*(t-e)+e;for(let e=0;e<=r;e++){const t=e/r,i=t*l+a,c=Math.sin(i),m=Math.cos(i);s.x=y*c,s.y=-v*n+g,s.z=y*m,u.push(s.x,s.y,s.z),o.set(c,b,m).normalize(),d.push(o.x,o.y,o.z),p.push(t,1-v),h.push(f++)}m.push(h)}for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=m[t][e],r=m[t+1][e],i=m[t+1][e+1],o=m[t][e+1];h.push(n,r,o),h.push(r,i,o),x+=6}c.addGroup(y,x,0),y+=x}(),!1===o&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new et(u,3)),this.setAttribute("normal",new et(d,3)),this.setAttribute("uv",new et(p,2))}}class _o extends go{constructor(e,t,n,r,i,o,s,a){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new bo(e,t,n,r,i,o,s,a)),this.mergeVertices()}}class wo extends _o{constructor(e,t,n,r,i,o,s){super(0,e,t,n,r,i,o,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:s}}}class Mo extends bo{constructor(e=1,t=1,n=8,r=1,i=!1,o=0,s=2*Math.PI){super(0,e,t,n,r,i,o,s),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:s}}}class So extends pt{constructor(e,t,n=1,r=0){super(),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const i=[],o=[];function a(e,t,n,r){const i=r+1,o=[];for(let r=0;r<=i;r++){o[r]=[];const s=e.clone().lerp(n,r/i),a=t.clone().lerp(n,r/i),l=i-r;for(let e=0;e<=l;e++)o[r][e]=0===e&&r===i?s:s.clone().lerp(a,e/l)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){const n=Math.floor(t/2);t%2==0?(l(o[e][n+1]),l(o[e+1][n]),l(o[e][n])):(l(o[e][n+1]),l(o[e+1][n+1]),l(o[e+1][n]))}}function l(e){i.push(e.x,e.y,e.z)}function c(t,n){const r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function h(e,t,n,r){r<0&&1===e.x&&(o[t]=e.x-1),0===n.x&&0===n.z&&(o[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}function d(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){const n=new v,r=new v,i=new v;for(let o=0;o<t.length;o+=3)c(t[o+0],n),c(t[o+1],r),c(t[o+2],i),a(n,r,i,e)}(r),function(e){const t=new v;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){const e=new v;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];const n=u(e)/2/Math.PI+.5,r=d(e)/Math.PI+.5;o.push(n,1-r)}(function(){const e=new v,t=new v,n=new v,r=new v,a=new s,l=new s,c=new s;for(let s=0,d=0;s<i.length;s+=9,d+=6){e.set(i[s+0],i[s+1],i[s+2]),t.set(i[s+3],i[s+4],i[s+5]),n.set(i[s+6],i[s+7],i[s+8]),a.set(o[d+0],o[d+1]),l.set(o[d+2],o[d+3]),c.set(o[d+4],o[d+5]),r.copy(e).add(t).add(n).divideScalar(3);const p=u(r);h(a,d+0,e,p),h(l,d+2,t,p),h(c,d+4,n,p)}})(),function(){for(let e=0;e<o.length;e+=6){const t=o[e+0],n=o[e+2],r=o[e+4],i=Math.max(t,n,r),s=Math.min(t,n,r);i>.9&&s<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new et(i,3)),this.setAttribute("normal",new et(i.slice(),3)),this.setAttribute("uv",new et(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}class To extends So{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class Ao extends go{constructor(e,t){super(),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new To(e,t)),this.mergeVertices()}}const Eo=new v,Po=new v,Lo=new v,Co=new Re;class Ro extends pt{constructor(e,t){super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1,e.isGeometry&&(e=(new pt).fromGeometry(e));const n=Math.pow(10,4),r=Math.cos(o.DEG2RAD*t),i=e.getIndex(),s=e.getAttribute("position"),a=i?i.count:s.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let e=0;e<a;e+=3){i?(l[0]=i.getX(e),l[1]=i.getX(e+1),l[2]=i.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:o,c:a}=Co;if(t.fromBufferAttribute(s,l[0]),o.fromBufferAttribute(s,l[1]),a.fromBufferAttribute(s,l[2]),Co.getNormal(Lo),h[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,h[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,h[2]=`${Math.round(a.x*n)},${Math.round(a.y*n)},${Math.round(a.z*n)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=h[e],i=h[t],o=Co[c[e]],s=Co[c[t]],a=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(Lo.dot(u[p].normal)<=r&&(d.push(o.x,o.y,o.z),d.push(s.x,s.y,s.z)),u[p]=null):a in u||(u[a]={index0:l[e],index1:l[t],normal:Lo.clone()})}}for(const e in u)if(u[e]){const{index0:t,index1:n}=u[e];Eo.fromBufferAttribute(s,t),Po.fromBufferAttribute(s,n),d.push(Eo.x,Eo.y,Eo.z),d.push(Po.x,Po.y,Po.z)}this.setAttribute("position",new et(d,3))}}const Io=function(e,t,n){n=n||2;const r=t&&t.length,i=r?t[0]*n:e.length;let o=Fo(e,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c,h,u,d,p;if(r&&(o=function(e,t,n,r){const i=[];let o,s,a,l,c;for(o=0,s=t.length;o<s;o++)a=t[o]*r,l=o<s-1?t[o+1]*r:e.length,c=Fo(e,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Vo(c));for(i.sort(zo),o=0;o<i.length;o++)Go(i[o],n),n=Oo(n,n.next);return n}(e,t,o,n)),e.length>80*n){a=c=e[0],l=h=e[1];for(let t=n;t<i;t+=n)u=e[t],d=e[t+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return No(o,s,n,a,l,p),s};function Fo(e,t,n,r,i){let o,s;if(i===function(e,t,n,r){let i=0;for(let o=t,s=n-r;o<n;o+=r)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}(e,t,n,r)>0)for(o=t;o<n;o+=r)s=es(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=es(o,e[o],e[o+1],s);return s&&qo(s,s.next)&&(ts(s),s=s.next),s}function Oo(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!qo(r,r.next)&&0!==Yo(r.prev,r,r.next))r=r.next;else{if(ts(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function No(e,t,n,r,i,o,s){if(!e)return;!s&&o&&function(e,t,n,r){let i=e;do{null===i.z&&(i.z=jo(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n,r,i,o,s,a,l,c=1;do{for(n=e,e=null,o=null,s=0;n;){for(s++,r=n,a=0,t=0;t<c&&(a++,r=r.nextZ,r);t++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(s>1)}(i)}(e,r,i,o);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,o?Bo(e,r,i,o):Do(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),ts(e),e=l.next,c=l.next;else if((e=l)===c){s?1===s?No(e=Uo(Oo(e),t,n),t,n,r,i,o,2):2===s&&ko(e,t,n,r,i,o):No(Oo(e),t,n,r,i,o,1);break}}function Do(e){const t=e.prev,n=e,r=e.next;if(Yo(t,n,r)>=0)return!1;let i=e.next.next;for(;i!==e.prev;){if(Wo(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Yo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Bo(e,t,n,r){const i=e.prev,o=e,s=e.next;if(Yo(i,o,s)>=0)return!1;const a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,c=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,u=jo(a,l,t,n,r),d=jo(c,h,t,n,r);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Yo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Yo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Yo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Wo(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Yo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Uo(e,t,n){let r=e;do{const i=r.prev,o=r.next.next;!qo(i,o)&&Qo(i,r,r.next,o)&&Ko(i,o)&&Ko(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),ts(r),ts(r.next),r=e=o),r=r.next}while(r!==e);return Oo(r)}function ko(e,t,n,r,i,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Xo(s,e)){let a=$o(s,e);return s=Oo(s,s.next),a=Oo(a,a.next),No(s,t,n,r,i,o),void No(a,t,n,r,i,o)}e=e.next}s=s.next}while(s!==e)}function zo(e,t){return e.x-t.x}function Go(e,t){if(t=function(e,t){let n=t;const r=e.x,i=e.y;let o,s=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>s){if(s=e,e===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===s)return o;const a=o,l=o.x,c=o.y;let h,u=1/0;n=o;do{r>=n.x&&n.x>=l&&r!==n.x&&Wo(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)&&(h=Math.abs(i-n.y)/(r-n.x),Ko(n,e)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&Ho(o,n)))&&(o=n,u=h)),n=n.next}while(n!==a);return o}(e,t)){const n=$o(t,e);Oo(t,t.next),Oo(n,n.next)}}function Ho(e,t){return Yo(e.prev,e,t.prev)<0&&Yo(t.next,e,e.next)<0}function jo(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Vo(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Wo(e,t,n,r,i,o,s,a){return(i-s)*(t-a)-(e-s)*(o-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function Xo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Qo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ko(e,t)&&Ko(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Yo(e.prev,e,t.prev)||Yo(e,t.prev,t))||qo(e,t)&&Yo(e.prev,e,e.next)>0&&Yo(t.prev,t,t.next)>0)}function Yo(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function qo(e,t){return e.x===t.x&&e.y===t.y}function Qo(e,t,n,r){const i=Jo(Yo(e,t,n)),o=Jo(Yo(e,t,r)),s=Jo(Yo(n,r,e)),a=Jo(Yo(n,r,t));return i!==o&&s!==a||(!(0!==i||!Zo(e,n,t))||(!(0!==o||!Zo(e,r,t))||(!(0!==s||!Zo(n,e,r))||!(0!==a||!Zo(n,t,r)))))}function Zo(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Jo(e){return e>0?1:e<0?-1:0}function Ko(e,t){return Yo(e.prev,e,e.next)<0?Yo(e,t,e.next)>=0&&Yo(e,e.prev,t)>=0:Yo(e,t,e.prev)<0||Yo(e,e.next,t)<0}function $o(e,t){const n=new ns(e.i,e.x,e.y),r=new ns(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function es(e,t,n,r){const i=new ns(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ts(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ns(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}const rs={area:function(e){const t=e.length;let n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return rs.area(e)<0},triangulateShape:function(e,t){const n=[],r=[],i=[];is(e),os(n,e);let o=e.length;t.forEach(is);for(let e=0;e<t.length;e++)r.push(o),o+=t[e].length,os(n,t[e]);const s=Io(n,r);for(let e=0;e<s.length;e+=3)i.push(s.slice(e,e+3));return i}};function is(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function os(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class ss extends pt{constructor(e,t){super(),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){o(e[t])}function o(e){const o=[],a=void 0!==t.curveSegments?t.curveSegments:12,l=void 0!==t.steps?t.steps:1;let c=void 0!==t.depth?t.depth:100,h=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,d=void 0!==t.bevelSize?t.bevelSize:u-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,f=void 0!==t.bevelSegments?t.bevelSegments:3;const m=t.extrudePath,g=void 0!==t.UVGenerator?t.UVGenerator:as;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);let y,x,b,_,w,M=!1;m&&(y=m.getSpacedPoints(l),M=!0,h=!1,x=m.computeFrenetFrames(l,!1),b=new v,_=new v,w=new v),h||(f=0,u=0,d=0,p=0);const S=e.extractPoints(a);let T=S.shape;const A=S.holes;if(!rs.isClockWise(T)){T=T.reverse();for(let e=0,t=A.length;e<t;e++){const t=A[e];rs.isClockWise(t)&&(A[e]=t.reverse())}}const E=rs.triangulateShape(T,A),P=T;for(let e=0,t=A.length;e<t;e++){const t=A[e];T=T.concat(t)}function L(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}const C=T.length,R=E.length;function I(e,t,n){let r,i,o;const a=e.x-t.x,l=e.y-t.y,c=n.x-e.x,h=n.y-e.y,u=a*a+l*l,d=a*h-l*c;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(u),p=Math.sqrt(c*c+h*h),f=t.x-l/d,m=t.y+a/d,g=((n.x-h/p-f)*h-(n.y+c/p-m)*c)/(a*h-l*c);r=f+a*g-e.x,i=m+l*g-e.y;const v=r*r+i*i;if(v<=2)return new s(r,i);o=Math.sqrt(v/2)}else{let e=!1;a>Number.EPSILON?c>Number.EPSILON&&(e=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(e=!0):Math.sign(l)===Math.sign(h)&&(e=!0),e?(r=-l,i=a,o=Math.sqrt(u)):(r=a,i=l,o=Math.sqrt(u/2))}return new s(r/o,i/o)}const F=[];for(let e=0,t=P.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),F[e]=I(P[e],P[n],P[r]);const O=[];let N,D=F.concat();for(let e=0,t=A.length;e<t;e++){const t=A[e];N=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),N[e]=I(t[e],t[r],t[i]);O.push(N),D=D.concat(N)}for(let e=0;e<f;e++){const t=e/f,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+p;for(let e=0,t=P.length;e<t;e++){const t=L(P[e],F[e],r);k(t.x,t.y,-n)}for(let e=0,t=A.length;e<t;e++){const t=A[e];N=O[e];for(let e=0,i=t.length;e<i;e++){const i=L(t[e],N[e],r);k(i.x,i.y,-n)}}}const B=d+p;for(let e=0;e<C;e++){const t=h?L(T[e],D[e],B):T[e];M?(_.copy(x.normals[0]).multiplyScalar(t.x),b.copy(x.binormals[0]).multiplyScalar(t.y),w.copy(y[0]).add(_).add(b),k(w.x,w.y,w.z)):k(t.x,t.y,0)}for(let e=1;e<=l;e++)for(let t=0;t<C;t++){const n=h?L(T[t],D[t],B):T[t];M?(_.copy(x.normals[e]).multiplyScalar(n.x),b.copy(x.binormals[e]).multiplyScalar(n.y),w.copy(y[e]).add(_).add(b),k(w.x,w.y,w.z)):k(n.x,n.y,c/l*e)}for(let e=f-1;e>=0;e--){const t=e/f,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+p;for(let e=0,t=P.length;e<t;e++){const t=L(P[e],F[e],r);k(t.x,t.y,c+n)}for(let e=0,t=A.length;e<t;e++){const t=A[e];N=O[e];for(let e=0,i=t.length;e<i;e++){const i=L(t[e],N[e],r);M?k(i.x,i.y+y[l-1].y,y[l-1].x+n):k(i.x,i.y,c+n)}}}function U(e,t){let n=e.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=e.length-1);for(let e=0,n=l+2*f;e<n;e++){const n=C*e,o=C*(e+1);G(t+r+n,t+i+n,t+i+o,t+r+o)}}}function k(e,t,n){o.push(e),o.push(t),o.push(n)}function z(e,t,i){H(e),H(t),H(i);const o=r.length/3,s=g.generateTopUV(n,r,o-3,o-2,o-1);j(s[0]),j(s[1]),j(s[2])}function G(e,t,i,o){H(e),H(t),H(o),H(t),H(i),H(o);const s=r.length/3,a=g.generateSideWallUV(n,r,s-6,s-3,s-2,s-1);j(a[0]),j(a[1]),j(a[3]),j(a[1]),j(a[2]),j(a[3])}function H(e){r.push(o[3*e+0]),r.push(o[3*e+1]),r.push(o[3*e+2])}function j(e){i.push(e.x),i.push(e.y)}!function(){const e=r.length/3;if(h){let e=0,t=C*e;for(let e=0;e<R;e++){const n=E[e];z(n[2]+t,n[1]+t,n[0]+t)}e=l+2*f,t=C*e;for(let e=0;e<R;e++){const n=E[e];z(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<R;e++){const t=E[e];z(t[2],t[1],t[0])}for(let e=0;e<R;e++){const t=E[e];z(t[0]+C*l,t[1]+C*l,t[2]+C*l)}}n.addGroup(e,r.length/3-e,0)}(),function(){const e=r.length/3;let t=0;U(P,t),t+=P.length;for(let e=0,n=A.length;e<n;e++){const n=A[e];U(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}()}this.setAttribute("position",new et(r,3)),this.setAttribute("uv",new et(i,2)),this.computeVertexNormals()}toJSON(){const e=pt.prototype.toJSON.call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){const r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}const as={generateTopUV:function(e,t,n,r,i){const o=t[3*n],a=t[3*n+1],l=t[3*r],c=t[3*r+1],h=t[3*i],u=t[3*i+1];return[new s(o,a),new s(l,c),new s(h,u)]},generateSideWallUV:function(e,t,n,r,i,o){const a=t[3*n],l=t[3*n+1],c=t[3*n+2],h=t[3*r],u=t[3*r+1],d=t[3*r+2],p=t[3*i],f=t[3*i+1],m=t[3*i+2],g=t[3*o],v=t[3*o+1],y=t[3*o+2];return Math.abs(l-u)<.01?[new s(a,1-c),new s(h,1-d),new s(p,1-m),new s(g,1-y)]:[new s(l,1-c),new s(u,1-d),new s(f,1-m),new s(v,1-y)]}};class ls extends go{constructor(e,t){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new ss(e,t)),this.mergeVertices()}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){const r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}class cs extends So{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class hs extends go{constructor(e,t){super(),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new cs(e,t)),this.mergeVertices()}}class us extends pt{constructor(e,t=12,n=0,r=2*Math.PI){super(),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=o.clamp(r,0,2*Math.PI);const i=[],a=[],l=[],c=1/t,h=new v,u=new s;for(let i=0;i<=t;i++){const o=n+i*c*r,s=Math.sin(o),d=Math.cos(o);for(let n=0;n<=e.length-1;n++)h.x=e[n].x*s,h.y=e[n].y,h.z=e[n].x*d,a.push(h.x,h.y,h.z),u.x=i/t,u.y=n/(e.length-1),l.push(u.x,u.y)}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const r=t+n*e.length,o=r,s=r+e.length,a=r+e.length+1,l=r+1;i.push(o,s,l),i.push(s,a,l)}if(this.setIndex(i),this.setAttribute("position",new et(a,3)),this.setAttribute("uv",new et(l,2)),this.computeVertexNormals(),r===2*Math.PI){const n=this.attributes.normal.array,r=new v,i=new v,o=new v,s=t*e.length*3;for(let t=0,a=0;t<e.length;t++,a+=3)r.x=n[a+0],r.y=n[a+1],r.z=n[a+2],i.x=n[s+a+0],i.y=n[s+a+1],i.z=n[s+a+2],o.addVectors(r,i).normalize(),n[a+0]=n[s+a+0]=o.x,n[a+1]=n[s+a+1]=o.y,n[a+2]=n[s+a+2]=o.z}}}class ds extends go{constructor(e,t,n,r){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new us(e,t,n,r)),this.mergeVertices()}}class ps extends So{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class fs extends go{constructor(e,t){super(),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ps(e,t)),this.mergeVertices()}}function ms(e,t,n){pt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};const r=[],i=[],o=[],s=[],a=1e-5,l=new v,c=new v,h=new v,u=new v,d=new v;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=t+1;for(let r=0;r<=n;r++){const p=r/n;for(let n=0;n<=t;n++){const r=n/t;e(r,p,c),i.push(c.x,c.y,c.z),r-a>=0?(e(r-a,p,h),u.subVectors(c,h)):(e(r+a,p,h),u.subVectors(h,c)),p-a>=0?(e(r,p-a,h),d.subVectors(c,h)):(e(r,p+a,h),d.subVectors(h,c)),l.crossVectors(u,d).normalize(),o.push(l.x,l.y,l.z),s.push(r,p)}}for(let e=0;e<n;e++)for(let n=0;n<t;n++){const t=e*p+n,i=e*p+n+1,o=(e+1)*p+n+1,s=(e+1)*p+n;r.push(t,i,s),r.push(i,o,s)}this.setIndex(r),this.setAttribute("position",new et(i,3)),this.setAttribute("normal",new et(o,3)),this.setAttribute("uv",new et(s,2))}function gs(e,t,n){go.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new ms(e,t,n)),this.mergeVertices()}ms.prototype=Object.create(pt.prototype),ms.prototype.constructor=ms,gs.prototype=Object.create(go.prototype),gs.prototype.constructor=gs;class vs extends go{constructor(e,t,n,r){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Zt(e,t,n,r)),this.mergeVertices()}}class ys extends go{constructor(e,t,n,r){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new So(e,t,n,r)),this.mergeVertices()}}class xs extends pt{constructor(e=.5,t=1,n=8,r=1,i=0,o=2*Math.PI){super(),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},n=Math.max(3,n);const a=[],l=[],c=[],h=[];let u=e;const d=(t-e)/(r=Math.max(1,r)),p=new v,f=new s;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){const r=i+e/n*o;p.x=u*Math.cos(r),p.y=u*Math.sin(r),l.push(p.x,p.y,p.z),c.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,h.push(f.x,f.y)}u+=d}for(let e=0;e<r;e++){const t=e*(n+1);for(let e=0;e<n;e++){const r=e+t,i=r,o=r+n+1,s=r+n+2,l=r+1;a.push(i,o,l),a.push(o,s,l)}}this.setIndex(a),this.setAttribute("position",new et(l,3)),this.setAttribute("normal",new et(c,3)),this.setAttribute("uv",new et(h,2))}}class bs extends go{constructor(e,t,n,r,i,o){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new xs(e,t,n,r,i,o)),this.mergeVertices()}}class _s extends pt{constructor(e,t=12){super(),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],i=[],o=[];let s=0,a=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,a,t),s+=a,a=0;function l(e){const s=r.length/3,l=e.extractPoints(t);let c=l.shape;const h=l.holes;!1===rs.isClockWise(c)&&(c=c.reverse());for(let e=0,t=h.length;e<t;e++){const t=h[e];!0===rs.isClockWise(t)&&(h[e]=t.reverse())}const u=rs.triangulateShape(c,h);for(let e=0,t=h.length;e<t;e++){const t=h[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];r.push(t.x,t.y,0),i.push(0,0,1),o.push(t.x,t.y)}for(let e=0,t=u.length;e<t;e++){const t=u[e],r=t[0]+s,i=t[1]+s,o=t[2]+s;n.push(r,i,o),a+=3}}this.setIndex(n),this.setAttribute("position",new et(r,3)),this.setAttribute("normal",new et(i,3)),this.setAttribute("uv",new et(o,2))}toJSON(){const e=pt.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}class ws extends go{constructor(e,t){super(),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new _s(e,t)),this.mergeVertices()}toJSON(){const e=go.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}class Ms extends pt{constructor(e=1,t=8,n=6,r=0,i=2*Math.PI,o=0,s=Math.PI){super(),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const a=Math.min(o+s,Math.PI);let l=0;const c=[],h=new v,u=new v,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let y=0;0==d&&0==o?y=.5/t:d==n&&a==Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const a=n/t;h.x=-e*Math.cos(r+a*i)*Math.sin(o+v*s),h.y=e*Math.cos(o+v*s),h.z=e*Math.sin(r+a*i)*Math.sin(o+v*s),p.push(h.x,h.y,h.z),u.copy(h).normalize(),f.push(u.x,u.y,u.z),m.push(a+y,1-v),g.push(l++)}c.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){const t=c[e][r+1],i=c[e][r],s=c[e+1][r],l=c[e+1][r+1];(0!==e||o>0)&&d.push(t,i,l),(e!==n-1||a<Math.PI)&&d.push(i,s,l)}this.setIndex(d),this.setAttribute("position",new et(p,3)),this.setAttribute("normal",new et(f,3)),this.setAttribute("uv",new et(m,2))}}class Ss extends go{constructor(e,t,n,r,i,o,s){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Ms(e,t,n,r,i,o,s)),this.mergeVertices()}}class Ts extends So{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}}class As extends go{constructor(e,t){super(),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ts(e,t)),this.mergeVertices()}}class Es extends ss{constructor(e,t={}){const n=t.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new pt;const r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),super(r,t),this.type="TextBufferGeometry"}}class Ps extends go{constructor(e,t){super(),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Es(e,t)),this.mergeVertices()}}class Ls extends pt{constructor(e=1,t=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const o=[],s=[],a=[],l=[],c=new v,h=new v,u=new v;for(let o=0;o<=n;o++)for(let d=0;d<=r;d++){const p=d/r*i,f=o/n*Math.PI*2;h.x=(e+t*Math.cos(f))*Math.cos(p),h.y=(e+t*Math.cos(f))*Math.sin(p),h.z=t*Math.sin(f),s.push(h.x,h.y,h.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),u.subVectors(h,c).normalize(),a.push(u.x,u.y,u.z),l.push(d/r),l.push(o/n)}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,s=(r+1)*(e-1)+t,a=(r+1)*e+t;o.push(n,i,a),o.push(i,s,a)}this.setIndex(o),this.setAttribute("position",new et(s,3)),this.setAttribute("normal",new et(a,3)),this.setAttribute("uv",new et(l,2))}}class Cs extends go{constructor(e,t,n,r,i){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Ls(e,t,n,r,i)),this.mergeVertices()}}class Rs extends pt{constructor(e=1,t=.4,n=64,r=8,i=2,o=3){super(),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},n=Math.floor(n),r=Math.floor(r);const s=[],a=[],l=[],c=[],h=new v,u=new v,d=new v,p=new v,f=new v,m=new v,g=new v;for(let s=0;s<=n;++s){const v=s/n*i*Math.PI*2;y(v,i,o,e,d),y(v+.01,i,o,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=r;++e){const i=e/r*Math.PI*2,o=-t*Math.cos(i),p=t*Math.sin(i);h.x=d.x+(o*g.x+p*f.x),h.y=d.y+(o*g.y+p*f.y),h.z=d.z+(o*g.z+p*f.z),a.push(h.x,h.y,h.z),u.subVectors(h,d).normalize(),l.push(u.x,u.y,u.z),c.push(s/n),c.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,a=(r+1)*(e-1)+t;s.push(n,i,a),s.push(i,o,a)}function y(e,t,n,r,i){const o=Math.cos(e),s=Math.sin(e),a=n/t*e,l=Math.cos(a);i.x=r*(2+l)*.5*o,i.y=r*(2+l)*s*.5,i.z=r*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new et(a,3)),this.setAttribute("normal",new et(l,3)),this.setAttribute("uv",new et(c,2))}}class Is extends go{constructor(e,t,n,r,i,o,s){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==s&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Rs(e,t,n,r,i,o)),this.mergeVertices()}}class Fs extends pt{constructor(e,t=64,n=1,r=8,i=!1){super(),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};const o=e.computeFrenetFrames(t,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new v,l=new v,c=new s;let h=new v;const u=[],d=[],p=[],f=[];function m(i){h=e.getPointAt(i/t,h);const s=o.normals[i],c=o.binormals[i];for(let e=0;e<=r;e++){const t=e/r*Math.PI*2,i=Math.sin(t),o=-Math.cos(t);l.x=o*s.x+i*c.x,l.y=o*s.y+i*c.y,l.z=o*s.z+i*c.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=h.x+n*l.x,a.y=h.y+n*l.y,a.z=h.z+n*l.z,u.push(a.x,a.y,a.z)}}!function(){for(let e=0;e<t;e++)m(e);m(!1===i?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,p.push(c.x,c.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,s=(r+1)*(e-1)+t;f.push(n,i,s),f.push(i,o,s)}}()}(),this.setIndex(f),this.setAttribute("position",new et(u,3)),this.setAttribute("normal",new et(d,3)),this.setAttribute("uv",new et(p,2))}toJSON(){const e=pt.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e}}class Os extends go{constructor(e,t,n,r,i,o){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");const s=new Fs(e,t,n,r,i);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals,this.fromBufferGeometry(s),this.mergeVertices()}}class Ns extends pt{constructor(e){super(),this.type="WireframeGeometry";const t=[],n=[0,0],r={},i=["a","b","c"];if(e&&e.isGeometry){const o=e.faces;for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0;e<3;e++){const o=t[i[e]],s=t[i[(e+1)%3]];n[0]=Math.min(o,s),n[1]=Math.max(o,s);const a=n[0]+","+n[1];void 0===r[a]&&(r[a]={index1:n[0],index2:n[1]})}}for(const n in r){const i=r[n];let o=e.vertices[i.index1];t.push(o.x,o.y,o.z),o=e.vertices[i.index2],t.push(o.x,o.y,o.z)}}else if(e&&e.isBufferGeometry){const i=new v;if(null!==e.index){const o=e.attributes.position,s=e.index;let a=e.groups;0===a.length&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,t=a.length;e<t;++e){const t=a[e],i=t.start;for(let e=i,o=i+t.count;e<o;e+=3)for(let t=0;t<3;t++){const i=s.getX(e+t),o=s.getX(e+(t+1)%3);n[0]=Math.min(i,o),n[1]=Math.max(i,o);const a=n[0]+","+n[1];void 0===r[a]&&(r[a]={index1:n[0],index2:n[1]})}}for(const e in r){const n=r[e];i.fromBufferAttribute(o,n.index1),t.push(i.x,i.y,i.z),i.fromBufferAttribute(o,n.index2),t.push(i.x,i.y,i.z)}}else{const n=e.attributes.position;for(let e=0,r=n.count/3;e<r;e++)for(let r=0;r<3;r++){const o=3*e+r;i.fromBufferAttribute(n,o),t.push(i.x,i.y,i.z);const s=3*e+(r+1)%3;i.fromBufferAttribute(n,s),t.push(i.x,i.y,i.z)}}}this.setAttribute("position",new et(t,3))}}var Ds=Object.freeze({__proto__:null,BoxGeometry:vo,BoxBufferGeometry:Ot,CircleGeometry:xo,CircleBufferGeometry:yo,ConeGeometry:wo,ConeBufferGeometry:Mo,CylinderGeometry:_o,CylinderBufferGeometry:bo,DodecahedronGeometry:Ao,DodecahedronBufferGeometry:To,EdgesGeometry:Ro,ExtrudeGeometry:ls,ExtrudeBufferGeometry:ss,IcosahedronGeometry:hs,IcosahedronBufferGeometry:cs,LatheGeometry:ds,LatheBufferGeometry:us,OctahedronGeometry:fs,OctahedronBufferGeometry:ps,ParametricGeometry:gs,ParametricBufferGeometry:ms,PlaneGeometry:vs,PlaneBufferGeometry:Zt,PolyhedronGeometry:ys,PolyhedronBufferGeometry:So,RingGeometry:bs,RingBufferGeometry:xs,ShapeGeometry:ws,ShapeBufferGeometry:_s,SphereGeometry:Ss,SphereBufferGeometry:Ms,TetrahedronGeometry:As,TetrahedronBufferGeometry:Ts,TextGeometry:Ps,TextBufferGeometry:Es,TorusGeometry:Cs,TorusBufferGeometry:Ls,TorusKnotGeometry:Is,TorusKnotBufferGeometry:Rs,TubeGeometry:Os,TubeBufferGeometry:Fs,WireframeGeometry:Ns});function Bs(e){Ge.call(this),this.type="ShadowMaterial",this.color=new Ue(0),this.transparent=!0,this.setValues(e)}function Us(e){Ut.call(this,e),this.type="RawShaderMaterial"}function ks(e){Ge.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ue(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function zs(e){ks.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new s(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(e){this.reflectivity=o.clamp(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(e)}function Gs(e){Ge.call(this),this.type="MeshPhongMaterial",this.color=new Ue(16777215),this.specular=new Ue(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Hs(e){Ge.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ue(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function js(e){Ge.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Vs(e){Ge.call(this),this.type="MeshLambertMaterial",this.color=new Ue(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ws(e){Ge.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ue(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new s(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Xs(e){ji.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Bs.prototype=Object.create(Ge.prototype),Bs.prototype.constructor=Bs,Bs.prototype.isShadowMaterial=!0,Bs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this},Us.prototype=Object.create(Ut.prototype),Us.prototype.constructor=Us,Us.prototype.isRawShaderMaterial=!0,ks.prototype=Object.create(Ge.prototype),ks.prototype.constructor=ks,ks.prototype.isMeshStandardMaterial=!0,ks.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},zs.prototype=Object.create(ks.prototype),zs.prototype.constructor=zs,zs.prototype.isMeshPhysicalMaterial=!0,zs.prototype.copy=function(e){return ks.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new Ue).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this},Gs.prototype=Object.create(Ge.prototype),Gs.prototype.constructor=Gs,Gs.prototype.isMeshPhongMaterial=!0,Gs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Hs.prototype=Object.create(Ge.prototype),Hs.prototype.constructor=Hs,Hs.prototype.isMeshToonMaterial=!0,Hs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},js.prototype=Object.create(Ge.prototype),js.prototype.constructor=js,js.prototype.isMeshNormalMaterial=!0,js.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Vs.prototype=Object.create(Ge.prototype),Vs.prototype.constructor=Vs,Vs.prototype.isMeshLambertMaterial=!0,Vs.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Ws.prototype=Object.create(Ge.prototype),Ws.prototype.constructor=Ws,Ws.prototype.isMeshMatcapMaterial=!0,Ws.prototype.copy=function(e){return Ge.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Xs.prototype=Object.create(ji.prototype),Xs.prototype.constructor=Xs,Xs.prototype.isLineDashedMaterial=!0,Xs.prototype.copy=function(e){return ji.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Ys=Object.freeze({__proto__:null,ShadowMaterial:Bs,SpriteMaterial:ci,RawShaderMaterial:Us,ShaderMaterial:Ut,PointsMaterial:eo,MeshPhysicalMaterial:zs,MeshStandardMaterial:ks,MeshPhongMaterial:Gs,MeshToonMaterial:Hs,MeshNormalMaterial:js,MeshLambertMaterial:Vs,MeshDepthMaterial:Vr,MeshDistanceMaterial:Wr,MeshBasicMaterial:He,MeshMatcapMaterial:Ws,LineDashedMaterial:Xs,LineBasicMaterial:ji,Material:Ge});const qs={arraySlice:function(e,t,n){return qs.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const r=e.length,i=new e.constructor(r);for(let o=0,s=0;s!==r;++o){const r=n[o]*t;for(let n=0;n!==t;++n)i[s++]=e[r+n]}return i},flattenJSON:function(e,t,n,r){let i=1,o=e[0];for(;void 0!==o&&void 0===o[r];)o=e[i++];if(void 0===o)return;let s=o[r];if(void 0!==s)if(Array.isArray(s))do{s=o[r],void 0!==s&&(t.push(o.time),n.push.apply(n,s)),o=e[i++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[r],void 0!==s&&(t.push(o.time),s.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{s=o[r],void 0!==s&&(t.push(o.time),n.push(s)),o=e[i++]}while(void 0!==o)},subclip:function(e,t,n,r,i=30){const o=e.clone();o.name=t;const s=[];for(let e=0;e<o.tracks.length;++e){const t=o.tracks[e],a=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const o=t.times[e]*i;if(!(o<n||o>=r)){l.push(t.times[e]);for(let n=0;n<a;++n)c.push(t.values[e*a+n])}}0!==l.length&&(t.times=qs.convertArray(l,t.times.constructor),t.values=qs.convertArray(c,t.values.constructor),s.push(t))}o.tracks=s;let a=1/0;for(let e=0;e<o.tracks.length;++e)a>o.tracks[e].times[0]&&(a=o.tracks[e].times[0]);for(let e=0;e<o.tracks.length;++e)o.tracks[e].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(e,t=0,n=e,r=30){r<=0&&(r=30);const i=n.tracks.length,o=t/r;for(let t=0;t<i;++t){const r=n.tracks[t],i=r.ValueTypeName;if("bool"===i||"string"===i)continue;const s=e.tracks.find((function(e){return e.name===r.name&&e.ValueTypeName===i}));if(void 0===s)continue;let a=0;const l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=r.times.length-1;let d;if(o<=r.times[0]){const e=a,t=l-a;d=qs.arraySlice(r.values,e,t)}else if(o>=r.times[u]){const e=u*l+a,t=e+l-a;d=qs.arraySlice(r.values,e,t)}else{const e=r.createInterpolant(),t=a,n=l-a;e.evaluate(o),d=qs.arraySlice(e.resultBuffer,t,n)}if("quaternion"===i){(new g).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let e=0;e<p;++e){const t=e*h+c;if("quaternion"===i)g.multiplyQuaternionsFlat(s.values,t,d,0,s.values,t);else{const e=h-2*c;for(let n=0;n<e;++n)s.values[t+n]-=d[n]}}}return e.blendMode=2501,e}};function Qs(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Zs(e,t,n,r){Qs.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Js(e,t,n,r){Qs.call(this,e,t,n,r)}function Ks(e,t,n,r){Qs.call(this,e,t,n,r)}function $s(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=qs.convertArray(t,this.TimeBufferType),this.values=qs.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function ea(e,t,n){$s.call(this,e,t,n)}function ta(e,t,n,r){$s.call(this,e,t,n,r)}function na(e,t,n,r){$s.call(this,e,t,n,r)}function ra(e,t,n,r){Qs.call(this,e,t,n,r)}function ia(e,t,n,r){$s.call(this,e,t,n,r)}function oa(e,t,n,r){$s.call(this,e,t,n,r)}function sa(e,t,n,r){$s.call(this,e,t,n,r)}function aa(e,t=-1,n,r=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=o.generateUUID(),this.duration<0&&this.resetDuration()}function la(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return na;case"vector":case"vector2":case"vector3":case"vector4":return sa;case"color":return ta;case"quaternion":return ia;case"bool":case"boolean":return ea;case"string":return oa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];qs.flattenJSON(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(Qs.prototype,{evaluate:function(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{let o;n:{r:if(!(e<r)){for(let o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break t}o=t.length;break n}if(e>=i)break e;{const s=t[1];e<s&&(n=2,i=s);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}o=n,n=0}}for(;n<o;){const r=n+o>>>1;e<t[r]?o=r:n=r+1}if(r=t[n],i=t[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Qs.prototype,{beforeStart_:Qs.prototype.copySampleValue_,afterEnd_:Qs.prototype.copySampleValue_}),Zs.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Zs,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,n){const r=this.parameterPositions;let i=e-2,o=e+1,s=r[i],a=r[o];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:i=e,s=2*t-n;break;case 2402:i=r.length-2,s=t+r[i]-r[i+1];break;default:i=e,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:o=e,a=2*n-t;break;case 2402:o=1,a=n+r[1]-r[0];break;default:o=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(a-n),this._offsetPrev=i*c,this._offsetNext=o*c},interpolate_:function(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=e*s,l=a-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let e=0;e!==s;++e)i[e]=g*o[c+e]+v*o[l+e]+y*o[a+e]+x*o[h+e];return i}}),Js.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Js,interpolate_:function(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=e*s,l=a-s,c=(n-t)/(r-t),h=1-c;for(let e=0;e!==s;++e)i[e]=o[l+e]*h+o[a+e]*c;return i}}),Ks.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Ks,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign($s,{toJSON:function(e){const t=e.constructor;let n;if(void 0!==t.toJSON)n=t.toJSON(e);else{n={name:e.name,times:qs.convertArray(e.times,Array),values:qs.convertArray(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}}),Object.assign($s.prototype,{constructor:$s,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new Ks(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Js(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Zs(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this},scale:function(e){if(1!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this},trim:function(e,t){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<e;)++i;for(;-1!==o&&n[o]>t;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);const e=this.getValueSize();this.times=qs.arraySlice(n,i,o),this.values=qs.arraySlice(this.values,i*e,o*e)}return this},validate:function(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let t=0;t!==i;t++){const r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,o),e=!1;break}o=r}if(void 0!==r&&qs.isTypedArray(r))for(let t=0,n=r.length;t!==n;++t){const n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e},optimize:function(){const e=qs.arraySlice(this.times),t=qs.arraySlice(this.values),n=this.getValueSize(),r=2302===this.getInterpolation(),i=e.length-1;let o=1;for(let s=1;s<i;++s){let i=!1;const a=e[s];if(a!==e[s+1]&&(1!==s||a!==a[0]))if(r)i=!0;else{const e=s*n,r=e-n,o=e+n;for(let s=0;s!==n;++s){const n=t[e+s];if(n!==t[r+s]||n!==t[o+s]){i=!0;break}}}if(i){if(s!==o){e[o]=e[s];const r=s*n,i=o*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++o}}if(i>0){e[o]=e[i];for(let e=i*n,r=o*n,s=0;s!==n;++s)t[r+s]=t[e+s];++o}return o!==e.length?(this.times=qs.arraySlice(e,0,o),this.values=qs.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this},clone:function(){const e=qs.arraySlice(this.times,0),t=qs.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),ea.prototype=Object.assign(Object.create($s.prototype),{constructor:ea,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ta.prototype=Object.assign(Object.create($s.prototype),{constructor:ta,ValueTypeName:"color"}),na.prototype=Object.assign(Object.create($s.prototype),{constructor:na,ValueTypeName:"number"}),ra.prototype=Object.assign(Object.create(Qs.prototype),{constructor:ra,interpolate_:function(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-t)/(r-t);let l=e*s;for(let e=l+s;l!==e;l+=4)g.slerpFlat(i,0,o,l-s,o,l,a);return i}}),ia.prototype=Object.assign(Object.create($s.prototype),{constructor:ia,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new ra(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),oa.prototype=Object.assign(Object.create($s.prototype),{constructor:oa,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),sa.prototype=Object.assign(Object.create($s.prototype),{constructor:sa,ValueTypeName:"vector"}),Object.assign(aa,{parse:function(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(la(n[e]).scale(r));const i=new aa(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i},toJSON:function(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push($s.toJSON(n[e]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){const i=t.length,o=[];for(let e=0;e<i;e++){let s=[],a=[];s.push((e+i-1)%i,e,(e+1)%i),a.push(0,1,0);const l=qs.getKeyframeOrder(s);s=qs.sortedArray(s,1,l),a=qs.sortedArray(a,1,l),r||0!==s[0]||(s.push(i),a.push(a[0])),o.push(new na(".morphTargetInfluences["+t[e].name+"]",s,a).scale(1/n))}return new aa(e,-1,o)},findByName:function(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],o=n.name.match(i);if(o&&o.length>1){const e=o[1];let t=r[e];t||(r[e]=t=[]),t.push(n)}}const o=[];for(const e in r)o.push(aa.CreateFromMorphTargetSequence(e,r[e],t,n));return o},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,r,i){if(0!==n.length){const o=[],s=[];qs.flattenJSON(n,o,s,r),0!==o.length&&i.push(new e(t,o,s))}},r=[],i=e.name||"default",o=e.fps||30,s=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const i=l[e].keys;if(i&&0!==i.length)if(i[0].morphTargets){const e={};let t;for(t=0;t<i.length;t++)if(i[t].morphTargets)for(let n=0;n<i[t].morphTargets.length;n++)e[i[t].morphTargets[n]]=-1;for(const n in e){const e=[],o=[];for(let r=0;r!==i[t].morphTargets.length;++r){const r=i[t];e.push(r.time),o.push(r.morphTarget===n?1:0)}r.push(new na(".morphTargetInfluence["+n+"]",e,o))}a=e.length*(o||1)}else{const o=".bones["+t[e].name+"]";n(sa,o+".position",i,"pos",r),n(ia,o+".quaternion",i,"rot",r),n(sa,o+".scale",i,"scl",r)}}if(0===r.length)return null;return new aa(i,a,r,s)}}),Object.assign(aa.prototype,{resetDuration:function(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this},trim:function(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new aa(this.name,this.duration,e,this.blendMode)},toJSON:function(){return aa.toJSON(this)}});const ca={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function ha(e,t,n){const r=this;let i,o=!1,s=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===o&&void 0!==r.onStart&&r.onStart(e,s,a),o=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,a),s===a&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],r=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null}}const ua=new ha;function da(e){this.manager=void 0!==e?e:ua,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(da.prototype,{load:function(){},loadAsync:function(e,t){const n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});const pa={};function fa(e){da.call(this,e)}function ma(e){da.call(this,e)}function ga(e){da.call(this,e)}function va(e){da.call(this,e)}function ya(e){da.call(this,e)}function xa(e){da.call(this,e)}function ba(e){da.call(this,e)}function _a(){this.type="Curve",this.arcLengthDivisions=200}function wa(e,t,n,r,i,o,s,a){_a.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=s||!1,this.aRotation=a||0}function Ma(e,t,n,r,i,o){wa.call(this,e,t,n,n,r,i,o),this.type="ArcCurve"}function Sa(){let e=0,t=0,n=0,r=0;function i(i,o,s,a){e=i,t=s,n=-3*i+3*o-2*s-a,r=2*i-2*o+s+a}return{initCatmullRom:function(e,t,n,r,o){i(t,n,o*(n-e),o*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,o,s,a){let l=(t-e)/o-(n-e)/(o+s)+(n-t)/s,c=(n-t)/s-(r-t)/(s+a)+(r-n)/a;l*=s,c*=s,i(t,n,l,c)},calc:function(i){const o=i*i;return e+t*i+n*o+r*(o*i)}}}fa.prototype=Object.assign(Object.create(da.prototype),{constructor:fa,load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=ca.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;if(void 0!==pa[e])return void pa[e].push({onLoad:t,onProgress:n,onError:r});const s=e.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const n=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let r;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const e=new Uint8Array(a.length);for(let t=0;t<a.length;t++)e[t]=a.charCodeAt(t);r="blob"===o?new Blob([e.buffer],{type:n}):e.buffer;break;case"document":const t=new DOMParser;r=t.parseFromString(a,n);break;case"json":r=JSON.parse(a);break;default:r=a}setTimeout((function(){t&&t(r),i.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{pa[e]=[],pa[e].push({onLoad:t,onProgress:n,onError:r}),a=new XMLHttpRequest,a.open("GET",e,!0),a.addEventListener("load",(function(t){const n=this.response,r=pa[e];if(delete pa[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ca.add(e,n);for(let e=0,t=r.length;e<t;e++){const t=r[e];t.onLoad&&t.onLoad(n)}i.manager.itemEnd(e)}else{for(let e=0,n=r.length;e<n;e++){const n=r[e];n.onError&&n.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),a.addEventListener("progress",(function(t){const n=pa[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onProgress&&r.onProgress(t)}}),!1),a.addEventListener("error",(function(t){const n=pa[e];delete pa[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onError&&r.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),a.addEventListener("abort",(function(t){const n=pa[e];delete pa[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onError&&r.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const e in this.requestHeader)a.setRequestHeader(e,this.requestHeader[e]);a.send(null)}return i.manager.itemStart(e),a},setResponseType:function(e){return this.responseType=e,this},setMimeType:function(e){return this.mimeType=e,this}}),ma.prototype=Object.assign(Object.create(da.prototype),{constructor:ma,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){const t=[];for(let n=0;n<e.length;n++){const r=aa.parse(e[n]);t.push(r)}return t}}),ga.prototype=Object.assign(Object.create(da.prototype),{constructor:ga,load:function(e,t,n,r){const i=this,o=[],s=new lo,a=new fa(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials);let l=0;function c(c){a.load(e[c],(function(e){const n=i.parse(e,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(s.minFilter=1006),s.image=o,s.format=n.format,s.needsUpdate=!0,t&&t(s))}),n,r)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else a.load(e,(function(e){const n=i.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){o[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)o[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),o[t].format=n.format,o[t].width=n.width,o[t].height=n.height}s.image=o}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=1006),s.format=n.format,s.needsUpdate=!0,t&&t(s)}),n,r);return s}}),va.prototype=Object.assign(Object.create(da.prototype),{constructor:va,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=ca.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),ca.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),i.manager.itemStart(e),s.src=e,s}}),ya.prototype=Object.assign(Object.create(da.prototype),{constructor:ya,load:function(e,t,n,r){const i=new Ht,o=new va(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(e[n],(function(e){i.images[n]=e,s++,6===s&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(let t=0;t<e.length;++t)a(t);return i}}),xa.prototype=Object.assign(Object.create(da.prototype),{constructor:xa,load:function(e,t,n,r){const i=this,o=new Vt,s=new fa(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(i.withCredentials),s.load(e,(function(e){const n=i.parse(e);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:1001,o.wrapT=void 0!==n.wrapT?n.wrapT:1001,o.magFilter=void 0!==n.magFilter?n.magFilter:1006,o.minFilter=void 0!==n.minFilter?n.minFilter:1006,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=1008),1===n.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,t&&t(o,n))}),n,r),o}}),ba.prototype=Object.assign(Object.create(da.prototype),{constructor:ba,load:function(e,t,n,r){const i=new u,o=new va(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,(function(n){i.image=n;const r=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=r?1022:1023,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}),Object.assign(_a.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){const e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),i=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){const n=this.getLengths();let r=0;const i=n.length;let o;o=t||e*n[i-1];let s,a=0,l=i-1;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),s=n[r]-o,s<0)a=r+1;else{if(!(s>0)){l=r;break}l=r-1}if(r=l,n[r]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)},getTangent:function(e,t){const n=1e-4;let r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);const o=this.getPoint(r),a=this.getPoint(i),l=t||(o.isVector2?new s:new v);return l.copy(a).sub(o).normalize(),l},getTangentAt:function(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){const n=new v,r=[],i=[],s=[],a=new v,l=new W;for(let t=0;t<=e;t++){const n=t/e;r[t]=this.getTangentAt(n,new v),r[t].normalize()}i[0]=new v,s[0]=new v;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),s[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(r[t-1],r[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(o.clamp(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(l.makeRotationAxis(a,e))}s[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(o.clamp(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(a.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(l.makeRotationAxis(r[n],t*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),wa.prototype=Object.create(_a.prototype),wa.prototype.constructor=wa,wa.prototype.isEllipseCurve=!0,wa.prototype.getPoint=function(e,t){const n=t||new s,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const a=this.aStartAngle+e*i;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=l-this.aX,r=c-this.aY;l=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(l,c)},wa.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},wa.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},wa.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ma.prototype=Object.create(wa.prototype),Ma.prototype.constructor=Ma,Ma.prototype.isArcCurve=!0;const Ta=new v,Aa=new Sa,Ea=new Sa,Pa=new Sa;function La(e=[],t=!1,n="centripetal",r=.5){_a.call(this),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}function Ca(e,t,n,r,i){const o=.5*(r-t),s=.5*(i-n),a=e*e;return(2*n-2*r+o+s)*(e*a)+(-3*n+3*r-2*o-s)*a+o*e+n}function Ra(e,t,n,r){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function Ia(e,t,n,r,i){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}function Fa(e=new s,t=new s,n=new s,r=new s){_a.call(this),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}function Oa(e=new v,t=new v,n=new v,r=new v){_a.call(this),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}function Na(e=new s,t=new s){_a.call(this),this.type="LineCurve",this.v1=e,this.v2=t}function Da(e=new v,t=new v){_a.call(this),this.type="LineCurve3",this.v1=e,this.v2=t}function Ba(e=new s,t=new s,n=new s){_a.call(this),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}function Ua(e=new v,t=new v,n=new v){_a.call(this),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}function ka(e=[]){_a.call(this),this.type="SplineCurve",this.points=e}La.prototype=Object.create(_a.prototype),La.prototype.constructor=La,La.prototype.isCatmullRomCurve3=!0,La.prototype.getPoint=function(e,t=new v){const n=t,r=this.points,i=r.length,o=(i-(this.closed?0:1))*e;let s,a,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?s=r[(l-1)%i]:(Ta.subVectors(r[0],r[1]).add(r[0]),s=Ta);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2<i?a=r[(l+2)%i]:(Ta.subVectors(r[i-1],r[i-2]).add(r[i-1]),a=Ta),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(s.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(u),e),r=Math.pow(u.distanceToSquared(a),e);n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),Aa.initNonuniformCatmullRom(s.x,h.x,u.x,a.x,t,n,r),Ea.initNonuniformCatmullRom(s.y,h.y,u.y,a.y,t,n,r),Pa.initNonuniformCatmullRom(s.z,h.z,u.z,a.z,t,n,r)}else"catmullrom"===this.curveType&&(Aa.initCatmullRom(s.x,h.x,u.x,a.x,this.tension),Ea.initCatmullRom(s.y,h.y,u.y,a.y,this.tension),Pa.initCatmullRom(s.z,h.z,u.z,a.z,this.tension));return n.set(Aa.calc(c),Ea.calc(c),Pa.calc(c)),n},La.prototype.copy=function(e){_a.prototype.copy.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},La.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},La.prototype.fromJSON=function(e){_a.prototype.fromJSON.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new v).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Fa.prototype=Object.create(_a.prototype),Fa.prototype.constructor=Fa,Fa.prototype.isCubicBezierCurve=!0,Fa.prototype.getPoint=function(e,t=new s){const n=t,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(Ia(e,r.x,i.x,o.x,a.x),Ia(e,r.y,i.y,o.y,a.y)),n},Fa.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Fa.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Fa.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Oa.prototype=Object.create(_a.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isCubicBezierCurve3=!0,Oa.prototype.getPoint=function(e,t=new v){const n=t,r=this.v0,i=this.v1,o=this.v2,s=this.v3;return n.set(Ia(e,r.x,i.x,o.x,s.x),Ia(e,r.y,i.y,o.y,s.y),Ia(e,r.z,i.z,o.z,s.z)),n},Oa.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Oa.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Oa.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Na.prototype=Object.create(_a.prototype),Na.prototype.constructor=Na,Na.prototype.isLineCurve=!0,Na.prototype.getPoint=function(e,t=new s){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Na.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Na.prototype.getTangent=function(e,t){const n=t||new s;return n.copy(this.v2).sub(this.v1).normalize(),n},Na.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Na.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Na.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Da.prototype=Object.create(_a.prototype),Da.prototype.constructor=Da,Da.prototype.isLineCurve3=!0,Da.prototype.getPoint=function(e,t=new v){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Da.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Da.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Da.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Da.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ba.prototype=Object.create(_a.prototype),Ba.prototype.constructor=Ba,Ba.prototype.isQuadraticBezierCurve=!0,Ba.prototype.getPoint=function(e,t=new s){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(Ra(e,r.x,i.x,o.x),Ra(e,r.y,i.y,o.y)),n},Ba.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ba.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ba.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ua.prototype=Object.create(_a.prototype),Ua.prototype.constructor=Ua,Ua.prototype.isQuadraticBezierCurve3=!0,Ua.prototype.getPoint=function(e,t=new v){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(Ra(e,r.x,i.x,o.x),Ra(e,r.y,i.y,o.y),Ra(e,r.z,i.z,o.z)),n},Ua.prototype.copy=function(e){return _a.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ua.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ua.prototype.fromJSON=function(e){return _a.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ka.prototype=Object.create(_a.prototype),ka.prototype.constructor=ka,ka.prototype.isSplineCurve=!0,ka.prototype.getPoint=function(e,t=new s){const n=t,r=this.points,i=(r.length-1)*e,o=Math.floor(i),a=i-o,l=r[0===o?o:o-1],c=r[o],h=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(Ca(a,l.x,c.x,h.x,u.x),Ca(a,l.y,c.y,h.y,u.y)),n},ka.prototype.copy=function(e){_a.prototype.copy.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this},ka.prototype.toJSON=function(){const e=_a.prototype.toJSON.call(this);e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e},ka.prototype.fromJSON=function(e){_a.prototype.fromJSON.call(this,e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new s).fromArray(n))}return this};var za=Object.freeze({__proto__:null,ArcCurve:Ma,CatmullRomCurve3:La,CubicBezierCurve:Fa,CubicBezierCurve3:Oa,EllipseCurve:wa,LineCurve:Na,LineCurve3:Da,QuadraticBezierCurve:Ba,QuadraticBezierCurve3:Ua,SplineCurve:ka});function Ga(){_a.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Ha(e){Ga.call(this),this.type="Path",this.currentPoint=new s,e&&this.setFromPoints(e)}function ja(e){Ha.call(this,e),this.uuid=o.generateUUID(),this.type="Shape",this.holes=[]}function Va(e,t=1){ge.call(this),this.type="Light",this.color=new Ue(e),this.intensity=t}function Wa(e,t,n){Va.call(this,e,n),this.type="HemisphereLight",this.position.copy(ge.DefaultUp),this.updateMatrix(),this.groundColor=new Ue(t)}function Xa(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new s(512,512),this.map=null,this.mapPass=null,this.matrix=new W,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yt,this._frameExtents=new s(1,1),this._viewportCount=1,this._viewports=[new p(0,0,1,1)]}function Ya(){Xa.call(this,new zt(50,1,.5,500)),this.focus=1}function qa(e,t,n,r,i,o){Va.call(this,e,t),this.type="SpotLight",this.position.copy(ge.DefaultUp),this.updateMatrix(),this.target=new ge,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Ya}function Qa(){Xa.call(this,new zt(90,1,.5,500)),this._frameExtents=new s(4,2),this._viewportCount=6,this._viewports=[new p(2,1,1,1),new p(0,1,1,1),new p(3,1,1,1),new p(1,1,1,1),new p(3,0,1,1),new p(1,0,1,1)],this._cubeDirections=[new v(1,0,0),new v(-1,0,0),new v(0,0,1),new v(0,0,-1),new v(0,1,0),new v(0,-1,0)],this._cubeUps=[new v(0,1,0),new v(0,1,0),new v(0,1,0),new v(0,1,0),new v(0,0,1),new v(0,0,-1)]}function Za(e,t,n,r){Va.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new Qa}function Ja(e=-1,t=1,n=1,r=-1,i=.1,o=2e3){kt.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=o,this.updateProjectionMatrix()}function Ka(){Xa.call(this,new Ja(-5,5,5,-5,.5,500))}function $a(e,t){Va.call(this,e,t),this.type="DirectionalLight",this.position.copy(ge.DefaultUp),this.updateMatrix(),this.target=new ge,this.shadow=new Ka}function el(e,t){Va.call(this,e,t),this.type="AmbientLight"}function tl(e,t,n,r){Va.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}Ga.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ga,add:function(e){this.curves.push(e)},closePath:function(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Na(t,e))},getPoint:function(e){const t=e*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=t){const e=n[r]-t,i=this.curves[r],o=i.getLength(),s=0===o?0:1-e/o;return i.getPointAt(s)}r++}return null},getLength:function(){const e=this.getCurveLengths();return e[e.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 e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e=12){const t=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],s=o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,a=o.getPoints(s);for(let e=0;e<a.length;e++){const r=a[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){_a.prototype.copy.call(this,e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){const e=_a.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e},fromJSON:function(e){_a.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new za[n.type]).fromJSON(n))}return this}}),Ha.prototype=Object.assign(Object.create(Ga.prototype),{constructor:Ha,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){const n=new Na(this.currentPoint.clone(),new s(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){const i=new Ba(this.currentPoint.clone(),new s(e,t),new s(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,o){const a=new Fa(this.currentPoint.clone(),new s(e,t),new s(n,r),new s(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this},splineThru:function(e){const t=new ka([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(e+s,t+a,n,r,i,o),this},absarc:function(e,t,n,r,i,o){return this.absellipse(e,t,n,n,r,i,o),this},ellipse:function(e,t,n,r,i,o,s,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,r,i,o,s,a),this},absellipse:function(e,t,n,r,i,o,s,a){const l=new wa(e,t,n,r,i,o,s,a);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this},copy:function(e){return Ga.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){const e=Ga.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Ga.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ja.prototype=Object.assign(Object.create(Ha.prototype),{constructor:ja,getPointsHoles:function(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Ha.prototype.copy.call(this,e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this},toJSON:function(){const e=Ha.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e},fromJSON:function(e){Ha.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new Ha).fromJSON(n))}return this}}),Va.prototype=Object.assign(Object.create(ge.prototype),{constructor:Va,isLight:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Wa.prototype=Object.assign(Object.create(Va.prototype),{constructor:Wa,isHemisphereLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Xa.prototype,{_projScreenMatrix:new W,_lightPositionWorld:new v,_lookTarget:new v,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){const t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(e.matrixWorld),t.position.copy(o),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ya.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Ya,isSpotLightShadow:!0,updateMatrices:function(e){const t=this.camera,n=2*o.RAD2DEG*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),Xa.prototype.updateMatrices.call(this,e)}}),qa.prototype=Object.assign(Object.create(Va.prototype),{constructor:qa,isSpotLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Qa.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Qa,isPointLightShadow:!0,updateMatrices:function(e,t=0){const n=this.camera,r=this.matrix,i=this._lightPositionWorld,o=this._lookTarget,s=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),o.copy(n.position),o.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(o),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),s.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(s)}}),Za.prototype=Object.assign(Object.create(Va.prototype),{constructor:Za,isPointLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Ja.prototype=Object.assign(Object.create(kt.prototype),{constructor:Ja,isOrthographicCamera:!0,copy:function(e,t){return kt.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,o){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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-e,o=n+e,s=r+t,a=r-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,o=i+e*this.view.width,s-=t*this.view.offsetY,a=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(e){const t=ge.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),Ka.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Ka,isDirectionalLightShadow:!0,updateMatrices:function(e){Xa.prototype.updateMatrices.call(this,e)}}),$a.prototype=Object.assign(Object.create(Va.prototype),{constructor:$a,isDirectionalLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),el.prototype=Object.assign(Object.create(Va.prototype),{constructor:el,isAmbientLight:!0}),tl.prototype=Object.assign(Object.create(Va.prototype),{constructor:tl,isRectAreaLight:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){const t=Va.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});class nl{constructor(){Object.defineProperty(this,"isSphericalHarmonics3",{value:!0}),this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new v)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*i),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],n*r*1.092548),t.addScaledVector(o[5],r*i*1.092548),t.addScaledVector(o[6],.315392*(3*i*i-1)),t.addScaledVector(o[7],n*i*1.092548),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*r),t.addScaledVector(o[2],1.023328*i),t.addScaledVector(o[3],1.023328*n),t.addScaledVector(o[4],.858086*n*r),t.addScaledVector(o[5],.858086*r*i),t.addScaledVector(o[6],.743125*i*i-.247708),t.addScaledVector(o[7],.858086*n*i),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){const n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}function rl(e,t){Va.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new nl}function il(e){da.call(this,e),this.textures={}}rl.prototype=Object.assign(Object.create(Va.prototype),{constructor:rl,isLightProbe:!0,copy:function(e){return Va.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){const t=Va.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),il.prototype=Object.assign(Object.create(da.prototype),{constructor:il,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const r=new Ys[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=(new Ue).setHex(e.sheen)),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(r.morphNormals=e.morphNormals),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.vertexTangents&&(r.vertexTangents=e.vertexTangents),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=n(i.value);break;case"c":r.uniforms[t].value=(new Ue).setHex(i.value);break;case"v2":r.uniforms[t].value=(new s).fromArray(i.value);break;case"v3":r.uniforms[t].value=(new v).fromArray(i.value);break;case"v4":r.uniforms[t].value=(new p).fromArray(i.value);break;case"m3":r.uniforms[t].value=(new a).fromArray(i.value);break;case"m4":r.uniforms[t].value=(new W).fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=(new s).fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new s).fromArray(e.clearcoatNormalScale)),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),r},setTextures:function(e){return this.textures=e,this}});const ol={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){const t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function sl(){pt.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function al(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),We.call(this,e,t,n),this.meshPerAttribute=r||1}function ll(e){da.call(this,e)}sl.prototype=Object.assign(Object.create(pt.prototype),{constructor:sl,isInstancedBufferGeometry:!0,copy:function(e){return pt.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const e=pt.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),al.prototype=Object.assign(Object.create(We.prototype),{constructor:al,isInstancedBufferAttribute:!0,copy:function(e){return We.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){const e=We.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),ll.prototype=Object.assign(Object.create(da.prototype),{constructor:ll,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){const t={},n={};function r(e,r){if(void 0!==t[r])return t[r];const i=e.interleavedBuffers[r],o=function(e,t){if(void 0!==n[t])return n[t];const r=e.arrayBuffers[t],i=new Uint32Array(r).buffer;return n[t]=i,i}(e,i.buffer),s=new si(ot(i.type,o),i.stride);return s.uuid=i.uuid,t[r]=s,s}const i=e.isInstancedBufferGeometry?new sl:new pt,o=e.data.index;if(void 0!==o){const e=ot(o.type,o.array);i.setIndex(new We(e,1))}const s=e.data.attributes;for(const t in s){const n=s[t];let o;if(n.isInterleavedBufferAttribute){o=new li(r(e.data,n.data),n.itemSize,n.offset,n.normalized)}else{const e=ot(n.type,n.array);o=new(n.isInstancedBufferAttribute?al:We)(e,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),i.setAttribute(t,o)}const a=e.data.morphAttributes;if(a)for(const t in a){const n=a[t],o=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];let s;if(i.isInterleavedBufferAttribute){s=new li(r(e.data,i.data),i.itemSize,i.offset,i.normalized)}else{s=new We(ot(i.type,i.array),i.itemSize,i.normalized)}void 0!==i.name&&(s.name=i.name),o.push(s)}i.morphAttributes[t]=o}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];i.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new v;void 0!==c.center&&e.fromArray(c.center),i.boundingSphere=new D(e,c.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}});const cl={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},hl={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},ul={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};function dl(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),da.call(this,e),this.options={premultiplyAlpha:"none"}}function pl(){this.type="ShapePath",this.color=new Ue,this.subPaths=[],this.currentPath=null}function fl(e){this.type="Font",this.data=e}function ml(e,t,n,r,i){const o=i.glyphs[e]||i.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".");const s=new pl;let a,l,c,h,u,d,p,f;if(o.o){const e=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let i=0,o=e.length;i<o;){switch(e[i++]){case"m":a=e[i++]*t+n,l=e[i++]*t+r,s.moveTo(a,l);break;case"l":a=e[i++]*t+n,l=e[i++]*t+r,s.lineTo(a,l);break;case"q":c=e[i++]*t+n,h=e[i++]*t+r,u=e[i++]*t+n,d=e[i++]*t+r,s.quadraticCurveTo(u,d,c,h);break;case"b":c=e[i++]*t+n,h=e[i++]*t+r,u=e[i++]*t+n,d=e[i++]*t+r,p=e[i++]*t+n,f=e[i++]*t+r,s.bezierCurveTo(u,d,p,f,c,h)}}}return{offsetX:o.ha*t,path:s}}function gl(e){da.call(this,e)}let vl;dl.prototype=Object.assign(Object.create(da.prototype),{constructor:dl,isImageBitmapLoader:!0,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=ca.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,i.options)})).then((function(n){ca.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}),Object.assign(pl.prototype,{moveTo:function(e,t){return this.currentPath=new Ha,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,o){return this.currentPath.bezierCurveTo(e,t,n,r,i,o),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n],i=new ja;i.curves=r.curves,t.push(i)}return t}function r(e,t){const n=t.length;let r=!1;for(let i=n-1,o=0;o<n;i=o++){let n=t[i],s=t[o],a=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[o],a=-a,s=t[i],l=-l),e.y<n.y||e.y>s.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return r}const i=rs.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);let s,a,l;const c=[];if(1===o.length)return a=o[0],l=new ja,l.curves=a.curves,c.push(l),c;let h=!i(o[0].getPoints());h=e?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=o.length;t<n;t++)a=o[t],p=a.getPoints(),s=i(p),s=e?!s:s,s?(!h&&d[g]&&g++,d[g]={s:new ja,p:p},d[g].s.curves=a.curves,h&&g++,m[g]=[]):m[g].push({h:a,p:p[0]});if(!d[0])return n(o);if(d.length>1){let e=!1;const t=[];for(let e=0,t=d.length;e<t;e++)u[e]=[];for(let n=0,i=d.length;n<i;n++){const i=m[n];for(let o=0;o<i.length;o++){const s=i[o];let a=!0;for(let i=0;i<d.length;i++)r(s.p,d[i].p)&&(n!==i&&t.push({froms:n,tos:i,hole:o}),a?(a=!1,u[i].push(s)):e=!0);a&&u[n].push(s)}}t.length>0&&(e||(m=u))}for(let e=0,t=d.length;e<t;e++){l=d[e].s,c.push(l),f=m[e];for(let e=0,t=f.length;e<t;e++)l.holes.push(f[e].h)}return c}}),Object.assign(fl.prototype,{isFont:!0,generateShapes:function(e,t=100){const n=[],r=function(e,t,n){const r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,s=[];let a=0,l=0;for(let e=0;e<r.length;e++){const t=r[e];if("\n"===t)a=0,l-=o;else{const e=ml(t,i,a,l,n);a+=e.offsetX,s.push(e.path)}}return s}(e,t,this.data);for(let e=0,t=r.length;e<t;e++)Array.prototype.push.apply(n,r[e].toShapes());return n}}),gl.prototype=Object.assign(Object.create(da.prototype),{constructor:gl,load:function(e,t,n,r){const i=this,o=new fa(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){let n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}const r=i.parse(n);t&&t(r)}),n,r)},parse:function(e){return new fl(e)}});const yl={getContext:function(){return void 0===vl&&(vl=new(window.AudioContext||window.webkitAudioContext)),vl},setContext:function(e){vl=e}};function xl(e){da.call(this,e)}function bl(e,t,n){rl.call(this,void 0,n);const r=(new Ue).set(e),i=(new Ue).set(t),o=new v(r.r,r.g,r.b),s=new v(i.r,i.g,i.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}function _l(e,t){rl.call(this,void 0,t);const n=(new Ue).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}xl.prototype=Object.assign(Object.create(da.prototype),{constructor:xl,load:function(e,t,n,r){const i=this,o=new fa(i.manager);o.setResponseType("arraybuffer"),o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{const e=n.slice(0);yl.getContext().decodeAudioData(e,(function(e){t(e)}))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}}),bl.prototype=Object.assign(Object.create(rl.prototype),{constructor:bl,isHemisphereLightProbe:!0,copy:function(e){return rl.prototype.copy.call(this,e),this},toJSON:function(e){return rl.prototype.toJSON.call(this,e)}}),_l.prototype=Object.assign(Object.create(rl.prototype),{constructor:_l,isAmbientLightProbe:!0,copy:function(e){return rl.prototype.copy.call(this,e),this},toJSON:function(e){return rl.prototype.toJSON.call(this,e)}});const wl=new W,Ml=new W;function Sl(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}Object.assign(Sl.prototype,{update:function(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;const n=e.projectionMatrix.clone(),r=t.eyeSep/2,i=r*t.near/t.focus,s=t.near*Math.tan(o.DEG2RAD*t.fov*.5)/t.zoom;let a,l;Ml.elements[12]=-r,wl.elements[12]=r,a=-s*t.aspect+i,l=s*t.aspect+i,n.elements[0]=2*t.near/(l-a),n.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(n),a=-s*t.aspect-i,l=s*t.aspect-i,n.elements[0]=2*t.near/(l-a),n.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ml),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(wl)}});class Tl{constructor(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Al(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Al();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Al(){return("undefined"==typeof performance?Date:performance).now()}const El=new v,Pl=new g,Ll=new v,Cl=new v;class Rl extends ge{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Il=new v,Fl=new g,Ol=new v,Nl=new v;class Dl{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}function Bl(e,t,n){let r,i,o;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Object.assign(Bl.prototype,{accumulate:function(e,t){const n=this.buffer,r=this.valueSize,i=e*r+r;let o=this.cumulativeWeight;if(0===o){for(let e=0;e!==r;++e)n[i+e]=n[e];o=t}else{o+=t;const e=t/o;this._mixBufferRegion(n,i,0,e,r)}this.cumulativeWeight=o},accumulateAdditive:function(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){const t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const e=t*this._origIndex;this._mixBufferRegion(n,r,e,1-i,t)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){s.setValue(n,r);break}},saveOriginalState:function(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n,i=r;e!==i;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},_setAdditiveIdentityOther:function(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]},_slerp:function(e,t,n,r){g.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){const o=this._workIndex*i;g.multiplyQuaternionsFlat(e,o,e,t,e,n),g.slerpFlat(e,t,e,t,e,o,r)},_lerp:function(e,t,n,r,i){const o=1-r;for(let s=0;s!==i;++s){const i=t+s;e[i]=e[i]*o+e[n+s]*r}},_lerpAdditive:function(e,t,n,r,i){for(let o=0;o!==i;++o){const i=t+o;e[i]=e[i]+e[n+o]*r}}});const Ul=new RegExp("[\\[\\]\\.:\\/]","g"),kl="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",zl=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Gl=/(WCOD+)?/.source.replace("WCOD",kl),Hl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),jl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Vl=new RegExp("^"+zl+Gl+Hl+jl+"$"),Wl=["material","materials","bones"];function Xl(e,t,n){const r=n||Yl.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Yl(e,t,n){this.path=t,this.parsedPath=n||Yl.parseTrackName(t),this.node=Yl.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function ql(){this.uuid=o.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}Object.assign(Xl.prototype,{getValue:function(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Yl,{Composite:Xl,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Yl.Composite(e,t,n):new Yl(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(Ul,"")},parseTrackName:function(e){const t=Vl.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const e=n.nodeName.substring(r+1);-1!==Wl.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let r=0;r<e.length;r++){const i=e[r];if(i.name===t||i.uuid===t)return i;const o=n(i.children);if(o)return o}return null},r=n(e.children);if(r)return r}return null}}),Object.assign(Yl.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let i=t.propertyIndex;if(e||(e=Yl.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==r){if(void 0===e[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}const o=e[r];if(void 0===o){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",e)}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Yl.prototype,{_getValue_unbound:Yl.prototype.getValue,_setValue_unbound:Yl.prototype.setValue}),Object.assign(ql.prototype,{isAnimationObjectGroup:!0,add:function(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,o=i.length;let s,a=e.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=t[u];if(void 0===d){d=a++,t[u]=d,e.push(h);for(let e=0,t=o;e!==t;++e)i[e].push(new Yl(h,n[e],r[e]))}else if(d<l){s=e[d];const a=--l,c=e[a];t[c.uuid]=d,e[d]=c,t[u]=a,e[a]=h;for(let e=0,t=o;e!==t;++e){const t=i[e],o=t[a];let s=t[d];t[d]=o,void 0===s&&(s=new Yl(h,n[e],r[e])),t[a]=s}}else e[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l},remove:function(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=t[a];if(void 0!==l&&l>=i){const o=i++,c=e[o];t[c.uuid]=l,e[l]=c,t[a]=o,e[o]=s;for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[o],i=t[l];t[l]=r,t[o]=i}}}this.nCachedObjects_=i},uncache:function(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,o=e.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=t[a];if(void 0!==l)if(delete t[a],l<i){const s=--i,a=e[s],c=--o,h=e[c];t[a.uuid]=l,e[l]=a,t[h.uuid]=s,e[s]=h,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[s],i=t[c];t[l]=r,t[s]=i,t.pop()}}else{const i=--o,s=e[i];i>0&&(t[s.uuid]=l),e[l]=s,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e];t[l]=t[i],t.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const i=this._bindings;if(void 0!==r)return i[r];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[e]=r,o.push(e),s.push(t),i.push(h);for(let n=c,r=a.length;n!==r;++n){const r=a[n];h[n]=new Yl(r,e,t)}return h},unsubscribe_:function(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const r=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];t[e[s]]=n,o[n]=a,o.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}});class Ql{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const i=t.tracks,o=i.length,s=new Array(o),a={endingStart:2400,endingEnd:2400};for(let e=0;e!==o;++e){const t=i[e].createInterpolant(null);s[e]=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=2201,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(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,r=e._clip.duration,i=r/n,o=n/r;e.warp(1,i,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,i=r.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=i,a[1]=i+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);const i=this._startTime;if(null!==i){const r=(e-i)*n;if(r<0||0===n)return;this._startTime=null,t=n*r}t*=this._updateTimeScale(e);const o=this._updateTime(t),s=this._updateWeight(e);if(s>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case 2501:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(o),t[n].accumulateAdditive(s);break;case 2500:default:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(o),t[n].accumulate(r,s)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,i=this._loopCount;const o=2202===n;if(0===e)return-1===i?r:o&&1==(1&i)?t-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=t||r<0){const n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){const t=e<0;this._setEndings(t,!t,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&1==(1&i))return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(e,t,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=i,a[0]=t,s[1]=i+e,a[1]=n,this}}function Zl(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}Zl.prototype=Object.assign(Object.create(n.prototype),{constructor:Zl,_bindAction:function(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,s=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==i;++e){const i=r[e],l=i.name;let h=c[l];if(void 0!==h)o[e]=h;else{if(h=o[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const r=t&&t._propertyBindings[e].binding.parsedPath;h=new Bl(Yl.create(n,l,r),i.ValueTypeName,i.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),o[e]=h}s[e].resultBuffer=h.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){const r=this._actions,i=this._actionsByClip;let o=i[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o;else{const t=o.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[n]=e},_removeInactiveAction:function(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const i=e._clip.uuid,o=this._actionsByClip,s=o[i],a=s.knownActions,l=a[a.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),e._byClipCacheIndex=null;delete s.actionByRoot[(e._localRoot||this._root).uuid],0===a.length&&delete o[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[t];void 0===o&&(o={},r[t]=o),o[n]=e,e._cacheIndex=i.length,i.push(e)},_removeInactiveBinding:function(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,s=o[r],a=t[t.length-1],l=e._cacheIndex;a._cacheIndex=l,t[l]=a,t.pop(),delete s[i],0===Object.keys(s).length&&delete o[r]},_lendBinding:function(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new Js(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){const r=t||this._root,i=r.uuid;let o="string"==typeof e?aa.findByName(r,e):e;const s=null!==o?o.uuid:e,a=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:2500),void 0!==a){const e=a.actionByRoot[i];if(void 0!==e&&e.blendMode===n)return e;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new Ql(this,o,t,n);return this._bindAction(c,l),this._addInactiveAction(c,s,i),c},existingAction:function(e,t){const n=t||this._root,r=n.uuid,i="string"==typeof e?aa.findByName(n,e):e,o=i?i.uuid:e,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[r]||null},stopAllAction:function(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1;for(let s=0;s!==n;++s){t[s]._update(r,e,i,o)}const s=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)s[e].apply(o);return this},setTime:function(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const e=i.knownActions;for(let n=0,r=e.length;n!==r;++n){const r=e[n];this._deactivateAction(r);const i=r._cacheIndex,o=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,t[i]=o,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}},uncacheRoot:function(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const r=n[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName[t];if(void 0!==r)for(const e in r){const t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}},uncacheAction:function(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}});class Jl{constructor(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Jl(void 0===this.value.clone?this.value:this.value.clone())}}function Kl(e,t,n){si.call(this,e,t),this.meshPerAttribute=n||1}function $l(e,t,n,r,i){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}function ec(e,t,n,r){this.ray=new V(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new ne,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function tc(e,t){return e.distance-t.distance}function nc(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r){const r=e.children;for(let e=0,i=r.length;e<i;e++)nc(r[e],t,n,!0)}}Kl.prototype=Object.assign(Object.create(si.prototype),{constructor:Kl,isInstancedInterleavedBuffer:!0,copy:function(e){return si.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},clone:function(e){const t=si.prototype.clone.call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t},toJSON:function(e){const t=si.prototype.toJSON.call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}),Object.defineProperty($l.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign($l.prototype,{isGLBufferAttribute:!0,setBuffer:function(e){return this.buffer=e,this},setType:function(e,t){return this.type=e,this.elementSize=t,this},setItemSize:function(e){return this.itemSize=e,this},setCount:function(e){return this.count=e,this}}),Object.assign(ec.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)},intersectObject:function(e,t,n){const r=n||[];return nc(e,this,r,t),r.sort(tc),r},intersectObjects:function(e,t,n){const r=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(let n=0,i=e.length;n<i;n++)nc(e[n],this,r,t);return r.sort(tc),r}});const rc=new s;class ic{constructor(e,t){Object.defineProperty(this,"isBox2",{value:!0}),this.min=void 0!==e?e:new s(1/0,1/0),this.max=void 0!==t?t:new s(-1/0,-1/0)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=rc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new s),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new s),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new s),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new s),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return rc.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const oc=new v,sc=new v;class ac{constructor(e,t){this.start=void 0!==e?e:new v,this.end=void 0!==t?t:new v}set(e,t){return this.start.copy(e),this.end.copy(t),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new v),e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new v),e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new v),this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){oc.subVectors(e,this.start),sc.subVectors(this.end,this.start);const n=sc.dot(sc);let r=sc.dot(oc)/n;return t&&(r=o.clamp(r,0,1)),r}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new v),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}function lc(e){ge.call(this),this.material=e,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}lc.prototype=Object.create(ge.prototype),lc.prototype.constructor=lc,lc.prototype.isImmediateRenderObject=!0;const cc=new v;class hc extends ge{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new pt,r=[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 e=0,t=1,n=32;e<n;e++,t++){const i=e/n*Math.PI*2,o=t/n*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new et(r,3));const i=new ji({fog:!1,toneMapped:!1});this.cone=new Ki(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),cc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const uc=new v,dc=new W,pc=new W;class fc extends Ki{constructor(e){const t=mc(e),n=new pt,r=[],i=[],o=new Ue(0,0,1),s=new Ue(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(s.r,s.g,s.b))}n.setAttribute("position",new et(r,3)),n.setAttribute("color",new et(i,3));super(n,new ji({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");pc.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const i=t[e];i.parent&&i.parent.isBone&&(dc.multiplyMatrices(pc,i.matrixWorld),uc.setFromMatrixPosition(dc),r.setXYZ(n,uc.x,uc.y,uc.z),dc.multiplyMatrices(pc,i.parent.matrixWorld),uc.setFromMatrixPosition(dc),r.setXYZ(n+1,uc.x,uc.y,uc.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function mc(e){const t=[];e&&e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,mc(e.children[n]));return t}class gc extends Rt{constructor(e,t,n){super(new Ms(t,4,2),new He({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const vc=new v,yc=new Ue,xc=new Ue;class bc extends ge{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new ps(t);r.rotateY(.5*Math.PI),this.material=new He({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),o=new Float32Array(3*i.count);r.setAttribute("color",new We(o,3)),this.add(new Rt(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");yc.copy(this.light.color),xc.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const r=e<n/2?yc:xc;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(vc.setFromMatrixPosition(this.light.matrixWorld).negate())}}class _c extends Ki{constructor(e=10,t=10,n=4473924,r=8947848){n=new Ue(n),r=new Ue(r);const i=t/2,o=e/t,s=e/2,a=[],l=[];for(let e=0,c=0,h=-s;e<=t;e++,h+=o){a.push(-s,0,h,s,0,h),a.push(h,0,-s,h,0,s);const t=e===i?n:r;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new pt;c.setAttribute("position",new et(a,3)),c.setAttribute("color",new et(l,3));super(c,new ji({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}const wc=new v,Mc=new v,Sc=new v;class Tc extends ge{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);let r=new pt;r.setAttribute("position",new et([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const i=new ji({fog:!1,toneMapped:!1});this.lightPlane=new Qi(r,i),this.add(this.lightPlane),r=new pt,r.setAttribute("position",new et([0,0,0,0,0,1],3)),this.targetLine=new Qi(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){wc.setFromMatrixPosition(this.light.matrixWorld),Mc.setFromMatrixPosition(this.light.target.matrixWorld),Sc.subVectors(Mc,wc),this.lightPlane.lookAt(Mc),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Mc),this.targetLine.scale.z=Sc.length()}}const Ac=new v,Ec=new kt;function Pc(e,t,n,r,i,o,s){Ac.set(i,o,s).unproject(r);const a=t[e];if(void 0!==a){const e=n.getAttribute("position");for(let t=0,n=a.length;t<n;t++)e.setXYZ(a[t],Ac.x,Ac.y,Ac.z)}}const Lc=new b;class Cc extends Ki{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new pt;i.setIndex(new We(n,1)),i.setAttribute("position",new We(r,3)),super(i,new ji({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Lc.setFromObject(this.object),Lc.isEmpty())return;const t=Lc.min,n=Lc.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Ki.prototype.copy.call(this,e),this.object=e.object,this}}class Rc extends Ki{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new pt;r.setIndex(new We(n,1)),r.setAttribute("position",new et([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new ji({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}const Ic=new v;let Fc,Oc;class Nc extends Ki{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new pt;n.setAttribute("position",new et(t,3)),n.setAttribute("color",new et([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new ji({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}const Dc=new Float32Array(1),Bc=new Int32Array(Dc.buffer),Uc={toHalfFloat:function(e){Dc[0]=e;const t=Bc[0];let n=t>>16&32768,r=t>>12&2047;const i=t>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&t,n):i<113?(r|=2048,n|=(r>>114-i)+(r>>113-i&1),n):(n|=i-112<<10|r>>1,n+=1&r,n)}},kc=Math.pow(2,8),zc=[.125,.215,.35,.446,.526,.582],Gc=5+zc.length,Hc={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},jc=new Ja,{_lodPlanes:Vc,_sizeLods:Wc,_sigmas:Xc}=$c(),Yc=new Ue;let qc=null;const Qc=(1+Math.sqrt(5))/2,Zc=1/Qc,Jc=[new v(1,1,1),new v(-1,1,1),new v(1,1,-1),new v(-1,1,-1),new v(0,Qc,Zc),new v(0,Qc,-Zc),new v(Zc,0,Qc),new v(-Zc,0,Qc),new v(Qc,Zc,0),new v(-Qc,Zc,0)];function Kc(e){return void 0!==e&&1009===e.type&&(3e3===e.encoding||3001===e.encoding||3007===e.encoding)}function $c(){const e=[],t=[],n=[];let r=8;for(let i=0;i<Gc;i++){const o=Math.pow(2,r);t.push(o);let s=1/o;i>4?s=zc[i-8+4-1]:0==i&&(s=0),n.push(s);const a=1/(o-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*u),v=new Float32Array(f*d*u),y=new Float32Array(m*d*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(r,p*d*e),v.set(h,f*d*e);const i=[e,e,e,e,e,e];y.set(i,m*d*e)}const x=new pt;x.setAttribute("position",new We(g,p)),x.setAttribute("uv",new We(v,f)),x.setAttribute("faceIndex",new We(y,m)),e.push(x),r>4&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function eh(e){const t=new f(3*kc,3*kc,e);return t.texture.mapping=306,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function th(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function nh(){return new Us({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new s(1,1)},inputEncoding:{value:Hc[3e3]},outputEncoding:{value:Hc[3e3]}},vertexShader:ih(),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${oh()}\n\n\t\t\t#include <common>\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:0,depthTest:!1,depthWrite:!1})}function rh(){return new Us({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Hc[3e3]},outputEncoding:{value:Hc[3e3]}},vertexShader:ih(),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${oh()}\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:0,depthTest:!1,depthWrite:!1})}function ih(){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 oh(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\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 sh(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),La.call(this,e),this.type="catmullrom",this.closed=!0}function ah(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),La.call(this,e),this.type="catmullrom"}function lh(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),La.call(this,e),this.type="catmullrom"}_a.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(_a.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(Ga.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const t=new go;for(let n=0,r=e.length;n<r;n++){const r=e[n];t.vertices.push(new v(r.x,r.y,r.z||0))}return t}}),Object.assign(Ha.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),sh.prototype=Object.create(La.prototype),ah.prototype=Object.create(La.prototype),lh.prototype=Object.create(La.prototype),Object.assign(lh.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),_c.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},fc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(da.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ol.extractUrlBase(e)}}),da.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(ic.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(b.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(D.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Yt.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},ac.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(o,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),o.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),o.ceilPowerOfTwo(e)}}),Object.assign(a.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},getInverse:function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()}}),Object.assign(W.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new v).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,o)},getInverse:function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()}}),be.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Object.assign(g.prototype,{multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},inverse:function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()}}),Object.assign(V.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Re.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Re,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Re.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Re.getNormal(e,t,n,r)}}),Object.assign(ja.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ls(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ws(this,e)}}),Object.assign(s.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(v.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(p.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(go.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(ge.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(ge.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(Rt.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(Rt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Ei.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Bi.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Fi.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(_a.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),zt.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Va.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(We.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Object.assign(We.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(pt.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new We(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(pt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(sl.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(ec.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(si.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(si.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(ss.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.assign(oi.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}}),Object.defineProperties(Jl.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Ge.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Ue}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(Gs.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(zs.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(e){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=e}}}),Object.defineProperties(Ut.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(ti.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(ti.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Xr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(f.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Rl.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new xl).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Dl.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Gt.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Gt.prototype.clear=function(e,t,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,r)};const ch={merge:function(e,t,n){let r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};c.crossOrigin=void 0,c.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new ba;i.setCrossOrigin(this.crossOrigin);const o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},c.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new ya;i.setCrossOrigin(this.crossOrigin);const o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},c.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},c.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const hh={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"124"}}));var uh=Object.freeze({__proto__:null,ACESFilmicToneMapping:4,AddEquation:100,AddOperation:2,AdditiveAnimationBlendMode:2501,AdditiveBlending:2,AlphaFormat:1021,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:el,AmbientLightProbe:_l,AnimationClip:aa,AnimationLoader:ma,AnimationMixer:Zl,AnimationObjectGroup:ql,AnimationUtils:qs,ArcCurve:Ma,ArrayCamera:Zr,ArrowHelper:class extends ge{constructor(e,t,n,r,i,o){super(),this.type="ArrowHelper",void 0===e&&(e=new v(0,0,1)),void 0===t&&(t=new v(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===o&&(o=.2*i),void 0===Fc&&(Fc=new pt,Fc.setAttribute("position",new et([0,0,0,0,1,0],3)),Oc=new bo(0,.5,1,5,1),Oc.translate(0,-.5,0)),this.position.copy(t),this.line=new Qi(Fc,new ji({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Rt(Oc,new He({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Ic.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ic,t)}}setLength(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},Audio:Rl,AudioAnalyser:Dl,AudioContext:yl,AudioListener:class extends ge{constructor(){super(),this.type="AudioListener",this.context=yl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Tl}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(El,Pl,Ll),Cl.set(0,0,-1).applyQuaternion(Pl),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(El.x,e),t.positionY.linearRampToValueAtTime(El.y,e),t.positionZ.linearRampToValueAtTime(El.z,e),t.forwardX.linearRampToValueAtTime(Cl.x,e),t.forwardY.linearRampToValueAtTime(Cl.y,e),t.forwardZ.linearRampToValueAtTime(Cl.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition(El.x,El.y,El.z),t.setOrientation(Cl.x,Cl.y,Cl.z,n.x,n.y,n.z)}},AudioLoader:xl,AxesHelper:Nc,AxisHelper:function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Nc(e)},BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BinaryTextureLoader:function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xa(e)},Bone:Oi,BooleanKeyframeTrack:ea,BoundingBoxHelper:function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Cc(e,t)},Box2:ic,Box3:b,Box3Helper:Rc,BoxBufferGeometry:Ot,BoxGeometry:vo,BoxHelper:Cc,BufferAttribute:We,BufferGeometry:pt,BufferGeometryLoader:ll,ByteType:1010,Cache:ca,Camera:kt,CameraHelper:class extends Ki{constructor(e){const t=new pt,n=new ji({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={},s=new Ue(16755200),a=new Ue(16711680),l=new Ue(43775),c=new Ue(16777215),h=new Ue(3355443);function u(e,t,n){d(e,n),d(t,n)}function d(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}u("n1","n2",s),u("n2","n4",s),u("n4","n3",s),u("n3","n1",s),u("f1","f2",s),u("f2","f4",s),u("f4","f3",s),u("f3","f1",s),u("n1","f1",s),u("n2","f2",s),u("n3","f3",s),u("n4","f4",s),u("p","n1",a),u("p","n2",a),u("p","n3",a),u("p","n4",a),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new et(r,3)),t.setAttribute("color",new et(i,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const e=this.geometry,t=this.pointMap;Ec.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Pc("c",t,e,Ec,0,0,-1),Pc("t",t,e,Ec,0,0,1),Pc("n1",t,e,Ec,-1,-1,-1),Pc("n2",t,e,Ec,1,-1,-1),Pc("n3",t,e,Ec,-1,1,-1),Pc("n4",t,e,Ec,1,1,-1),Pc("f1",t,e,Ec,-1,-1,1),Pc("f2",t,e,Ec,1,-1,1),Pc("f3",t,e,Ec,-1,1,1),Pc("f4",t,e,Ec,1,1,1),Pc("u1",t,e,Ec,.7,1.1,-1),Pc("u2",t,e,Ec,-.7,1.1,-1),Pc("u3",t,e,Ec,0,2,-1),Pc("cf1",t,e,Ec,-1,0,1),Pc("cf2",t,e,Ec,1,0,1),Pc("cf3",t,e,Ec,0,-1,1),Pc("cf4",t,e,Ec,0,1,1),Pc("cn1",t,e,Ec,-1,0,-1),Pc("cn2",t,e,Ec,1,0,-1),Pc("cn3",t,e,Ec,0,-1,-1),Pc("cn4",t,e,Ec,0,1,-1),e.getAttribute("position").needsUpdate=!0}},CanvasRenderer:function(){console.error("THREE.CanvasRenderer has been removed")},CanvasTexture:co,CatmullRomCurve3:La,CineonToneMapping:3,CircleBufferGeometry:yo,CircleGeometry:xo,ClampToEdgeWrapping:1001,Clock:Tl,ClosedSplineCurve3:sh,Color:Ue,ColorKeyframeTrack:ta,CompressedTexture:lo,CompressedTextureLoader:ga,ConeBufferGeometry:Mo,ConeGeometry:wo,CubeCamera:Gt,CubeGeometry:vo,CubeReflectionMapping:301,CubeRefractionMapping:302,CubeTexture:Ht,CubeTextureLoader:ya,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307,CubicBezierCurve:Fa,CubicBezierCurve3:Oa,CubicInterpolant:Zs,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:_a,CurvePath:Ga,CustomBlending:5,CustomToneMapping:5,CylinderBufferGeometry:bo,CylinderGeometry:_o,Cylindrical:class{constructor(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}clone(){return(new this.constructor).copy(this)}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},DataTexture:Vt,DataTexture2DArray:mn,DataTexture3D:gn,DataTextureLoader:xa,DataUtils:Uc,DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:ua,DepthFormat:1026,DepthStencilFormat:1027,DepthTexture:ho,DirectionalLight:$a,DirectionalLightHelper:Tc,DiscreteInterpolant:Ks,DodecahedronBufferGeometry:To,DodecahedronGeometry:Ao,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicBufferAttribute:function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new We(e,t).setUsage(35048)},DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:Ro,EdgesHelper:function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ki(new Ro(e.geometry),new ji({color:void 0!==t?t:16777215}))},EllipseCurve:wa,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,Euler:$,EventDispatcher:n,ExtrudeBufferGeometry:ss,ExtrudeGeometry:ls,Face3:ke,Face4:function(e,t,n,r,i,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ke(e,t,n,i,o,s)},FaceColors:1,FileLoader:fa,FlatShading:1,Float16BufferAttribute:$e,Float32Attribute:function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new et(e,t)},Float32BufferAttribute:et,Float64Attribute:function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new tt(e,t)},Float64BufferAttribute:tt,FloatType:1015,Fog:ii,FogExp2:ri,Font:fl,FontLoader:gl,FrontSide:0,Frustum:Yt,GLBufferAttribute:$l,GLSL1:"100",GLSL3:"300 es",GammaEncoding:3007,Geometry:go,GeometryUtils:ch,GreaterDepth:6,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:_c,Group:Jr,HalfFloatType:1016,HemisphereLight:Wa,HemisphereLightHelper:bc,HemisphereLightProbe:bl,IcosahedronBufferGeometry:cs,IcosahedronGeometry:hs,ImageBitmapLoader:dl,ImageLoader:va,ImageUtils:c,ImmediateRenderObject:lc,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:al,InstancedBufferGeometry:sl,InstancedInterleavedBuffer:Kl,InstancedMesh:Hi,Int16Attribute:function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Qe(e,t)},Int16BufferAttribute:Qe,Int32Attribute:function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Je(e,t)},Int32BufferAttribute:Je,Int8Attribute:function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Xe(e,t)},Int8BufferAttribute:Xe,IntType:1013,InterleavedBuffer:si,InterleavedBufferAttribute:li,Interpolant:Qs,InterpolateDiscrete:2300,InterpolateLinear:2301,InterpolateSmooth:2302,InvertStencilOp:5386,JSONLoader:function(){console.error("THREE.JSONLoader has been removed.")},KeepStencilOp:7680,KeyframeTrack:$s,LOD:Ei,LatheBufferGeometry:us,LatheGeometry:ds,Layers:ne,LensFlare:function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},LessDepth:2,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Va,LightProbe:rl,Line:Qi,Line3:ac,LineBasicMaterial:ji,LineCurve:Na,LineCurve3:Da,LineDashedMaterial:Xs,LineLoop:$i,LinePieces:1,LineSegments:Ki,LineStrip:0,LinearEncoding:3e3,LinearFilter:1006,LinearInterpolant:Js,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:1008,LinearMipmapNearestFilter:1007,LinearToneMapping:1,Loader:da,LoaderUtils:ol,LoadingManager:ha,LogLuvEncoding:3003,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,LuminanceAlphaFormat:1025,LuminanceFormat:1024,MOUSE:{LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Material:Ge,MaterialLoader:il,Math:o,MathUtils:o,Matrix3:a,Matrix4:W,MaxEquation:104,Mesh:Rt,MeshBasicMaterial:He,MeshDepthMaterial:Vr,MeshDistanceMaterial:Wr,MeshFaceMaterial:function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},MeshLambertMaterial:Vs,MeshMatcapMaterial:Ws,MeshNormalMaterial:js,MeshPhongMaterial:Gs,MeshPhysicalMaterial:zs,MeshStandardMaterial:ks,MeshToonMaterial:Hs,MinEquation:103,MirroredRepeatWrapping:1002,MixOperation:1,MultiMaterial:function(e=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e},MultiplyBlending:4,MultiplyOperation:0,NearestFilter:1003,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:1005,NearestMipmapNearestFilter:1004,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColors:0,NoToneMapping:0,NormalAnimationBlendMode:2500,NormalBlending:1,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:na,Object3D:ge,ObjectLoader:class extends da{constructor(e){super(e)}load(e,t,n,r){const i=this,o=""===this.path?ol.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const s=new fa(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){let o=null;try{o=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const s=o.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?i.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),s=this.parseTextures(e.textures,o),a=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,i,a,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),void 0!==t){let e=!1;for(const t in o)if(o[t]instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}parseShapes(e){const t={};if(void 0!==e)for(let n=0,r=e.length;n<r;n++){const r=(new ja).fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(let t=0,i=e.length;t<i;t++){const i=(new Bi).fromJSON(e[t],r);n[i.uuid]=i}return n}parseGeometries(e,t){const n={};let r;if(void 0!==e){const i=new ll;for(let o=0,s=e.length;o<s;o++){let s;const a=e[o];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Ds[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Ds[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Ds[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Ds[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Ds[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Ds[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Ds[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Ds[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Ds[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Ds[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"TubeGeometry":case"TubeBufferGeometry":s=new Ds[a.type]((new za[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Ds[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Ds[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":r=[];for(let e=0,n=a.shapes.length;e<n;e++){const n=t[a.shapes[e]];r.push(n)}s=new Ds[a.type](r,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":r=[];for(let e=0,n=a.shapes.length;e<n;e++){const n=t[a.shapes[e]];r.push(n)}const e=a.options.extrudePath;void 0!==e&&(a.options.extrudePath=(new za[e.type]).fromJSON(e)),s=new Ds[a.type](r,a.options);break;case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(a);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),!0===s.isBufferGeometry&&void 0!==a.userData&&(s.userData=a.userData),n[a.uuid]=s}}return n}parseMaterials(e,t){const n={},r={};if(void 0!==e){const i=new il;i.setTextures(t);for(let t=0,o=e.length;t<o;t++){const o=e[t];if("MultiMaterial"===o.type){const e=[];for(let t=0;t<o.materials.length;t++){const r=o.materials[t];void 0===n[r.uuid]&&(n[r.uuid]=i.parse(r)),e.push(n[r.uuid])}r[o.uuid]=e}else void 0===n[o.uuid]&&(n[o.uuid]=i.parse(o)),r[o.uuid]=n[o.uuid]}}return r}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const r=e[n],i=aa.parse(r);t[i.uuid]=i}return t}parseImages(e,t){const n=this,r={};let i;function o(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),i.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:ot(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new ha(t);i=new va(n),i.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.url;if(Array.isArray(i)){r[n.uuid]=[];for(let e=0,t=i.length;e<t;e++){const t=o(i[e]);null!==t&&(t instanceof HTMLImageElement?r[n.uuid].push(t):r[n.uuid].push(new Vt(t.data,t.width,t.height)))}}else{const e=o(n.url);null!==e&&(r[n.uuid]=e)}}}return r}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const r={};if(void 0!==e)for(let i=0,o=e.length;i<o;i++){const o=e[i];let s;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const a=t[o.image];Array.isArray(a)?(s=new Ht(a),6===a.length&&(s.needsUpdate=!0)):(s=a&&a.data?new Vt(a.data,a.width,a.height):new u(a),a&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,cl)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],hl),s.wrapT=n(o.wrap[1],hl)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,ul)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,ul)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r}parseObject(e,t,n,r){let i,o,s;function a(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function l(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),t.push(n[i])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":i=new oi,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new Ue(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new ii(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new ri(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new zt(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new Ja(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new el(e.color,e.intensity);break;case"DirectionalLight":i=new $a(e.color,e.intensity);break;case"PointLight":i=new Za(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new tl(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new qa(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new Wa(e.color,e.groundColor,e.intensity);break;case"LightProbe":i=(new rl).fromJSON(e);break;case"SkinnedMesh":o=a(e.geometry),s=l(e.material),i=new Fi(o,s),void 0!==e.bindMode&&(i.bindMode=e.bindMode),void 0!==e.bindMatrix&&i.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(i.skeleton=e.skeleton);break;case"Mesh":o=a(e.geometry),s=l(e.material),i=new Rt(o,s);break;case"InstancedMesh":o=a(e.geometry),s=l(e.material);const t=e.count,n=e.instanceMatrix;i=new Hi(o,s,t),i.instanceMatrix=new We(new Float32Array(n.array),16);break;case"LOD":i=new Ei;break;case"Line":i=new Qi(a(e.geometry),l(e.material));break;case"LineLoop":i=new $i(a(e.geometry),l(e.material));break;case"LineSegments":i=new Ki(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":i=new oo(a(e.geometry),l(e.material));break;case"Sprite":i=new Mi(l(e.material));break;case"Group":i=new Jr;break;case"Bone":i=new Oi;break;default:i=new ge}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(i.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children){const o=e.children;for(let e=0;e<o.length;e++)i.add(this.parseObject(o[e],t,n,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];i.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],r=i.getObjectByProperty("uuid",n.object);void 0!==r&&i.addLevel(r,n.distance)}}return i}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}},ObjectSpaceNormalMap:1,OctahedronBufferGeometry:ps,OctahedronGeometry:fs,OneFactor:201,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:205,OneMinusSrcColorFactor:203,OrthographicCamera:Ja,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(e),n=new v(0,1,0);return new Us({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Hc[3e3]},outputEncoding:{value:Hc[3e3]}},vertexShader:ih(),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${oh()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\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:0,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){qc=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=rh(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=nh(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e<Vc.length;e++)Vc[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(qc),e.scissorTest=!1,th(e,0,0,e.width,e.height)}_fromTexture(e){qc=this._renderer.getRenderTarget();const t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){const t={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:Kc(e)?e.encoding:3002,depthBuffer:!1},n=eh(t);return n.depthBuffer=!e,this._pingPongRenderTarget=eh(t),n}_compileMaterial(e){const t=new Rt(Vc[0],e);this._renderer.compile(t,jc)}_sceneToCubeUV(e,t,n,r){const i=new zt(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.outputEncoding,c=a.toneMapping;a.getClearColor(Yc);const h=a.getClearAlpha();a.toneMapping=0,a.outputEncoding=3e3;let u=e.background;if(u&&u.isColor){u.convertSRGBToLinear();const t=Math.max(u.r,u.g,u.b),n=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);u=u.multiplyScalar(Math.pow(2,-n));const r=(n+128)/255;a.setClearColor(u,r),e.background=null}for(let t=0;t<6;t++){const n=t%3;0==n?(i.up.set(0,o[t],0),i.lookAt(s[t],0,0)):1==n?(i.up.set(0,0,o[t]),i.lookAt(0,s[t],0)):(i.up.set(0,o[t],0),i.lookAt(0,0,s[t])),th(r,n*kc,t>2?kc:0,kc,kc),a.setRenderTarget(r),a.render(e,i)}a.toneMapping=c,a.outputEncoding=l,a.setClearColor(Yc,h)}_textureToCubeUV(e,t){const n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=rh()):null==this._equirectShader&&(this._equirectShader=nh());const r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new Rt(Vc[0],r),o=r.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=Hc[e.encoding],o.outputEncoding.value=Hc[t.texture.encoding],th(t,0,0,3*kc,2*kc),n.setRenderTarget(t),n.render(i,jc)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t<Gc;t++){const n=Math.sqrt(Xc[t]*Xc[t]-Xc[t-1]*Xc[t-1]),r=Jc[(t-1)%Jc.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",i),this._halfBlur(o,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,o,s){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Rt(Vc[r],l),h=l.uniforms,u=Wc[n]-1,d=isFinite(i)?Math.PI/(2*u):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0==e?g+=n:e<f&&(g+=2*n)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===o,s&&(h.poleAxis.value=s),h.dTheta.value=d,h.mipInt.value=8-n,h.inputEncoding.value=Hc[e.texture.encoding],h.outputEncoding.value=Hc[e.texture.encoding];const v=Wc[r];th(t,3*Math.max(0,kc-2*v),(0===r?0:2*kc)+2*v*(r>4?r-8+4:0),3*v,2*v),a.setRenderTarget(t),a.render(c,jc)}},ParametricBufferGeometry:ms,ParametricGeometry:gs,Particle:function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Mi(e)},ParticleBasicMaterial:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new eo(e)},ParticleSystem:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new oo(e,t)},ParticleSystemMaterial:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new eo(e)},Path:Ha,PerspectiveCamera:zt,Plane:be,PlaneBufferGeometry:Zt,PlaneGeometry:vs,PlaneHelper:class extends Qi{constructor(e,t=1,n=16776960){const r=n,i=new pt;i.setAttribute("position",new et([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),super(i,new ji({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=new pt;o.setAttribute("position",new et([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new Rt(o,new He({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}},PointCloud:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new oo(e,t)},PointCloudMaterial:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new eo(e)},PointLight:Za,PointLightHelper:gc,Points:oo,PointsMaterial:eo,PolarGridHelper:class extends Ki{constructor(e=10,t=16,n=8,r=64,i=4473924,o=8947848){i=new Ue(i),o=new Ue(o);const s=[],a=[];for(let n=0;n<=t;n++){const r=n/t*(2*Math.PI),l=Math.sin(r)*e,c=Math.cos(r)*e;s.push(0,0,0),s.push(l,0,c);const h=1&n?i:o;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let t=0;t<=n;t++){const l=1&t?i:o,c=e-e/n*t;for(let e=0;e<r;e++){let t=e/r*(2*Math.PI),n=Math.sin(t)*c,i=Math.cos(t)*c;s.push(n,0,i),a.push(l.r,l.g,l.b),t=(e+1)/r*(2*Math.PI),n=Math.sin(t)*c,i=Math.cos(t)*c,s.push(n,0,i),a.push(l.r,l.g,l.b)}}const l=new pt;l.setAttribute("position",new et(s,3)),l.setAttribute("color",new et(a,3));super(l,new ji({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}},PolyhedronBufferGeometry:So,PolyhedronGeometry:ys,PositionalAudio:class extends Rl{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Il,Fl,Ol),Nl.set(0,0,1).applyQuaternion(Fl);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Il.x,e),t.positionY.linearRampToValueAtTime(Il.y,e),t.positionZ.linearRampToValueAtTime(Il.z,e),t.orientationX.linearRampToValueAtTime(Nl.x,e),t.orientationY.linearRampToValueAtTime(Nl.y,e),t.orientationZ.linearRampToValueAtTime(Nl.z,e)}else t.setPosition(Il.x,Il.y,Il.z),t.setOrientation(Nl.x,Nl.y,Nl.z)}},PropertyBinding:Yl,PropertyMixer:Bl,QuadraticBezierCurve:Ba,QuadraticBezierCurve3:Ua,Quaternion:g,QuaternionKeyframeTrack:ia,QuaternionLinearInterpolant:ra,REVISION:"124",RGBADepthPacking:3201,RGBAFormat:1023,RGBAIntegerFormat:1033,RGBA_ASTC_10x10_Format:37819,RGBA_ASTC_10x5_Format:37816,RGBA_ASTC_10x6_Format:37817,RGBA_ASTC_10x8_Format:37818,RGBA_ASTC_12x10_Format:37820,RGBA_ASTC_12x12_Format:37821,RGBA_ASTC_4x4_Format:37808,RGBA_ASTC_5x4_Format:37809,RGBA_ASTC_5x5_Format:37810,RGBA_ASTC_6x5_Format:37811,RGBA_ASTC_6x6_Format:37812,RGBA_ASTC_8x5_Format:37813,RGBA_ASTC_8x6_Format:37814,RGBA_ASTC_8x8_Format:37815,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_2BPPV1_Format:35843,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT1_Format:33777,RGBA_S3TC_DXT3_Format:33778,RGBA_S3TC_DXT5_Format:33779,RGBDEncoding:3006,RGBEEncoding:3002,RGBEFormat:1023,RGBFormat:1022,RGBIntegerFormat:1032,RGBM16Encoding:3005,RGBM7Encoding:3004,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_2BPPV1_Format:35841,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776,RGFormat:1030,RGIntegerFormat:1031,RawShaderMaterial:Us,Ray:V,Raycaster:ec,RectAreaLight:tl,RedFormat:1028,RedIntegerFormat:1029,ReinhardToneMapping:2,RepeatWrapping:1e3,ReplaceStencilOp:7681,ReverseSubtractEquation:102,RingBufferGeometry:xs,RingGeometry:bs,SRGB8_ALPHA8_ASTC_10x10_Format:37851,SRGB8_ALPHA8_ASTC_10x5_Format:37848,SRGB8_ALPHA8_ASTC_10x6_Format:37849,SRGB8_ALPHA8_ASTC_10x8_Format:37850,SRGB8_ALPHA8_ASTC_12x10_Format:37852,SRGB8_ALPHA8_ASTC_12x12_Format:37853,SRGB8_ALPHA8_ASTC_4x4_Format:37840,SRGB8_ALPHA8_ASTC_5x4_Format:37841,SRGB8_ALPHA8_ASTC_5x5_Format:37842,SRGB8_ALPHA8_ASTC_6x5_Format:37843,SRGB8_ALPHA8_ASTC_6x6_Format:37844,SRGB8_ALPHA8_ASTC_8x5_Format:37845,SRGB8_ALPHA8_ASTC_8x6_Format:37846,SRGB8_ALPHA8_ASTC_8x8_Format:37847,Scene:oi,SceneUtils:hh,ShaderChunk:Jt,ShaderLib:$t,ShaderMaterial:Ut,ShadowMaterial:Bs,Shape:ja,ShapeBufferGeometry:_s,ShapeGeometry:ws,ShapePath:pl,ShapeUtils:rs,ShortType:1011,Skeleton:Bi,SkeletonHelper:fc,SkinnedMesh:Fi,SmoothShading:2,Sphere:D,SphereBufferGeometry:Ms,SphereGeometry:Ss,Spherical:class{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}clone(){return(new this.constructor).copy(this)}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(o.clamp(t/this.radius,-1,1))),this}},SphericalHarmonics3:nl,Spline:lh,SplineCurve:ka,SplineCurve3:ah,SpotLight:qa,SpotLightHelper:hc,Sprite:Mi,SpriteMaterial:ci,SrcAlphaFactor:204,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:35044,StaticReadUsage:35045,StereoCamera:Sl,StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:oa,SubtractEquation:101,SubtractiveBlending:3,TOUCH:{ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},TangentSpaceNormalMap:0,TetrahedronBufferGeometry:Ts,TetrahedronGeometry:As,TextBufferGeometry:Es,TextGeometry:Ps,Texture:u,TextureLoader:ba,TorusBufferGeometry:Ls,TorusGeometry:Cs,TorusKnotBufferGeometry:Rs,TorusKnotGeometry:Is,Triangle:Re,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeBufferGeometry:Fs,TubeGeometry:Os,UVMapping:300,Uint16Attribute:function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ze(e,t)},Uint16BufferAttribute:Ze,Uint32Attribute:function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Ke(e,t)},Uint32BufferAttribute:Ke,Uint8Attribute:function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ye(e,t)},Uint8BufferAttribute:Ye,Uint8ClampedAttribute:function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new qe(e,t)},Uint8ClampedBufferAttribute:qe,Uniform:Jl,UniformsLib:Kt,UniformsUtils:Bt,UnsignedByteType:1009,UnsignedInt248Type:1020,UnsignedIntType:1014,UnsignedShort4444Type:1017,UnsignedShort5551Type:1018,UnsignedShort565Type:1019,UnsignedShortType:1012,VSMShadowMap:3,Vector2:s,Vector3:v,Vector4:p,VectorKeyframeTrack:sa,Vertex:function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new v(e,t,n)},VertexColors:2,VideoTexture:ao,WebGL1Renderer:ni,WebGLCubeRenderTarget:jt,WebGLMultisampleRenderTarget:m,WebGLRenderTarget:f,WebGLRenderTargetCube:function(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new jt(e,n)},WebGLRenderer:ti,WebGLUtils:Qr,WireframeGeometry:Ns,WireframeHelper:function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Ki(new Ns(e.geometry),new ji({color:void 0!==t?t:16777215}))},WrapAroundEnding:2402,XHRLoader:function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new fa(e)},ZeroCurvatureEnding:2400,ZeroFactor:200,ZeroSlopeEnding:2401,ZeroStencilOp:0,sRGBEncoding:3001});const dh=(e,t)=>{let n="";for(let e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)};function ph(e){return e instanceof v?e:new v(e.x,e.y,e.z)}function fh(e){return e instanceof $?e:new $(e.x,e.y,e.z)}function mh(e){return new b(new v(0,0,0),new v(500,500,500)).setFromObject(e)}function gh(e,t,n){const r=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?r[e]+=2*Math.PI:r[e]-=2*Math.PI),r}function vh(e,t){const n=gh("x",e,t),r=gh("y",e,t),i=gh("z",e,t);return new $(n.x,r.y,i.z,t.order)}function yh(e){return Math.PI/180*e}function xh(e){return e/(Math.PI/180)}function bh(e,t=!0){return t?{position:e.getWorldPosition(new v),rotation:(new $).setFromQuaternion(e.getWorldQuaternion(new g)),scale:e.getWorldScale(new v)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function _h(e,t,n=!0){const r=bh(t,n);e.position.copy(r.position),e.rotation.copy(r.rotation),e.scale.copy(r.scale)}class wh{constructor(){this.min=null,this.roots=[],this.nodes=[]}shift(){const e=this.min;if(null==e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],r=this.getDistance(n);r<t&&(t=r,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let r=0;r<n;r++){const n=this.roots[r],i=this.nodes[n].depth;i<t&&e[i].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const r=e[n].shift(),i=e[n].shift(),o=n+1;let s=-1;this.nodes[r].distance<this.nodes[i].distance?(this.nodes[r].depth=o,this.nodes[r].children.push(i),this.nodes[i].parent=r,o<=t&&e[o].push(r),s=this.roots.indexOf(i)):(this.nodes[i].depth=o,this.nodes[i].children.push(r),this.nodes[r].parent=i,o<=t&&e[o].push(i),s=this.roots.indexOf(r)),s>-1&&this.roots.splice(s,1)}}add(e,t){this.nodes[e]={nodeIndex:e,distance:t,depth:0,parent:null,children:[]},(!this.min||t<this.nodes[this.min].distance)&&(this.min=e),this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){if(!this.nodes[e])return;const t=this.nodes[e].children.length;if(t>0)for(let n=0;n<t;n++){const t=this.nodes[e].children[n];this.nodes[t].parent=this.nodes[e].parent,null==this.nodes[t].parent&&this.roots.push(t)}let n=this.nodes[e].parent;if(null==n){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;n;)this.nodes[n].depth--,n=this.nodes[n].parent}getDistance(e){return this.nodes[e]?this.nodes[e].distance:1/0}}function Mh(e,t=["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]){return new Promise((n=>{(new ya).setPath(e).load(t,(e=>{e.format=1022,n(e)}))}))}const Sh=e=>{let t=kh(e,0,8);if("SBMG----"!==t)throw new TypeError("This format file ("+t+") is not supported by the SoonSpace.js");const n=new DataView(e.slice(8));for(let e=0;e<n.byteLength;e++){const t=n.getUint8(e),r=(t>>4&15)+(t<<4&240);n.setUint8(e,r)}return n.buffer},Th=Object.prototype.hasOwnProperty,Ah=(e,t)=>Th.call(e,t),Eh=e=>"string"==typeof e,Ph=e=>"boolean"==typeof e,Lh=e=>"number"==typeof e,Ch=e=>null===e,Rh=e=>"symbol"==typeof e,Ih=e=>e instanceof Date,Fh=Array.isArray,Oh=e=>null!==e&&"object"==typeof e,Nh=e=>"function"==typeof e,Dh=e=>Oh(e)&&Nh(e.then)&&Nh(e.catch),Bh=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),Uh=e=>new Promise((t=>setTimeout((()=>t()),e))),kh=(e,t,n)=>String.fromCharCode(...new Uint8Array(e,t,n));var zh,Gh=Object.freeze({__proto__:null,hasOwn:Ah,isString:Eh,isBoolean:Ph,isNumber:Lh,isNull:Ch,isSymbol:Rh,isDate:Ih,isArray:Fh,isObject:Oh,isFunction:Nh,isPromise:Dh,typeJudge:Bh,sleep:Uh,getAsciiString:kh,log:dh,IVector3ToVector3:ph,IVector3ToEuler:fh,getBoundingBox:mh,rotationAxisFix:gh,rotationAFix:vh,deg2Euler:yh,euler2Deg:xh,getSpaceAttributeFromObject:bh,syncSpaceAttributeToObject:_h,MinHeap:wh,getCubeTexture:Mh,parseSbmx:Sh}),Hh={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Hh.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Hh.Bounce.In(2*e):.5*Hh.Bounce.Out(2*e-1)+.5}}},jh="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Vh=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=jh()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],o=!t;i&&!1===i.update(e,o)&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),Wh={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Wh.Utils.Linear;return t<0?o(e[0],e[1],r):t>1?o(e[n],e[n-1],n-r):o(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,o=Wh.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-t,r-s)*i(t,s)*e[s]*o(r,s);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Wh.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),o(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(o(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):o(e[i?i-1:0],e[i],e[n<i+1?n:i+1],e[n<i+2?n:i+2],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=Wh.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(zh=[1],function(e){var t=1;if(zh[e])return zh[e];for(var n=e;n>1;n--)t*=n;return zh[e]=t,t}),CatmullRom:function(e,t,n,r,i){var o=.5*(n-e),s=.5*(r-t),a=i*i;return(2*t-2*n+o+s)*(i*a)+(-3*t+3*n-2*o-s)*a+o*i+t}}},Xh=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Yh=new Vh,qh=function(){function e(e,t){void 0===t&&(t=Yh),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Hh.Linear.None,this._interpolationFunction=Wh.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Xh.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?jh()+parseFloat(e):e:jh(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,r){for(var i in n){var o=e[i],s=Array.isArray(o),a=s?"array":typeof o,l=!s&&Array.isArray(n[i]);if("undefined"!==a&&"function"!==a){if(l){var c=n[i];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,o)),n[i]=[o].concat(c)}if("object"!==a&&!s||!o||l)void 0===t[i]&&(t[i]=o),s||(t[i]*=1),r[i]=l?n[i].slice().reverse():t[i]||0;else{for(var h in t[i]=s?[]:{},o)t[i][h]=o[h];r[i]=s?[]:{},this._setupProperties(o,t[i],n[i],r[i])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=jh()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=jh()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=jh()),void 0===t&&(t=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var o=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,a=this._chainedTweens.length;s<a;s++)this._chainedTweens[s].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,r){for(var i in n)if(void 0!==t[i]){var o=t[i]||0,s=n[i],a=Array.isArray(e[i]),l=Array.isArray(s);!a&&l?e[i]=this._interpolationFunction(s,r):"object"==typeof s&&s?this._updateProperties(e[i],o,s,r):"number"==typeof(s=this._handleRelativeValue(o,s))&&(e[i]=o+(s-o)*r)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),Qh=Xh.nextId,Zh=Yh,Jh=Zh.getAll.bind(Zh),Kh=Zh.removeAll.bind(Zh),$h=Zh.add.bind(Zh),eu=Zh.remove.bind(Zh),tu=Zh.update.bind(Zh),nu={Easing:Hh,Group:Vh,Interpolation:Wh,now:jh,Sequence:Xh,nextId:Qh,Tween:qh,VERSION:"18.6.4",getAll:Jh,removeAll:Kh,add:$h,remove:eu,update:tu};const ru={"Linear.None":Hh.Linear.None,"Quadratic.In":Hh.Quadratic.In,"Quadratic.Out":Hh.Quadratic.Out,"Quadratic.InOut":Hh.Quadratic.InOut,"Cubic.In":Hh.Cubic.In,"Cubic.Out":Hh.Cubic.Out,"Cubic.InOut":Hh.Cubic.InOut,"Quartic.In":Hh.Quartic.In,"Quartic.Out":Hh.Quartic.Out,"Quartic.InOut":Hh.Quartic.InOut,"Quintic.In":Hh.Quintic.In,"Quintic.Out":Hh.Quintic.Out,"Quintic.InOut":Hh.Quintic.InOut,"Sinusoidal.In":Hh.Sinusoidal.In,"Sinusoidal.Out":Hh.Sinusoidal.Out,"Sinusoidal.InOut":Hh.Sinusoidal.InOut,"Exponential.In":Hh.Exponential.In,"Exponential.Out":Hh.Exponential.Out,"Exponential.InOut":Hh.Exponential.InOut,"Circular.In":Hh.Circular.In,"Circular.Out":Hh.Circular.Out,"Circular.InOut":Hh.Circular.InOut,"Elastic.In":Hh.Elastic.In,"Elastic.Out":Hh.Elastic.Out,"Elastic.InOut":Hh.Elastic.InOut,"Back.In":Hh.Back.In,"Back.Out":Hh.Back.Out,"Back.InOut":Hh.Back.InOut,"Bounce.In":Hh.Bounce.In,"Bounce.Out":Hh.Bounce.Out,"Bounce.InOut":Hh.Bounce.InOut};function iu(e,t,n={},r,i){return new Promise((o=>{const{duration:s=1e3,delay:a=0,repeat:l=!1,mode:c="Linear.None"}=n,h=ru[c],u=new qh(e).to(t,s).easing(h).delay(a).onUpdate((n=>{e instanceof $&&t instanceof $&&n instanceof $&&(n.order=t.order),r&&r(n,u)})).onComplete((()=>{u.stop(),o()}));Lh(l)?u.repeat(l):Ph(l)&&l&&u.repeat(1/0),u.start(),u.onStart((()=>{i&&i(u)}))}))}class ou extends Rt{constructor(e,t,n,r="BaseMesh"){super(e,t);const{id:i,name:o="",level:s={max:null,min:null},visible:a=!0,position:l={x:0,y:0,z:0},rotation:c={x:0,y:0,z:0},scale:h={x:1,y:1,z:1},userData:u={}}=n;if(void 0===i)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=i,this.name=o,this.stype=r,this.level=s,this.visible=null==a||a,this.handleHide=!a,this.position.set(l.x,l.y,l.z),this.rotation.set(c.x,c.y,c.z),this.scale.set(h.x,h.y,h.z),this.castShadow=!0,this.receiveShadow=!0,this.renderOrder=1,this.userData=u,this.isEventPropagation=!1,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}setMove(e,t){return iu(this.position,ph(e),t)}setRotate(e,t){return iu(this.rotation,fh(e),t)}setScale(e,t){return iu(this.scale,ph(e),t)}getBoundingBox(){return new b(new v,new v).setFromObject(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new ou(this.geometry,this.material,{id:`${this.sid}_clone`}).sCopy(this,e)}sCopy(e,t=!0){if(this.name=e.name,this.sid=e.sid,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.geometry=e.geometry.clone(),Fh(e.material)?this.material=e.material.map((e=>e.clone())):this.material=e.material.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++)e.children[t]instanceof su||e.children[t]instanceof ou?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}class su extends ge{constructor(e,t="BaseObject3D"){super();const{id:n,name:r="",level:i={max:null,min:null},visible:o=!0,position:s={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},userData:c={}}=e;if(void 0===n)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=n,this.name=r,this.stype=t,this.level=i,this.visible=null==o||o,this.handleHide=!o,this.position.set(s.x,s.y,s.z),this.rotation.set(a.x,a.y,a.z),this.scale.set(l.x,l.y,l.z),this.castShadow=!0,this.receiveShadow=!0,this.renderOrder=1,this.userData=c,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}setMove(e,t,n,r){return iu(this.position,ph(e),t,n,r)}setRotate(e,t,n,r){return iu(this.rotation,fh(e),t,n,r)}setScale(e,t,n,r){return iu(this.scale,ph(e),t,n,r)}sClone(e){return new su({id:`${this.sid}_clone`}).sCopy(this,e)}sCopy(e,t=!0){if(this.name=e.name,this.sid=e.sid,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];n instanceof su||n instanceof ou?this.add(n.sClone()):this.add(n.clone())}return this}getSpaceAttribute(e=!0){return bh(this,e)}syncSpaceAttribute(e,t=!0){e instanceof su?_h(this,e,t):console.warn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!",e)}}class au extends su{constructor(e){super(e,"SceneManage"),this.name=e.id.toString(),this.isSceneManage=!0}}class lu extends su{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof su&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof su&&e.hide()}))}}class cu extends su{constructor(e){super(e,"PluginObject")}}class hu extends ge{constructor(e){super(),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof hu&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}}let uu,du;const pu=new v,fu=new W,mu=new W,gu={objects:new WeakMap};function vu(){const e=new v,t=new v;return function(n,r){return e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(r.matrixWorld),e.distanceToSquared(t)}}function yu(e){const t=function(e){var t=[];return e.traverse((function(e){e instanceof hu&&t.push(e)})),t}(e).sort((function(e,t){return gu.objects.get(e).distanceToCameraSquared-gu.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,r=t.length;e<r;e++)t[e].element.style.zIndex=""+(n-e)}class xu{constructor(e){e||(e=document.createElement("div")),e.style.overflow="hidden",this.domElement=e}setSize(e,t){uu=e/2,du=t/2,this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"}renderObject(e,t,n){if(e instanceof hu){pu.setFromMatrixPosition(e.matrixWorld),pu.applyMatrix4(mu);const t=e.element,r="translate(-50%,-100%) translate("+(pu.x*uu+uu)+"px,"+(-pu.y*du+du)+"px)";t.style.transform=r,t.style.display=e.visible&&pu.z>=-1&&pu.z<=1?e.userData.elDisplay||"":"none";const i={distanceToCameraSquared:vu()(n,e)};gu.objects.set(e,i),t.parentNode!==this.domElement&&this.domElement.appendChild(t)}for(var r=0,i=e.children.length;r<i;r++)this.renderObject(e.children[r],t,n)}render(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),fu.copy(t.matrixWorldInverse),mu.multiplyMatrices(t.projectionMatrix,fu),this.renderObject(e,e,t),yu(e)}}class bu extends ge{constructor(e){super(),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof bu&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}}let _u,wu;const Mu={camera:{fov:0,style:""},objects:new WeakMap};function Su(e){return Math.abs(e)<1e-10?0:e}function Tu(e){const t=e.elements;return"matrix3d("+Su(t[0])+","+Su(-t[1])+","+Su(t[2])+","+Su(t[3])+","+Su(t[4])+","+Su(-t[5])+","+Su(t[6])+","+Su(t[7])+","+Su(t[8])+","+Su(-t[9])+","+Su(t[10])+","+Su(t[11])+","+Su(t[12])+","+Su(-t[13])+","+Su(t[14])+","+Su(t[15])+")"}class Au{constructor(e,t){e||(e=document.createElement("div")),e.style.overflow="hidden",e.style.pointerEvents="auto",this.domElement=e,t||(t=document.createElement("div")),t.style.transformStyle="preserve-3d",t.style.pointerEvents="auto",t.style.position="absolute",t.style.top="0",e.appendChild(t),this.cameraElement=t}setSize(e,t){_u=e/2,wu=t/2,this.domElement.style.width=e+"px",this.domElement.style.height=t+"px",this.cameraElement.style.width=e+"px",this.cameraElement.style.height=t+"px"}renderObject(e,t,n,r){if(e instanceof bu){const t=function(e,t){const n=e.elements;return"translateX(-50%)matrix3d("+Su(n[0])+","+Su(n[1])+","+Su(n[2])+","+Su(n[3])+","+Su(-n[4])+","+Su(-n[5])+","+Su(-n[6])+","+Su(-n[7])+","+Su(n[8])+","+Su(n[9])+","+Su(n[10])+","+Su(n[11])+","+Su(n[12])+","+Su(n[13])+","+Su(n[14])+","+Su(n[15])+")"}(e.matrixWorld),n=e.element;n.style.transform=t;let r={style:t,distanceToCameraSquared:0};Mu.objects.set(e,r),n.parentNode!==this.cameraElement&&this.cameraElement.appendChild(n)}for(var i=0,o=e.children.length;i<o;i++)this.renderObject(e.children[i],t,n,r)}render(e,t){var n=t.projectionMatrix.elements[5]*wu;Mu.camera.fov!==n&&(this.domElement.style.perspective=t instanceof zt?n+"px":"",Mu.camera.fov=n),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld();let r="";if(t instanceof Ja){r+="scale("+n+")translateX("+Su(-(t.right+t.left)/2)+"px)"+Tu(t.matrixWorldInverse)}else r+="translateZ("+n+"px)"+Tu(t.matrixWorldInverse);const i=r+"translate("+_u+"px,"+wu+"px)";this.cameraElement.style.transform=i,Mu.camera.style=i,this.renderObject(e,e,t,r)}}class Eu extends ge{constructor(e){super(),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Eu&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}}let Pu,Lu;const Cu={camera:{fov:0,style:""},objects:new WeakMap};function Ru(e){return Math.abs(e)<1e-10?0:e}function Iu(e){const t=e.elements;return"matrix3d("+Ru(t[0])+","+Ru(-t[1])+","+Ru(t[2])+","+Ru(t[3])+","+Ru(t[4])+","+Ru(-t[5])+","+Ru(t[6])+","+Ru(t[7])+","+Ru(t[8])+","+Ru(-t[9])+","+Ru(t[10])+","+Ru(t[11])+","+Ru(t[12])+","+Ru(-t[13])+","+Ru(t[14])+","+Ru(t[15])+")"}class Fu{constructor(e,t){e||(e=document.createElement("div")),e.style.overflow="hidden",e.style.pointerEvents="auto",this.domElement=e,t||(t=document.createElement("div")),t.style.transformStyle="preserve-3d",t.style.pointerEvents="auto",t.style.position="absolute",t.style.top="0",e.appendChild(t),this.cameraElement=t}setSize(e,t){Pu=e/2,Lu=t/2,this.domElement.style.width=e+"px",this.domElement.style.height=t+"px",this.cameraElement.style.width=e+"px",this.cameraElement.style.height=t+"px"}renderObject(e,t,n,r){if(e instanceof Eu){const t=n.quaternion.clone();t.x=-n.quaternion.x,t.z=-n.quaternion.z;const r=function(e,t){const n=e.elements;return"translateX(-50%)matrix3d("+Ru(n[0])+","+Ru(-n[1])+","+Ru(n[2])+","+Ru(n[3])+","+Ru(n[4])+","+Ru(-n[5])+","+Ru(n[6])+","+Ru(n[7])+","+Ru(n[8])+","+Ru(-n[9])+","+Ru(n[10])+","+Ru(n[11])+","+Ru(n[12])+","+Ru(n[13])+","+Ru(n[14])+","+Ru(n[15])+")"}((new W).compose(e.parent.getWorldPosition(new v(0,0,0)),t,e.parent.scale)),i=e.element;i.style.transform=r;const o={style:r,distanceToCameraSquared:0};Cu.objects.set(e,o),i.parentNode!==this.cameraElement&&this.cameraElement.appendChild(i)}for(let i=0,o=e.children.length;i<o;i++)this.renderObject(e.children[i],t,n,r)}render(e,t){const n=t.projectionMatrix.elements[5]*Lu;Cu.camera.fov!==n&&(this.domElement.style.perspective=t instanceof zt?n+"px":"",Cu.camera.fov=n),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld();let r="";if(t instanceof Ja){r+="scale("+n+")translateX("+Ru(-(t.right+t.left)/2)+"px)"+Iu(t.matrixWorldInverse)}else r+="translateZ("+n+"px)"+Iu(t.matrixWorldInverse);const i=r+"translate("+Pu+"px,"+Lu+"px)";this.cameraElement.style.transform=i,Cu.camera.style=i,this.renderObject(e,e,t,r)}}class Ou extends su{constructor(e){super(e,"PoiNode");const{type:t,element:n}=e;this.elementType=t,this.element=n,this.create(t)}create(e){"2D"===e||"2d"===e?this._create2D():"2.5D"===e||"2.5d"===e?this._create2DHalf():"3D"!==e&&"3d"!==e||this._create3D()}show(){this.visible=!0,this.handleHide=!1,this._setElementDisplay(!0),this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this._setElementDisplay(!1),this.autoUpdate=!0}getBoundingBox(e=50){e=e<=0?50:e;let t=new v,n=new v,r=new v(e,e,e);return t.copy(this.position),n.copy(this.position),t.sub(r),n.add(r),new b(t,n)}_create2D(){this.add(new hu(this.element))}_create2DHalf(){this.add(new Eu(this.element))}_create3D(){this.add(new bu(this.element))}_setElementDisplay(e){this.children.forEach((t=>{(t instanceof hu||t instanceof Eu||t instanceof bu)&&("2D"===this.elementType||"2d"===this.elementType?t.visible=e:e&&"none"===t.element.style.display?t.element.style.display=t.userData.elDisplay||"block":e||"none"===t.element.style.display||(t.userData.elDisplay=t.element.style.display,t.element.style.display="none"))}))}}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -32,5 +32,5 @@ PERFORMANCE OF THIS SOFTWARE.
32
32
  Version 1.9.0
33
33
  https://localforage.github.io/localForage
34
34
  (c) 2013-2017 Mozilla, Apache License 2.0
35
- */var Bp,Up=(function(e,t){e.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(!a&&Zu)return Zu(s);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,(function(e){var n=t[s][1][e];return i(n||e)}),c,c.exports,e,t,n,r)}return n[s].exports}for(var o=Zu,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){(function(e){var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(h),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),n=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var l=new e.MessageChannel;l.port1.onmessage=h,n=function(){l.port2.postMessage(0)}}var c=[];function h(){var e,t;r=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}r=!1}function u(e){1!==c.push(e)||r||n()}t.exports=u}).call(this,void 0!==qu?qu:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function h(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return o.reject(e,t)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function r(t){n||(n=!0,o.reject(e,t))}function i(t){n||(n=!0,o.resolve(e,t))}function s(){t(i,r)}var a=f(s);"error"===a.status&&r(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function m(e){return e instanceof this?e:o.resolve(new this(i),e)}function g(e){var t=new this(i);return o.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,l=-1,c=new this(i);++l<n;)h(e[l],l);return c;function h(e,i){function l(e){s[i]=e,++a!==n||r||(r=!0,o.resolve(c,s))}t.resolve(e).then(l,(function(e){r||(r=!0,o.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=-1,a=new this(i);++s<n;)l(e[s]);return a;function l(e){t.resolve(e).then((function(e){r||(r=!0,o.resolve(a,e))}),(function(e){r||(r=!0,o.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(i);return this.state!==l?u(n,this.state===a?e:t,this.outcome):this.queue.push(new h(n,e,t)),n},h.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){o.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=f(d,t);if("error"===n.status)return o.reject(e,n.value);var r=n.value;if(r)p(e,r);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},c.resolve=m,c.reject=g,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==qu?qu:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var s=o();function a(){try{if(!s||!s.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function h(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function p(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",m=void 0,g={},v=Object.prototype.toString,y="readonly",x="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function _(e){return new c((function(t){var n=e.transaction(f,x),r=l([""]);n.objectStore(f).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function w(e){return"boolean"==typeof m?c.resolve(m):_(e).then((function(e){return m=e}))}function M(e){var t=g[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function S(e){var t=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=g[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function A(e,t){return new c((function(n,r){if(g[e.name]=g[e.name]||D(),e.db){if(!t)return n(e.db);M(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=s.open.apply(s,i);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(f)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),r(o.error)},o.onsuccess=function(){n(o.result),S(e)}}))}function E(e){return A(e,!1)}function P(e){return A(e,!0)}function L(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function C(e){return new c((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(n){var r=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:r,type:e.type})},r.readAsBinaryString(e)}))}function R(e){return l([b(atob(e.data))],{type:e.type})}function I(e){return e&&e.__local_forage_encoded_blob}function F(e){var t=this,n=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function O(e){M(e);for(var t=g[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,L(e)?P(e):t})).then((function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(t){throw T(e,t),t}))}function N(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(r>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),P(e)})).then((function(){return O(e).then((function(){N(e,t,n,r-1)}))})).catch(n);n(i)}}function D(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function B(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var i=g[n.name];i||(i=D(),g[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=F);var o=[];function s(){return c.resolve()}for(var a=0;a<i.forages.length;a++){var l=i.forages[a];l!==t&&o.push(l._initReady().catch(s))}var h=i.forages.slice(0);return c.all(o).then((function(){return n.db=i.db,E(n)})).then((function(e){return n.db=e,L(n,t._defaultConfig.version)?P(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<h.length;r++){var o=h[r];o!==t&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}}))}function U(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){N(n._dbInfo,y,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),I(e)&&(e=R(e)),t(e)},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function k(e,t){var n=this,r=new c((function(t,r){n.ready().then((function(){N(n._dbInfo,y,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var n=s.result;if(n){var r=n.value;I(r)&&(r=R(r));var i=e(r,n.key,a++);void 0!==i?t(i):n.continue()}else t()},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function z(e,t,n){var r=this;e=d(e);var i=new c((function(n,i){var o;r.ready().then((function(){return o=r._dbInfo,"[object Blob]"===v.call(t)?w(o.db).then((function(e){return e?t:C(t)})):t})).then((function(t){N(r._dbInfo,x,(function(o,s){if(o)return i(o);try{var a=s.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),n(t)},s.onabort=s.onerror=function(){var e=l.error?l.error:l.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return h(i,n),i}function G(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){N(n._dbInfo,x,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){r(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){N(t._dbInfo,x,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function j(e){var t=this,n=new c((function(e,n){t.ready().then((function(){N(t._dbInfo,y,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function V(e,t){var n=this,r=new c((function(t,r){e<0?t(null):n.ready().then((function(){N(n._dbInfo,y,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName),a=!1,l=s.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){r(l.error)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function W(e){var t=this,n=new c((function(e,n){t.ready().then((function(){N(t._dbInfo,y,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):e(s)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function X(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var o=e.name===n.name&&i._dbInfo.db?c.resolve(i._dbInfo.db):E(e).then((function(t){var n=g[e.name],r=n.forages;n.db=t;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=t;return t}));r=e.storeName?o.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;M(e);var r=g[e.name],i=r.forages;t.close();for(var o=0;o<i.length;o++){var a=i[o];a._dbInfo.db=null,a._dbInfo.version=n}return new c((function(t,r){var i=s.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}})).then((function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,S(n._dbInfo)}})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}})):o.then((function(t){M(e);var n=g[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;return new c((function(t,n){var r=s.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<r.length;t++)S(r[t]._dbInfo)})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}))}else r=c.reject("Invalid arguments");return h(r,t),r}var Y={_driver:"asyncStorage",_initStorage:B,_support:a(),iterate:k,getItem:U,setItem:z,removeItem:G,clear:H,length:j,key:V,keys:W,dropInstance:X};function q(){return"function"==typeof openDatabase}var Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z="~~local_forage_type~",J=/^~~local_forage_type~([^~]+)~/,K="__lfsc__:",$=K.length,ee="arbf",te="blob",ne="si08",re="ui08",ie="uic8",oe="si16",se="si32",ae="ur16",le="ui32",ce="fl32",he="fl64",ue=$+ee.length,de=Object.prototype.toString;function pe(e){var t,n,r,i,o,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var c=new ArrayBuffer(s),h=new Uint8Array(c);for(t=0;t<a;t+=4)n=Q.indexOf(e[t]),r=Q.indexOf(e[t+1]),i=Q.indexOf(e[t+2]),o=Q.indexOf(e[t+3]),h[l++]=n<<2|r>>4,h[l++]=(15&r)<<4|i>>2,h[l++]=(3&i)<<6|63&o;return c}function fe(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=Q[n[t]>>2],r+=Q[(3&n[t])<<4|n[t+1]>>4],r+=Q[(15&n[t+1])<<2|n[t+2]>>6],r+=Q[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function me(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var r,i=K;e instanceof ArrayBuffer?(r=e,i+=ee):(r=e.buffer,"[object Int8Array]"===n?i+=ne:"[object Uint8Array]"===n?i+=re:"[object Uint8ClampedArray]"===n?i+=ie:"[object Int16Array]"===n?i+=oe:"[object Uint16Array]"===n?i+=ae:"[object Int32Array]"===n?i+=se:"[object Uint32Array]"===n?i+=le:"[object Float32Array]"===n?i+=ce:"[object Float64Array]"===n?i+=he:t(new Error("Failed to get type for BinaryArray"))),t(i+fe(r))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){var n=Z+e.type+"~"+fe(this.result);t(K+te+n)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function ge(e){if(e.substring(0,$)!==K)return JSON.parse(e);var t,n=e.substring(ue),r=e.substring($,ue);if(r===te&&J.test(n)){var i=n.match(J);t=i[1],n=n.substring(i[0].length)}var o=pe(n);switch(r){case ee:return o;case te:return l([o],{type:t});case ne:return new Int8Array(o);case re:return new Uint8Array(o);case ie:return new Uint8ClampedArray(o);case oe:return new Int16Array(o);case ae:return new Uint16Array(o);case se:return new Int32Array(o);case le:return new Uint32Array(o);case ce:return new Float32Array(o);case he:return new Float64Array(o);default:throw new Error("Unkown type: "+r)}}var ve={serialize:me,deserialize:ge,stringToBuffer:pe,bufferToString:fe};function ye(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function xe(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var i=new c((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(i){ye(i,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=ve,i}function be(e,t,n,r,i,o){e.executeSql(n,r,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?o(e,s):ye(e,t,(function(){e.executeSql(n,r,i,o)}),o)}),o):o(e,s)}),o)}function _e(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function we(e,t){var n=this,r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT * FROM "+i.storeName,[],(function(n,r){for(var o=r.rows,s=o.length,a=0;a<s;a++){var l=o.item(a),c=l.value;if(c&&(c=i.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function Me(e,t,n,r){var i=this;e=d(e);var o=new c((function(o,s){i.ready().then((function(){void 0===t&&(t=null);var a=t,l=i._dbInfo;l.serializer.serialize(t,(function(t,c){c?s(c):l.db.transaction((function(n){be(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){o(a)}),(function(e,t){s(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void o(Me.apply(i,[e,a,n,r-1]));s(t)}}))}))})).catch(s)}));return h(o,n),o}function Se(e,t,n){return Me.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function Ae(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){be(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Ee(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){be(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Pe(e,t){var n=this,r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function Le(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){be(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Ce(e){return new c((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var i=[],o=0;o<r.rows.length;o++)i.push(r.rows.item(o).name);t({db:e,storeNames:i})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Re(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;return h(r=e.name?new c((function(t){var r;r=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(Ce(r))})).then((function(e){return new c((function(t,n){e.db.transaction((function(r){function i(e){return new c((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var o=[],s=0,a=e.storeNames.length;s<a;s++)o.push(i(e.storeNames[s]));c.all(o).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),t),r}var Ie={_driver:"webSQLStorage",_initStorage:xe,_support:q(),iterate:we,getItem:_e,setItem:Se,removeItem:Te,clear:Ae,length:Ee,key:Pe,keys:Le,dropInstance:Re};function Fe(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Oe(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function Ne(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function De(){return!Ne()||localStorage.length>0}function Be(e){var t=this,n={};if(e)for(var r in e)n[r]=e[r];return n.keyPrefix=Oe(e,t._defaultConfig),De()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function Ue(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return h(n,e),n}function ke(e,t){var n=this;e=d(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return h(r,t),r}function ze(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,i=r.length,o=localStorage.length,s=1,a=0;a<o;a++){var l=localStorage.key(a);if(0===l.indexOf(r)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(i),s++)))return c}}}));return h(r,t),r}function Ge(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return h(r,t),r}function He(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var o=localStorage.key(i);0===o.indexOf(e.keyPrefix)&&r.push(o.substring(e.keyPrefix.length))}return r}));return h(n,e),n}function je(e){var t=this.keys().then((function(e){return e.length}));return h(t,e),t}function Ve(e,t){var n=this;e=d(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return h(r,t),r}function We(e,t,n){var r=this;e=d(e);var i=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(i,o){var s=r._dbInfo;s.serializer.serialize(t,(function(t,r){if(r)o(r);else try{localStorage.setItem(s.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}}))}))}));return h(i,n),i}function Xe(e,t){if(t=p.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,i=this;return h(r=e.name?new c((function(t){e.storeName?t(Oe(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),t),r}var Ye={_driver:"localStorageWrapper",_initStorage:Be,_support:Fe(),iterate:ze,getItem:ke,setItem:We,removeItem:Ve,clear:Ue,length:je,key:Ge,keys:He,dropInstance:Xe},qe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Qe=function(e,t){for(var n=e.length,r=0;r<n;){if(qe(e[r],t))return!0;r++}return!1},Ze=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Je={},Ke={},$e={INDEXEDDB:Y,WEBSQL:Ie,LOCALSTORAGE:Ye},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),rt={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function it(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function ot(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ze(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var st=new(function(){function e(t){for(var n in i(this,e),$e)if($e.hasOwnProperty(n)){var r=$e[n],o=r._driver;this[n]=o,Je[o]||this.defineDriver(r)}this._defaultConfig=ot({},rt),this._config=ot({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new c((function(t,n){try{var r=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);for(var o=nt.concat("_initStorage"),s=0,a=o.length;s<a;s++){var l=o[s];if((!Qe(tt,l)||e[l])&&"function"!=typeof e[l])return void n(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return h(n,arguments[arguments.length-1]),n}},n=0,r=tt.length;n<r;n++){var i=tt[n];e[i]||(e[i]=t(i))}}();var u=function(n){Je[r]&&console.info("Redefining LocalForage driver: "+r),Je[r]=e,Ke[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(u,n):u(!!e._support):u(!0)}catch(e){n(e)}}));return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=Je[e]?c.resolve(Je[e]):c.reject(new Error("Driver not found."));return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;Ze(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){r._config.driver=r.driver()}function s(e){return r._extend(e),o(),r._ready=r._initStorage(r._config),r._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var i=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(s).catch(n)}o();var a=new Error("No available storage method found.");return r._driverSet=c.reject(a),r._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=a(i)}))})).catch((function(){o();var e=new Error("No available storage method found.");return r._driverSet=c.reject(e),r._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Ke[e]},e.prototype._extend=function(e){ot(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)it(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=st},{3:3}]},{},[4])(4)}(Bp={exports:{}},Bp.exports),Bp.exports);class kp extends DataView{constructor(e,t,n){super(e),this.appKeys=t,this.isLE=n}byteRevers(e,t){const n=t%this.appKeys.length;return e^this.appKeys[n]}getSoonUint8(e){return this.byteRevers(this.getUint8(e),e)}getSoonUint16(e){const t=[];for(let n=0;n<2;n++)t.push(this.getSoonUint8(e+n));return new DataView(new Uint8Array(t).buffer).getUint16(0,this.isLE)}getSoonUint32(e){const t=[];for(let n=0;n<4;n++)t.push(this.getSoonUint8(e+n));return new DataView(new Uint8Array(t).buffer).getUint32(0,this.isLE)}getSoonFloat32(e){const t=[];for(let n=0;n<4;n++)t.push(this.getSoonUint8(e+n));return new DataView(new Uint8Array(t).buffer).getFloat32(0,this.isLE)}}var zp=class{constructor(){this.materials=new Map,this.sbmInfo=null,this.isLE=!0}load(e,t){return this.sbmInfo=e,fetch(e.url).then((e=>e.arrayBuffer())).then((n=>this.parse(n,e,t)))}parse(e,t,n){this.sbmInfo=t;const r=new DataView(e);let i=0;const o=[];for(let e=0;e<8;e++)o.push(r.getUint8(i)),i+=1;if("SBK-----"!==String.fromCharCode(...o))return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})格式或数据错误!`);const s=[],a=[],l=[];for(let e=0;e<32;e++)s.push(r.getUint8(i)),i+=1;const c=r.getUint8(i);i+=1;const h=r.getUint8(i);i+=1;for(let e=0;e<32;e++)a.push(r.getUint8(i)),i+=1;for(let e=0;e<64;e++)l.push(r.getUint8(i)),i+=1;const u=[...a,...l,...s],d=[];for(let e=0;e<u.length;e++)(e<=7||e>23&&e<=31||e>39&&e<=55||e>63&&e<=87||e>95&&e<=103)&&d.push(u[e]);if(64!==d.length)return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url} 数据错误!`);if(1===c){const e=new kp(r.buffer.slice(i,r.buffer.byteLength),d,this.isLE);return 1===h||2===h?this._parseV2(e,0,n):3===h?this._parseV3(e,0,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}return Promise.resolve(new vp(this.sbmInfo))}_parseV2(e,t,n){return Nu(this,void 0,void 0,(function*(){const r=performance.now(),i=[],o=[],a=[];for(let n=0;n<2;n++)i.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)o.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)a.push(e.getSoonUint8(t)),t+=1;const l={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const c=new vp(this.sbmInfo),h=e.getSoonUint16(t);t+=2;const d=e.getSoonUint16(t);t+=2,l.total=d;for(let n=0;n<h;++n){const n=e.getSoonUint16(t).toString();t+=2,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;const r=e.getSoonFloat32(t);t+=4;const i=e.getSoonFloat32(t);t+=4;const o=e.getSoonFloat32(t);t+=4;const s=e.getSoonFloat32(t);t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;let a=e.getSoonUint8(t);t+=1,0===a?a=0:1===a?a=1:2===a&&(a=2);const l=e.getSoonUint16(t);t+=2;let c=null;if(l>0){let n="",r="";for(let i=0;i<l;i++){const i=e.getSoonUint8(t);i>127?r=r+"%"+i.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(i),r=""):n+=String.fromCharCode(i),t+=1}n=n.replace("\\","/");const{url:i,isPlatform:o}=this.sbmInfo,s=this.getTextureUrl(i,n,o);c=new u,c.image=(new va).load(s),c.wrapS=1e3,c.wrapT=1e3,c.flipY=!1,c.anisotropy=16,c.mipmaps=[],c.generateMipmaps=!0,c.version+=1}if(!this.materials.has(n)){const e=s<1,t=new Gs({color:new Ue(r,i,o),opacity:s,transparent:e,map:c,side:a,shininess:0,specular:0});t.name=n,this.materials.set(n,t)}}for(let i=0;i<d;++i){const i=e.getSoonUint16(t);t+=2;const o=e.getSoonUint16(t);t+=2;const a=[],h=[],u=[],d=[],p=e.getSoonUint16(t);if(t+=2,p>0)for(let n=0;n<p;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4,a.push(n)}const f=e.getSoonUint16(t);if(t+=2,f>0)for(let n=0;n<f;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4}const m=e.getSoonUint16(t);if(t+=2,m>0)for(let n=0;n<m;n++){const n=new s;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,h.push(n)}const g=e.getSoonUint16(t);if(t+=2,g>0)for(let n=0;n<g;n++){const n=e.getSoonUint16(t);t+=2;const r=e.getSoonUint16(t);t+=2;const i=e.getSoonUint16(t);t+=2;const o=new ke(n,r,i);u.push(o),h.length>0&&d.push([h[o.a],h[o.b],h[o.c]])}const y=[],x=[],b=[];for(let e=0;e<u.length;e++){const t=u[e];y.push(a[t.a],a[t.b],a[t.c]);const n=t.vertexColors;if(3===n.length)x.push(n[0],n[1],n[2]);else{const e=t.color;x.push(e,e,e)}const r=d[e];void 0!==r?b.push(r[0],r[1],r[2]):b.push(new s,new s,new s)}const _=new pt;if(y.length>0){const e=new Float32Array(3*y.length);_.setAttribute("position",new We(e,3).copyVector3sArray(y))}if(x.length>0){const e=new Float32Array(3*x.length);_.setAttribute("color",new We(e,3).copyColorsArray(x))}if(b.length>0){const e=new Float32Array(2*b.length);_.setAttribute("uv",new We(e,2).copyVector2sArray(b))}_.computeVertexNormals();const w=this.materials.get(o.toString());if(w){const e=new ou(_,w,{id:i,name:i.toString()});c.add(e)}l.loaded++,l.timeStamp=performance.now()-r,n&&n(l)}return Promise.resolve(c)}))}_parseV3(e,t,n){const r=[],i=[],o=[];for(let n=0;n<2;n++)r.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)i.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)o.push(e.getSoonUint8(t)),t+=1;const a=performance.now(),l={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const c=new vp(this.sbmInfo),h=e.getSoonUint16(t);t+=2;const d=e.getSoonUint16(t);t+=2,l.total=d;for(let n=0;n<h;++n){const n=e.getSoonUint16(t).toString();t+=2,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;const r=e.getSoonFloat32(t);t+=4;const i=e.getSoonFloat32(t);t+=4;const o=e.getSoonFloat32(t);t+=4;const s=e.getSoonFloat32(t);t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;let a=e.getSoonUint8(t);t+=1,0===a?a=0:1===a?a=1:2===a&&(a=2);const l=e.getSoonUint16(t);t+=2;let c=null;if(l>0){let n="",r="";for(let i=0;i<l;i++){const i=e.getSoonUint8(t);i>127?r=r+"%"+i.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(i),r=""):n+=String.fromCharCode(i),t+=1}n=n.replace("\\","/");const{url:i,isPlatform:o}=this.sbmInfo,s=this.getTextureUrl(i,n,o);c=new u,c.image=(new va).load(s),c.wrapS=1e3,c.wrapT=1e3,c.flipY=!1,c.anisotropy=16,c.mipmaps=[],c.generateMipmaps=!0,c.version+=1}if(!this.materials.has(n)){const e=s<1,t=new Gs({color:new Ue(r,i,o),opacity:s,transparent:e,map:c,side:a,shininess:0,specular:0});t.name=n,this.materials.set(n,t)}}for(let r=0;r<d;++r){const r=e.getSoonUint16(t).toString();t+=2;const i=e.getSoonUint16(t);if(t+=2,i>0){let n="";for(let r=0;r<i;r++){const r=e.getUint8(t);r>127?n=n+"%"+r.toString(16).toUpperCase():n.length>0&&(n=""),t+=1}}const o=e.getSoonUint16(t).toString();t+=2;const h=[],u=[],d=[],p=[],f=e.getSoonUint32(t);if(t+=4,f>0)for(let n=0;n<f;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4,h.push(n)}const m=e.getSoonUint32(t);if(t+=4,m>0)for(let n=0;n<m;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4}const g=e.getSoonUint32(t);if(t+=4,g>0)for(let n=0;n<g;n++){const n=new s;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,u.push(n)}const y=e.getSoonUint32(t);if(t+=4,y>0)for(let n=0;n<y;n++){const n=e.getSoonUint32(t);t+=4;const r=e.getSoonUint32(t);t+=4;const i=e.getSoonUint32(t);t+=4;const o=new ke(n,r,i);d.push(o),u.length>0&&p.push([u[o.a],u[o.b],u[o.c]])}const x=[],b=[],_=[];for(let e=0;e<d.length;e++){const t=d[e];x.push(h[t.a],h[t.b],h[t.c]);const n=t.vertexColors;if(3===n.length)b.push(n[0],n[1],n[2]);else{const e=t.color;b.push(e,e,e)}const r=p[e];void 0!==r?_.push(r[0],r[1],r[2]):_.push(new s,new s,new s)}const w=new pt;if(x.length>0){const e=new Float32Array(3*x.length);w.setAttribute("position",new We(e,3).copyVector3sArray(x))}if(b.length>0){const e=new Float32Array(3*b.length);w.setAttribute("color",new We(e,3).copyColorsArray(b))}if(_.length>0){const e=new Float32Array(2*_.length);w.setAttribute("uv",new We(e,2).copyVector2sArray(_))}if(w.computeVertexNormals(),this.materials.has(o)){const e=new ou(w,this.materials.get(o),{id:r,name:r});c.add(e)}l.loaded++,l.timeStamp=performance.now()-a,n&&n(l)}return Promise.resolve(c)}getTextureUrl(e,t,n){let r="",i=t;const o=i.lastIndexOf("/");if(-1!==o&&(i=i.substring(o+1)),r=e,n){const e=r.split("/");e.length>1&&(e.splice(e.length-3,e.length),r=e.join("/")+"/Maps/"+i)}else{const e=r.lastIndexOf("/");-1!==e&&(r=r.substring(0,e+1)+"Maps/"+i)}return r}},Gp=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),r=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(r),t.removeComments&&this.removeCommentProperties(r),t.transformTextOnly&&this.transformTextOnly(r),r):r},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,r){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,r){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,r){var i=Object.keys(e[n]).length>1,o=Object.keys(e[n])[0];i||"object"==typeof e[n][o]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var r=e.attributes.item(n);t._attributes[r.nodeName]=r.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++){var o=e.childNodes.item(i),s=o.nodeName;if(void 0===t[s])t[s]=this.xmlToJson(o);else{if(void 0===t[s].push){var a=t[s];t[s]=[],t[s].push(a)}t[s].push(this.xmlToJson(o))}}return t},e}();function Hp(e){return fetch(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new Gp).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class jp extends Np{constructor(e){super("Sbm",e),this.viewport=e,this.modelMaps=new Map,this.store=Up.createInstance({name:"soonspace",version:2,storeName:"sbmData"})}load(e,t){return this._loadItem(e,t)}parse(e,t,n){return(new zp).parse(e,t,n).then((e=>{if(!this.modelMaps.get(t.url)){const n=e.sClone();this.modelMaps.set(t.url,n)}return e.onLoad&&e.onLoad(e),Promise.resolve(e)}))}clone(e,t,n){return new Promise(((r,i)=>{"Sbm"!==e.stype&&i("In soonspacejs: 方法 cloneSbm 参入对象类型错误!");const{id:o,name:s,level:a,visible:l,position:c,rotation:h,scale:u,onClick:d,onDblClick:p,onRightClick:f,onLoad:m,userData:g}=t,v=e.sClone();o&&(v.sid=o),s&&(v.name=s),a&&(v.level=a),Ph(l)&&(v.visible=l),c&&v.position.set(c.x,c.y,c.z),h&&v.rotation.set(h.x,h.y,h.z),u&&v.scale.set(u.x,u.y,u.z),v.onClick=d?d.bind(v):null,v.onDblClick=p?p.bind(v):null,v.onRightClick=f?f.bind(v):null,v.onLoad=m?m.bind(v):null,v.onLoad&&v.onLoad(v),g&&(v.userData=g),null!==n&&this.viewport.scener.addObject(v,n||this.scene||e.parent),r(v)}))}loadToGroup(e,t,n){return new Promise((r=>Nu(this,void 0,void 0,(function*(){const i=new lu(e);for(let e=0;e<t.length;e++){const r=yield this._loadItem(t[e],(r=>{n&&n({modelTotal:t.length,loadingModelIndex:e+1,current:r})}),null);i.add(r)}this.viewport.scener.addObject(i,this.scene),r(i)}))))}addForGroup(e,t,n){return new Promise((r=>Nu(this,void 0,void 0,(function*(){const i=this.getGroupById(e);if(i)for(let e=0;e<t.length;e++){const o=yield this._loadItem(t[e],(r=>{n&&n({modelTotal:t.length,loadingModelIndex:e+1,current:r})}),null);this.viewport.scener.addObject(o,i),e===t.length-1&&r(i)}r(i)}))))}createGroupFromXml(e,t){return new Promise((n=>Nu(this,void 0,void 0,(function*(){let r=!1;const i=yield Hp(t),o=new lu(e),{ProjectInfo:s,Building:a}=i.Project,l=e=>Nu(this,void 0,void 0,(function*(){const i=t.split(s.Title+".xml")[0],{id:l,name:c}=e._attributes,{name:h}=e.FileSource._attributes,u=s.Title+c,d=yield this._loadItem({id:l,name:u,url:i+h.replace("\\","/")},void 0,null);let p;if(o.add(d),p=Fh(a.ObjectHierarchy.Entity)?a.ObjectHierarchy.Entity.find((e=>e._attributes.id===l)):a.ObjectHierarchy.Entity,!p)return;const f=p.Entity.filter((e=>"FACILITY"===e._attributes.type)),m=f.length;if(0===m&&r)this.viewport.scener.addObject(o,this.scene),n(o);else for(let e=0;e<m;e++){const{id:t,name:s,longname:a,position:l,scale:c,orient:h}=f[e]._attributes,u=l.split(","),p=c.split(","),g=h.split(","),v=yield this._loadItem({id:t,name:s,url:i+a+".sbm",position:{x:10*Number(u[0].trim()),y:10*Number(u[1].trim()),z:10*Number(u[2].trim())},scale:{x:10*Number(p[0].trim()),y:10*Number(p[1].trim()),z:10*Number(p[2].trim())}},void 0,null);v.quaternion.set(Number(g[1].trim()),Number(g[2].trim()),Number(g[3].trim()),Number(g[0].trim())),d.add(v),r&&e===m-1&&(this.viewport.scener.addObject(o,this.scene),n(o))}})),{Floor:c}=a.Floors;Fh(c)?c.forEach(((e,t)=>{t===c.length-1&&(r=!0),l(e)})):Oh(c)&&(r=!0,l(c))}))))}clearIdb(){return this.store.clear()}_loadItem(e,t,n=this.scene){return Nu(this,void 0,void 0,(function*(){const{url:r}=e,{useIndexedDB:i}=this.viewport.options,o=this.modelMaps.get(r);let s=null;if(o)return this.clone(o,e,n);i&&(s=yield this.store.getItem(r)),s||(s=yield this._fetchBuffer(e));const a=yield this.parse(s,e,t);return null!==n&&this.viewport.scener.addObject(a,n||this.scene),Promise.resolve(a)}))}_fetchBuffer(e){const{url:t}=e,{useIndexedDB:n}=this.viewport.options;return fetch(t).then((e=>e.arrayBuffer())).then((e=>(n&&this.store.setItem(t,e),Promise.resolve(e))))}}
36
- /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */var Vp={},Wp=void 0,Xp=Vp;function Yp(e,t){var n,r=e.split("."),i=Xp;!(r[0]in i)&&i.execScript&&i.execScript("var "+r[0]);for(;r.length&&(n=r.shift());)r.length||t===Wp?i=i[n]?i[n]:i[n]={}:i[n]=t}var qp="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function Qp(e){var t,n,r,i,o,s,a,l,c,h,u=e.length,d=0,p=Number.POSITIVE_INFINITY;for(l=0;l<u;++l)e[l]>d&&(d=e[l]),e[l]<p&&(p=e[l]);for(t=1<<d,n=new(qp?Uint32Array:Array)(t),r=1,i=0,o=2;r<=d;){for(l=0;l<u;++l)if(e[l]===r){for(s=0,a=i,c=0;c<r;++c)s=s<<1|1&a,a>>=1;for(h=r<<16|l,c=s;c<t;c+=o)n[c]=h;++i}++r,i<<=1,o<<=1}return[n,d,p]}function Zp(e,t){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=qp?new Uint8Array(e):e,this.m=!1,this.i=Kp,this.r=!1,!t&&(t={})||(t.index&&(this.a=t.index),t.bufferSize&&(this.h=t.bufferSize),t.bufferType&&(this.i=t.bufferType),t.resize&&(this.r=t.resize)),this.i){case Jp:this.b=32768,this.c=new(qp?Uint8Array:Array)(32768+this.h+258);break;case Kp:this.b=0,this.c=new(qp?Uint8Array:Array)(this.h),this.e=this.z,this.n=this.v,this.j=this.w;break;default:throw Error("invalid inflate mode")}}var Jp=0,Kp=1,$p={t:Jp,s:Kp};Zp.prototype.k=function(){for(;!this.m;){var e=xf(this,3);switch(1&e&&(this.m=!0),e>>>=1){case 0:var t=this.input,n=this.a,r=this.c,i=this.b,o=t.length,s=Wp,a=r.length,l=Wp;if(this.d=this.f=0,n+1>=o)throw Error("invalid uncompressed block header: LEN");if(s=t[n++]|t[n++]<<8,n+1>=o)throw Error("invalid uncompressed block header: NLEN");if(s===~(t[n++]|t[n++]<<8))throw Error("invalid uncompressed block header: length verify");if(n+s>t.length)throw Error("input buffer is broken");switch(this.i){case Jp:for(;i+s>r.length;){if(s-=l=a-i,qp)r.set(t.subarray(n,n+l),i),i+=l,n+=l;else for(;l--;)r[i++]=t[n++];this.b=i,r=this.e(),i=this.b}break;case Kp:for(;i+s>r.length;)r=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(qp)r.set(t.subarray(n,n+s),i),i+=s,n+=s;else for(;s--;)r[i++]=t[n++];this.a=n,this.b=i,this.c=r;break;case 1:this.j(gf,yf);break;case 2:var c,h,u,d,p=xf(this,5)+257,f=xf(this,5)+1,m=xf(this,4)+4,g=new(qp?Uint8Array:Array)(rf.length),v=Wp,y=Wp,x=Wp,b=Wp,_=Wp;for(_=0;_<m;++_)g[rf[_]]=xf(this,3);if(!qp)for(_=m,m=g.length;_<m;++_)g[rf[_]]=0;for(c=Qp(g),v=new(qp?Uint8Array:Array)(p+f),_=0,d=p+f;_<d;)switch(y=bf(this,c),y){case 16:for(b=3+xf(this,2);b--;)v[_++]=x;break;case 17:for(b=3+xf(this,3);b--;)v[_++]=0;x=0;break;case 18:for(b=11+xf(this,7);b--;)v[_++]=0;x=0;break;default:x=v[_++]=y}h=Qp(qp?v.subarray(0,p):v.slice(0,p)),u=Qp(qp?v.subarray(p):v.slice(p)),this.j(h,u);break;default:throw Error("unknown BTYPE: "+e)}}return this.n()};var ef,tf,nf=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rf=qp?new Uint16Array(nf):nf,of=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],sf=qp?new Uint16Array(of):of,af=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],lf=qp?new Uint8Array(af):af,cf=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],hf=qp?new Uint16Array(cf):cf,uf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],df=qp?new Uint8Array(uf):uf,pf=new(qp?Uint8Array:Array)(288);for(ef=0,tf=pf.length;ef<tf;++ef)pf[ef]=143>=ef?8:255>=ef?9:279>=ef?7:8;var ff,mf,gf=Qp(pf),vf=new(qp?Uint8Array:Array)(30);for(ff=0,mf=vf.length;ff<mf;++ff)vf[ff]=5;var yf=Qp(vf);function xf(e,t){for(var n,r=e.f,i=e.d,o=e.input,s=e.a,a=o.length;i<t;){if(s>=a)throw Error("input buffer is broken");r|=o[s++]<<i,i+=8}return n=r&(1<<t)-1,e.f=r>>>t,e.d=i-t,e.a=s,n}function bf(e,t){for(var n,r,i=e.f,o=e.d,s=e.input,a=e.a,l=s.length,c=t[0],h=t[1];o<h&&!(a>=l);)i|=s[a++]<<o,o+=8;if((r=(n=c[i&(1<<h)-1])>>>16)>o)throw Error("invalid code length: "+r);return e.f=i>>r,e.d=o-r,e.a=a,65535&n}function _f(e,t){var n,r;switch(this.input=e,this.a=0,!t&&(t={})||(t.index&&(this.a=t.index),t.verify&&(this.A=t.verify)),n=e[this.a++],r=e[this.a++],15&n){case wf:this.method=wf;break;default:throw Error("unsupported compression method")}if(0!=((n<<8)+r)%31)throw Error("invalid fcheck flag:"+((n<<8)+r)%31);if(32&r)throw Error("fdict flag is not supported");this.q=new Zp(e,{index:this.a,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}Zp.prototype.j=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,o,s,a,l=n.length-258;256!==(i=bf(this,e));)if(256>i)r>=l&&(this.b=r,n=this.e(),r=this.b),n[r++]=i;else for(a=sf[o=i-257],0<lf[o]&&(a+=xf(this,lf[o])),i=bf(this,t),s=hf[i],0<df[i]&&(s+=xf(this,df[i])),r>=l&&(this.b=r,n=this.e(),r=this.b);a--;)n[r]=n[r++-s];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},Zp.prototype.w=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,o,s,a,l=n.length;256!==(i=bf(this,e));)if(256>i)r>=l&&(l=(n=this.e()).length),n[r++]=i;else for(a=sf[o=i-257],0<lf[o]&&(a+=xf(this,lf[o])),i=bf(this,t),s=hf[i],0<df[i]&&(s+=xf(this,df[i])),r+a>l&&(l=(n=this.e()).length);a--;)n[r]=n[r++-s];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},Zp.prototype.e=function(){var e,t,n=new(qp?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.c;if(qp)n.set(i.subarray(32768,n.length));else for(e=0,t=n.length;e<t;++e)n[e]=i[e+32768];if(this.g.push(n),this.l+=n.length,qp)i.set(i.subarray(r,r+32768));else for(e=0;32768>e;++e)i[e]=i[r+e];return this.b=32768,i},Zp.prototype.z=function(e){var t,n,r,i=this.input.length/this.a+1|0,o=this.input,s=this.c;return e&&("number"==typeof e.p&&(i=e.p),"number"==typeof e.u&&(i+=e.u)),2>i?n=(r=(o.length-this.a)/this.o[2]/2*258|0)<s.length?s.length+r:s.length<<1:n=s.length*i,qp?(t=new Uint8Array(n)).set(s):t=s,this.c=t},Zp.prototype.n=function(){var e,t,n,r,i,o=0,s=this.c,a=this.g,l=new(qp?Uint8Array:Array)(this.l+(this.b-32768));if(0===a.length)return qp?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(t=0,n=a.length;t<n;++t)for(r=0,i=(e=a[t]).length;r<i;++r)l[o++]=e[r];for(t=32768,n=this.b;t<n;++t)l[o++]=s[t];return this.g=[],this.buffer=l},Zp.prototype.v=function(){var e,t=this.b;return qp?this.r?(e=new Uint8Array(t)).set(this.c.subarray(0,t)):e=this.c.subarray(0,t):(this.c.length>t&&(this.c.length=t),e=this.c),this.buffer=e},_f.prototype.k=function(){var e,t,n=this.input;if(e=this.q.k(),this.a=this.q.a,this.A){t=(n[this.a++]<<24|n[this.a++]<<16|n[this.a++]<<8|n[this.a++])>>>0;var r=e;if("string"==typeof r){var i,o,s=r.split("");for(i=0,o=s.length;i<o;i++)s[i]=(255&s[i].charCodeAt(0))>>>0;r=s}for(var a,l=1,c=0,h=r.length,u=0;0<h;){h-=a=1024<h?1024:h;do{c+=l+=r[u++]}while(--a);l%=65521,c%=65521}if(t!==(c<<16|l)>>>0)throw Error("invalid adler-32 checksum")}return e};var wf=8;Yp("Zlib.Inflate",_f),Yp("Zlib.Inflate.prototype.decompress",_f.prototype.k);var Mf,Sf,Tf,Af,Ef={ADAPTIVE:$p.s,BLOCK:$p.t};if(Object.keys)Mf=Object.keys(Ef);else for(Sf in Mf=[],Tf=0,Ef)Mf[Tf++]=Sf;for(Tf=0,Af=Mf.length;Tf<Af;++Tf)Yp("Zlib.Inflate.BufferType."+(Sf=Mf[Tf]),Ef[Sf]);var Pf=Vp.Zlib.Inflate,Lf={findSpan:function(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,o=r,s=Math.floor((i+o)/2);t<n[s]||t>=n[s+1];)t<n[s]?o=s:i=s,s=Math.floor((i+o)/2);return s},calcBasisFunctions:function(e,t,n,r){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=n;++a){o[a]=t-r[e+1-a],s[a]=r[e+a]-t;for(var l=0,c=0;c<a;++c){var h=s[c+1],u=o[a-c],d=i[c]/(h+u);i[c]=l+h*d,l=u*d}i[a]=l}return i},calcBSplinePoint:function(e,t,n,r){for(var i=this.findSpan(e,r,t),o=this.calcBasisFunctions(i,r,e,t),s=new p(0,0,0,0),a=0;a<=e;++a){var l=n[i-e+a],c=o[a],h=l.w*c;s.x+=l.x*h,s.y+=l.y*h,s.z+=l.z*h,s.w+=l.w*c}return s},calcBasisFunctionDerivatives:function(e,t,n,r,i){for(var o=[],s=0;s<=n;++s)o[s]=0;var a=[];for(s=0;s<=r;++s)a[s]=o.slice(0);var l=[];for(s=0;s<=n;++s)l[s]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),h=o.slice(0),u=1;u<=n;++u){c[u]=t-i[e+1-u],h[u]=i[e+u]-t;for(var d=0,p=0;p<u;++p){var f=h[p+1],m=c[u-p];l[u][p]=f+m;var g=l[p][u-1]/l[u][p];l[p][u]=d+f*g,d=m*g}l[u][u]=d}for(u=0;u<=n;++u)a[0][u]=l[u][n];for(p=0;p<=n;++p){var v=0,y=1,x=[];for(s=0;s<=n;++s)x[s]=o.slice(0);x[0][0]=1;for(var b=1;b<=r;++b){var _=0,w=p-b,M=n-b;p>=b&&(x[y][0]=x[v][0]/l[M+1][w],_=x[y][0]*l[w][M]);var S=p-1<=M?b-1:n-p;for(u=w>=-1?1:-w;u<=S;++u)x[y][u]=(x[v][u]-x[v][u-1])/l[M+1][w+u],_+=x[y][u]*l[w+u][M];p<=M&&(x[y][b]=-x[v][b-1]/l[M+1][p],_+=x[y][b]*l[p][M]),a[b][p]=_;u=v;v=y,y=u}}for(p=n,b=1;b<=r;++b){for(u=0;u<=n;++u)a[b][u]*=p;p*=n-b}return a},calcBSplineDerivatives:function(e,t,n,r,i){for(var o=i<e?i:e,s=[],a=this.findSpan(e,r,t),l=this.calcBasisFunctionDerivatives(a,r,e,o,t),c=[],h=0;h<n.length;++h){var u=(f=n[h].clone()).w;f.x*=u,f.y*=u,f.z*=u,c[h]=f}for(var d=0;d<=o;++d){for(var f=c[a-e].clone().multiplyScalar(l[d][0]),m=1;m<=e;++m)f.add(c[a-e+m].clone().multiplyScalar(l[d][m]));s[d]=f}for(d=o+1;d<=i+1;++d)s[d]=new p(0,0,0);return s},calcKoverI:function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;var i=1;for(r=2;r<=t;++r)i*=r;for(r=2;r<=e-t;++r)i*=r;return n/i},calcRationalCurveDerivatives:function(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var o=e[i];n[i]=new v(o.x,o.y,o.z),r[i]=o.w}for(var s=[],a=0;a<t;++a){var l=n[a].clone();for(i=1;i<=a;++i)l.sub(s[a-i].clone().multiplyScalar(this.calcKoverI(a,i)*r[i]));s[a]=l.divideScalar(r[0])}return s},calcNURBSDerivatives:function(e,t,n,r,i){var o=this.calcBSplineDerivatives(e,t,n,r,i);return this.calcRationalCurveDerivatives(o)},calcSurfacePoint:function(e,t,n,r,i,o,s,a){for(var l=this.findSpan(e,o,n),c=this.findSpan(t,s,r),h=this.calcBasisFunctions(l,o,e,n),u=this.calcBasisFunctions(c,s,t,r),d=[],f=0;f<=t;++f){d[f]=new p(0,0,0,0);for(var m=0;m<=e;++m){var g=i[l-e+m][c-t+f].clone(),v=g.w;g.x*=v,g.y*=v,g.z*=v,d[f].add(g.multiplyScalar(h[m]))}}var y=new p(0,0,0,0);for(f=0;f<=t;++f)y.add(d[f].multiplyScalar(u[f]));y.divideScalar(y.w),a.set(y.x,y.y,y.z)}},Cf=function(e,t,n,r,i){_a.call(this),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||this.knots.length-1;for(var o=0;o<n.length;++o){var s=n[o];this.controlPoints[o]=new p(s.x,s.y,s.z,s.w)}};(Cf.prototype=Object.create(_a.prototype)).constructor=Cf,Cf.prototype.getPoint=function(e,t){var n=t||new v,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Lf.calcBSplinePoint(this.degree,this.knots,this.controlPoints,r);return 1!=i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)},Cf.prototype.getTangent=function(e,t){var n=t||new v,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Lf.calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n};var Rf=function(){var e,t,n;function r(e){da.call(this,e)}function i(e,t){this.textureLoader=e,this.manager=t}function s(){}function l(){}function c(){}function h(){}function d(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function f(){}function m(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function y(e){return e/46186158e3}r.prototype=Object.assign(Object.create(da.prototype),{constructor:r,load:function(e,t,n,r){var i=this,o=""===i.path?ol.extractUrlBase(e):i.path,s=new fa(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,(function(n){try{t(i.parse(n,o))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(t,n){if(s="Kaydara FBX Binary \0",(o=t).byteLength>=s.length&&s===A(o,0,s.length))e=(new h).parse(t);else{var r=A(t);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var i=0;i<t.length;++i){if(r(1)===t[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(m(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+m(r));e=(new c).parse(r)}var o,s;return new i(new ba(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),this.manager).parse(e)}}),i.prototype={constructor:i,parse:function(){t=this.parseConnections();var e=this.parseImages(),r=this.parseTextures(e),i=this.parseMaterials(r),o=this.parseDeformers(),a=(new s).parse(o);return this.parseScene(o,a,i),n},parseConnections:function(){var t=new Map;"Connections"in e&&e.Connections.connections.forEach((function(e){var n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var o={ID:r,relationship:i};t.get(n).parents.push(o),t.has(r)||t.set(r,{parents:[],children:[]});var s={ID:n,relationship:i};t.get(r).children.push(s)}));return t},parseImages:function(){var t={},n={};if("Video"in e.Objects){var r=e.Objects.Video;for(var i in r){var o=r[i];if(t[c=parseInt(i)]=o.RelativeFilename||o.Filename,"Content"in o){var s=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,a="string"==typeof o.Content&&""!==o.Content;if(s||a){var l=this.parseImage(r[i]);n[o.RelativeFilename||o.Filename]=l}}}}for(var c in t){var h=t[c];void 0!==n[h]?t[c]=n[h]:t[c]=t[c].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var o=new Uint8Array(n);return window.URL.createObjectURL(new Blob([o],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var r=e.Objects.Texture;for(var i in r){var o=this.parseTexture(r[i],t);n.set(parseInt(i),o)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,i=e.WrapModeV,o=void 0!==r?r.value:0,s=void 0!==i?i.value:0;if(n.wrapS=0===o?1e3:1001,n.wrapT=0===s?1e3:1001,"Scaling"in e){var a=e.Scaling.value;n.repeat.x=a[0],n.repeat.y=a[1]}return n},loadTexture:function(e,n){var r,i,o=this.textureLoader.path,s=t.get(e.id).children;void 0!==s&&s.length>0&&void 0!==n[s[0].ID]&&(0!==(r=n[s[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var a=e.FileName.slice(-3).toLowerCase();if("tga"===a){var l=this.manager.getHandler(".tga");null===l?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new u):i=l.load(r)}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new u):i=this.textureLoader.load(r);return this.textureLoader.setPath(o),i},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var r=e.Objects.Material;for(var i in r){var o=this.parseMaterial(r[i],t);null!==o&&n.set(parseInt(i),o)}}return n},parseMaterial:function(e,n){var r=e.id,i=e.attrName,o=e.ShadingModel;if("object"==typeof o&&(o=o.value),!t.has(r))return null;var s,a=this.parseParameters(e,n,r);switch(o.toLowerCase()){case"phong":s=new Gs;break;case"lambert":s=new Vs;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new Gs}return s.setValues(a),s.name=i,s},parseParameters:function(e,n,r){var i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new Ue).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new Ue).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new Ue).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new Ue).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new Ue).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new Ue).fromArray(e.SpecularColor.value));var o=this;return t.get(r).children.forEach((function(e){var t=e.relationship;switch(t){case"Bump":i.bumpMap=o.getTexture(n,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=o.getTexture(n,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=o.getTexture(n,e.ID),i.map.encoding=3001;break;case"DisplacementColor":i.displacementMap=o.getTexture(n,e.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(n,e.ID),i.emissiveMap.encoding=3001;break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=o.getTexture(n,e.ID);break;case"ReflectionColor":i.envMap=o.getTexture(n,e.ID),i.envMap.mapping=303,i.envMap.encoding=3001;break;case"SpecularColor":i.specularMap=o.getTexture(n,e.ID),i.specularMap.encoding=3001;break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=o.getTexture(n,e.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}})),i},getTexture:function(n,r){return"LayeredTexture"in e.Objects&&r in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=t.get(r).children[0].ID),n.get(r)},parseDeformers:function(){var n={},r={};if("Deformer"in e.Objects){var i=e.Objects.Deformer;for(var o in i){var s=i[o],a=t.get(parseInt(o));if("Skin"===s.attrType){var l=this.parseSkeleton(a,i);l.ID=o,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=a.parents[0].ID,n[o]=l}else if("BlendShape"===s.attrType){var c={id:o};c.rawTargets=this.parseMorphTargets(a,i),c.id=o,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),r[o]=c}}}return{skeletons:n,morphTargets:r}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var i={ID:e.ID,indices:[],weights:[],transformLink:(new W).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,n){for(var r=[],i=0;i<e.children.length;i++){var o=e.children[i],s=n[o.ID],a={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;a.geoID=t.get(parseInt(o.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(a)}return r},parseScene:function(r,i,o){n=new Jr;var s=this.parseModels(r.skeletons,i,o),a=e.Objects.Model,c=this;s.forEach((function(e){var r=a[e.ID];c.setLookAtProperties(e,r),t.get(e.ID).parents.forEach((function(t){var n=s.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&n.add(e)})),this.bindSkeleton(r.skeletons,i,s),this.createAmbientLight(),this.setupMorphMaterials(),n.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrixWorld=e.parent.matrix);var t=M(e.userData.transformData);e.applyMatrix4(t)}}));var h=(new l).parse();1===n.children.length&&n.children[0].isGroup&&(n.children[0].animations=h,n=n.children[0]),n.animations=h},parseModels:function(n,r,i){var o=new Map,s=e.Objects.Model;for(var a in s){var l=parseInt(a),c=s[a],h=t.get(l),u=this.buildSkeleton(h,n,l,c.attrName);if(!u){switch(c.attrType){case"Camera":u=this.createCamera(h);break;case"Light":u=this.createLight(h);break;case"Mesh":u=this.createMesh(h,r,i);break;case"NurbsCurve":u=this.createCurve(h,r);break;case"LimbNode":case"Root":u=new Oi;break;case"Null":default:u=new Jr}u.name=c.attrName?Yl.sanitizeNodeName(c.attrName):"",u.ID=l}this.getTransformData(u,c),o.set(l,u)}return o},buildSkeleton:function(e,t,n,r){var i=null;return e.parents.forEach((function(e){for(var o in t){var s=t[o];s.rawBones.forEach((function(t,o){if(t.ID===e.ID){var a=i;(i=new Oi).matrixWorld.copy(t.transformLink),i.name=r?Yl.sanitizeNodeName(r):"",i.ID=n,s.bones[o]=i,null!==a&&i.add(a)}}))}})),i},createCamera:function(t){var n,r;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(r=n)})),void 0===r)n=new ge;else{var i=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(i=1);var o=1;void 0!==r.NearPlane&&(o=r.NearPlane.value/1e3);var s=1e3;void 0!==r.FarPlane&&(s=r.FarPlane.value/1e3);var a=window.innerWidth,l=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(a=r.AspectWidth.value,l=r.AspectHeight.value);var c=a/l,h=45;void 0!==r.FieldOfView&&(h=r.FieldOfView.value);var u=r.FocalLength?r.FocalLength.value:null;switch(i){case 0:n=new zt(h,c,o,s),null!==u&&n.setFocalLength(u);break;case 1:n=new Ja(-a/2,a/2,l/2,-l/2,o,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),n=new ge}}return n},createLight:function(t){var n,r;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(r=n)})),void 0===r)n=new ge;else{var i;i=void 0===r.LightType?0:r.LightType.value;var s=16777215;void 0!==r.Color&&(s=(new Ue).fromArray(r.Color.value));var a=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0);var l=0;void 0!==r.FarAttenuationEnd&&(l=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(i){case 0:n=new Za(s,a,l,1);break;case 1:n=new $a(s,a);break;case 2:var c=Math.PI/3;void 0!==r.InnerAngle&&(c=o.degToRad(r.InnerAngle.value));var h=0;void 0!==r.OuterAngle&&(h=o.degToRad(r.OuterAngle.value),h=Math.max(h,1)),n=new qa(s,a,l,c,h,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),n=new Za(s,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(n.castShadow=!0)}return n},createMesh:function(e,t,n){var r,i=null,o=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new Gs({color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(s.forEach((function(e){e.skinning=!0})),(r=new Fi(i,o)).normalizeSkinWeights()):r=new Rt(i,o),r},createCurve:function(e,t){return new Qi(e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),new ji({color:3342591,linewidth:1}))},getTransformData:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?S(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n},setLookAtProperties:function(r,i){"LookAtProperty"in i&&t.get(r.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var i=e.Objects.Model[t.ID];if("Lcl_Translation"in i){var o=i.Lcl_Translation.value;void 0!==r.target?(r.target.position.fromArray(o),n.add(r.target)):r.lookAt((new v).fromArray(o))}}}))},bindSkeleton:function(e,n,r){var i=this.parsePoseNodes();for(var o in e){var s=e[o];t.get(parseInt(s.ID)).parents.forEach((function(e){if(n.has(e.ID)){var o=e.ID;t.get(o).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new Bi(s.bones),i[e.ID])}))}}))}},parsePoseNodes:function(){var t={};if("Pose"in e.Objects){var n=e.Objects.Pose;for(var r in n)if("BindPose"===n[r].attrType){var i=n[r].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new W).fromArray(e.Matrix.a)})):t[i.Node]=(new W).fromArray(i.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,r=t[0],i=t[1],o=t[2];if(0!==r||0!==i||0!==o){var s=new Ue(r,i,o);n.add(new el(s,1))}}},setupMorphMaterials:function(){var e=this;n.traverse((function(t){t.isMesh&&t.geometry.morphAttributes.position&&t.geometry.morphAttributes.position.length&&(Array.isArray(t.material)?t.material.forEach((function(n,r){e.setupMorphMaterial(t,n,r)})):e.setupMorphMaterial(t,t.material))}))},setupMorphMaterial:function(e,t,r){var i=e.uuid,o=t.uuid,s=!1;if(n.traverse((function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach((function(t){t.uuid===o&&e.uuid!==i&&(s=!0)})):e.material.uuid===o&&e.uuid!==i&&(s=!0))})),!0===s){var a=t.clone();a.morphTargets=!0,void 0===r?e.material=a:e.material[r]=a}else t.morphTargets=!0}},s.prototype={constructor:s,parse:function(n){var r=new Map;if("Geometry"in e.Objects){var i=e.Objects.Geometry;for(var o in i){var s=t.get(parseInt(o)),a=this.parseGeometry(s,i[o],n);r.set(parseInt(o),a)}}return r},parseGeometry:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(t,n,r){var i=r.skeletons,o=[],s=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==s.length){var a=t.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);t.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])}));var l=s[0],c={};"RotationOrder"in l&&(c.eulerOrder=S(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);var h=M(c);return this.genGeometry(n,a,o,h)}},genGeometry:function(e,t,n,r){var i=new pt;e.attrName&&(i.name=e.attrName);var o=this.parseGeoNode(e,t),s=this.genBuffers(o),l=new et(s.vertex,3);if(l.applyMatrix4(r),i.setAttribute("position",l),s.colors.length>0&&i.setAttribute("color",new et(s.colors,3)),t&&(i.setAttribute("skinIndex",new Ze(s.weightsIndices,4)),i.setAttribute("skinWeight",new et(s.vertexWeights,4)),i.FBX_Deformer=t),s.normal.length>0){var c=(new a).getNormalMatrix(r),h=new et(s.normal,3);h.applyNormalMatrix(c),i.setAttribute("normal",h)}if(s.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),i.setAttribute(n,new et(s.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){var u=s.materialIndex[0],d=0;if(s.materialIndex.forEach((function(e,t){e!==u&&(i.addGroup(d,t-d,u),u=e,d=t)})),i.groups.length>0){var p=i.groups[i.groups.length-1],f=p.start+p.count;f!==s.materialIndex.length&&i.addGroup(f,s.materialIndex.length-f,u)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i},parseGeoNode:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,o=[],s=[],a=[],l=[],c=[],h=[],u=this;return e.vertexIndices.forEach((function(d,p){var f=!1;d<0&&(d^=-1,f=!0);var m=[],g=[];if(o.push(3*d,3*d+1,3*d+2),e.color){var v=b(p,n,d,e.color);a.push(v[0],v[1],v[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){g.push(e.weight),m.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var y=[0,0,0,0],x=[0,0,0,0];g.forEach((function(e,t){var n=e,r=m[t];x.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var o=y[t];y[t]=r,r=o}}))})),m=y,g=x}for(;g.length<4;)g.push(0),m.push(0);for(var _=0;_<4;++_)c.push(g[_]),h.push(m[_])}if(e.normal){v=b(p,n,d,e.normal);s.push(v[0],v[1],v[2])}if(e.material&&"AllSame"!==e.material.mappingType)var w=b(p,n,d,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var r=b(p,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(r[0]),l[t].push(r[1])})),r++,f&&(u.genFace(t,e,o,w,s,a,l,c,h,r),n++,r=0,o=[],s=[],a=[],l=[],c=[],h=[])})),t},genFace:function(e,t,n,r,i,o,s,a,l,c){for(var h=2;h<c;h++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(h-1)]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[n[3*h]]),e.vertex.push(t.vertexPositions[n[3*h+1]]),e.vertex.push(t.vertexPositions[n[3*h+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(h-1)]),e.vertexWeights.push(a[4*(h-1)+1]),e.vertexWeights.push(a[4*(h-1)+2]),e.vertexWeights.push(a[4*(h-1)+3]),e.vertexWeights.push(a[4*h]),e.vertexWeights.push(a[4*h+1]),e.vertexWeights.push(a[4*h+2]),e.vertexWeights.push(a[4*h+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(h-1)]),e.weightsIndices.push(l[4*(h-1)+1]),e.weightsIndices.push(l[4*(h-1)+2]),e.weightsIndices.push(l[4*(h-1)+3]),e.weightsIndices.push(l[4*h]),e.weightsIndices.push(l[4*h+1]),e.weightsIndices.push(l[4*h+2]),e.weightsIndices.push(l[4*h+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(h-1)]),e.colors.push(o[3*(h-1)+1]),e.colors.push(o[3*(h-1)+2]),e.colors.push(o[3*h]),e.colors.push(o[3*h+1]),e.colors.push(o[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(h-1)]),e.normal.push(i[3*(h-1)+1]),e.normal.push(i[3*(h-1)+2]),e.normal.push(i[3*h]),e.normal.push(i[3*h+1]),e.normal.push(i[3*h+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(s[n][0]),e.uvs[n].push(s[n][1]),e.uvs[n].push(s[n][2*(h-1)]),e.uvs[n].push(s[n][2*(h-1)+1]),e.uvs[n].push(s[n][2*h]),e.uvs[n].push(s[n][2*h+1])}))},addMorphTargets:function(t,n,r,i){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var o=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var s=e.Objects.Geometry[r.geoID];void 0!==s&&o.genMorphGeometry(t,n,s,i,r.name)}))}))}},genMorphGeometry:function(e,t,n,r,i){for(var o=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],s=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),h=0;h<a.length;h++){var u=3*a[h];c[u]=s[3*h],c[u+1]=s[3*h+1],c[u+2]=s[3*h+2]}var d={vertexIndices:o,vertexPositions:c},p=new et(this.genBuffers(d).vertex,3);p.name=i||n.attrName,p.applyMatrix4(r),e.morphAttributes.position.push(p)},parseNormals:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}},parseUVs:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return"IndexToDirect"===n&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}},parseVertexColors:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];return"IndexToDirect"===n&&(i=e.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}},parseMaterialIndices:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],o=0;o<r.length;++o)i.push(o);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}},parseNurbsGeometry:function(e){if(void 0===Cf)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new pt;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new pt;for(var n,r,i=t-1,o=e.KnotVector.a,s=[],a=e.Points.a,l=0,c=a.length;l<c;l+=4)s.push((new p).fromArray(a,l));if("Closed"===e.Form)s.push(s[0]);else if("Periodic"===e.Form){n=i,r=o.length-1-n;for(l=0;l<i;++l)s.push(s[l])}var h=new Cf(i,o,s,n,r).getPoints(7*s.length),u=new Float32Array(3*h.length);h.forEach((function(e,t){e.toArray(u,3*t)}));var d=new pt;return d.setAttribute("position",new We(u,3)),d}},l.prototype={constructor:l,parse:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var r=t[n],i=this.addClip(r);e.push(i)}return e},parseClips:function(){if(void 0!==e.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var n=this.parseAnimationLayers(t);return this.parseAnimStacks(n)}},parseAnimationCurveNodes:function(){var t=e.Objects.AnimationCurveNode,n=new Map;for(var r in t){var i=t[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){var o={id:i.id,attr:i.attrName,curves:{}};n.set(o.id,o)}}return n},parseAnimationCurves:function(n){var r=e.Objects.AnimationCurve;for(var i in r){var o={id:r[i].id,times:r[i].KeyTime.a.map(y),values:r[i].KeyValueFloat.a},s=t.get(o.id);if(void 0!==s){var a=s.parents[0].ID,l=s.parents[0].relationship;l.match(/X/)?n.get(a).curves.x=o:l.match(/Y/)?n.get(a).curves.y=o:l.match(/Z/)?n.get(a).curves.z=o:l.match(/d|DeformPercent/)&&n.has(a)&&(n.get(a).curves.morph=o)}}},parseAnimationLayers:function(r){var i=e.Objects.AnimationLayer,o=new Map;for(var s in i){var a=[],l=t.get(parseInt(s));if(void 0!==l)l.children.forEach((function(i,o){if(r.has(i.ID)){var s=r.get(i.ID);if(void 0!==s.curves.x||void 0!==s.curves.y||void 0!==s.curves.z){if(void 0===a[o])if(void 0!==(p=t.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID)){if(void 0===(c=e.Objects.Model[p.toString()]))return void console.warn("THREE.FBXLoader: Encountered a unused curve.",i);var l={modelName:c.attrName?Yl.sanitizeNodeName(c.attrName):"",ID:c.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};n.traverse((function(e){e.ID===c.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new W),"PreRotation"in c&&(l.preRotation=c.PreRotation.value),"PostRotation"in c&&(l.postRotation=c.PostRotation.value),a[o]=l}a[o]&&(a[o][s.attr]=s)}else if(void 0!==s.curves.morph){if(void 0===a[o]){var c,h=t.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,u=t.get(h).parents[0].ID,d=t.get(u).parents[0].ID,p=t.get(d).parents[0].ID;l={modelName:(c=e.Objects.Model[p]).attrName?Yl.sanitizeNodeName(c.attrName):"",morphName:e.Objects.Deformer[h].attrName};a[o]=l}a[o][s.attr]=s}}})),o.set(parseInt(s),a)}return o},parseAnimStacks:function(n){var r=e.Objects.AnimationStack,i={};for(var o in r){var s=t.get(parseInt(o)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var a=n.get(s[0].ID);i[o]={name:r[o].attrName,layer:a}}return i},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new aa(e.name,-1,t)},generateTracks:function(e){var t=[],n=new v,r=new g,i=new v;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new $).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var o=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==o&&t.push(o)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var s=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==s&&t.push(s)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==a&&t.push(a)}if(void 0!==e.DeformPercent){var l=this.generateMorphTrack(e);void 0!==l&&t.push(l)}return t},generateVectorTrack:function(e,t,n,r){var i=this.getTimesForAllAxes(t);return new sa(e+"."+r,i,this.getKeyframeTrackValues(i,t,n))},generateRotationTrack:function(e,t,n,r,i,s){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(o.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(o.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(o.degToRad));var a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,n);void 0!==r&&((r=r.map(o.degToRad)).push(s),r=(new $).fromArray(r),r=(new g).setFromEuler(r)),void 0!==i&&((i=i.map(o.degToRad)).push(s),i=(new $).fromArray(i),i=(new g).setFromEuler(i).invert());for(var c=new g,h=new $,u=[],d=0;d<l.length;d+=3)h.set(l[d],l[d+1],l[d+2],s),c.setFromEuler(h),void 0!==r&&c.premultiply(r),void 0!==i&&c.multiply(i),c.toArray(u,d/3*4);return new ia(e+".quaternion",a,u)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),i=n.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new na(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)},getTimesForAllAxes:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),(t=t.sort((function(e,t){return e-t}))).length>1){for(var n=1,r=t[0],i=1;i<t.length;i++){var o=t[i];o!==r&&(t[n]=o,r=o,n++)}t=t.slice(0,n)}return t},getKeyframeTrackValues:function(e,t,n){var r=n,i=[],o=-1,s=-1,a=-1;return e.forEach((function(e){if(t.x&&(o=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==o){var n=t.x.values[o];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==s){var l=t.y.values[s];i.push(l),r[1]=l}else i.push(r[1]);if(-1!==a){var c=t.z.values[a];i.push(c),r[2]=c}else i.push(r[2])})),i},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n,i=Math.abs(r);if(i>=180){for(var o=i/180,s=r/o,a=n+s,l=e.times[t-1],c=(e.times[t]-l)/o,h=l+c,u=[],d=[];h<e.times[t];)u.push(h),h+=c,d.push(a),a+=s;e.times=E(e.times,t,u),e.values=E(e.values,t,d)}}}},c.prototype={constructor:c,getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new f,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i=e.match(/^[\s\t]*;/),o=e.match(/^[\s\t]*$/);if(!i&&!o){var s=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");s?t.parseNodeBegin(e,s):a?t.parseNodeProperty(e,a,n[++r]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes},parseNodeBegin:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},o=this.parseNodeAttr(r),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in s?("PoseNode"===n?s.PoseNode.push(i):void 0!==s[n].id&&(s[n]={},s[n][s[n].id]=s[n]),""!==o.id&&(s[n][o.id]=i)):"number"==typeof o.id?(s[n]={},s[n][o.id]=i):"Properties70"!==n&&(s[n]="PoseNode"===n?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}},parseNodeProperty:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===r){var s=i.split(",").slice(1),a=parseInt(s[0]),l=parseInt(s[1]),c=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}(i=[a,l],c=c.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===o[r]&&(o[r]=[])}"Node"===r&&(o.id=i),r in o&&Array.isArray(o[r])?o[r].push(i):"a"!==r?o[r]=i:o.a=i,this.setCurrentProp(o,r),"a"===r&&","!==i.slice(-1)&&(o.a=T(i))}else this.parseNodeSpecialProperty(e,r,i)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=T(t.a))},parseNodeSpecialProperty:function(e,t,n){var r=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],o=r[1],s=r[2],a=r[3],l=r[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=T(l)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:l},this.setCurrentProp(this.getPrevNode(),i)}},h.prototype={constructor:h,parse:function(e){var t=new d(e);t.skip(23);var n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new f;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var o=e.getUint8(),s=e.getString(o);if(0===r)return null;for(var a=[],l=0;l<i;l++)a.push(this.parseProperty(e));var c=a.length>0?a[0]:"",h=a.length>1?a[1]:"",u=a.length>2?a[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(s,n,d)}return n.propertyList=a,"number"==typeof c&&(n.id=c),""!==h&&(n.attrName=h),""!==u&&(n.attrType=u),""!==s&&(n.name=s),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var o,s=n.propertyList[0],a=n.propertyList[1],l=n.propertyList[2],c=n.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[s]={type:a,type2:l,flag:c,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var n=e.getUint32();return e.getArrayBuffer(n);case"S":n=e.getUint32();return e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===Pf&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var s=new d(new Pf(new Uint8Array(e.getArrayBuffer(o))).decompress().buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},d.prototype={constructor:d,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e},getInt64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var r=t.indexOf(0);return r>=0&&(t=t.slice(0,r)),ol.decodeText(new Uint8Array(t))}},f.prototype={constructor:f,add:function(e,t){this[e]=t}};var x=[];function b(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var o=i*r.dataSize,s=o+r.dataSize;return function(e,t,n,r){for(var i=n,o=0;i<r;i++,o++)e[o]=t[i];return e}(x,r.buffer,o,s)}var _=new $,w=new v;function M(e){var t,n=new W,r=new W,i=new W,s=new W,a=new W,l=new W,c=new W,h=new W,u=new W,d=new W,p=new W,f=e.inheritType?e.inheritType:0;(e.translation&&n.setPosition(w.fromArray(e.translation)),e.preRotation)&&((t=e.preRotation.map(o.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(_.fromArray(t)));e.rotation&&((t=e.rotation.map(o.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(_.fromArray(t)));e.postRotation&&((t=e.postRotation.map(o.degToRad)).push(e.eulerOrder),s.makeRotationFromEuler(_.fromArray(t)));e.scale&&a.scale(w.fromArray(e.scale)),e.scalingOffset&&c.setPosition(w.fromArray(e.scalingOffset)),e.scalingPivot&&l.setPosition(w.fromArray(e.scalingPivot)),e.rotationOffset&&h.setPosition(w.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(w.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d=e.parentMatrixWorld);var m=r.multiply(i).multiply(s),g=new W;d.extractRotation(g),(new W).copyPosition(d);var v=new W;v.copy(g).invert().multiply(d);var y=new W;if(0===f)y.copy(g).multiply(m).multiply(v).multiply(a);else if(1===f)y.copy(g).multiply(v).multiply(m).multiply(a);else{var x=new W;x.copy(a).invert();var b=(new W).multiply(v).multiply(x);y.copy(g).multiply(m).multiply(b).multiply(a)}var M=new W;M.copy(u).invert();var S=new W;S.copy(l).invert();var T=new W;T.copy(n).multiply(h).multiply(u).multiply(r).multiply(i).multiply(s).multiply(M).multiply(c).multiply(l).multiply(a).multiply(S);var A=(new W).copyPosition(T),E=(new W).copy(d).multiply(A);return p.copyPosition(E),T=(new W).multiply(p).multiply(y)}function S(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function T(e){return e.split(",").map((function(e){return parseFloat(e)}))}function A(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),ol.decodeText(new Uint8Array(e,t,n))}function E(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}return r}(),If=function(){function e(e){da.call(this,e),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new l(e)})),this.register((function(e){return new h(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new i(e)})),this.register((function(e){return new d(e)}))}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(da.prototype),{constructor:e,load:function(e,t,n,r){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:ol.extractUrlBase(e),this.manager.itemStart(e);var s=function(t){r?r(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},a=new fa(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{o.parse(n,i,(function(n){t(n),o.manager.itemEnd(e)}),s)}catch(e){s(e)}}),n,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(e,t,i,o){var s,l={},c={};if("string"==typeof e)s=e;else if(ol.decodeText(new Uint8Array(e,0,4))===p){try{l[n.KHR_BINARY_GLTF]=new g(e)}catch(e){return void(o&&o(e))}s=l[n.KHR_BINARY_GLTF].content}else s=ol.decodeText(new Uint8Array(e));var h=JSON.parse(s);if(void 0===h.asset||h.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new Z(h,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var d=0;d<this.pluginCallbacks.length;d++){var f=this.pluginCallbacks[d](u);c[f.name]=f,l[f.name]=!0}if(h.extensionsUsed)for(d=0;d<h.extensionsUsed.length;++d){var m=h.extensionsUsed[d],v=h.extensionsRequired||[];switch(m){case n.KHR_MATERIALS_UNLIT:l[m]=new a;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:l[m]=new w;break;case n.KHR_DRACO_MESH_COMPRESSION:l[m]=new y(h,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:l[m]=new r(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:l[m]=new x;break;case n.KHR_MESH_QUANTIZATION:l[m]=new M;break;default:v.indexOf(m)>=0&&void 0===c[m]&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}u.setExtensions(l),u.setPlugins(c),u.parse(i,o)}}});var n={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 r(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function i(e){this.parser=e,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function a(){this.name=n.KHR_MATERIALS_UNLIT}function l(e){this.parser=e,this.name=n.KHR_MATERIALS_CLEARCOAT}function c(e){this.parser=e,this.name=n.KHR_MATERIALS_TRANSMISSION}function h(e){this.parser=e,this.name=n.KHR_TEXTURE_BASISU}function u(e){this.parser=e,this.name=n.EXT_TEXTURE_WEBP,this.isSupported=null}function d(e){this.name=n.EXT_MESHOPT_COMPRESSION,this.parser=e}i.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}},i.prototype._loadLight=function(e){var t=this.parser,n="light:"+e,r=t.cache.get(n);if(r)return r;var i,o=t.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],a=new Ue(16777215);void 0!==s.color&&a.fromArray(s.color);var l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new $a(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new Za(a)).distance=l;break;case"spot":(i=new qa(a)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,void 0!==s.intensity&&(i.intensity=s.intensity),i.name=t.createUniqueName(s.name||"light_"+e),r=Promise.resolve(i),t.cache.add(n,r),r},i.prototype.createNodeAttachment=function(e){var t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(e){return n._getNodeRef(t.cache,i,e)}))},a.prototype.getMaterialType=function(){return He},a.prototype.extendParams=function(e,t,n){var r=[];e.color=new Ue(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture))}return Promise.all(r)},l.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?zs:null},l.prototype.extendMaterialParams=function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new s(a,a)}return Promise.all(i)},c.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?zs:null},c.prototype.extendMaterialParams=function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(t.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)},h.prototype.loadTexture=function(e){var t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],o=n.images[i.source],s=t.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o,s)},u.prototype.loadTexture=function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var o=i.extensions[t],s=r.images[o.source],a=s.uri?n.options.manager.getHandler(s.uri):n.textureLoader;return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,s,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))},u.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},d.prototype.loadBufferView=function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,o.ready]).then((function(e){var t=r.byteOffset||0,n=r.byteLength||0,i=r.count,s=r.byteStride,a=new ArrayBuffer(i*s),l=new Uint8Array(e[0],t,n);return o.decodeGltfBuffer(new Uint8Array(a),i,s,l,r.mode,r.filter),a}))}return null};var p="glTF",f=1313821514,m=5130562;function g(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:ol.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==p)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 r=new DataView(e,12),i=0;i<r.byteLength;){var o=r.getUint32(i,!0);i+=4;var s=r.getUint32(i,!0);if(i+=4,s===f){var a=new Uint8Array(e,12+i,o);this.content=ol.decodeText(a)}else if(s===m){var l=12+i;this.body=e.slice(l,l+o)}i+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function y(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function x(){this.name=n.KHR_TEXTURE_TRANSFORM}function _(e){ks.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),i=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),s={specular:{value:(new Ue).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var a in s)e.uniforms[a]=s[a];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",i).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){s.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(e)}function w(){return{name:n.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 _},extendParams:function(e,t,n){var r=t.extensions[this.name];e.color=new Ue(1,1,1),e.opacity=1;var i=[];if(Array.isArray(r.diffuseFactor)){var o=r.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==r.diffuseTexture&&i.push(n.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new Ue(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new Ue(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;i.push(n.assignTexture(e,"glossinessMap",s)),i.push(n.assignTexture(e,"specularMap",s))}return Promise.all(i)},createMaterial:function(e){var t=new _(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function M(){this.name=n.KHR_MESH_QUANTIZATION}function S(e,t,n,r){Qs.call(this,e,t,n,r)}y.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},a={},l={};for(var c in o){var h=B[c]||c.toLowerCase();s[h]=o[c]}for(c in e.attributes){h=B[c]||c.toLowerCase();if(void 0!==o[c]){var u=n.accessors[e.attributes[c]],d=I[u.componentType];l[h]=d,a[h]=!0===u.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=a[n];void 0!==i&&(r.normalized=i)}t(e)}),s,l)}))}))},x.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},_.prototype=Object.create(ks.prototype),_.prototype.constructor=_,_.prototype.copy=function(e){return ks.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},S.prototype=Object.create(Qs.prototype),S.prototype.constructor=S,S.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,o=0;o!==r;o++)t[o]=n[i+o];return t},S.prototype.beforeStart_=S.prototype.copySampleValue_,S.prototype.afterEnd_=S.prototype.copySampleValue_,S.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,c=r-t,h=(n-t)/c,u=h*h,d=u*h,p=e*l,f=p-l,m=-2*d+3*u,g=d-u,v=1-m,y=g-u+h,x=0;x!==s;x++){var b=o[f+x+s],_=o[f+x+a]*c,w=o[p+x+s],M=o[p+x]*c;i[x]=v*b+y*_+m*w+g*M}return i};var T=0,A=1,E=2,P=3,L=4,C=5,R=6,I={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},F={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},O={33071:1001,33648:1002,10497:1e3},N={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},B={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},U={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},k={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300},z="OPAQUE",G="MASK",H="BLEND";function j(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function V(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new ks({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function X(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Y(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 q(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)e.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Q(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Z(e,n){this.json=e||{},this.extensions={},this.plugins={},this.options=n||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new dl(this.options.manager):this.textureLoader=new ba(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new fa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function J(e,t,n){var r=t.attributes,i=[];function o(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var s in r){var a=B[s]||s.toLowerCase();a in e.attributes||i.push(o(r[s],a))}if(void 0!==t.indices&&!e.index){var l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));i.push(l)}return Y(e,t),function(e,t,n){var r=t.attributes,i=new b;if(void 0!==r.POSITION){var o=(d=n.json.accessors[r.POSITION]).min,s=d.max;if(void 0!==o&&void 0!==s){i.set(new v(o[0],o[1],o[2]),new v(s[0],s[1],s[2]));var a=t.targets;if(void 0!==a){for(var l=new v,c=new v,h=0,u=a.length;h<u;h++){var d,p=a[h];if(void 0!==p.POSITION)o=(d=n.json.accessors[p.POSITION]).min,s=d.max,void 0!==o&&void 0!==s?(c.setX(Math.max(Math.abs(o[0]),Math.abs(s[0]))),c.setY(Math.max(Math.abs(o[1]),Math.abs(s[1]))),c.setZ(Math.max(Math.abs(o[2]),Math.abs(s[2]))),l.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}i.expandByVector(l)}e.boundingBox=i;var f=new D;i.getCenter(f.center),f.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(i).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,o=0,s=t.length;o<s&&(void 0!==(c=t[o]).POSITION&&(r=!0),void 0!==c.NORMAL&&(i=!0),!r||!i);o++);if(!r&&!i)return Promise.resolve(e);var a=[],l=[];for(o=0,s=t.length;o<s;o++){var c=t[o];if(r){var h=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;a.push(h)}i&&(h=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal,l.push(h))}return Promise.all([Promise.all(a),Promise.all(l)]).then((function(t){var n=t[0],o=t[1];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function K(e,t){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<i.count;o++)r.push(o);e.setIndex(r),n=e.getIndex()}var s=n.count-2,a=[];if(2===t)for(o=1;o<=s;o++)a.push(n.getX(0)),a.push(n.getX(o)),a.push(n.getX(o+1));else for(o=0;o<s;o++)o%2==0?(a.push(n.getX(o)),a.push(n.getX(o+1)),a.push(n.getX(o+2))):(a.push(n.getX(o+2)),a.push(n.getX(o+1)),a.push(n.getX(o)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(a),l}return Z.prototype.setExtensions=function(e){this.extensions=e},Z.prototype.setPlugins=function(e){this.plugins=e},Z.prototype.parse=function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};X(i,o,r),Y(o,r),e(o)})).catch(t)},Z.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var o=t[r].joints,s=0,a=o.length;s<a;s++)e[o[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var h=e[l];void 0!==h.mesh&&(this._addNodeRef(this.meshCache,h.mesh),void 0!==h.skin&&(n[h.mesh].isSkinnedMesh=!0)),void 0!==h.camera&&this._addNodeRef(this.cameraCache,h.camera)}},Z.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},Z.prototype._getNodeRef=function(e,t,n){if(e.refs[t]<=1)return n;var r=n.clone();return r.name+="_instance_"+e.uses[t]++,r},Z.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}},Z.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n},Z.prototype.getDependency=function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r},Z.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return n.getDependency(e,r)}))),this.cache.add(e,t)}return t},Z.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(j(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},Z.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))},Z.prototype.loadAccessor=function(e){var t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then((function(e){var i,o=e[0],s=N[r.type],a=I[r.componentType],l=a.BYTES_PER_ELEMENT,c=l*s,h=r.byteOffset||0,u=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,d=!0===r.normalized;if(u&&u!==c){var p=Math.floor(h/u),f="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+p+":"+r.count,m=t.cache.get(f);m||(m=new si(new a(o,p*u,r.count*u/l),u/l),t.cache.add(f,m)),i=new li(m,s,h%u/l,d)}else i=new We(null===o?new a(r.count*s):new a(o,h,r.count*s),s,d);if(void 0!==r.sparse){var g=N.SCALAR,v=I[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,b=new v(e[1],y,r.sparse.count*g),_=new a(e[2],x,r.sparse.count*s);null!==o&&(i=new We(i.array.slice(),i.itemSize,i.normalized));for(var w=0,M=b.length;w<M;w++){var S=b[w];if(i.setX(S,_[w*s]),s>=2&&i.setY(S,_[w*s+1]),s>=3&&i.setZ(S,_[w*s+2]),s>=4&&i.setW(S,_[w*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i}))},Z.prototype.loadTexture=function(e){var t,r,i=this.json,o=this.options,s=i.textures[e],a=s.extensions||{};return(t=a[n.MSFT_TEXTURE_DDS]?i.images[a[n.MSFT_TEXTURE_DDS].source]:i.images[s.source]).uri&&(r=o.manager.getHandler(t.uri)),r||(r=a[n.MSFT_TEXTURE_DDS]?this.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,r)},Z.prototype.loadTextureImage=function(e,t,n){var r=this,i=this.json,o=this.options,s=i.textures[e],a=self.URL||self.webkitURL,l=t.uri,c=!1,h=!0;return"image/jpeg"===t.mimeType&&(h=!1),void 0!==t.bufferView&&(l=r.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var n=new DataView(e,25,1).getUint8(0,!1);h=6===n||4===n||3===n}c=!0;var r=new Blob([e],{type:t.mimeType});return l=a.createObjectURL(r)}))),Promise.resolve(l).then((function(e){return new Promise((function(t,r){var i=t;!0===n.isImageBitmapLoader&&(i=function(e){t(new co(e))}),n.load(j(e,o.path),i,void 0,r)}))})).then((function(t){!0===c&&a.revokeObjectURL(l),t.flipY=!1,s.name&&(t.name=s.name),h||(t.format=1022);var n=(i.samplers||{})[s.sampler]||{};return t.magFilter=F[n.magFilter]||1006,t.minFilter=F[n.minFilter]||1008,t.wrapS=O[n.wrapS]||1e3,t.wrapT=O[n.wrapT]||1e3,r.associations.set(t,{type:"textures",index:e}),t}))},Z.prototype.assignTexture=function(e,t,r){var i=this;return this.getDependency("texture",r.index).then((function(o){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."),i.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}e[t]=o}))},Z.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,r=void 0!==t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal,s=!0===e.isSkinnedMesh,a=Object.keys(t.morphAttributes).length>0,l=a&&void 0!==t.morphAttributes.normal;if(e.isPoints){var c="PointsMaterial:"+n.uuid,h=this.cache.get(c);h||(h=new eo,Ge.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(c,h)),n=h}else if(e.isLine){c="LineBasicMaterial:"+n.uuid;var u=this.cache.get(c);u||(u=new ji,Ge.prototype.copy.call(u,n),u.color.copy(n.color),this.cache.add(c,u)),n=u}if(r||i||o||s||a){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),r&&(c+="vertex-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:"),a&&(c+="morph-targets:"),l&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=n.clone(),s&&(d.skinning=!0),r&&(d.vertexTangents=!0),i&&(d.vertexColors=!0),o&&(d.flatShading=!0),a&&(d.morphTargets=!0),l&&(d.morphNormals=!0),this.cache.add(c,d),this.associations.set(d,this.associations.get(n))),n=d}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),n.normalScale&&!r&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!r&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},Z.prototype.getMaterialType=function(){return ks},Z.prototype.loadMaterial=function(e){var t,r=this,i=this.json,o=this.extensions,a=i.materials[e],l={},c=a.extensions||{},h=[];if(c[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),h.push(u.extendParams(l,a,r))}else if(c[n.KHR_MATERIALS_UNLIT]){var d=o[n.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),h.push(d.extendParams(l,a,r))}else{var p=a.pbrMetallicRoughness||{};if(l.color=new Ue(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;l.color.fromArray(f),l.opacity=f[3]}void 0!==p.baseColorTexture&&h.push(r.assignTexture(l,"map",p.baseColorTexture)),l.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,l.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(h.push(r.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),h.push(r.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))}!0===a.doubleSided&&(l.side=2);var m=a.alphaMode||z;return m===H?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===G&&(l.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==He&&(h.push(r.assignTexture(l,"normalMap",a.normalTexture)),l.normalScale=new s(1,1),void 0!==a.normalTexture.scale&&l.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==He&&(h.push(r.assignTexture(l,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(l.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==He&&(l.emissive=(new Ue).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==He&&h.push(r.assignTexture(l,"emissiveMap",a.emissiveTexture)),Promise.all(h).then((function(){var i;return i=t===_?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new t(l),a.name&&(i.name=a.name),i.map&&(i.map.encoding=3001),i.emissiveMap&&(i.emissiveMap.encoding=3001),Y(i,a),r.associations.set(i,{type:"materials",index:e}),a.extensions&&X(o,i,a),i}))},Z.prototype.createUniqueName=function(e){for(var t=Yl.sanitizeNodeName(e||""),n=t,r=1;this.nodeNamesUsed[n];++r)n=t+"_"+r;return this.nodeNamesUsed[n]=!0,n},Z.prototype.loadGeometries=function(e){var t=this,r=this.extensions,i=this.primitiveCache;function o(e){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return J(n,e,t)}))}for(var s,a,l=[],c=0,h=e.length;c<h;c++){var u,d=e[c],p=(a=void 0,(a=(s=d).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+a.bufferView+":"+a.indices+":"+Q(a.attributes):s.indices+":"+Q(s.attributes)+":"+s.mode),f=i[p];if(f)l.push(f.promise);else u=d.extensions&&d.extensions[n.KHR_DRACO_MESH_COMPRESSION]?o(d):J(new pt,d,t),i[p]={primitive:d,promise:u},l.push(u)}return Promise.all(l)},Z.prototype.loadMesh=function(e){for(var t=this,n=this.json,r=this.extensions,i=n.meshes[e],o=i.primitives,s=[],a=0,l=o.length;a<l;a++){var c=void 0===o[a].material?V(this.cache):this.getDependency("material",o[a].material);s.push(c)}return s.push(t.loadGeometries(o)),Promise.all(s).then((function(n){for(var s=n.slice(0,n.length-1),a=n[n.length-1],l=[],c=0,h=a.length;c<h;c++){var u,d=a[c],p=o[c],f=s[c];if(p.mode===L||p.mode===C||p.mode===R||void 0===p.mode)!0!==(u=!0===i.isSkinnedMesh?new Fi(d,f):new Rt(d,f)).isSkinnedMesh||u.geometry.attributes.skinWeight.normalized||u.normalizeSkinWeights(),p.mode===C?u.geometry=K(u.geometry,1):p.mode===R&&(u.geometry=K(u.geometry,2));else if(p.mode===A)u=new Ki(d,f);else if(p.mode===P)u=new Qi(d,f);else if(p.mode===E)u=new $i(d,f);else{if(p.mode!==T)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);u=new oo(d,f)}Object.keys(u.geometry.morphAttributes).length>0&&q(u,i),u.name=t.createUniqueName(i.name||"mesh_"+e),Y(u,i),p.extensions&&X(r,u,p),t.assignFinalMaterial(u),l.push(u)}if(1===l.length)return l[0];var m=new Jr;for(c=0,h=l.length;c<h;c++)m.add(l[c]);return m}))},Z.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new zt(o.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new Ja(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Y(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},Z.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return n.inverseBindMatrices=e,n}))},Z.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],r=[],i=[],o=[],s=[],a=0,l=t.channels.length;a<l;a++){var c=t.channels[a],h=t.samplers[c.sampler],u=c.target,d=void 0!==u.node?u.node:u.id,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),r.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",f)),o.push(h),s.push(u)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(n){for(var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=[],c=0,h=r.length;c<h;c++){var u=r[c],d=i[c],p=o[c],f=s[c],m=a[c];if(void 0!==u){var g;switch(u.updateMatrix(),u.matrixAutoUpdate=!0,U[m.path]){case U.weights:g=na;break;case U.rotation:g=ia;break;case U.position:case U.scale:default:g=sa}var v=u.name?u.name:u.uuid,y=void 0!==f.interpolation?k[f.interpolation]:2301,x=[];U[m.path]===U.weights?u.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(v);var b=p.array;if(p.normalized){var _;if(b.constructor===Int8Array)_=1/127;else if(b.constructor===Uint8Array)_=1/255;else if(b.constructor==Int16Array)_=1/32767;else{if(b.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");_=1/65535}for(var w=new Float32Array(b.length),M=0,T=b.length;M<T;M++)w[M]=b[M]*_;b=w}for(M=0,T=x.length;M<T;M++){var A=new g(x[M]+"."+U[m.path],d.array,b,y);"CUBICSPLINE"===f.interpolation&&(A.createInterpolant=function(e){return new S(this.times,this.values,this.getValueSize()/3,e)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(A)}}}return new aa(t.name?t.name:"animation_"+e,void 0,l)}))},Z.prototype.loadNode=function(e){var t,n=this.json,r=this.extensions,i=this,o=n.nodes[e],s=o.name?i.createUniqueName(o.name):"";return(t=[],void 0!==o.mesh&&t.push(i.getDependency("mesh",o.mesh).then((function(e){var t=i._getNodeRef(i.meshCache,o.mesh,e);return void 0!==o.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=o.weights.length;t<n;t++)e.morphTargetInfluences[t]=o.weights[t]})),t}))),void 0!==o.camera&&t.push(i.getDependency("camera",o.camera).then((function(e){return i._getNodeRef(i.cameraCache,o.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t)).then((function(t){var n;if((n=!0===o.isBone?new Oi:t.length>1?new Jr:1===t.length?t[0]:new ge)!==t[0])for(var a=0,l=t.length;a<l;a++)n.add(t[a]);if(o.name&&(n.userData.name=o.name,n.name=s),Y(n,o),o.extensions&&X(r,n,o),void 0!==o.matrix){var c=new W;c.fromArray(o.matrix),n.applyMatrix4(c)}else void 0!==o.translation&&n.position.fromArray(o.translation),void 0!==o.rotation&&n.quaternion.fromArray(o.rotation),void 0!==o.scale&&n.scale.fromArray(o.scale);return i.associations.set(n,{type:"nodes",index:e}),n}))},Z.prototype.loadScene=function(){function e(t,n,r,i){var o=r.nodes[t];return i.getDependency("node",t).then((function(e){return void 0===o.skin?e:i.getDependency("skin",o.skin).then((function(e){for(var n=[],r=0,o=(t=e).joints.length;r<o;r++)n.push(i.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var r=[],i=[],o=0,s=n.length;o<s;o++){var a=n[o];if(a){r.push(a);var l=new W;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*o),i.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new Bi(r,i),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var s=[];if(o.children)for(var a=o.children,l=0,c=a.length;l<c;l++){var h=a[l];s.push(e(h,t,r,i))}return Promise.all(s)}))}return function(t){var n=this.json,r=this.extensions,i=this.json.scenes[t],o=new Jr;i.name&&(o.name=this.createUniqueName(i.name)),Y(o,i),i.extensions&&X(r,o,i);for(var s=i.nodes||[],a=[],l=0,c=s.length;l<c;l++)a.push(e(s[l],o,n,this));return Promise.all(a).then((function(){return o}))}}(),e}(),Ff=function(e){da.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};Ff.prototype=Object.assign(Object.create(da.prototype),{constructor:Ff,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,n,r){var i=new fa(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(e=>{var n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(r)}),n,r)},decodeDracoFile:function(e,t,n,r){var i={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)},decodeGeometry:function(e,t){for(var n in t.attributeTypes){var r=t.attributeTypes[n];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=r.name)}var i,o=JSON.stringify(t);if(Ff.taskCache.has(e)){var s=Ff.taskCache.get(e);if(s.key===o)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var a=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(a,l).then((n=>(i=n,new Promise(((n,r)=>{i._callbacks[a]={resolve:n,reject:r},i.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{i&&a&&this._releaseTask(i,a)})),Ff.taskCache.set(e,{key:o,promise:c}),c},_createGeometry:function(e){var t=new pt;e.index&&t.setIndex(new We(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n],i=r.name,o=r.array,s=r.itemSize;t.setAttribute(i,new We(o,s))}return t},_loadLibrary:function(e,t){var n=new fa(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{n.load(e,t,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var r=Ff.DRACOWorker.toString(),i=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var n;this.workerPool.length<this.workerLimit?((n=new Worker(this.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(n)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(n=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),Ff.DRACOWorker=function(){var e,t;function n(e,t,n,r,i,o){var s=o.num_components(),a=n.num_points()*s,l=a*i.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,o,c,l,h);var u=new i(e.HEAPF32.buffer,h,a).slice();return e._free(h),{name:r,array:u,itemSize:s}}onmessage=function(r){var i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var o=i.buffer,s=i.taskConfig;t.then((e=>{var t=e.draco,r=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(o),o.byteLength);try{var l=function(e,t,r,i){var o,s,a=i.attributeIDs,l=i.attributeTypes,c=t.GetEncodedGeometryType(r);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,s=t.DecodeBufferToMesh(r,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,s=t.DecodeBufferToPointCloud(r,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var h={index:null,attributes:[]};for(var u in a){var d,p,f=self[l[u]];if(i.useUniqueIDs)p=a[u],d=t.GetAttributeByUniqueId(o,p);else{if(-1===(p=t.GetAttributeId(o,e[a[u]])))continue;d=t.GetAttribute(o,p)}h.attributes.push(n(e,t,o,u,f,d))}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){var r=3*n.num_faces(),i=4*r,o=e._malloc(i);t.GetTrianglesUInt32Array(n,i,o);var s=new Uint32Array(e.HEAPF32.buffer,o,r).slice();return e._free(o),{array:s,itemSize:1}}(e,t,o));return e.destroy(o),h}(t,r,a,s),c=l.attributes.map((e=>e.array.buffer));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(a),t.destroy(r)}}))}}},Ff.taskCache=new WeakMap,Ff.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},Ff.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},Ff.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},Ff.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};class Of extends Np{constructor(e){super("Model",e),this.viewport=e,this.gltfLoader=null,this.fbxLoader=null,this.modelMaps=new Map,this.store=Up.createInstance({name:"soonspace",version:2,storeName:"modelData"}),this.dracoDecoderPath=null}setDracoDecoderPath(e){this.dracoDecoderPath=e}load(e){return this._loadItem(e)}parse(e,t,n){return new Promise(((r,i)=>{const o=new xp(Object.assign({format:e},n)),{url:s}=n,a=e.toLocaleUpperCase(),l="SBMX"===a;if("GLTF"===a||"GLB"===a||l){const e=s.substring(0,s.lastIndexOf("/")+1);if(this.gltfLoader||(this.gltfLoader=new If),this.dracoDecoderPath&&!this.gltfLoader.dracoLoader){const e=new Ff;e.setDecoderPath(this.dracoDecoderPath),this.gltfLoader.setDRACOLoader(e)}l&&(t=Sh(t)),this.gltfLoader.parse(t,e,(e=>{const{animations:t}=e;if(t&&t.length>0&&(o.animations=t),e.scene.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),o.add(e.scene),!this.modelMaps.get(s)){const e=o.sClone();this.modelMaps.set(s,e)}r(o)}),(e=>{i(e)}))}else if("FBX"===a){this.fbxLoader||(this.fbxLoader=new Rf);const e=this.fbxLoader.parse(t,""),{animations:n}=e;if(n&&n.length>0&&(o.animations=n),e.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),o.add(e),!this.modelMaps.get(s)){const e=o.sClone();this.modelMaps.set(s,e)}r(o)}else i(`In soonspacejs: 加载通用模型资源(${s})格式错误,当前支持 fbx、gltf、glb !`)}))}clone(e,t,n){return new Promise(((r,i)=>Nu(this,void 0,void 0,(function*(){"Model"!==e.stype&&i("In soonspacejs: 方法 cloneModel 参入对象类型错误!");const{id:o,name:s,level:a,visible:l,position:c,rotation:h,scale:u,onClick:d,onDblClick:p,onRightClick:f,onLoad:m,userData:g}=t;function v(e,t,n){n(e,t);for(var r=0;r<e.children.length;r++)v(e.children[r],t.children[r],n)}const y=yield function(e){const t=new Map,n=new Map;let r;return r=e instanceof su||e instanceof ou?e.sClone():e.clone(),v(e,r,(function(e,r){t.set(r,e),n.set(e,r)})),r.traverse((function(e){if(e instanceof Fi){const r=e,i=t.get(e),o=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=o.map((function(e){return n.get(e)})),r.bind(r.skeleton,r.bindMatrix)}})),r}(e);y.animations=yield y.animations.map((e=>e.clone())),yield this._copyMaterial(y),o&&(y.sid=o),s&&(y.name=s),a&&(y.level=a),!1===l&&y.hide(),c&&y.position.set(c.x,c.y,c.z),h&&y.rotation.set(h.x,h.y,h.z),u&&y.scale.set(u.x,u.y,u.z),y.onClick=d?d.bind(y):null,y.onDblClick=p?p.bind(y):null,y.onRightClick=f?f.bind(y):null,y.onLoad=m?m.bind(y):null,y.onLoad&&y.onLoad(y),g&&(y.userData=g),null!==n&&this.viewport.scener.addObject(y,n||e.parent||this.scene),r(y)}))))}loadToGroup(e,t){return new Promise((n=>Nu(this,void 0,void 0,(function*(){const r=new lu(e);for(let e=0;e<t.length;e++){const n=yield this._loadItem(t[e],null);r.add(n)}this.viewport.scener.addObject(r,this.scene),n(r)}))))}addForGroup(e,t){return new Promise((n=>Nu(this,void 0,void 0,(function*(){const r=this.getGroupById(e);if(r){for(let e=0;e<t.length;e++){const n=yield this._loadItem(t[e],null);r.add(n)}this.viewport.scener.addObject(r,this.scene)}n(r)}))))}clearIdb(){return this.store.clear()}_loadItem(e,t=this.scene){return Nu(this,void 0,void 0,(function*(){const{url:n}=e,{useIndexedDB:r}=this.viewport.options,i=n.slice(n.lastIndexOf(".")+1),o=this.modelMaps.get(n);let s=null;if(o)return this.clone(o,e,t);r&&(s=yield this.store.getItem(n)),s||(s=yield this._fetchBuffer(e));const a=yield this.parse(i,s,e);return null!==t&&this.viewport.scener.addObject(a,t||this.scene),Promise.resolve(a)}))}_fetchBuffer(e){const{url:t}=e,{useIndexedDB:n}=this.viewport.options;return fetch(t).then((e=>e.arrayBuffer())).then((e=>(n&&this.store.setItem(t,e),Promise.resolve(e))))}_copyMaterial(e){e.traverse((e=>{e instanceof Rt&&(Fh(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof Ge&&(e.material=e.material.clone()))}))}}class Nf extends Np{constructor(e){super("Poi",e),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new wp(t,e);return this.viewport.scener.addObject(n,this.scene),n}clone(e,t,n){"Poi"!==e.stype&&console.error("In soonspacejs: 方法 clonePoi 参入对象类型错误!");const{id:r,name:i,level:o,visible:s,position:a,rotation:l,scale:c,onClick:h,onDblClick:u,onRightClick:d,userData:p}=t,f=e.sClone();return this._copyMaterial(f),r&&(f.sid=r),i&&(f.name=i),o&&(f.level=o),Ph(s)&&(f.visible=s),a&&f.position.set(a.x,a.y,a.z),l&&f.rotation.set(l.x,l.y,l.z),c&&f.scale.set(c.x,c.y,c.z),f.onClick=h?h.bind(f):null,f.onDblClick=u?u.bind(f):null,f.onRightClick=d?d.bind(f):null,p&&(f.userData=p),null!==n&&this.viewport.scener.addObject(f,n||this.scene||e.parent),f}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{const t=this._createMaterial(e.url),r=new wp(t,e);n.add(r)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&(t.forEach((e=>{const t=this._createMaterial(e.url),r=new wp(t,e);n.add(r)})),this.viewport.scener.addObject(n,this.scene)),n}_createMaterial(e){const t=this.materials.get(e);if(!t){const t=(new ba).load(e);t.flipY=!0;const n=new ci({map:t,color:16777215});return this.materials.set(e,n),n}return t}_copyMaterial(e){e.traverse((e=>{(e instanceof Rt||e instanceof Mi)&&(Fh(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof Ge&&(e.material=e.material.clone()))}))}}class Df extends Np{constructor(e){super("PoiNode",e)}create(e){this._openEnableRenderCss(e);const t=new Ou(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{this._openEnableRenderCss(e);const t=new Ou(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&(t.forEach((e=>{const t=new Ou(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene)),n}_openEnableRenderCss(e){switch(e.type){case"2d":case"2D":this.viewport.rendererManager.setInternalState("enableRenderCss2D",!0);break;case"2.5d":case"2.5D":this.viewport.rendererManager.setInternalState("enableRenderCss2DHalf",!0);break;case"3d":case"3D":this.viewport.rendererManager.setInternalState("enableRenderCss3D",!0)}}}class Bf extends Np{constructor(e){super("Canvas3D",e)}create(e){const t=new Ip(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{const t=new Ip(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&(t.forEach((e=>{const t=new Ip(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene)),n}}class Uf{constructor(){this.graph=[],this.queue=null,this.distance=[],this.previous=[]}setGraph(e){if(!Fh(e))return console.error("In soonspacejs: 内容错误 - 路径计算! ( dijkstra setGraph method graph isn't an array )");if(!(e.length<1))for(let t=0;t<e.length;t++){const n=e[t];if(2!==n.length)return console.error(`In soonspacejs: 内容错误 - 路径计算! ( dijkstra setGraph method graph item must be an array and contain 2 values [name, vertices], Failed at index: ${t} )`);const r=n[0],i=n[1];this.graph[r]=[];for(let e=0;e<i.length;e++){const t=i[e],n=t[0],o=t[1];this.graph[r][n]=o}}}getPath(e,t){if(void 0===this.graph[e])return console.error(`In soonspacejs: 内容错误 - 路径计算! ( dijkstra getPath method source ${e} doesn't exist )`),[];if(void 0===this.graph[t])return console.error(`In soonspacejs: 内容错误 - 路径计算! ( dijkstra getPath method target ${t} doesn't exist )`),[];if(e===t)return[];let n;for(this.queue=new wh,this.queue.add(e,0),this.previous[e]=null;n=this.queue.shift();){if(n===t){const e=[];for(;Lh(n)&&null!==this.previous[n];)e.unshift(n),n=this.previous[n];return e}const e=this.queue.getDistance(n);if(e===1/0)return[];for(let t in this.graph[n]){const r=this.queue.getDistance(Number(t)),i=e+this.graph[n][t];i<r&&(this.queue.update(Number(t),i),this.previous[t]=n)}}return[]}}class kf extends Np{constructor(e){super("Topology",e),this.dijkstra=new Uf}createFromGml(e){const{url:t,linkWidth:n=20,linkColor:r=65280,renderNode:i=!0,nodeColor:o=255}=e;return Hp(t).then((t=>{if(!t||!t.MultiLayeredGraph)return Promise.reject('In soonspace: createTopologyFromGml "url" path error!');const s=[],a=new Map;let l=[],c=[];const h=t.MultiLayeredGraph.SpaceLayerMember.SpaceLayer.X_floor;Fh(h)?h.forEach((e=>{l=[...l,...e.state],c=[...c,...e.transition]})):(l=[...l,...h.state],c=[...c,...h.transition]),l.forEach(((e,t)=>{const n=e.State._attributes["gml:id"],r=e.State.topoNode["gml:Node"].node_name;s.push({id:Eh(n)?n:"",name:Eh(r)?r:"",position:{x:Number(e.State.topoNode["gml:Node"].xcoord["#text"]),y:Number(e.State.topoNode["gml:Node"].zcoord["#text"]),z:-1*Number(e.State.topoNode["gml:Node"].ycoord["#text"])},graphs:[]}),a.set(n,t)})),c.forEach((e=>{const t=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][0]._attributes["xlink:href"],n=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][1]._attributes["xlink:href"],r=e.Transition.topoEdge["gml:Edge"].length["#text"],i=e.Transition.topoEdge["gml:Edge"].restrict["#text"],o=e.Transition.topoEdge["gml:Edge"].passable["#text"],l=a.get(t),c=a.get(n),h=e.Transition._attributes["gml:id"],u=e.Transition.topoEdge["gml:Edge"].link_name["#text"];void 0!==l&&void 0!==c&&("2"!==o&&"3"!==o&&s[l].graphs.push({targetNodeId:n,linkInfo:{id:h,name:u},enable:!0,length:parseInt(r),restrict:parseInt(i),passable:parseInt(o)}),"1"!==o&&"3"!==o&&s[c].graphs.push({targetNodeId:t,linkInfo:{id:h,name:u},enable:!0,length:parseInt(r),restrict:parseInt(i),passable:parseInt(o)}))})),this.setDijkstraGraph(s);const u=new Ep(Object.assign(Object.assign({},e),{type:"network",nodes:s,linkWidth:n,renderLink:!0,linkColor:r,renderNode:i,nodeColor:o}));return this.viewport.scener.addObject(u,this.scene),Promise.resolve(u)}))}create(e){const t=this.generateLineTopologyInfoNodeGraphs(e);this.setDijkstraGraph(t.nodes);const n=new Ep(t);return this.viewport.scener.addObject(n,this.scene),n}resetNodes(e,t){const n=this.generateLineTopologyInfoNodeGraphs(Object.assign(Object.assign({},e.info),{nodes:t}));return e.resetNodes(n.nodes),this.viewport.signals.objectChanged.dispatch(),e}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e);this.setDijkstraGraph(t.nodes);const r=new Ep(t);n.add(r)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e);this.setDijkstraGraph(t.nodes);const r=new Ep(t);n.add(r)})),n}getShortestPath(e,t){const{nodes:n}=e.info,r=ph(t.start),i=ph(t.end);let o=null,s=1/0,a=null,l=1/0;if(n.forEach((e=>{if(e.graphs.length>0){const t=ph(e.position),n=t.distanceTo(r),c=t.distanceTo(i);n<s&&(s=n,o=Number(e.id)),c<l&&(l=c,a=Number(e.id))}})),o&&a){const s=this.dijkstra.getPath(o,a);if(s.length>0){const o=[{id:"startPoint",position:r,graphs:[]}];s.forEach((e=>{const t=n.find((t=>t.id==e));t&&o.push(t)})),o.push({id:"endPoint",position:i,graphs:[]});for(let e=0;e<o.length;e++)o[e].position.y+=1;const a=Object.assign(Object.assign(Object.assign({},t),{type:"line",nodes:o}),e.getSpaceAttribute(!0));this.generateLineTopologyInfoNodeGraphs(a);const l=new Ep(a);return this.viewport.scener.addObject(l,this.scene),l}}return null}getShortestPathByMultipleStartPoints(e,t){const{nodes:n}=e.info,r=[];t.start.forEach((e=>{const i=ph(e),o=ph(t.end);let s=null,a=1/0,l=null,c=1/0;if(n.forEach((e=>{if(e.graphs.length>0){const t=ph(e.position),n=t.distanceTo(i),r=t.distanceTo(o);n<a&&(a=n,s=Number(e.id)),r<c&&(c=r,l=Number(e.id))}})),s&&l){let e=0;const t=this.dijkstra.getPath(s,l);if(t.length>0){const s=[{id:"startPoint",position:i,graphs:[]}];t.forEach(((t,r)=>{const o=n.find((e=>e.id==t));o&&(e+=0===r?ph(o.position).distanceTo(i):ph(o.position).distanceTo(ph(s[s.length-1].position)),s.push(o))})),s.push({id:"endPoint",position:o,graphs:[]}),e+=o.distanceTo(ph(s[s.length-1].position)),r.push({nodeInfo:s,pathLength:e})}}}));let i=[],o=1/0;if(r.forEach((({nodeInfo:e,pathLength:t})=>{t<o&&(o=t,i=e)})),i.length){for(let e=0;e<i.length;e++)i[e].position.y+=1;const n=Object.assign(Object.assign({},t),{type:"line",nodes:i,position:e.getWorldPosition(new v),rotation:(new $).setFromQuaternion(e.getWorldQuaternion(new g)),scale:e.getWorldScale(new v)});this.generateLineTopologyInfoNodeGraphs(n);const r=new Ep(n);return this.viewport.scener.addObject(r,this.scene),r}return null}getShortestPathByMultipleEndPoints(e,t){const{nodes:n}=e.info,r=[];t.end.forEach((e=>{const i=ph(t.start),o=ph(e);let s=null,a=1/0,l=null,c=1/0;if(n.forEach((e=>{if(e.graphs.length>0){const t=ph(e.position),n=t.distanceTo(i),r=t.distanceTo(o);n<a&&(a=n,s=Number(e.id)),r<c&&(c=r,l=Number(e.id))}})),s&&l){let e=0;const t=this.dijkstra.getPath(s,l);if(t.length>0){const s=[{id:"startPoint",position:i,graphs:[]}];t.forEach(((t,r)=>{const o=n.find((e=>e.id==t));o&&(e+=0===r?ph(o.position).distanceTo(i):ph(o.position).distanceTo(ph(s[s.length-1].position)),s.push(o))})),s.push({id:"endPoint",position:o,graphs:[]}),e+=o.distanceTo(ph(s[s.length-1].position)),r.push({nodeInfo:s,pathLength:e})}}}));let i=[],o=1/0;if(r.forEach((({nodeInfo:e,pathLength:t})=>{t<o&&(o=t,i=e)})),i.length){for(let e=0;e<i.length;e++)i[e].position.y+=1;const n=Object.assign(Object.assign({},t),{type:"line",nodes:i,position:e.getWorldPosition(new v),rotation:(new $).setFromQuaternion(e.getWorldQuaternion(new g)),scale:e.getWorldScale(new v)});this.generateLineTopologyInfoNodeGraphs(n);const r=new Ep(n);return this.viewport.scener.addObject(r,this.scene),r}return null}setDijkstraGraph(e){const t=[];e.forEach((n=>{if(n.graphs&&n.graphs.length>0){const r=[];n.graphs.forEach((t=>{const i=e.find((e=>e.id===t.targetNodeId));i&&r.push([Number(t.targetNodeId),t.length||ph(n.position).distanceTo(ph(i.position))])})),t.push([Number(n.id),r])}})),t.length>0&&this.dijkstra.setGraph(t)}generateLineTopologyInfoNodeGraphs(e){if("line"===e.type)for(let t=0;t<e.nodes.length;t++)if(t===e.nodes.length-1)e.nodes[t].graphs=[];else{const n=e.nodes[t],r=e.nodes[t+1];e.nodes[t].graphs=[{targetNodeId:r.id.toString(),linkInfo:{id:`${n.id}_to_${r.id}`,name:`${n.name||n.id}_to_${r.name||r.id}`},enable:!0,length:ph(e.nodes[t].position).distanceTo(ph(r.position)),restrict:0,passable:0}]}return e}}class zf extends Np{constructor(e){super("Helper",e)}addGridHelper(e){const{id:t,size:n=1e3,divisions:r=20,color:i="#fff",position:o={x:0,y:0,z:0},rotation:s={x:0,y:0,z:0},scale:a={x:1,y:1,z:1}}=e,l=new _c(n,r,i,i);return l.position.set(o.x,o.y,o.z),l.rotation.set(s.x,s.y,s.z),l.scale.set(a.x,a.y,a.z),l.userData.sid=t,l.userData.stype="Helper",this.viewport.scener.addObject(l,this.scene),l}addAxesHelper(e){const{id:t,axesLength:n=1e3}=e,r=new Nc(n);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addBoxHelper(e){const{id:t,box:n,color:r="#00ff00"}=e,i=new Rc(n,new Ue(r));return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addPlaneHelper(e){const{id:t,width:n=500,height:r=500,color:i="#00ff00",opacity:o=.2,position:s={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1}}=e,c=new ou(new Zt(n,r),new He({color:i,opacity:o,transparent:!0,side:2}),{id:t,position:s,rotation:a,scale:l});return c.userData.sid=t,c.userData.stype="Helper",this.viewport.scener.addObject(c,this.scene),c}addGroundHelper(e){const{imgUrl:t,id:n,width:r=500,height:i=500,opacity:o=1,position:s={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},repeat:c={x:10,y:10}}=e,h=(new ba).load(t),u=new Zt(r,i);u.computeBoundingBox();const d=new ks({side:2,map:h,transparent:!0,opacity:o,roughness:.8});d.map&&(d.map.repeat.set(c.x,c.x),d.map.wrapS=1e3,d.map.wrapT=1e3,d.map.version++),a.x-=Math.PI/2,d.version++;const p=new Fp(u,d,{id:n,position:s,rotation:a,scale:l});return p.userData.sid=n,p.userData.stype="Helper",this.viewport.scener.addObject(p,this.scene),p}addDirectionalLightHelper(e){const{id:t,light:n,color:r,size:i=50}=e,o=new Tc(n,i,r);return o.userData.sid=t,o.userData.stype="Helper",this.viewport.scener.addObject(o,this.scene),o}addHemisphereLightHelper(e){const{id:t,light:n,color:r,size:i=20}=e,o=new bc(n,i,r);return o.userData.sid=t,o.userData.stype="Helper",this.viewport.scener.addObject(o,this.scene),o}addSpotLightHelper(e){const{id:t,light:n,color:r}=e,i=new hc(n,r);return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addPointLightHelper(e){const{id:t,light:n,color:r,size:i=20}=e,o=new gc(n,i,r);return o.userData.sid=t,o.userData.stype="Helper",this.viewport.scener.addObject(o,this.scene),o}}class Gf extends Np{constructor(e){super("PluginObject",e)}createObject(e,t){const n=new cu(e);return t&&n.add(t),this.viewport.scener.addObject(n,this.scene),n}addToObject(e,t){const n=this.getById(e);return n?(this.viewport.scener.addObject(t,n),n):null}}class Hf{constructor(e){this.viewport=e,this.needUpdate=!1,this.store={LightManager:new Dp(e),sbmManager:new jp(e),modelManager:new Of(e),poiManager:new Nf(e),poiNodeManager:new Df(e),canvas3DManager:new Bf(e),topologyManager:new kf(e),helperManager:new zf(e),pluginObjectManager:new Gf(e)},this.postUpdate=new Map;for(let e in this.store)this.postUpdate.set(e,this.store[e].update.bind(this.store[e]));e.postUpdate.set("ManagerRender",this.update.bind(this))}update(){const e=performance.now();this.postUpdate.forEach((e=>e())),this.viewport.signals.lodRendered.dispatch(performance.now()-e)}clearObject(){this.store.sbmManager.clear(),this.store.modelManager.clear(),this.store.poiManager.clear(),this.store.poiNodeManager.clear(),this.store.canvas3DManager.clear(),this.store.topologyManager.clear(),this.store.helperManager.clear(),this.store.pluginObjectManager.clear()}clear(){this.clearObject(),this.store.LightManager.clear()}}export default class{constructor(e){this.THREE=uh;const{el:n,options:r={},events:i={}}=e;if(this.version=t,this.domElement=document.querySelector(n),this.options=Object.assign(Object.assign({},{showInfo:!1,showGrid:!1,background:{color:0,alpha:!1},fog:!1,controls:{},hoverEnabled:!1,closeInfoLog:!1,closeWarnLog:!0,useIndexedDB:!0,logarithmicDepthBuffer:!0}),r),this.utils=Gh,this.animation=iu,this.library=Op,this.viewport=new mp(this.options),this.signals=this.viewport.signals,this.manager=new Hf(this.viewport),this.plugins={},!this.domElement)throw new Error(`In SoonSpace: Can't find element by "${n}"!`);this.domElement.appendChild(this.viewport.container),this._init(),this._initEvents(i),this._initDefaultLight()}_init(){const{showGrid:t,background:n,fog:r,controls:i,closeInfoLog:o,closeWarnLog:s,useIndexedDB:a}=this.options;if(!o){dh(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),dh(e,{color:"#3eaf7c","font-size":"24px"}),dh(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),dh("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),dh("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),dh("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}t&&this.addGridHelper(!0===t?{id:"defaultGridHelper"}:t),(null==n?void 0:n.skyBox)?Eh(null==n?void 0:n.skyBox)?this.setSphereSkyBackground(null==n?void 0:n.skyBox):Oh(null==n?void 0:n.skyBox)&&this.setSkyBackground(n.skyBox.dirPath,n.skyBox.fileNames):(null==n?void 0:n.img)?this.setBackgroundImage(n.img):(null==n?void 0:n.color)&&this.setBackgroundColor(n.color),r&&this.openSceneFog(!0===r?void 0:r),i&&this.setControlsOptions(i),s&&(window.console.warn=function(){}),a&&!window.indexedDB&&(this.options.useIndexedDB=!1,window.console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."))}_initEvents(e){const{modelHover:t,modelUnHover:n,modelClick:r,modelRightClick:i,modelDblClick:o,poiHover:s,poiUnHover:a,poiClick:l,poiRightClick:c,poiDblClick:h,selectPosition:u,sceneClick:d,resize:p}=e;t&&this.signals.modelHover.add(t),n&&this.signals.modelUnHover.add(n),r&&this.signals.modelClick.add(r),i&&this.signals.modelRightClick.add(i),o&&this.signals.modelDblClick.add(o),s&&this.signals.poiHover.add(s),a&&this.signals.poiUnHover.add(a),l&&this.signals.poiClick.add(l),c&&this.signals.poiRightClick.add(c),h&&this.signals.poiDblClick.add(h),u&&this.signals.selectPosition.add(u),d&&this.signals.sceneClick.add(d),p&&this.signals.windowResize.add(p),this.signals.windowResize.dispatch(),window.addEventListener("resize",(()=>this.signals.windowResize.dispatch()),!1)}_initDefaultLight(){this.createAmbientLight({id:"defaultAmbientLight",name:"defaultAmbientLight"}),this.createDirectionalLight({id:"defaultDirectionalLight",name:"defaultDirectionalLight"}),this.createHemisphereLight({id:"defaultHemisphereLight",name:"defaulHemisphereLight",intensity:.1})}registerPlugin(e,t){const n=new e(this);return this.plugins[t]=n,n}getPlugin(e){return this.plugins[e]?this.plugins[e]:null}createPluginObject(e,t){return this.manager.store.pluginObjectManager.createObject(e,t)}addToPluginObject(e,t){return this.manager.store.pluginObjectManager.addToObject(e,t)}getPluginObjectById(e){return this.manager.store.pluginObjectManager.getById(e)}getPluginObjectByName(e){return this.manager.store.pluginObjectManager.getByName(e)}removePluginObjectById(e){return this.manager.store.pluginObjectManager.removeById(e)}setHoverEnabled(e){this.viewport.setHoverEnabled(e)}setBackgroundColor(e){this.viewport.setBackgroundColor(e)}setBackgroundImage(e){this.viewport.setBackgroundImage(e)}setSphereSkyBackground(e){this.viewport.setSphereSkyBackground(e)}setSkyBackground(e,t){this.viewport.setSkyBackground(e,t)}playModelAnimation(e,t){return this.viewport.playModelAnimation(e,t)}stopModelAnimation(e,t){this.viewport.stopModelAnimation(e,t)}getOffsetByPosition(e){return this.viewport.getOffsetByPosition(e)}getPositionByOffset(e,t){return this.viewport.getPositionByOffset(e,t)}render(e){return this.viewport.render(e)}clearSignals(){this.viewport.clearSignals()}dispose(){return this.clear(),this.clearSignals(),this.viewport.dispose()}getCameraViewpoint(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraViewpoint(e){this.viewport.cameraManager.setCameraViewpoint(e)}flyTo(e,t="frontTop",n){return this.viewport.cameraManager.flyTo(e,t,n)}flyToBoundingBox(e,t="frontTop",n){return this.viewport.cameraManager.flyToBoundingBox(e,t,n)}flyToObj(e,t="frontTop",n){return this.viewport.cameraManager.flyToObj(e,t,n)}flyMainViewpoint(e="frontTop",t){return this.flyToObj(this.viewport.scene,e,t)}surroundOnTarget(e,t){return this.viewport.cameraManager.surroundOnTarget(e,t)}surroundOnObject(e,t){return this.viewport.cameraManager.surroundOnObject(e,t)}getObjectLabelPos(e,t="frontTop",n){return this.viewport.cameraManager.getObjectLabelPos(e,t,n)}setControlsOptions(e){return this.viewport.controls.setOptions(e)}addObject(e,t){this.viewport.scener.addObject(e,t)}removeObject(e){this.viewport.scener.removeObject(e)}openSceneFog(e){this.viewport.scener.openSceneFog(e)}closeSceneFog(){this.viewport.scener.closeSceneFog()}edgeShow(e,t){return this.viewport.scener.edgeShow(e,t)}unEdgeShow(e){return this.viewport.scener.unEdgeShow(e)}strokeShow(e,t){return this.viewport.scener.strokeShow(e,t)}unStrokeShow(e){return this.viewport.scener.unStrokeShow(e)}opacityShow(e,t){return this.viewport.scener.opacityShow(e,t)}unOpacityShow(e){return this.viewport.scener.unOpacityShow(e)}highlightShow(e,t){return this.viewport.scener.highlightShow(e,t)}unHighlightShow(e){return this.viewport.scener.unHighlightShow(e)}emissiveShow(e,t){return this.viewport.scener.emissiveShow(e,t)}unEmissiveShow(e){return this.viewport.scener.unEmissiveShow(e)}clearObject(){this.manager.clearObject()}clear(){this.manager.clear()}createAmbientLight(e){return this.manager.store.LightManager.createAmbientLight(e)}setAmbientLight(e){return this.manager.store.LightManager.setAmbientLight(e)}createDirectionalLight(e){return this.manager.store.LightManager.createDirectionalLight(e)}setDirectionalLight(e){return this.manager.store.LightManager.setDirectionalLight(e)}createHemisphereLight(e){return this.manager.store.LightManager.createHemisphereLight(e)}setHemisphereLight(e){return this.manager.store.LightManager.setHemisphereLight(e)}createSpotLight(e){return this.manager.store.LightManager.createSpotLight(e)}setSpotLight(e){return this.manager.store.LightManager.setSpotLight(e)}createPointLight(e){return this.manager.store.LightManager.createPointLight(e)}setPointLight(e){return this.manager.store.LightManager.setPointLight(e)}getLightById(e){return this.manager.store.LightManager.getById(e)}removeLightById(e){return this.manager.store.LightManager.removeById(e)}getAllLight(){return this.manager.store.LightManager.getAll()}clearLight(){return this.manager.store.LightManager.clear()}showAllLight(){return this.manager.store.LightManager.showAll()}hideAllLight(){return this.manager.store.LightManager.hideAll()}loadSbm(e,t){return this.manager.store.sbmManager.load(e,t)}parseSbm(e,t,n){return this.manager.store.sbmManager.parse(e,t,n)}cloneSbm(e,t,n){return this.manager.store.sbmManager.clone(e,t,n)}getSbmById(e){return this.manager.store.sbmManager.getById(e)}getSbmByName(e){return this.manager.store.sbmManager.getByName(e)}getSbmByUserDataProperty(e,t){return this.manager.store.sbmManager.getByUserDataProperty(e,t)}removeSbmById(e){return this.manager.store.sbmManager.removeById(e)}createGroupForSbm(e){return this.manager.store.sbmManager.createGroup(e)}loadSbmToGroup(e,t,n){return this.manager.store.sbmManager.loadToGroup(e,t,n)}addSbmForGroup(e,t,n){return this.manager.store.sbmManager.addForGroup(e,t,n)}createSbmGroupFromXml(e,t){return this.manager.store.sbmManager.createGroupFromXml(e,t)}getSbmGroupById(e){return this.manager.store.sbmManager.getGroupById(e)}getSbmGroupByName(e){return this.manager.store.sbmManager.getGroupByName(e)}getAllSbmGroup(){return this.manager.store.sbmManager.getAllGroup()}removeSbmGroupById(e){return this.manager.store.sbmManager.removeGroupById(e)}clearSbm(){return this.manager.store.sbmManager.clear()}getAllSbm(){return this.manager.store.sbmManager.getAll()}showAllSbm(){return this.manager.store.sbmManager.showAll()}hideAllSbm(){return this.manager.store.sbmManager.hideAll()}getSbmModelMaps(){return this.manager.store.sbmManager.modelMaps}setSbmModelMaps(e){this.manager.store.sbmManager.modelMaps=e}clearIdb(){return Promise.all([this.manager.store.sbmManager.clearIdb(),this.manager.store.modelManager.clearIdb()])}setModelDracoDecoderPath(e){return this.manager.store.modelManager.setDracoDecoderPath(e)}loadModel(e){return this.manager.store.modelManager.load(e)}cloneModel(e,t,n){return this.manager.store.modelManager.clone(e,t,n)}getModelById(e){return this.manager.store.modelManager.getById(e)}getModelByName(e){return this.manager.store.modelManager.getByName(e)}getModelByUserDataProperty(e,t){return this.manager.store.modelManager.getByUserDataProperty(e,t)}removeModelById(e){return this.manager.store.modelManager.removeById(e)}createGroupForModel(e){return this.manager.store.modelManager.createGroup(e)}loadModelToGroup(e,t){return this.manager.store.modelManager.loadToGroup(e,t)}addModelForGroup(e,t){return this.manager.store.modelManager.addForGroup(e,t)}getModelGroupById(e){return this.manager.store.modelManager.getGroupById(e)}getModelGroupByName(e){return this.manager.store.modelManager.getGroupByName(e)}getAllModelGroup(){return this.manager.store.modelManager.getAllGroup()}removeModelGroupById(e){return this.manager.store.modelManager.removeGroupById(e)}clearModel(){return this.manager.store.modelManager.clear()}getAllModel(){return this.manager.store.modelManager.getAll()}showAllModel(){return this.manager.store.modelManager.showAll()}hideAllModel(){return this.manager.store.modelManager.hideAll()}createPoi(e){return this.manager.store.poiManager.create(e)}clonePoi(e,t,n){return this.manager.store.poiManager.clone(e,t,n)}getPoiById(e){return this.manager.store.poiManager.getById(e)}getPoiByName(e){return this.manager.store.poiManager.getByName(e)}getPoiByUserDataProperty(e,t){return this.manager.store.poiManager.getByUserDataProperty(e,t)}removePoiById(e){return this.manager.store.poiManager.removeById(e)}createGroupForPoi(e){return this.manager.store.poiManager.createGroup(e)}createPoiToGroup(e,t){return this.manager.store.poiManager.createToGroup(e,t)}addPoiForGroup(e,t){return this.manager.store.poiManager.addForGroup(e,t)}getPoiGroupById(e){return this.manager.store.poiManager.getGroupById(e)}getPoiGroupByName(e){return this.manager.store.poiManager.getGroupByName(e)}getAllPoiGroup(){return this.manager.store.poiManager.getAllGroup()}removePoiGroupById(e){return this.manager.store.poiManager.removeGroupById(e)}clearPoi(){return this.manager.store.poiManager.clear()}getAllPoi(){return this.manager.store.poiManager.getAll()}showAllPoi(){return this.manager.store.poiManager.showAll()}hideAllPoi(){return this.manager.store.poiManager.hideAll()}createPoiNode(e){return this.manager.store.poiNodeManager.create(e)}getPoiNodeById(e){return this.manager.store.poiNodeManager.getById(e)}getPoiNodeByName(e){return this.manager.store.poiNodeManager.getByName(e)}getPoiNodeByUserDataProperty(e,t){return this.manager.store.poiNodeManager.getByUserDataProperty(e,t)}removePoiNodeById(e){return this.manager.store.poiNodeManager.removeById(e)}createGroupForPoiNode(e){return this.manager.store.poiNodeManager.createGroup(e)}createPoiNodeToGroup(e,t){return this.manager.store.poiNodeManager.createToGroup(e,t)}addPoiNodeForGroup(e,t){return this.manager.store.poiNodeManager.addForGroup(e,t)}getPoiNodeGroupById(e){return this.manager.store.poiNodeManager.getGroupById(e)}getPoiNodeGroupByName(e){return this.manager.store.poiNodeManager.getGroupByName(e)}getAllPoiNodeGroup(){return this.manager.store.poiNodeManager.getAllGroup()}removePoiNodeGroupById(e){return this.manager.store.poiNodeManager.removeGroupById(e)}clearPoiNode(){return this.manager.store.poiNodeManager.clear()}getAllPoiNode(){return this.manager.store.poiNodeManager.getAll()}showAllPoiNode(){return this.manager.store.poiNodeManager.showAll()}hideAllPoiNode(){return this.manager.store.poiNodeManager.hideAll()}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return this.manager.store.canvas3DManager.getById(e)}getCanvas3DByName(e){return this.manager.store.canvas3DManager.getByName(e)}getCanvas3DByUserDataProperty(e,t){return this.manager.store.canvas3DManager.getByUserDataProperty(e,t)}removeCanvas3DById(e){return this.manager.store.canvas3DManager.removeById(e)}createGroupForCanvas3D(e){return this.manager.store.canvas3DManager.createGroup(e)}createCanvas3DToGroup(e,t){return this.manager.store.canvas3DManager.createToGroup(e,t)}addCanvas3DForGroup(e,t){return this.manager.store.canvas3DManager.addForGroup(e,t)}getCanvas3DGroupById(e){return this.manager.store.canvas3DManager.getGroupById(e)}getCanvas3DGroupByName(e){return this.manager.store.canvas3DManager.getGroupByName(e)}getAllCanvas3DGroup(){return this.manager.store.canvas3DManager.getAllGroup()}removeCanvas3DGroupById(e){return this.manager.store.canvas3DManager.removeGroupById(e)}clearCanvas3D(){return this.manager.store.canvas3DManager.clear()}getAllCanvas3D(){return this.manager.store.canvas3DManager.getAll()}showAllCanvas3D(){return this.manager.store.canvas3DManager.showAll()}hideAllCanvas3D(){return this.manager.store.canvas3DManager.hideAll()}getShortestPath(e,t){return this.manager.store.topologyManager.getShortestPath(e,t)}getShortestPathByMultipleStartPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleStartPoints(e,t)}getShortestPathByMultipleEndPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleEndPoints(e,t)}createTopologyFromGml(e){return this.manager.store.topologyManager.createFromGml(e)}createTopology(e){return this.manager.store.topologyManager.create(e)}resetTopologyNodes(e,t){return this.manager.store.topologyManager.resetNodes(e,t)}getTopologyById(e){return this.manager.store.topologyManager.getById(e)}getTopologyByName(e){return this.manager.store.topologyManager.getByName(e)}getTopologyByUserDataProperty(e,t){return this.manager.store.topologyManager.getByUserDataProperty(e,t)}removeTopologyById(e){return this.manager.store.topologyManager.removeById(e)}createGroupForTopology(e){return this.manager.store.topologyManager.createGroup(e)}createTopologyToGroup(e,t){return this.manager.store.topologyManager.createToGroup(e,t)}addTopologyForGroup(e,t){return this.manager.store.topologyManager.addForGroup(e,t)}getTopologyGroupById(e){return this.manager.store.topologyManager.getGroupById(e)}getTopologyGroupByName(e){return this.manager.store.topologyManager.getGroupByName(e)}getAllTopologyGroup(){return this.manager.store.topologyManager.getAllGroup()}removeTopologyGroupById(e){return this.manager.store.topologyManager.removeGroupById(e)}clearTopology(){return this.manager.store.topologyManager.clear()}getAllTopology(){return this.manager.store.topologyManager.getAll()}showAllTopology(){return this.manager.store.topologyManager.showAll()}hideAllTopology(){return this.manager.store.topologyManager.hideAll()}addGridHelper(e){return this.manager.store.helperManager.addGridHelper(e)}addAxesHelper(e){return this.manager.store.helperManager.addAxesHelper(e)}addBoxHelper(e){return this.manager.store.helperManager.addBoxHelper(e)}addPlaneHelper(e){return this.manager.store.helperManager.addPlaneHelper(e)}createGround(e){return console.warn("In soonspacejs: 'createGround' 已弃用,请使用 'addGroundHelper'!"),this.addGroundHelper(e)}addGroundHelper(e){return this.manager.store.helperManager.addGroundHelper(e)}addDirectionalLightHelper(e){return this.manager.store.helperManager.addDirectionalLightHelper(e)}addHemisphereLightHelper(e){return this.manager.store.helperManager.addHemisphereLightHelper(e)}addSpotLightHelper(e){return this.manager.store.helperManager.addSpotLightHelper(e)}addPointLightHelper(e){return this.manager.store.helperManager.addPointLightHelper(e)}getHelperById(e){return this.manager.store.helperManager.getById(e)}removeHelperById(e){return this.manager.store.helperManager.removeById(e)}clearHelper(){return this.manager.store.helperManager.clear()}showAllHelper(){return this.manager.store.helperManager.showAll()}hideAllHelper(){return this.manager.store.helperManager.hideAll()}}export{ou as BaseMesh,su as BaseObject3D,Ip as Canvas3D,Tp as Circle,Fp as Ground,lu as Group,fh as IVector3ToEuler,ph as IVector3ToVector3,_p as Icon,Lp as Line,Ap as Link,wh as MinHeap,xp as Model,Sp as Node,cu as PluginObject,wp as Poi,Ou as PoiNode,Mp as Point,Rp as Polygon,vp as Sbm,au as SceneManage,Ep as Topology,yh as deg2Euler,xh as euler2Deg,kh as getAsciiString,mh as getBoundingBox,Mh as getCubeTexture,bh as getSpaceAttributeFromObject,Ah as hasOwn,Fh as isArray,Ph as isBoolean,Ih as isDate,Nh as isFunction,Ch as isNull,Lh as isNumber,Oh as isObject,Dh as isPromise,Eh as isString,Rh as isSymbol,dh as log,Sh as parseSbmx,vh as rotationAFix,gh as rotationAxisFix,Uh as sleep,_h as syncSpaceAttributeToObject,Bh as typeJudge};
35
+ */var Bp,Up=(function(e,t){e.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(!a&&Zu)return Zu(s);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,(function(e){var n=t[s][1][e];return i(n||e)}),c,c.exports,e,t,n,r)}return n[s].exports}for(var o=Zu,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){(function(e){var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(h),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),n=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var l=new e.MessageChannel;l.port1.onmessage=h,n=function(){l.port2.postMessage(0)}}var c=[];function h(){var e,t;r=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}r=!1}function u(e){1!==c.push(e)||r||n()}t.exports=u}).call(this,void 0!==qu?qu:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function h(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return o.reject(e,t)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function r(t){n||(n=!0,o.reject(e,t))}function i(t){n||(n=!0,o.resolve(e,t))}function s(){t(i,r)}var a=f(s);"error"===a.status&&r(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function m(e){return e instanceof this?e:o.resolve(new this(i),e)}function g(e){var t=new this(i);return o.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,l=-1,c=new this(i);++l<n;)h(e[l],l);return c;function h(e,i){function l(e){s[i]=e,++a!==n||r||(r=!0,o.resolve(c,s))}t.resolve(e).then(l,(function(e){r||(r=!0,o.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=-1,a=new this(i);++s<n;)l(e[s]);return a;function l(e){t.resolve(e).then((function(e){r||(r=!0,o.resolve(a,e))}),(function(e){r||(r=!0,o.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(i);return this.state!==l?u(n,this.state===a?e:t,this.outcome):this.queue.push(new h(n,e,t)),n},h.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){o.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=f(d,t);if("error"===n.status)return o.reject(e,n.value);var r=n.value;if(r)p(e,r);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},c.resolve=m,c.reject=g,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==qu?qu:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var s=o();function a(){try{if(!s||!s.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function h(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function p(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",m=void 0,g={},v=Object.prototype.toString,y="readonly",x="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function _(e){return new c((function(t){var n=e.transaction(f,x),r=l([""]);n.objectStore(f).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function w(e){return"boolean"==typeof m?c.resolve(m):_(e).then((function(e){return m=e}))}function M(e){var t=g[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function S(e){var t=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=g[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function A(e,t){return new c((function(n,r){if(g[e.name]=g[e.name]||D(),e.db){if(!t)return n(e.db);M(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=s.open.apply(s,i);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(f)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),r(o.error)},o.onsuccess=function(){n(o.result),S(e)}}))}function E(e){return A(e,!1)}function P(e){return A(e,!0)}function L(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function C(e){return new c((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(n){var r=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:r,type:e.type})},r.readAsBinaryString(e)}))}function R(e){return l([b(atob(e.data))],{type:e.type})}function I(e){return e&&e.__local_forage_encoded_blob}function F(e){var t=this,n=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function O(e){M(e);for(var t=g[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,L(e)?P(e):t})).then((function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(t){throw T(e,t),t}))}function N(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(r>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),P(e)})).then((function(){return O(e).then((function(){N(e,t,n,r-1)}))})).catch(n);n(i)}}function D(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function B(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var i=g[n.name];i||(i=D(),g[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=F);var o=[];function s(){return c.resolve()}for(var a=0;a<i.forages.length;a++){var l=i.forages[a];l!==t&&o.push(l._initReady().catch(s))}var h=i.forages.slice(0);return c.all(o).then((function(){return n.db=i.db,E(n)})).then((function(e){return n.db=e,L(n,t._defaultConfig.version)?P(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<h.length;r++){var o=h[r];o!==t&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}}))}function U(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){N(n._dbInfo,y,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),I(e)&&(e=R(e)),t(e)},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function k(e,t){var n=this,r=new c((function(t,r){n.ready().then((function(){N(n._dbInfo,y,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var n=s.result;if(n){var r=n.value;I(r)&&(r=R(r));var i=e(r,n.key,a++);void 0!==i?t(i):n.continue()}else t()},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function z(e,t,n){var r=this;e=d(e);var i=new c((function(n,i){var o;r.ready().then((function(){return o=r._dbInfo,"[object Blob]"===v.call(t)?w(o.db).then((function(e){return e?t:C(t)})):t})).then((function(t){N(r._dbInfo,x,(function(o,s){if(o)return i(o);try{var a=s.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),n(t)},s.onabort=s.onerror=function(){var e=l.error?l.error:l.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return h(i,n),i}function G(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){N(n._dbInfo,x,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){r(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){N(t._dbInfo,x,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function j(e){var t=this,n=new c((function(e,n){t.ready().then((function(){N(t._dbInfo,y,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function V(e,t){var n=this,r=new c((function(t,r){e<0?t(null):n.ready().then((function(){N(n._dbInfo,y,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName),a=!1,l=s.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){r(l.error)}}catch(e){r(e)}}))})).catch(r)}));return h(r,t),r}function W(e){var t=this,n=new c((function(e,n){t.ready().then((function(){N(t._dbInfo,y,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):e(s)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function X(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var o=e.name===n.name&&i._dbInfo.db?c.resolve(i._dbInfo.db):E(e).then((function(t){var n=g[e.name],r=n.forages;n.db=t;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=t;return t}));r=e.storeName?o.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;M(e);var r=g[e.name],i=r.forages;t.close();for(var o=0;o<i.length;o++){var a=i[o];a._dbInfo.db=null,a._dbInfo.version=n}return new c((function(t,r){var i=s.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}})).then((function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,S(n._dbInfo)}})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}})):o.then((function(t){M(e);var n=g[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;return new c((function(t,n){var r=s.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<r.length;t++)S(r[t]._dbInfo)})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}))}else r=c.reject("Invalid arguments");return h(r,t),r}var Y={_driver:"asyncStorage",_initStorage:B,_support:a(),iterate:k,getItem:U,setItem:z,removeItem:G,clear:H,length:j,key:V,keys:W,dropInstance:X};function q(){return"function"==typeof openDatabase}var Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z="~~local_forage_type~",J=/^~~local_forage_type~([^~]+)~/,K="__lfsc__:",$=K.length,ee="arbf",te="blob",ne="si08",re="ui08",ie="uic8",oe="si16",se="si32",ae="ur16",le="ui32",ce="fl32",he="fl64",ue=$+ee.length,de=Object.prototype.toString;function pe(e){var t,n,r,i,o,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var c=new ArrayBuffer(s),h=new Uint8Array(c);for(t=0;t<a;t+=4)n=Q.indexOf(e[t]),r=Q.indexOf(e[t+1]),i=Q.indexOf(e[t+2]),o=Q.indexOf(e[t+3]),h[l++]=n<<2|r>>4,h[l++]=(15&r)<<4|i>>2,h[l++]=(3&i)<<6|63&o;return c}function fe(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=Q[n[t]>>2],r+=Q[(3&n[t])<<4|n[t+1]>>4],r+=Q[(15&n[t+1])<<2|n[t+2]>>6],r+=Q[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function me(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var r,i=K;e instanceof ArrayBuffer?(r=e,i+=ee):(r=e.buffer,"[object Int8Array]"===n?i+=ne:"[object Uint8Array]"===n?i+=re:"[object Uint8ClampedArray]"===n?i+=ie:"[object Int16Array]"===n?i+=oe:"[object Uint16Array]"===n?i+=ae:"[object Int32Array]"===n?i+=se:"[object Uint32Array]"===n?i+=le:"[object Float32Array]"===n?i+=ce:"[object Float64Array]"===n?i+=he:t(new Error("Failed to get type for BinaryArray"))),t(i+fe(r))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){var n=Z+e.type+"~"+fe(this.result);t(K+te+n)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function ge(e){if(e.substring(0,$)!==K)return JSON.parse(e);var t,n=e.substring(ue),r=e.substring($,ue);if(r===te&&J.test(n)){var i=n.match(J);t=i[1],n=n.substring(i[0].length)}var o=pe(n);switch(r){case ee:return o;case te:return l([o],{type:t});case ne:return new Int8Array(o);case re:return new Uint8Array(o);case ie:return new Uint8ClampedArray(o);case oe:return new Int16Array(o);case ae:return new Uint16Array(o);case se:return new Int32Array(o);case le:return new Uint32Array(o);case ce:return new Float32Array(o);case he:return new Float64Array(o);default:throw new Error("Unkown type: "+r)}}var ve={serialize:me,deserialize:ge,stringToBuffer:pe,bufferToString:fe};function ye(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function xe(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var i=new c((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(i){ye(i,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=ve,i}function be(e,t,n,r,i,o){e.executeSql(n,r,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?o(e,s):ye(e,t,(function(){e.executeSql(n,r,i,o)}),o)}),o):o(e,s)}),o)}function _e(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function we(e,t){var n=this,r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT * FROM "+i.storeName,[],(function(n,r){for(var o=r.rows,s=o.length,a=0;a<s;a++){var l=o.item(a),c=l.value;if(c&&(c=i.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function Me(e,t,n,r){var i=this;e=d(e);var o=new c((function(o,s){i.ready().then((function(){void 0===t&&(t=null);var a=t,l=i._dbInfo;l.serializer.serialize(t,(function(t,c){c?s(c):l.db.transaction((function(n){be(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){o(a)}),(function(e,t){s(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void o(Me.apply(i,[e,a,n,r-1]));s(t)}}))}))})).catch(s)}));return h(o,n),o}function Se(e,t,n){return Me.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=d(e);var r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function Ae(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){be(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Ee(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){be(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Pe(e,t){var n=this,r=new c((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return h(r,t),r}function Le(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){be(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Ce(e){return new c((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var i=[],o=0;o<r.rows.length;o++)i.push(r.rows.item(o).name);t({db:e,storeNames:i})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Re(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;return h(r=e.name?new c((function(t){var r;r=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(Ce(r))})).then((function(e){return new c((function(t,n){e.db.transaction((function(r){function i(e){return new c((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var o=[],s=0,a=e.storeNames.length;s<a;s++)o.push(i(e.storeNames[s]));c.all(o).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),t),r}var Ie={_driver:"webSQLStorage",_initStorage:xe,_support:q(),iterate:we,getItem:_e,setItem:Se,removeItem:Te,clear:Ae,length:Ee,key:Pe,keys:Le,dropInstance:Re};function Fe(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Oe(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function Ne(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function De(){return!Ne()||localStorage.length>0}function Be(e){var t=this,n={};if(e)for(var r in e)n[r]=e[r];return n.keyPrefix=Oe(e,t._defaultConfig),De()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function Ue(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return h(n,e),n}function ke(e,t){var n=this;e=d(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return h(r,t),r}function ze(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,i=r.length,o=localStorage.length,s=1,a=0;a<o;a++){var l=localStorage.key(a);if(0===l.indexOf(r)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(i),s++)))return c}}}));return h(r,t),r}function Ge(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return h(r,t),r}function He(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var o=localStorage.key(i);0===o.indexOf(e.keyPrefix)&&r.push(o.substring(e.keyPrefix.length))}return r}));return h(n,e),n}function je(e){var t=this.keys().then((function(e){return e.length}));return h(t,e),t}function Ve(e,t){var n=this;e=d(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return h(r,t),r}function We(e,t,n){var r=this;e=d(e);var i=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(i,o){var s=r._dbInfo;s.serializer.serialize(t,(function(t,r){if(r)o(r);else try{localStorage.setItem(s.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}}))}))}));return h(i,n),i}function Xe(e,t){if(t=p.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,i=this;return h(r=e.name?new c((function(t){e.storeName?t(Oe(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),t),r}var Ye={_driver:"localStorageWrapper",_initStorage:Be,_support:Fe(),iterate:ze,getItem:ke,setItem:We,removeItem:Ve,clear:Ue,length:je,key:Ge,keys:He,dropInstance:Xe},qe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Qe=function(e,t){for(var n=e.length,r=0;r<n;){if(qe(e[r],t))return!0;r++}return!1},Ze=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Je={},Ke={},$e={INDEXEDDB:Y,WEBSQL:Ie,LOCALSTORAGE:Ye},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),rt={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function it(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function ot(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ze(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var st=new(function(){function e(t){for(var n in i(this,e),$e)if($e.hasOwnProperty(n)){var r=$e[n],o=r._driver;this[n]=o,Je[o]||this.defineDriver(r)}this._defaultConfig=ot({},rt),this._config=ot({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new c((function(t,n){try{var r=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);for(var o=nt.concat("_initStorage"),s=0,a=o.length;s<a;s++){var l=o[s];if((!Qe(tt,l)||e[l])&&"function"!=typeof e[l])return void n(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return h(n,arguments[arguments.length-1]),n}},n=0,r=tt.length;n<r;n++){var i=tt[n];e[i]||(e[i]=t(i))}}();var u=function(n){Je[r]&&console.info("Redefining LocalForage driver: "+r),Je[r]=e,Ke[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(u,n):u(!!e._support):u(!0)}catch(e){n(e)}}));return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=Je[e]?c.resolve(Je[e]):c.reject(new Error("Driver not found."));return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;Ze(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){r._config.driver=r.driver()}function s(e){return r._extend(e),o(),r._ready=r._initStorage(r._config),r._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var i=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(s).catch(n)}o();var a=new Error("No available storage method found.");return r._driverSet=c.reject(a),r._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=a(i)}))})).catch((function(){o();var e=new Error("No available storage method found.");return r._driverSet=c.reject(e),r._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Ke[e]},e.prototype._extend=function(e){ot(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)it(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=st},{3:3}]},{},[4])(4)}(Bp={exports:{}},Bp.exports),Bp.exports);class kp extends DataView{constructor(e,t,n){super(e),this.appKeys=t,this.isLE=n}byteRevers(e,t){const n=t%this.appKeys.length;return e^this.appKeys[n]}getSoonUint8(e){return this.byteRevers(this.getUint8(e),e)}getSoonUint16(e){const t=[];for(let n=0;n<2;n++)t.push(this.getSoonUint8(e+n));return new DataView(new Uint8Array(t).buffer).getUint16(0,this.isLE)}getSoonUint32(e){const t=[];for(let n=0;n<4;n++)t.push(this.getSoonUint8(e+n));return new DataView(new Uint8Array(t).buffer).getUint32(0,this.isLE)}getSoonFloat32(e){const t=[];for(let n=0;n<4;n++)t.push(this.getSoonUint8(e+n));return new DataView(new Uint8Array(t).buffer).getFloat32(0,this.isLE)}}var zp=class{constructor(){this.materials=new Map,this.sbmInfo=null,this.isLE=!0}load(e,t){return this.sbmInfo=e,fetch(e.url).then((e=>e.arrayBuffer())).then((n=>this.parse(n,e,t)))}parse(e,t,n){this.sbmInfo=t;const r=new DataView(e);let i=0;const o=[];for(let e=0;e<8;e++)o.push(r.getUint8(i)),i+=1;if("SBK-----"!==String.fromCharCode(...o))return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})格式或数据错误!`);const s=[],a=[],l=[];for(let e=0;e<32;e++)s.push(r.getUint8(i)),i+=1;const c=r.getUint8(i);i+=1;const h=r.getUint8(i);i+=1;for(let e=0;e<32;e++)a.push(r.getUint8(i)),i+=1;for(let e=0;e<64;e++)l.push(r.getUint8(i)),i+=1;const u=[...a,...l,...s],d=[];for(let e=0;e<u.length;e++)(e<=7||e>23&&e<=31||e>39&&e<=55||e>63&&e<=87||e>95&&e<=103)&&d.push(u[e]);if(64!==d.length)return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url} 数据错误!`);if(1===c){const e=new kp(r.buffer.slice(i,r.buffer.byteLength),d,this.isLE);return 1===h||2===h?this._parseV2(e,0,n):3===h?this._parseV3(e,0,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}return Promise.resolve(new vp(this.sbmInfo))}_parseV2(e,t,n){return Nu(this,void 0,void 0,(function*(){const r=performance.now(),i=[],o=[],a=[];for(let n=0;n<2;n++)i.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)o.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)a.push(e.getSoonUint8(t)),t+=1;const l={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const c=new vp(this.sbmInfo),h=e.getSoonUint16(t);t+=2;const d=e.getSoonUint16(t);t+=2,l.total=d;for(let n=0;n<h;++n){const n=e.getSoonUint16(t).toString();t+=2,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;const r=e.getSoonFloat32(t);t+=4;const i=e.getSoonFloat32(t);t+=4;const o=e.getSoonFloat32(t);t+=4;const s=e.getSoonFloat32(t);t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;let a=e.getSoonUint8(t);t+=1,0===a?a=0:1===a?a=1:2===a&&(a=2);const l=e.getSoonUint16(t);t+=2;let c=null;if(l>0){let n="",r="";for(let i=0;i<l;i++){const i=e.getSoonUint8(t);i>127?r=r+"%"+i.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(i),r=""):n+=String.fromCharCode(i),t+=1}n=n.replace("\\","/");const{url:i,isPlatform:o}=this.sbmInfo,s=this.getTextureUrl(i,n,o);c=new u,c.image=(new va).load(s),c.wrapS=1e3,c.wrapT=1e3,c.flipY=!1,c.anisotropy=16,c.mipmaps=[],c.generateMipmaps=!0,c.version+=1}if(!this.materials.has(n)){const e=s<1,t=new Gs({color:new Ue(r,i,o),opacity:s,transparent:e,map:c,side:a,shininess:0,specular:0});t.name=n,this.materials.set(n,t)}}for(let i=0;i<d;++i){const i=e.getSoonUint16(t);t+=2;const o=e.getSoonUint16(t);t+=2;const a=[],h=[],u=[],d=[],p=e.getSoonUint16(t);if(t+=2,p>0)for(let n=0;n<p;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4,a.push(n)}const f=e.getSoonUint16(t);if(t+=2,f>0)for(let n=0;n<f;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4}const m=e.getSoonUint16(t);if(t+=2,m>0)for(let n=0;n<m;n++){const n=new s;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,h.push(n)}const g=e.getSoonUint16(t);if(t+=2,g>0)for(let n=0;n<g;n++){const n=e.getSoonUint16(t);t+=2;const r=e.getSoonUint16(t);t+=2;const i=e.getSoonUint16(t);t+=2;const o=new ke(n,r,i);u.push(o),h.length>0&&d.push([h[o.a],h[o.b],h[o.c]])}const y=[],x=[],b=[];for(let e=0;e<u.length;e++){const t=u[e];y.push(a[t.a],a[t.b],a[t.c]);const n=t.vertexColors;if(3===n.length)x.push(n[0],n[1],n[2]);else{const e=t.color;x.push(e,e,e)}const r=d[e];void 0!==r?b.push(r[0],r[1],r[2]):b.push(new s,new s,new s)}const _=new pt;if(y.length>0){const e=new Float32Array(3*y.length);_.setAttribute("position",new We(e,3).copyVector3sArray(y))}if(x.length>0){const e=new Float32Array(3*x.length);_.setAttribute("color",new We(e,3).copyColorsArray(x))}if(b.length>0){const e=new Float32Array(2*b.length);_.setAttribute("uv",new We(e,2).copyVector2sArray(b))}_.computeVertexNormals();const w=this.materials.get(o.toString());if(w){const e=new ou(_,w,{id:i,name:i.toString()});c.add(e)}l.loaded++,l.timeStamp=performance.now()-r,n&&n(l)}return Promise.resolve(c)}))}_parseV3(e,t,n){const r=[],i=[],o=[];for(let n=0;n<2;n++)r.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)i.push(e.getSoonUint8(t)),t+=1;for(let n=0;n<32;n++)o.push(e.getSoonUint8(t)),t+=1;const a=performance.now(),l={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const c=new vp(this.sbmInfo),h=e.getSoonUint16(t);t+=2;const d=e.getSoonUint16(t);t+=2,l.total=d;for(let n=0;n<h;++n){const n=e.getSoonUint16(t).toString();t+=2,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;const r=e.getSoonFloat32(t);t+=4;const i=e.getSoonFloat32(t);t+=4;const o=e.getSoonFloat32(t);t+=4;const s=e.getSoonFloat32(t);t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4,e.getSoonFloat32(t),t+=4;let a=e.getSoonUint8(t);t+=1,0===a?a=0:1===a?a=1:2===a&&(a=2);const l=e.getSoonUint16(t);t+=2;let c=null;if(l>0){let n="",r="";for(let i=0;i<l;i++){const i=e.getSoonUint8(t);i>127?r=r+"%"+i.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(i),r=""):n+=String.fromCharCode(i),t+=1}n=n.replace("\\","/");const{url:i,isPlatform:o}=this.sbmInfo,s=this.getTextureUrl(i,n,o);c=new u,c.image=(new va).load(s),c.wrapS=1e3,c.wrapT=1e3,c.flipY=!1,c.anisotropy=16,c.mipmaps=[],c.generateMipmaps=!0,c.version+=1}if(!this.materials.has(n)){const e=s<1,t=new Gs({color:new Ue(r,i,o),opacity:s,transparent:e,map:c,side:a,shininess:0,specular:0});t.name=n,this.materials.set(n,t)}}for(let r=0;r<d;++r){const r=e.getSoonUint16(t).toString();t+=2;const i=e.getSoonUint16(t);if(t+=2,i>0){let n="";for(let r=0;r<i;r++){const r=e.getUint8(t);r>127?n=n+"%"+r.toString(16).toUpperCase():n.length>0&&(n=""),t+=1}}const o=e.getSoonUint16(t).toString();t+=2;const h=[],u=[],d=[],p=[],f=e.getSoonUint32(t);if(t+=4,f>0)for(let n=0;n<f;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4,h.push(n)}const m=e.getSoonUint32(t);if(t+=4,m>0)for(let n=0;n<m;n++){const n=new v;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,n.setZ(e.getSoonFloat32(t)),t+=4}const g=e.getSoonUint32(t);if(t+=4,g>0)for(let n=0;n<g;n++){const n=new s;n.setX(e.getSoonFloat32(t)),t+=4,n.setY(e.getSoonFloat32(t)),t+=4,u.push(n)}const y=e.getSoonUint32(t);if(t+=4,y>0)for(let n=0;n<y;n++){const n=e.getSoonUint32(t);t+=4;const r=e.getSoonUint32(t);t+=4;const i=e.getSoonUint32(t);t+=4;const o=new ke(n,r,i);d.push(o),u.length>0&&p.push([u[o.a],u[o.b],u[o.c]])}const x=[],b=[],_=[];for(let e=0;e<d.length;e++){const t=d[e];x.push(h[t.a],h[t.b],h[t.c]);const n=t.vertexColors;if(3===n.length)b.push(n[0],n[1],n[2]);else{const e=t.color;b.push(e,e,e)}const r=p[e];void 0!==r?_.push(r[0],r[1],r[2]):_.push(new s,new s,new s)}const w=new pt;if(x.length>0){const e=new Float32Array(3*x.length);w.setAttribute("position",new We(e,3).copyVector3sArray(x))}if(b.length>0){const e=new Float32Array(3*b.length);w.setAttribute("color",new We(e,3).copyColorsArray(b))}if(_.length>0){const e=new Float32Array(2*_.length);w.setAttribute("uv",new We(e,2).copyVector2sArray(_))}if(w.computeVertexNormals(),this.materials.has(o)){const e=new ou(w,this.materials.get(o),{id:r,name:r});c.add(e)}l.loaded++,l.timeStamp=performance.now()-a,n&&n(l)}return Promise.resolve(c)}getTextureUrl(e,t,n){let r="",i=t;const o=i.lastIndexOf("/");if(-1!==o&&(i=i.substring(o+1)),r=e,n){const e=r.split("/");e.length>1&&(e.splice(e.length-3,e.length),r=e.join("/")+"/Maps/"+i)}else{const e=r.lastIndexOf("/");-1!==e&&(r=r.substring(0,e+1)+"Maps/"+i)}return r}},Gp=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),r=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(r),t.removeComments&&this.removeCommentProperties(r),t.transformTextOnly&&this.transformTextOnly(r),r):r},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,r){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,r){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,r){var i=Object.keys(e[n]).length>1,o=Object.keys(e[n])[0];i||"object"==typeof e[n][o]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var r=e.attributes.item(n);t._attributes[r.nodeName]=r.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++){var o=e.childNodes.item(i),s=o.nodeName;if(void 0===t[s])t[s]=this.xmlToJson(o);else{if(void 0===t[s].push){var a=t[s];t[s]=[],t[s].push(a)}t[s].push(this.xmlToJson(o))}}return t},e}();function Hp(e){return fetch(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new Gp).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class jp extends Np{constructor(e){super("Sbm",e),this.viewport=e,this.modelMaps=new Map,this.store=Up.createInstance({name:"soonspace",version:2,storeName:"sbmData"})}load(e,t){return this._loadItem(e,t)}parse(e,t,n){return(new zp).parse(e,t,n).then((e=>{if(!this.modelMaps.get(t.url)){const n=e.sClone();this.modelMaps.set(t.url,n)}return e.onLoad&&e.onLoad(e),Promise.resolve(e)}))}clone(e,t,n){return new Promise(((r,i)=>{"Sbm"!==e.stype&&i("In soonspacejs: 方法 cloneSbm 参入对象类型错误!");const{id:o,name:s,level:a,visible:l,position:c,rotation:h,scale:u,onClick:d,onDblClick:p,onRightClick:f,onLoad:m,userData:g}=t,v=e.sClone();o&&(v.sid=o),s&&(v.name=s),a&&(v.level=a),Ph(l)&&(v.visible=l),c&&v.position.set(c.x,c.y,c.z),h&&v.rotation.set(h.x,h.y,h.z),u&&v.scale.set(u.x,u.y,u.z),v.onClick=d?d.bind(v):null,v.onDblClick=p?p.bind(v):null,v.onRightClick=f?f.bind(v):null,v.onLoad=m?m.bind(v):null,v.onLoad&&v.onLoad(v),g&&(v.userData=g),null!==n&&this.viewport.scener.addObject(v,n||this.scene||e.parent),r(v)}))}loadToGroup(e,t,n){return new Promise((r=>Nu(this,void 0,void 0,(function*(){const i=new lu(e);for(let e=0;e<t.length;e++){const r=yield this._loadItem(t[e],(r=>{n&&n({modelTotal:t.length,loadingModelIndex:e+1,current:r})}),null);i.add(r)}this.viewport.scener.addObject(i,this.scene),r(i)}))))}addForGroup(e,t,n){return new Promise((r=>Nu(this,void 0,void 0,(function*(){const i=this.getGroupById(e);if(i)for(let e=0;e<t.length;e++){const r=yield this._loadItem(t[e],(r=>{n&&n({modelTotal:t.length,loadingModelIndex:e+1,current:r})}),null);this.viewport.scener.addObject(r,i)}r(i)}))))}createGroupFromXml(e,t){return new Promise((n=>Nu(this,void 0,void 0,(function*(){let r=!1;const i=yield Hp(t),o=new lu(e),{ProjectInfo:s,Building:a}=i.Project,l=e=>Nu(this,void 0,void 0,(function*(){const i=t.split(s.Title+".xml")[0],{id:l,name:c}=e._attributes,{name:h}=e.FileSource._attributes,u=s.Title+c,d=yield this._loadItem({id:l,name:u,url:i+h.replace("\\","/")},void 0,null);let p;if(o.add(d),p=Fh(a.ObjectHierarchy.Entity)?a.ObjectHierarchy.Entity.find((e=>e._attributes.id===l)):a.ObjectHierarchy.Entity,!p)return;const f=p.Entity.filter((e=>"FACILITY"===e._attributes.type)),m=f.length;if(0===m&&r)this.viewport.scener.addObject(o,this.scene),n(o);else for(let e=0;e<m;e++){const{id:t,name:s,longname:a,position:l,scale:c,orient:h}=f[e]._attributes,u=l.split(","),p=c.split(","),g=h.split(","),v=yield this._loadItem({id:t,name:s,url:i+a+".sbm",position:{x:10*Number(u[0].trim()),y:10*Number(u[1].trim()),z:10*Number(u[2].trim())},scale:{x:10*Number(p[0].trim()),y:10*Number(p[1].trim()),z:10*Number(p[2].trim())}},void 0,null);v.quaternion.set(Number(g[1].trim()),Number(g[2].trim()),Number(g[3].trim()),Number(g[0].trim())),d.add(v),r&&e===m-1&&(this.viewport.scener.addObject(o,this.scene),n(o))}})),{Floor:c}=a.Floors;Fh(c)?c.forEach(((e,t)=>{t===c.length-1&&(r=!0),l(e)})):Oh(c)&&(r=!0,l(c))}))))}clearIdb(){return this.store.clear()}_loadItem(e,t,n=this.scene){return Nu(this,void 0,void 0,(function*(){const{url:r}=e,{useIndexedDB:i}=this.viewport.options,o=this.modelMaps.get(r);let s=null;if(o)return this.clone(o,e,n);i&&(s=yield this.store.getItem(r)),s||(s=yield this._fetchBuffer(e));const a=yield this.parse(s,e,t);return null!==n&&this.viewport.scener.addObject(a,n||this.scene),Promise.resolve(a)}))}_fetchBuffer(e){const{url:t}=e,{useIndexedDB:n}=this.viewport.options;return fetch(t).then((e=>e.arrayBuffer())).then((e=>(n&&this.store.setItem(t,e),Promise.resolve(e))))}}
36
+ /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */var Vp={},Wp=void 0,Xp=Vp;function Yp(e,t){var n,r=e.split("."),i=Xp;!(r[0]in i)&&i.execScript&&i.execScript("var "+r[0]);for(;r.length&&(n=r.shift());)r.length||t===Wp?i=i[n]?i[n]:i[n]={}:i[n]=t}var qp="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function Qp(e){var t,n,r,i,o,s,a,l,c,h,u=e.length,d=0,p=Number.POSITIVE_INFINITY;for(l=0;l<u;++l)e[l]>d&&(d=e[l]),e[l]<p&&(p=e[l]);for(t=1<<d,n=new(qp?Uint32Array:Array)(t),r=1,i=0,o=2;r<=d;){for(l=0;l<u;++l)if(e[l]===r){for(s=0,a=i,c=0;c<r;++c)s=s<<1|1&a,a>>=1;for(h=r<<16|l,c=s;c<t;c+=o)n[c]=h;++i}++r,i<<=1,o<<=1}return[n,d,p]}function Zp(e,t){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=qp?new Uint8Array(e):e,this.m=!1,this.i=Kp,this.r=!1,!t&&(t={})||(t.index&&(this.a=t.index),t.bufferSize&&(this.h=t.bufferSize),t.bufferType&&(this.i=t.bufferType),t.resize&&(this.r=t.resize)),this.i){case Jp:this.b=32768,this.c=new(qp?Uint8Array:Array)(32768+this.h+258);break;case Kp:this.b=0,this.c=new(qp?Uint8Array:Array)(this.h),this.e=this.z,this.n=this.v,this.j=this.w;break;default:throw Error("invalid inflate mode")}}var Jp=0,Kp=1,$p={t:Jp,s:Kp};Zp.prototype.k=function(){for(;!this.m;){var e=xf(this,3);switch(1&e&&(this.m=!0),e>>>=1){case 0:var t=this.input,n=this.a,r=this.c,i=this.b,o=t.length,s=Wp,a=r.length,l=Wp;if(this.d=this.f=0,n+1>=o)throw Error("invalid uncompressed block header: LEN");if(s=t[n++]|t[n++]<<8,n+1>=o)throw Error("invalid uncompressed block header: NLEN");if(s===~(t[n++]|t[n++]<<8))throw Error("invalid uncompressed block header: length verify");if(n+s>t.length)throw Error("input buffer is broken");switch(this.i){case Jp:for(;i+s>r.length;){if(s-=l=a-i,qp)r.set(t.subarray(n,n+l),i),i+=l,n+=l;else for(;l--;)r[i++]=t[n++];this.b=i,r=this.e(),i=this.b}break;case Kp:for(;i+s>r.length;)r=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(qp)r.set(t.subarray(n,n+s),i),i+=s,n+=s;else for(;s--;)r[i++]=t[n++];this.a=n,this.b=i,this.c=r;break;case 1:this.j(gf,yf);break;case 2:var c,h,u,d,p=xf(this,5)+257,f=xf(this,5)+1,m=xf(this,4)+4,g=new(qp?Uint8Array:Array)(rf.length),v=Wp,y=Wp,x=Wp,b=Wp,_=Wp;for(_=0;_<m;++_)g[rf[_]]=xf(this,3);if(!qp)for(_=m,m=g.length;_<m;++_)g[rf[_]]=0;for(c=Qp(g),v=new(qp?Uint8Array:Array)(p+f),_=0,d=p+f;_<d;)switch(y=bf(this,c),y){case 16:for(b=3+xf(this,2);b--;)v[_++]=x;break;case 17:for(b=3+xf(this,3);b--;)v[_++]=0;x=0;break;case 18:for(b=11+xf(this,7);b--;)v[_++]=0;x=0;break;default:x=v[_++]=y}h=Qp(qp?v.subarray(0,p):v.slice(0,p)),u=Qp(qp?v.subarray(p):v.slice(p)),this.j(h,u);break;default:throw Error("unknown BTYPE: "+e)}}return this.n()};var ef,tf,nf=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rf=qp?new Uint16Array(nf):nf,of=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],sf=qp?new Uint16Array(of):of,af=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],lf=qp?new Uint8Array(af):af,cf=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],hf=qp?new Uint16Array(cf):cf,uf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],df=qp?new Uint8Array(uf):uf,pf=new(qp?Uint8Array:Array)(288);for(ef=0,tf=pf.length;ef<tf;++ef)pf[ef]=143>=ef?8:255>=ef?9:279>=ef?7:8;var ff,mf,gf=Qp(pf),vf=new(qp?Uint8Array:Array)(30);for(ff=0,mf=vf.length;ff<mf;++ff)vf[ff]=5;var yf=Qp(vf);function xf(e,t){for(var n,r=e.f,i=e.d,o=e.input,s=e.a,a=o.length;i<t;){if(s>=a)throw Error("input buffer is broken");r|=o[s++]<<i,i+=8}return n=r&(1<<t)-1,e.f=r>>>t,e.d=i-t,e.a=s,n}function bf(e,t){for(var n,r,i=e.f,o=e.d,s=e.input,a=e.a,l=s.length,c=t[0],h=t[1];o<h&&!(a>=l);)i|=s[a++]<<o,o+=8;if((r=(n=c[i&(1<<h)-1])>>>16)>o)throw Error("invalid code length: "+r);return e.f=i>>r,e.d=o-r,e.a=a,65535&n}function _f(e,t){var n,r;switch(this.input=e,this.a=0,!t&&(t={})||(t.index&&(this.a=t.index),t.verify&&(this.A=t.verify)),n=e[this.a++],r=e[this.a++],15&n){case wf:this.method=wf;break;default:throw Error("unsupported compression method")}if(0!=((n<<8)+r)%31)throw Error("invalid fcheck flag:"+((n<<8)+r)%31);if(32&r)throw Error("fdict flag is not supported");this.q=new Zp(e,{index:this.a,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}Zp.prototype.j=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,o,s,a,l=n.length-258;256!==(i=bf(this,e));)if(256>i)r>=l&&(this.b=r,n=this.e(),r=this.b),n[r++]=i;else for(a=sf[o=i-257],0<lf[o]&&(a+=xf(this,lf[o])),i=bf(this,t),s=hf[i],0<df[i]&&(s+=xf(this,df[i])),r>=l&&(this.b=r,n=this.e(),r=this.b);a--;)n[r]=n[r++-s];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},Zp.prototype.w=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,o,s,a,l=n.length;256!==(i=bf(this,e));)if(256>i)r>=l&&(l=(n=this.e()).length),n[r++]=i;else for(a=sf[o=i-257],0<lf[o]&&(a+=xf(this,lf[o])),i=bf(this,t),s=hf[i],0<df[i]&&(s+=xf(this,df[i])),r+a>l&&(l=(n=this.e()).length);a--;)n[r]=n[r++-s];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},Zp.prototype.e=function(){var e,t,n=new(qp?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.c;if(qp)n.set(i.subarray(32768,n.length));else for(e=0,t=n.length;e<t;++e)n[e]=i[e+32768];if(this.g.push(n),this.l+=n.length,qp)i.set(i.subarray(r,r+32768));else for(e=0;32768>e;++e)i[e]=i[r+e];return this.b=32768,i},Zp.prototype.z=function(e){var t,n,r,i=this.input.length/this.a+1|0,o=this.input,s=this.c;return e&&("number"==typeof e.p&&(i=e.p),"number"==typeof e.u&&(i+=e.u)),2>i?n=(r=(o.length-this.a)/this.o[2]/2*258|0)<s.length?s.length+r:s.length<<1:n=s.length*i,qp?(t=new Uint8Array(n)).set(s):t=s,this.c=t},Zp.prototype.n=function(){var e,t,n,r,i,o=0,s=this.c,a=this.g,l=new(qp?Uint8Array:Array)(this.l+(this.b-32768));if(0===a.length)return qp?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(t=0,n=a.length;t<n;++t)for(r=0,i=(e=a[t]).length;r<i;++r)l[o++]=e[r];for(t=32768,n=this.b;t<n;++t)l[o++]=s[t];return this.g=[],this.buffer=l},Zp.prototype.v=function(){var e,t=this.b;return qp?this.r?(e=new Uint8Array(t)).set(this.c.subarray(0,t)):e=this.c.subarray(0,t):(this.c.length>t&&(this.c.length=t),e=this.c),this.buffer=e},_f.prototype.k=function(){var e,t,n=this.input;if(e=this.q.k(),this.a=this.q.a,this.A){t=(n[this.a++]<<24|n[this.a++]<<16|n[this.a++]<<8|n[this.a++])>>>0;var r=e;if("string"==typeof r){var i,o,s=r.split("");for(i=0,o=s.length;i<o;i++)s[i]=(255&s[i].charCodeAt(0))>>>0;r=s}for(var a,l=1,c=0,h=r.length,u=0;0<h;){h-=a=1024<h?1024:h;do{c+=l+=r[u++]}while(--a);l%=65521,c%=65521}if(t!==(c<<16|l)>>>0)throw Error("invalid adler-32 checksum")}return e};var wf=8;Yp("Zlib.Inflate",_f),Yp("Zlib.Inflate.prototype.decompress",_f.prototype.k);var Mf,Sf,Tf,Af,Ef={ADAPTIVE:$p.s,BLOCK:$p.t};if(Object.keys)Mf=Object.keys(Ef);else for(Sf in Mf=[],Tf=0,Ef)Mf[Tf++]=Sf;for(Tf=0,Af=Mf.length;Tf<Af;++Tf)Yp("Zlib.Inflate.BufferType."+(Sf=Mf[Tf]),Ef[Sf]);var Pf=Vp.Zlib.Inflate,Lf={findSpan:function(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,o=r,s=Math.floor((i+o)/2);t<n[s]||t>=n[s+1];)t<n[s]?o=s:i=s,s=Math.floor((i+o)/2);return s},calcBasisFunctions:function(e,t,n,r){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=n;++a){o[a]=t-r[e+1-a],s[a]=r[e+a]-t;for(var l=0,c=0;c<a;++c){var h=s[c+1],u=o[a-c],d=i[c]/(h+u);i[c]=l+h*d,l=u*d}i[a]=l}return i},calcBSplinePoint:function(e,t,n,r){for(var i=this.findSpan(e,r,t),o=this.calcBasisFunctions(i,r,e,t),s=new p(0,0,0,0),a=0;a<=e;++a){var l=n[i-e+a],c=o[a],h=l.w*c;s.x+=l.x*h,s.y+=l.y*h,s.z+=l.z*h,s.w+=l.w*c}return s},calcBasisFunctionDerivatives:function(e,t,n,r,i){for(var o=[],s=0;s<=n;++s)o[s]=0;var a=[];for(s=0;s<=r;++s)a[s]=o.slice(0);var l=[];for(s=0;s<=n;++s)l[s]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),h=o.slice(0),u=1;u<=n;++u){c[u]=t-i[e+1-u],h[u]=i[e+u]-t;for(var d=0,p=0;p<u;++p){var f=h[p+1],m=c[u-p];l[u][p]=f+m;var g=l[p][u-1]/l[u][p];l[p][u]=d+f*g,d=m*g}l[u][u]=d}for(u=0;u<=n;++u)a[0][u]=l[u][n];for(p=0;p<=n;++p){var v=0,y=1,x=[];for(s=0;s<=n;++s)x[s]=o.slice(0);x[0][0]=1;for(var b=1;b<=r;++b){var _=0,w=p-b,M=n-b;p>=b&&(x[y][0]=x[v][0]/l[M+1][w],_=x[y][0]*l[w][M]);var S=p-1<=M?b-1:n-p;for(u=w>=-1?1:-w;u<=S;++u)x[y][u]=(x[v][u]-x[v][u-1])/l[M+1][w+u],_+=x[y][u]*l[w+u][M];p<=M&&(x[y][b]=-x[v][b-1]/l[M+1][p],_+=x[y][b]*l[p][M]),a[b][p]=_;u=v;v=y,y=u}}for(p=n,b=1;b<=r;++b){for(u=0;u<=n;++u)a[b][u]*=p;p*=n-b}return a},calcBSplineDerivatives:function(e,t,n,r,i){for(var o=i<e?i:e,s=[],a=this.findSpan(e,r,t),l=this.calcBasisFunctionDerivatives(a,r,e,o,t),c=[],h=0;h<n.length;++h){var u=(f=n[h].clone()).w;f.x*=u,f.y*=u,f.z*=u,c[h]=f}for(var d=0;d<=o;++d){for(var f=c[a-e].clone().multiplyScalar(l[d][0]),m=1;m<=e;++m)f.add(c[a-e+m].clone().multiplyScalar(l[d][m]));s[d]=f}for(d=o+1;d<=i+1;++d)s[d]=new p(0,0,0);return s},calcKoverI:function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;var i=1;for(r=2;r<=t;++r)i*=r;for(r=2;r<=e-t;++r)i*=r;return n/i},calcRationalCurveDerivatives:function(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var o=e[i];n[i]=new v(o.x,o.y,o.z),r[i]=o.w}for(var s=[],a=0;a<t;++a){var l=n[a].clone();for(i=1;i<=a;++i)l.sub(s[a-i].clone().multiplyScalar(this.calcKoverI(a,i)*r[i]));s[a]=l.divideScalar(r[0])}return s},calcNURBSDerivatives:function(e,t,n,r,i){var o=this.calcBSplineDerivatives(e,t,n,r,i);return this.calcRationalCurveDerivatives(o)},calcSurfacePoint:function(e,t,n,r,i,o,s,a){for(var l=this.findSpan(e,o,n),c=this.findSpan(t,s,r),h=this.calcBasisFunctions(l,o,e,n),u=this.calcBasisFunctions(c,s,t,r),d=[],f=0;f<=t;++f){d[f]=new p(0,0,0,0);for(var m=0;m<=e;++m){var g=i[l-e+m][c-t+f].clone(),v=g.w;g.x*=v,g.y*=v,g.z*=v,d[f].add(g.multiplyScalar(h[m]))}}var y=new p(0,0,0,0);for(f=0;f<=t;++f)y.add(d[f].multiplyScalar(u[f]));y.divideScalar(y.w),a.set(y.x,y.y,y.z)}},Cf=function(e,t,n,r,i){_a.call(this),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||this.knots.length-1;for(var o=0;o<n.length;++o){var s=n[o];this.controlPoints[o]=new p(s.x,s.y,s.z,s.w)}};(Cf.prototype=Object.create(_a.prototype)).constructor=Cf,Cf.prototype.getPoint=function(e,t){var n=t||new v,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Lf.calcBSplinePoint(this.degree,this.knots,this.controlPoints,r);return 1!=i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)},Cf.prototype.getTangent=function(e,t){var n=t||new v,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Lf.calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n};var Rf=function(){var e,t,n;function r(e){da.call(this,e)}function i(e,t){this.textureLoader=e,this.manager=t}function s(){}function l(){}function c(){}function h(){}function d(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function f(){}function m(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function y(e){return e/46186158e3}r.prototype=Object.assign(Object.create(da.prototype),{constructor:r,load:function(e,t,n,r){var i=this,o=""===i.path?ol.extractUrlBase(e):i.path,s=new fa(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,(function(n){try{t(i.parse(n,o))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(t,n){if(s="Kaydara FBX Binary \0",(o=t).byteLength>=s.length&&s===A(o,0,s.length))e=(new h).parse(t);else{var r=A(t);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var i=0;i<t.length;++i){if(r(1)===t[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(m(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+m(r));e=(new c).parse(r)}var o,s;return new i(new ba(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),this.manager).parse(e)}}),i.prototype={constructor:i,parse:function(){t=this.parseConnections();var e=this.parseImages(),r=this.parseTextures(e),i=this.parseMaterials(r),o=this.parseDeformers(),a=(new s).parse(o);return this.parseScene(o,a,i),n},parseConnections:function(){var t=new Map;"Connections"in e&&e.Connections.connections.forEach((function(e){var n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var o={ID:r,relationship:i};t.get(n).parents.push(o),t.has(r)||t.set(r,{parents:[],children:[]});var s={ID:n,relationship:i};t.get(r).children.push(s)}));return t},parseImages:function(){var t={},n={};if("Video"in e.Objects){var r=e.Objects.Video;for(var i in r){var o=r[i];if(t[c=parseInt(i)]=o.RelativeFilename||o.Filename,"Content"in o){var s=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,a="string"==typeof o.Content&&""!==o.Content;if(s||a){var l=this.parseImage(r[i]);n[o.RelativeFilename||o.Filename]=l}}}}for(var c in t){var h=t[c];void 0!==n[h]?t[c]=n[h]:t[c]=t[c].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var o=new Uint8Array(n);return window.URL.createObjectURL(new Blob([o],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var r=e.Objects.Texture;for(var i in r){var o=this.parseTexture(r[i],t);n.set(parseInt(i),o)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,i=e.WrapModeV,o=void 0!==r?r.value:0,s=void 0!==i?i.value:0;if(n.wrapS=0===o?1e3:1001,n.wrapT=0===s?1e3:1001,"Scaling"in e){var a=e.Scaling.value;n.repeat.x=a[0],n.repeat.y=a[1]}return n},loadTexture:function(e,n){var r,i,o=this.textureLoader.path,s=t.get(e.id).children;void 0!==s&&s.length>0&&void 0!==n[s[0].ID]&&(0!==(r=n[s[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var a=e.FileName.slice(-3).toLowerCase();if("tga"===a){var l=this.manager.getHandler(".tga");null===l?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new u):i=l.load(r)}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new u):i=this.textureLoader.load(r);return this.textureLoader.setPath(o),i},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var r=e.Objects.Material;for(var i in r){var o=this.parseMaterial(r[i],t);null!==o&&n.set(parseInt(i),o)}}return n},parseMaterial:function(e,n){var r=e.id,i=e.attrName,o=e.ShadingModel;if("object"==typeof o&&(o=o.value),!t.has(r))return null;var s,a=this.parseParameters(e,n,r);switch(o.toLowerCase()){case"phong":s=new Gs;break;case"lambert":s=new Vs;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new Gs}return s.setValues(a),s.name=i,s},parseParameters:function(e,n,r){var i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new Ue).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new Ue).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new Ue).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new Ue).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new Ue).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new Ue).fromArray(e.SpecularColor.value));var o=this;return t.get(r).children.forEach((function(e){var t=e.relationship;switch(t){case"Bump":i.bumpMap=o.getTexture(n,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=o.getTexture(n,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=o.getTexture(n,e.ID),i.map.encoding=3001;break;case"DisplacementColor":i.displacementMap=o.getTexture(n,e.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(n,e.ID),i.emissiveMap.encoding=3001;break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=o.getTexture(n,e.ID);break;case"ReflectionColor":i.envMap=o.getTexture(n,e.ID),i.envMap.mapping=303,i.envMap.encoding=3001;break;case"SpecularColor":i.specularMap=o.getTexture(n,e.ID),i.specularMap.encoding=3001;break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=o.getTexture(n,e.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}})),i},getTexture:function(n,r){return"LayeredTexture"in e.Objects&&r in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=t.get(r).children[0].ID),n.get(r)},parseDeformers:function(){var n={},r={};if("Deformer"in e.Objects){var i=e.Objects.Deformer;for(var o in i){var s=i[o],a=t.get(parseInt(o));if("Skin"===s.attrType){var l=this.parseSkeleton(a,i);l.ID=o,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=a.parents[0].ID,n[o]=l}else if("BlendShape"===s.attrType){var c={id:o};c.rawTargets=this.parseMorphTargets(a,i),c.id=o,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),r[o]=c}}}return{skeletons:n,morphTargets:r}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var i={ID:e.ID,indices:[],weights:[],transformLink:(new W).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,n){for(var r=[],i=0;i<e.children.length;i++){var o=e.children[i],s=n[o.ID],a={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;a.geoID=t.get(parseInt(o.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(a)}return r},parseScene:function(r,i,o){n=new Jr;var s=this.parseModels(r.skeletons,i,o),a=e.Objects.Model,c=this;s.forEach((function(e){var r=a[e.ID];c.setLookAtProperties(e,r),t.get(e.ID).parents.forEach((function(t){var n=s.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&n.add(e)})),this.bindSkeleton(r.skeletons,i,s),this.createAmbientLight(),this.setupMorphMaterials(),n.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrixWorld=e.parent.matrix);var t=M(e.userData.transformData);e.applyMatrix4(t)}}));var h=(new l).parse();1===n.children.length&&n.children[0].isGroup&&(n.children[0].animations=h,n=n.children[0]),n.animations=h},parseModels:function(n,r,i){var o=new Map,s=e.Objects.Model;for(var a in s){var l=parseInt(a),c=s[a],h=t.get(l),u=this.buildSkeleton(h,n,l,c.attrName);if(!u){switch(c.attrType){case"Camera":u=this.createCamera(h);break;case"Light":u=this.createLight(h);break;case"Mesh":u=this.createMesh(h,r,i);break;case"NurbsCurve":u=this.createCurve(h,r);break;case"LimbNode":case"Root":u=new Oi;break;case"Null":default:u=new Jr}u.name=c.attrName?Yl.sanitizeNodeName(c.attrName):"",u.ID=l}this.getTransformData(u,c),o.set(l,u)}return o},buildSkeleton:function(e,t,n,r){var i=null;return e.parents.forEach((function(e){for(var o in t){var s=t[o];s.rawBones.forEach((function(t,o){if(t.ID===e.ID){var a=i;(i=new Oi).matrixWorld.copy(t.transformLink),i.name=r?Yl.sanitizeNodeName(r):"",i.ID=n,s.bones[o]=i,null!==a&&i.add(a)}}))}})),i},createCamera:function(t){var n,r;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(r=n)})),void 0===r)n=new ge;else{var i=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(i=1);var o=1;void 0!==r.NearPlane&&(o=r.NearPlane.value/1e3);var s=1e3;void 0!==r.FarPlane&&(s=r.FarPlane.value/1e3);var a=window.innerWidth,l=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(a=r.AspectWidth.value,l=r.AspectHeight.value);var c=a/l,h=45;void 0!==r.FieldOfView&&(h=r.FieldOfView.value);var u=r.FocalLength?r.FocalLength.value:null;switch(i){case 0:n=new zt(h,c,o,s),null!==u&&n.setFocalLength(u);break;case 1:n=new Ja(-a/2,a/2,l/2,-l/2,o,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),n=new ge}}return n},createLight:function(t){var n,r;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(r=n)})),void 0===r)n=new ge;else{var i;i=void 0===r.LightType?0:r.LightType.value;var s=16777215;void 0!==r.Color&&(s=(new Ue).fromArray(r.Color.value));var a=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0);var l=0;void 0!==r.FarAttenuationEnd&&(l=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(i){case 0:n=new Za(s,a,l,1);break;case 1:n=new $a(s,a);break;case 2:var c=Math.PI/3;void 0!==r.InnerAngle&&(c=o.degToRad(r.InnerAngle.value));var h=0;void 0!==r.OuterAngle&&(h=o.degToRad(r.OuterAngle.value),h=Math.max(h,1)),n=new qa(s,a,l,c,h,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),n=new Za(s,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(n.castShadow=!0)}return n},createMesh:function(e,t,n){var r,i=null,o=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new Gs({color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(s.forEach((function(e){e.skinning=!0})),(r=new Fi(i,o)).normalizeSkinWeights()):r=new Rt(i,o),r},createCurve:function(e,t){return new Qi(e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),new ji({color:3342591,linewidth:1}))},getTransformData:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?S(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n},setLookAtProperties:function(r,i){"LookAtProperty"in i&&t.get(r.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var i=e.Objects.Model[t.ID];if("Lcl_Translation"in i){var o=i.Lcl_Translation.value;void 0!==r.target?(r.target.position.fromArray(o),n.add(r.target)):r.lookAt((new v).fromArray(o))}}}))},bindSkeleton:function(e,n,r){var i=this.parsePoseNodes();for(var o in e){var s=e[o];t.get(parseInt(s.ID)).parents.forEach((function(e){if(n.has(e.ID)){var o=e.ID;t.get(o).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new Bi(s.bones),i[e.ID])}))}}))}},parsePoseNodes:function(){var t={};if("Pose"in e.Objects){var n=e.Objects.Pose;for(var r in n)if("BindPose"===n[r].attrType){var i=n[r].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new W).fromArray(e.Matrix.a)})):t[i.Node]=(new W).fromArray(i.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,r=t[0],i=t[1],o=t[2];if(0!==r||0!==i||0!==o){var s=new Ue(r,i,o);n.add(new el(s,1))}}},setupMorphMaterials:function(){var e=this;n.traverse((function(t){t.isMesh&&t.geometry.morphAttributes.position&&t.geometry.morphAttributes.position.length&&(Array.isArray(t.material)?t.material.forEach((function(n,r){e.setupMorphMaterial(t,n,r)})):e.setupMorphMaterial(t,t.material))}))},setupMorphMaterial:function(e,t,r){var i=e.uuid,o=t.uuid,s=!1;if(n.traverse((function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach((function(t){t.uuid===o&&e.uuid!==i&&(s=!0)})):e.material.uuid===o&&e.uuid!==i&&(s=!0))})),!0===s){var a=t.clone();a.morphTargets=!0,void 0===r?e.material=a:e.material[r]=a}else t.morphTargets=!0}},s.prototype={constructor:s,parse:function(n){var r=new Map;if("Geometry"in e.Objects){var i=e.Objects.Geometry;for(var o in i){var s=t.get(parseInt(o)),a=this.parseGeometry(s,i[o],n);r.set(parseInt(o),a)}}return r},parseGeometry:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(t,n,r){var i=r.skeletons,o=[],s=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==s.length){var a=t.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);t.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])}));var l=s[0],c={};"RotationOrder"in l&&(c.eulerOrder=S(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);var h=M(c);return this.genGeometry(n,a,o,h)}},genGeometry:function(e,t,n,r){var i=new pt;e.attrName&&(i.name=e.attrName);var o=this.parseGeoNode(e,t),s=this.genBuffers(o),l=new et(s.vertex,3);if(l.applyMatrix4(r),i.setAttribute("position",l),s.colors.length>0&&i.setAttribute("color",new et(s.colors,3)),t&&(i.setAttribute("skinIndex",new Ze(s.weightsIndices,4)),i.setAttribute("skinWeight",new et(s.vertexWeights,4)),i.FBX_Deformer=t),s.normal.length>0){var c=(new a).getNormalMatrix(r),h=new et(s.normal,3);h.applyNormalMatrix(c),i.setAttribute("normal",h)}if(s.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),i.setAttribute(n,new et(s.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){var u=s.materialIndex[0],d=0;if(s.materialIndex.forEach((function(e,t){e!==u&&(i.addGroup(d,t-d,u),u=e,d=t)})),i.groups.length>0){var p=i.groups[i.groups.length-1],f=p.start+p.count;f!==s.materialIndex.length&&i.addGroup(f,s.materialIndex.length-f,u)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i},parseGeoNode:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,o=[],s=[],a=[],l=[],c=[],h=[],u=this;return e.vertexIndices.forEach((function(d,p){var f=!1;d<0&&(d^=-1,f=!0);var m=[],g=[];if(o.push(3*d,3*d+1,3*d+2),e.color){var v=b(p,n,d,e.color);a.push(v[0],v[1],v[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){g.push(e.weight),m.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var y=[0,0,0,0],x=[0,0,0,0];g.forEach((function(e,t){var n=e,r=m[t];x.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var o=y[t];y[t]=r,r=o}}))})),m=y,g=x}for(;g.length<4;)g.push(0),m.push(0);for(var _=0;_<4;++_)c.push(g[_]),h.push(m[_])}if(e.normal){v=b(p,n,d,e.normal);s.push(v[0],v[1],v[2])}if(e.material&&"AllSame"!==e.material.mappingType)var w=b(p,n,d,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var r=b(p,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(r[0]),l[t].push(r[1])})),r++,f&&(u.genFace(t,e,o,w,s,a,l,c,h,r),n++,r=0,o=[],s=[],a=[],l=[],c=[],h=[])})),t},genFace:function(e,t,n,r,i,o,s,a,l,c){for(var h=2;h<c;h++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(h-1)]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[n[3*h]]),e.vertex.push(t.vertexPositions[n[3*h+1]]),e.vertex.push(t.vertexPositions[n[3*h+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(h-1)]),e.vertexWeights.push(a[4*(h-1)+1]),e.vertexWeights.push(a[4*(h-1)+2]),e.vertexWeights.push(a[4*(h-1)+3]),e.vertexWeights.push(a[4*h]),e.vertexWeights.push(a[4*h+1]),e.vertexWeights.push(a[4*h+2]),e.vertexWeights.push(a[4*h+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(h-1)]),e.weightsIndices.push(l[4*(h-1)+1]),e.weightsIndices.push(l[4*(h-1)+2]),e.weightsIndices.push(l[4*(h-1)+3]),e.weightsIndices.push(l[4*h]),e.weightsIndices.push(l[4*h+1]),e.weightsIndices.push(l[4*h+2]),e.weightsIndices.push(l[4*h+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(h-1)]),e.colors.push(o[3*(h-1)+1]),e.colors.push(o[3*(h-1)+2]),e.colors.push(o[3*h]),e.colors.push(o[3*h+1]),e.colors.push(o[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(h-1)]),e.normal.push(i[3*(h-1)+1]),e.normal.push(i[3*(h-1)+2]),e.normal.push(i[3*h]),e.normal.push(i[3*h+1]),e.normal.push(i[3*h+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(s[n][0]),e.uvs[n].push(s[n][1]),e.uvs[n].push(s[n][2*(h-1)]),e.uvs[n].push(s[n][2*(h-1)+1]),e.uvs[n].push(s[n][2*h]),e.uvs[n].push(s[n][2*h+1])}))},addMorphTargets:function(t,n,r,i){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var o=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var s=e.Objects.Geometry[r.geoID];void 0!==s&&o.genMorphGeometry(t,n,s,i,r.name)}))}))}},genMorphGeometry:function(e,t,n,r,i){for(var o=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],s=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),h=0;h<a.length;h++){var u=3*a[h];c[u]=s[3*h],c[u+1]=s[3*h+1],c[u+2]=s[3*h+2]}var d={vertexIndices:o,vertexPositions:c},p=new et(this.genBuffers(d).vertex,3);p.name=i||n.attrName,p.applyMatrix4(r),e.morphAttributes.position.push(p)},parseNormals:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}},parseUVs:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return"IndexToDirect"===n&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}},parseVertexColors:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];return"IndexToDirect"===n&&(i=e.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}},parseMaterialIndices:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],o=0;o<r.length;++o)i.push(o);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}},parseNurbsGeometry:function(e){if(void 0===Cf)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new pt;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new pt;for(var n,r,i=t-1,o=e.KnotVector.a,s=[],a=e.Points.a,l=0,c=a.length;l<c;l+=4)s.push((new p).fromArray(a,l));if("Closed"===e.Form)s.push(s[0]);else if("Periodic"===e.Form){n=i,r=o.length-1-n;for(l=0;l<i;++l)s.push(s[l])}var h=new Cf(i,o,s,n,r).getPoints(7*s.length),u=new Float32Array(3*h.length);h.forEach((function(e,t){e.toArray(u,3*t)}));var d=new pt;return d.setAttribute("position",new We(u,3)),d}},l.prototype={constructor:l,parse:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var r=t[n],i=this.addClip(r);e.push(i)}return e},parseClips:function(){if(void 0!==e.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var n=this.parseAnimationLayers(t);return this.parseAnimStacks(n)}},parseAnimationCurveNodes:function(){var t=e.Objects.AnimationCurveNode,n=new Map;for(var r in t){var i=t[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){var o={id:i.id,attr:i.attrName,curves:{}};n.set(o.id,o)}}return n},parseAnimationCurves:function(n){var r=e.Objects.AnimationCurve;for(var i in r){var o={id:r[i].id,times:r[i].KeyTime.a.map(y),values:r[i].KeyValueFloat.a},s=t.get(o.id);if(void 0!==s){var a=s.parents[0].ID,l=s.parents[0].relationship;l.match(/X/)?n.get(a).curves.x=o:l.match(/Y/)?n.get(a).curves.y=o:l.match(/Z/)?n.get(a).curves.z=o:l.match(/d|DeformPercent/)&&n.has(a)&&(n.get(a).curves.morph=o)}}},parseAnimationLayers:function(r){var i=e.Objects.AnimationLayer,o=new Map;for(var s in i){var a=[],l=t.get(parseInt(s));if(void 0!==l)l.children.forEach((function(i,o){if(r.has(i.ID)){var s=r.get(i.ID);if(void 0!==s.curves.x||void 0!==s.curves.y||void 0!==s.curves.z){if(void 0===a[o])if(void 0!==(p=t.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID)){if(void 0===(c=e.Objects.Model[p.toString()]))return void console.warn("THREE.FBXLoader: Encountered a unused curve.",i);var l={modelName:c.attrName?Yl.sanitizeNodeName(c.attrName):"",ID:c.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};n.traverse((function(e){e.ID===c.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new W),"PreRotation"in c&&(l.preRotation=c.PreRotation.value),"PostRotation"in c&&(l.postRotation=c.PostRotation.value),a[o]=l}a[o]&&(a[o][s.attr]=s)}else if(void 0!==s.curves.morph){if(void 0===a[o]){var c,h=t.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,u=t.get(h).parents[0].ID,d=t.get(u).parents[0].ID,p=t.get(d).parents[0].ID;l={modelName:(c=e.Objects.Model[p]).attrName?Yl.sanitizeNodeName(c.attrName):"",morphName:e.Objects.Deformer[h].attrName};a[o]=l}a[o][s.attr]=s}}})),o.set(parseInt(s),a)}return o},parseAnimStacks:function(n){var r=e.Objects.AnimationStack,i={};for(var o in r){var s=t.get(parseInt(o)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var a=n.get(s[0].ID);i[o]={name:r[o].attrName,layer:a}}return i},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new aa(e.name,-1,t)},generateTracks:function(e){var t=[],n=new v,r=new g,i=new v;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new $).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var o=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==o&&t.push(o)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var s=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==s&&t.push(s)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==a&&t.push(a)}if(void 0!==e.DeformPercent){var l=this.generateMorphTrack(e);void 0!==l&&t.push(l)}return t},generateVectorTrack:function(e,t,n,r){var i=this.getTimesForAllAxes(t);return new sa(e+"."+r,i,this.getKeyframeTrackValues(i,t,n))},generateRotationTrack:function(e,t,n,r,i,s){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(o.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(o.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(o.degToRad));var a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,n);void 0!==r&&((r=r.map(o.degToRad)).push(s),r=(new $).fromArray(r),r=(new g).setFromEuler(r)),void 0!==i&&((i=i.map(o.degToRad)).push(s),i=(new $).fromArray(i),i=(new g).setFromEuler(i).invert());for(var c=new g,h=new $,u=[],d=0;d<l.length;d+=3)h.set(l[d],l[d+1],l[d+2],s),c.setFromEuler(h),void 0!==r&&c.premultiply(r),void 0!==i&&c.multiply(i),c.toArray(u,d/3*4);return new ia(e+".quaternion",a,u)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),i=n.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new na(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)},getTimesForAllAxes:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),(t=t.sort((function(e,t){return e-t}))).length>1){for(var n=1,r=t[0],i=1;i<t.length;i++){var o=t[i];o!==r&&(t[n]=o,r=o,n++)}t=t.slice(0,n)}return t},getKeyframeTrackValues:function(e,t,n){var r=n,i=[],o=-1,s=-1,a=-1;return e.forEach((function(e){if(t.x&&(o=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==o){var n=t.x.values[o];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==s){var l=t.y.values[s];i.push(l),r[1]=l}else i.push(r[1]);if(-1!==a){var c=t.z.values[a];i.push(c),r[2]=c}else i.push(r[2])})),i},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n,i=Math.abs(r);if(i>=180){for(var o=i/180,s=r/o,a=n+s,l=e.times[t-1],c=(e.times[t]-l)/o,h=l+c,u=[],d=[];h<e.times[t];)u.push(h),h+=c,d.push(a),a+=s;e.times=E(e.times,t,u),e.values=E(e.values,t,d)}}}},c.prototype={constructor:c,getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new f,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i=e.match(/^[\s\t]*;/),o=e.match(/^[\s\t]*$/);if(!i&&!o){var s=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");s?t.parseNodeBegin(e,s):a?t.parseNodeProperty(e,a,n[++r]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes},parseNodeBegin:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},o=this.parseNodeAttr(r),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in s?("PoseNode"===n?s.PoseNode.push(i):void 0!==s[n].id&&(s[n]={},s[n][s[n].id]=s[n]),""!==o.id&&(s[n][o.id]=i)):"number"==typeof o.id?(s[n]={},s[n][o.id]=i):"Properties70"!==n&&(s[n]="PoseNode"===n?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}},parseNodeProperty:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===r){var s=i.split(",").slice(1),a=parseInt(s[0]),l=parseInt(s[1]),c=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}(i=[a,l],c=c.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===o[r]&&(o[r]=[])}"Node"===r&&(o.id=i),r in o&&Array.isArray(o[r])?o[r].push(i):"a"!==r?o[r]=i:o.a=i,this.setCurrentProp(o,r),"a"===r&&","!==i.slice(-1)&&(o.a=T(i))}else this.parseNodeSpecialProperty(e,r,i)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=T(t.a))},parseNodeSpecialProperty:function(e,t,n){var r=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],o=r[1],s=r[2],a=r[3],l=r[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=T(l)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:l},this.setCurrentProp(this.getPrevNode(),i)}},h.prototype={constructor:h,parse:function(e){var t=new d(e);t.skip(23);var n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new f;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var o=e.getUint8(),s=e.getString(o);if(0===r)return null;for(var a=[],l=0;l<i;l++)a.push(this.parseProperty(e));var c=a.length>0?a[0]:"",h=a.length>1?a[1]:"",u=a.length>2?a[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(s,n,d)}return n.propertyList=a,"number"==typeof c&&(n.id=c),""!==h&&(n.attrName=h),""!==u&&(n.attrType=u),""!==s&&(n.name=s),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var o,s=n.propertyList[0],a=n.propertyList[1],l=n.propertyList[2],c=n.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[s]={type:a,type2:l,flag:c,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var n=e.getUint32();return e.getArrayBuffer(n);case"S":n=e.getUint32();return e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===Pf&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var s=new d(new Pf(new Uint8Array(e.getArrayBuffer(o))).decompress().buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},d.prototype={constructor:d,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e},getInt64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var r=t.indexOf(0);return r>=0&&(t=t.slice(0,r)),ol.decodeText(new Uint8Array(t))}},f.prototype={constructor:f,add:function(e,t){this[e]=t}};var x=[];function b(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var o=i*r.dataSize,s=o+r.dataSize;return function(e,t,n,r){for(var i=n,o=0;i<r;i++,o++)e[o]=t[i];return e}(x,r.buffer,o,s)}var _=new $,w=new v;function M(e){var t,n=new W,r=new W,i=new W,s=new W,a=new W,l=new W,c=new W,h=new W,u=new W,d=new W,p=new W,f=e.inheritType?e.inheritType:0;(e.translation&&n.setPosition(w.fromArray(e.translation)),e.preRotation)&&((t=e.preRotation.map(o.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(_.fromArray(t)));e.rotation&&((t=e.rotation.map(o.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(_.fromArray(t)));e.postRotation&&((t=e.postRotation.map(o.degToRad)).push(e.eulerOrder),s.makeRotationFromEuler(_.fromArray(t)));e.scale&&a.scale(w.fromArray(e.scale)),e.scalingOffset&&c.setPosition(w.fromArray(e.scalingOffset)),e.scalingPivot&&l.setPosition(w.fromArray(e.scalingPivot)),e.rotationOffset&&h.setPosition(w.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(w.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d=e.parentMatrixWorld);var m=r.multiply(i).multiply(s),g=new W;d.extractRotation(g),(new W).copyPosition(d);var v=new W;v.copy(g).invert().multiply(d);var y=new W;if(0===f)y.copy(g).multiply(m).multiply(v).multiply(a);else if(1===f)y.copy(g).multiply(v).multiply(m).multiply(a);else{var x=new W;x.copy(a).invert();var b=(new W).multiply(v).multiply(x);y.copy(g).multiply(m).multiply(b).multiply(a)}var M=new W;M.copy(u).invert();var S=new W;S.copy(l).invert();var T=new W;T.copy(n).multiply(h).multiply(u).multiply(r).multiply(i).multiply(s).multiply(M).multiply(c).multiply(l).multiply(a).multiply(S);var A=(new W).copyPosition(T),E=(new W).copy(d).multiply(A);return p.copyPosition(E),T=(new W).multiply(p).multiply(y)}function S(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function T(e){return e.split(",").map((function(e){return parseFloat(e)}))}function A(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),ol.decodeText(new Uint8Array(e,t,n))}function E(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}return r}(),If=function(){function e(e){da.call(this,e),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new l(e)})),this.register((function(e){return new h(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new i(e)})),this.register((function(e){return new d(e)}))}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(da.prototype),{constructor:e,load:function(e,t,n,r){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:ol.extractUrlBase(e),this.manager.itemStart(e);var s=function(t){r?r(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},a=new fa(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{o.parse(n,i,(function(n){t(n),o.manager.itemEnd(e)}),s)}catch(e){s(e)}}),n,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(e,t,i,o){var s,l={},c={};if("string"==typeof e)s=e;else if(ol.decodeText(new Uint8Array(e,0,4))===p){try{l[n.KHR_BINARY_GLTF]=new g(e)}catch(e){return void(o&&o(e))}s=l[n.KHR_BINARY_GLTF].content}else s=ol.decodeText(new Uint8Array(e));var h=JSON.parse(s);if(void 0===h.asset||h.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new Z(h,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var d=0;d<this.pluginCallbacks.length;d++){var f=this.pluginCallbacks[d](u);c[f.name]=f,l[f.name]=!0}if(h.extensionsUsed)for(d=0;d<h.extensionsUsed.length;++d){var m=h.extensionsUsed[d],v=h.extensionsRequired||[];switch(m){case n.KHR_MATERIALS_UNLIT:l[m]=new a;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:l[m]=new w;break;case n.KHR_DRACO_MESH_COMPRESSION:l[m]=new y(h,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:l[m]=new r(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:l[m]=new x;break;case n.KHR_MESH_QUANTIZATION:l[m]=new M;break;default:v.indexOf(m)>=0&&void 0===c[m]&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}u.setExtensions(l),u.setPlugins(c),u.parse(i,o)}}});var n={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 r(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function i(e){this.parser=e,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function a(){this.name=n.KHR_MATERIALS_UNLIT}function l(e){this.parser=e,this.name=n.KHR_MATERIALS_CLEARCOAT}function c(e){this.parser=e,this.name=n.KHR_MATERIALS_TRANSMISSION}function h(e){this.parser=e,this.name=n.KHR_TEXTURE_BASISU}function u(e){this.parser=e,this.name=n.EXT_TEXTURE_WEBP,this.isSupported=null}function d(e){this.name=n.EXT_MESHOPT_COMPRESSION,this.parser=e}i.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}},i.prototype._loadLight=function(e){var t=this.parser,n="light:"+e,r=t.cache.get(n);if(r)return r;var i,o=t.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],a=new Ue(16777215);void 0!==s.color&&a.fromArray(s.color);var l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new $a(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new Za(a)).distance=l;break;case"spot":(i=new qa(a)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,void 0!==s.intensity&&(i.intensity=s.intensity),i.name=t.createUniqueName(s.name||"light_"+e),r=Promise.resolve(i),t.cache.add(n,r),r},i.prototype.createNodeAttachment=function(e){var t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(e){return n._getNodeRef(t.cache,i,e)}))},a.prototype.getMaterialType=function(){return He},a.prototype.extendParams=function(e,t,n){var r=[];e.color=new Ue(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture))}return Promise.all(r)},l.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?zs:null},l.prototype.extendMaterialParams=function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new s(a,a)}return Promise.all(i)},c.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?zs:null},c.prototype.extendMaterialParams=function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(t.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)},h.prototype.loadTexture=function(e){var t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],o=n.images[i.source],s=t.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o,s)},u.prototype.loadTexture=function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var o=i.extensions[t],s=r.images[o.source],a=s.uri?n.options.manager.getHandler(s.uri):n.textureLoader;return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,s,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))},u.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},d.prototype.loadBufferView=function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,o.ready]).then((function(e){var t=r.byteOffset||0,n=r.byteLength||0,i=r.count,s=r.byteStride,a=new ArrayBuffer(i*s),l=new Uint8Array(e[0],t,n);return o.decodeGltfBuffer(new Uint8Array(a),i,s,l,r.mode,r.filter),a}))}return null};var p="glTF",f=1313821514,m=5130562;function g(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:ol.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==p)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 r=new DataView(e,12),i=0;i<r.byteLength;){var o=r.getUint32(i,!0);i+=4;var s=r.getUint32(i,!0);if(i+=4,s===f){var a=new Uint8Array(e,12+i,o);this.content=ol.decodeText(a)}else if(s===m){var l=12+i;this.body=e.slice(l,l+o)}i+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function y(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function x(){this.name=n.KHR_TEXTURE_TRANSFORM}function _(e){ks.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),i=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),s={specular:{value:(new Ue).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var a in s)e.uniforms[a]=s[a];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",i).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){s.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(e)}function w(){return{name:n.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 _},extendParams:function(e,t,n){var r=t.extensions[this.name];e.color=new Ue(1,1,1),e.opacity=1;var i=[];if(Array.isArray(r.diffuseFactor)){var o=r.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==r.diffuseTexture&&i.push(n.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new Ue(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new Ue(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;i.push(n.assignTexture(e,"glossinessMap",s)),i.push(n.assignTexture(e,"specularMap",s))}return Promise.all(i)},createMaterial:function(e){var t=new _(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function M(){this.name=n.KHR_MESH_QUANTIZATION}function S(e,t,n,r){Qs.call(this,e,t,n,r)}y.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},a={},l={};for(var c in o){var h=B[c]||c.toLowerCase();s[h]=o[c]}for(c in e.attributes){h=B[c]||c.toLowerCase();if(void 0!==o[c]){var u=n.accessors[e.attributes[c]],d=I[u.componentType];l[h]=d,a[h]=!0===u.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=a[n];void 0!==i&&(r.normalized=i)}t(e)}),s,l)}))}))},x.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},_.prototype=Object.create(ks.prototype),_.prototype.constructor=_,_.prototype.copy=function(e){return ks.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},S.prototype=Object.create(Qs.prototype),S.prototype.constructor=S,S.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,o=0;o!==r;o++)t[o]=n[i+o];return t},S.prototype.beforeStart_=S.prototype.copySampleValue_,S.prototype.afterEnd_=S.prototype.copySampleValue_,S.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,c=r-t,h=(n-t)/c,u=h*h,d=u*h,p=e*l,f=p-l,m=-2*d+3*u,g=d-u,v=1-m,y=g-u+h,x=0;x!==s;x++){var b=o[f+x+s],_=o[f+x+a]*c,w=o[p+x+s],M=o[p+x]*c;i[x]=v*b+y*_+m*w+g*M}return i};var T=0,A=1,E=2,P=3,L=4,C=5,R=6,I={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},F={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},O={33071:1001,33648:1002,10497:1e3},N={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},B={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},U={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},k={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300},z="OPAQUE",G="MASK",H="BLEND";function j(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function V(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new ks({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function X(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Y(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 q(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)e.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Q(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Z(e,n){this.json=e||{},this.extensions={},this.plugins={},this.options=n||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new dl(this.options.manager):this.textureLoader=new ba(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new fa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function J(e,t,n){var r=t.attributes,i=[];function o(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var s in r){var a=B[s]||s.toLowerCase();a in e.attributes||i.push(o(r[s],a))}if(void 0!==t.indices&&!e.index){var l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));i.push(l)}return Y(e,t),function(e,t,n){var r=t.attributes,i=new b;if(void 0!==r.POSITION){var o=(d=n.json.accessors[r.POSITION]).min,s=d.max;if(void 0!==o&&void 0!==s){i.set(new v(o[0],o[1],o[2]),new v(s[0],s[1],s[2]));var a=t.targets;if(void 0!==a){for(var l=new v,c=new v,h=0,u=a.length;h<u;h++){var d,p=a[h];if(void 0!==p.POSITION)o=(d=n.json.accessors[p.POSITION]).min,s=d.max,void 0!==o&&void 0!==s?(c.setX(Math.max(Math.abs(o[0]),Math.abs(s[0]))),c.setY(Math.max(Math.abs(o[1]),Math.abs(s[1]))),c.setZ(Math.max(Math.abs(o[2]),Math.abs(s[2]))),l.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}i.expandByVector(l)}e.boundingBox=i;var f=new D;i.getCenter(f.center),f.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(i).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,o=0,s=t.length;o<s&&(void 0!==(c=t[o]).POSITION&&(r=!0),void 0!==c.NORMAL&&(i=!0),!r||!i);o++);if(!r&&!i)return Promise.resolve(e);var a=[],l=[];for(o=0,s=t.length;o<s;o++){var c=t[o];if(r){var h=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;a.push(h)}i&&(h=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal,l.push(h))}return Promise.all([Promise.all(a),Promise.all(l)]).then((function(t){var n=t[0],o=t[1];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function K(e,t){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<i.count;o++)r.push(o);e.setIndex(r),n=e.getIndex()}var s=n.count-2,a=[];if(2===t)for(o=1;o<=s;o++)a.push(n.getX(0)),a.push(n.getX(o)),a.push(n.getX(o+1));else for(o=0;o<s;o++)o%2==0?(a.push(n.getX(o)),a.push(n.getX(o+1)),a.push(n.getX(o+2))):(a.push(n.getX(o+2)),a.push(n.getX(o+1)),a.push(n.getX(o)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(a),l}return Z.prototype.setExtensions=function(e){this.extensions=e},Z.prototype.setPlugins=function(e){this.plugins=e},Z.prototype.parse=function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};X(i,o,r),Y(o,r),e(o)})).catch(t)},Z.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var o=t[r].joints,s=0,a=o.length;s<a;s++)e[o[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var h=e[l];void 0!==h.mesh&&(this._addNodeRef(this.meshCache,h.mesh),void 0!==h.skin&&(n[h.mesh].isSkinnedMesh=!0)),void 0!==h.camera&&this._addNodeRef(this.cameraCache,h.camera)}},Z.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},Z.prototype._getNodeRef=function(e,t,n){if(e.refs[t]<=1)return n;var r=n.clone();return r.name+="_instance_"+e.uses[t]++,r},Z.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}},Z.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n},Z.prototype.getDependency=function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r},Z.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return n.getDependency(e,r)}))),this.cache.add(e,t)}return t},Z.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(j(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},Z.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))},Z.prototype.loadAccessor=function(e){var t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then((function(e){var i,o=e[0],s=N[r.type],a=I[r.componentType],l=a.BYTES_PER_ELEMENT,c=l*s,h=r.byteOffset||0,u=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,d=!0===r.normalized;if(u&&u!==c){var p=Math.floor(h/u),f="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+p+":"+r.count,m=t.cache.get(f);m||(m=new si(new a(o,p*u,r.count*u/l),u/l),t.cache.add(f,m)),i=new li(m,s,h%u/l,d)}else i=new We(null===o?new a(r.count*s):new a(o,h,r.count*s),s,d);if(void 0!==r.sparse){var g=N.SCALAR,v=I[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,b=new v(e[1],y,r.sparse.count*g),_=new a(e[2],x,r.sparse.count*s);null!==o&&(i=new We(i.array.slice(),i.itemSize,i.normalized));for(var w=0,M=b.length;w<M;w++){var S=b[w];if(i.setX(S,_[w*s]),s>=2&&i.setY(S,_[w*s+1]),s>=3&&i.setZ(S,_[w*s+2]),s>=4&&i.setW(S,_[w*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i}))},Z.prototype.loadTexture=function(e){var t,r,i=this.json,o=this.options,s=i.textures[e],a=s.extensions||{};return(t=a[n.MSFT_TEXTURE_DDS]?i.images[a[n.MSFT_TEXTURE_DDS].source]:i.images[s.source]).uri&&(r=o.manager.getHandler(t.uri)),r||(r=a[n.MSFT_TEXTURE_DDS]?this.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,r)},Z.prototype.loadTextureImage=function(e,t,n){var r=this,i=this.json,o=this.options,s=i.textures[e],a=self.URL||self.webkitURL,l=t.uri,c=!1,h=!0;return"image/jpeg"===t.mimeType&&(h=!1),void 0!==t.bufferView&&(l=r.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var n=new DataView(e,25,1).getUint8(0,!1);h=6===n||4===n||3===n}c=!0;var r=new Blob([e],{type:t.mimeType});return l=a.createObjectURL(r)}))),Promise.resolve(l).then((function(e){return new Promise((function(t,r){var i=t;!0===n.isImageBitmapLoader&&(i=function(e){t(new co(e))}),n.load(j(e,o.path),i,void 0,r)}))})).then((function(t){!0===c&&a.revokeObjectURL(l),t.flipY=!1,s.name&&(t.name=s.name),h||(t.format=1022);var n=(i.samplers||{})[s.sampler]||{};return t.magFilter=F[n.magFilter]||1006,t.minFilter=F[n.minFilter]||1008,t.wrapS=O[n.wrapS]||1e3,t.wrapT=O[n.wrapT]||1e3,r.associations.set(t,{type:"textures",index:e}),t}))},Z.prototype.assignTexture=function(e,t,r){var i=this;return this.getDependency("texture",r.index).then((function(o){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."),i.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}e[t]=o}))},Z.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,r=void 0!==t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal,s=!0===e.isSkinnedMesh,a=Object.keys(t.morphAttributes).length>0,l=a&&void 0!==t.morphAttributes.normal;if(e.isPoints){var c="PointsMaterial:"+n.uuid,h=this.cache.get(c);h||(h=new eo,Ge.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(c,h)),n=h}else if(e.isLine){c="LineBasicMaterial:"+n.uuid;var u=this.cache.get(c);u||(u=new ji,Ge.prototype.copy.call(u,n),u.color.copy(n.color),this.cache.add(c,u)),n=u}if(r||i||o||s||a){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),r&&(c+="vertex-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:"),a&&(c+="morph-targets:"),l&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=n.clone(),s&&(d.skinning=!0),r&&(d.vertexTangents=!0),i&&(d.vertexColors=!0),o&&(d.flatShading=!0),a&&(d.morphTargets=!0),l&&(d.morphNormals=!0),this.cache.add(c,d),this.associations.set(d,this.associations.get(n))),n=d}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),n.normalScale&&!r&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!r&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},Z.prototype.getMaterialType=function(){return ks},Z.prototype.loadMaterial=function(e){var t,r=this,i=this.json,o=this.extensions,a=i.materials[e],l={},c=a.extensions||{},h=[];if(c[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),h.push(u.extendParams(l,a,r))}else if(c[n.KHR_MATERIALS_UNLIT]){var d=o[n.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),h.push(d.extendParams(l,a,r))}else{var p=a.pbrMetallicRoughness||{};if(l.color=new Ue(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;l.color.fromArray(f),l.opacity=f[3]}void 0!==p.baseColorTexture&&h.push(r.assignTexture(l,"map",p.baseColorTexture)),l.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,l.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(h.push(r.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),h.push(r.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))}!0===a.doubleSided&&(l.side=2);var m=a.alphaMode||z;return m===H?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===G&&(l.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==He&&(h.push(r.assignTexture(l,"normalMap",a.normalTexture)),l.normalScale=new s(1,1),void 0!==a.normalTexture.scale&&l.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==He&&(h.push(r.assignTexture(l,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(l.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==He&&(l.emissive=(new Ue).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==He&&h.push(r.assignTexture(l,"emissiveMap",a.emissiveTexture)),Promise.all(h).then((function(){var i;return i=t===_?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new t(l),a.name&&(i.name=a.name),i.map&&(i.map.encoding=3001),i.emissiveMap&&(i.emissiveMap.encoding=3001),Y(i,a),r.associations.set(i,{type:"materials",index:e}),a.extensions&&X(o,i,a),i}))},Z.prototype.createUniqueName=function(e){for(var t=Yl.sanitizeNodeName(e||""),n=t,r=1;this.nodeNamesUsed[n];++r)n=t+"_"+r;return this.nodeNamesUsed[n]=!0,n},Z.prototype.loadGeometries=function(e){var t=this,r=this.extensions,i=this.primitiveCache;function o(e){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return J(n,e,t)}))}for(var s,a,l=[],c=0,h=e.length;c<h;c++){var u,d=e[c],p=(a=void 0,(a=(s=d).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+a.bufferView+":"+a.indices+":"+Q(a.attributes):s.indices+":"+Q(s.attributes)+":"+s.mode),f=i[p];if(f)l.push(f.promise);else u=d.extensions&&d.extensions[n.KHR_DRACO_MESH_COMPRESSION]?o(d):J(new pt,d,t),i[p]={primitive:d,promise:u},l.push(u)}return Promise.all(l)},Z.prototype.loadMesh=function(e){for(var t=this,n=this.json,r=this.extensions,i=n.meshes[e],o=i.primitives,s=[],a=0,l=o.length;a<l;a++){var c=void 0===o[a].material?V(this.cache):this.getDependency("material",o[a].material);s.push(c)}return s.push(t.loadGeometries(o)),Promise.all(s).then((function(n){for(var s=n.slice(0,n.length-1),a=n[n.length-1],l=[],c=0,h=a.length;c<h;c++){var u,d=a[c],p=o[c],f=s[c];if(p.mode===L||p.mode===C||p.mode===R||void 0===p.mode)!0!==(u=!0===i.isSkinnedMesh?new Fi(d,f):new Rt(d,f)).isSkinnedMesh||u.geometry.attributes.skinWeight.normalized||u.normalizeSkinWeights(),p.mode===C?u.geometry=K(u.geometry,1):p.mode===R&&(u.geometry=K(u.geometry,2));else if(p.mode===A)u=new Ki(d,f);else if(p.mode===P)u=new Qi(d,f);else if(p.mode===E)u=new $i(d,f);else{if(p.mode!==T)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);u=new oo(d,f)}Object.keys(u.geometry.morphAttributes).length>0&&q(u,i),u.name=t.createUniqueName(i.name||"mesh_"+e),Y(u,i),p.extensions&&X(r,u,p),t.assignFinalMaterial(u),l.push(u)}if(1===l.length)return l[0];var m=new Jr;for(c=0,h=l.length;c<h;c++)m.add(l[c]);return m}))},Z.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new zt(o.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new Ja(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Y(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},Z.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return n.inverseBindMatrices=e,n}))},Z.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],r=[],i=[],o=[],s=[],a=0,l=t.channels.length;a<l;a++){var c=t.channels[a],h=t.samplers[c.sampler],u=c.target,d=void 0!==u.node?u.node:u.id,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),r.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",f)),o.push(h),s.push(u)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(n){for(var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=[],c=0,h=r.length;c<h;c++){var u=r[c],d=i[c],p=o[c],f=s[c],m=a[c];if(void 0!==u){var g;switch(u.updateMatrix(),u.matrixAutoUpdate=!0,U[m.path]){case U.weights:g=na;break;case U.rotation:g=ia;break;case U.position:case U.scale:default:g=sa}var v=u.name?u.name:u.uuid,y=void 0!==f.interpolation?k[f.interpolation]:2301,x=[];U[m.path]===U.weights?u.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(v);var b=p.array;if(p.normalized){var _;if(b.constructor===Int8Array)_=1/127;else if(b.constructor===Uint8Array)_=1/255;else if(b.constructor==Int16Array)_=1/32767;else{if(b.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");_=1/65535}for(var w=new Float32Array(b.length),M=0,T=b.length;M<T;M++)w[M]=b[M]*_;b=w}for(M=0,T=x.length;M<T;M++){var A=new g(x[M]+"."+U[m.path],d.array,b,y);"CUBICSPLINE"===f.interpolation&&(A.createInterpolant=function(e){return new S(this.times,this.values,this.getValueSize()/3,e)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(A)}}}return new aa(t.name?t.name:"animation_"+e,void 0,l)}))},Z.prototype.loadNode=function(e){var t,n=this.json,r=this.extensions,i=this,o=n.nodes[e],s=o.name?i.createUniqueName(o.name):"";return(t=[],void 0!==o.mesh&&t.push(i.getDependency("mesh",o.mesh).then((function(e){var t=i._getNodeRef(i.meshCache,o.mesh,e);return void 0!==o.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=o.weights.length;t<n;t++)e.morphTargetInfluences[t]=o.weights[t]})),t}))),void 0!==o.camera&&t.push(i.getDependency("camera",o.camera).then((function(e){return i._getNodeRef(i.cameraCache,o.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t)).then((function(t){var n;if((n=!0===o.isBone?new Oi:t.length>1?new Jr:1===t.length?t[0]:new ge)!==t[0])for(var a=0,l=t.length;a<l;a++)n.add(t[a]);if(o.name&&(n.userData.name=o.name,n.name=s),Y(n,o),o.extensions&&X(r,n,o),void 0!==o.matrix){var c=new W;c.fromArray(o.matrix),n.applyMatrix4(c)}else void 0!==o.translation&&n.position.fromArray(o.translation),void 0!==o.rotation&&n.quaternion.fromArray(o.rotation),void 0!==o.scale&&n.scale.fromArray(o.scale);return i.associations.set(n,{type:"nodes",index:e}),n}))},Z.prototype.loadScene=function(){function e(t,n,r,i){var o=r.nodes[t];return i.getDependency("node",t).then((function(e){return void 0===o.skin?e:i.getDependency("skin",o.skin).then((function(e){for(var n=[],r=0,o=(t=e).joints.length;r<o;r++)n.push(i.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var r=[],i=[],o=0,s=n.length;o<s;o++){var a=n[o];if(a){r.push(a);var l=new W;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*o),i.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new Bi(r,i),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var s=[];if(o.children)for(var a=o.children,l=0,c=a.length;l<c;l++){var h=a[l];s.push(e(h,t,r,i))}return Promise.all(s)}))}return function(t){var n=this.json,r=this.extensions,i=this.json.scenes[t],o=new Jr;i.name&&(o.name=this.createUniqueName(i.name)),Y(o,i),i.extensions&&X(r,o,i);for(var s=i.nodes||[],a=[],l=0,c=s.length;l<c;l++)a.push(e(s[l],o,n,this));return Promise.all(a).then((function(){return o}))}}(),e}(),Ff=function(e){da.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};Ff.prototype=Object.assign(Object.create(da.prototype),{constructor:Ff,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,n,r){var i=new fa(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(e=>{var n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(r)}),n,r)},decodeDracoFile:function(e,t,n,r){var i={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)},decodeGeometry:function(e,t){for(var n in t.attributeTypes){var r=t.attributeTypes[n];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=r.name)}var i,o=JSON.stringify(t);if(Ff.taskCache.has(e)){var s=Ff.taskCache.get(e);if(s.key===o)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var a=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(a,l).then((n=>(i=n,new Promise(((n,r)=>{i._callbacks[a]={resolve:n,reject:r},i.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{i&&a&&this._releaseTask(i,a)})),Ff.taskCache.set(e,{key:o,promise:c}),c},_createGeometry:function(e){var t=new pt;e.index&&t.setIndex(new We(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n],i=r.name,o=r.array,s=r.itemSize;t.setAttribute(i,new We(o,s))}return t},_loadLibrary:function(e,t){var n=new fa(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{n.load(e,t,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var r=Ff.DRACOWorker.toString(),i=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var n;this.workerPool.length<this.workerLimit?((n=new Worker(this.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(n)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(n=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),Ff.DRACOWorker=function(){var e,t;function n(e,t,n,r,i,o){var s=o.num_components(),a=n.num_points()*s,l=a*i.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,o,c,l,h);var u=new i(e.HEAPF32.buffer,h,a).slice();return e._free(h),{name:r,array:u,itemSize:s}}onmessage=function(r){var i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var o=i.buffer,s=i.taskConfig;t.then((e=>{var t=e.draco,r=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(o),o.byteLength);try{var l=function(e,t,r,i){var o,s,a=i.attributeIDs,l=i.attributeTypes,c=t.GetEncodedGeometryType(r);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,s=t.DecodeBufferToMesh(r,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,s=t.DecodeBufferToPointCloud(r,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var h={index:null,attributes:[]};for(var u in a){var d,p,f=self[l[u]];if(i.useUniqueIDs)p=a[u],d=t.GetAttributeByUniqueId(o,p);else{if(-1===(p=t.GetAttributeId(o,e[a[u]])))continue;d=t.GetAttribute(o,p)}h.attributes.push(n(e,t,o,u,f,d))}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){var r=3*n.num_faces(),i=4*r,o=e._malloc(i);t.GetTrianglesUInt32Array(n,i,o);var s=new Uint32Array(e.HEAPF32.buffer,o,r).slice();return e._free(o),{array:s,itemSize:1}}(e,t,o));return e.destroy(o),h}(t,r,a,s),c=l.attributes.map((e=>e.array.buffer));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(a),t.destroy(r)}}))}}},Ff.taskCache=new WeakMap,Ff.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},Ff.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},Ff.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},Ff.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};class Of extends Np{constructor(e){super("Model",e),this.viewport=e,this.gltfLoader=null,this.fbxLoader=null,this.modelMaps=new Map,this.store=Up.createInstance({name:"soonspace",version:2,storeName:"modelData"}),this.dracoDecoderPath=null}setDracoDecoderPath(e){this.dracoDecoderPath=e}load(e){return this._loadItem(e)}parse(e,t,n){return new Promise(((r,i)=>{const o=new xp(Object.assign({format:e},n)),{url:s}=n,a=e.toLocaleUpperCase(),l="SBMX"===a;if("GLTF"===a||"GLB"===a||l){const e=s.substring(0,s.lastIndexOf("/")+1);if(this.gltfLoader||(this.gltfLoader=new If),this.dracoDecoderPath&&!this.gltfLoader.dracoLoader){const e=new Ff;e.setDecoderPath(this.dracoDecoderPath),this.gltfLoader.setDRACOLoader(e)}l&&(t=Sh(t)),this.gltfLoader.parse(t,e,(e=>{const{animations:t}=e;if(t&&t.length>0&&(o.animations=t),e.scene.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),o.add(e.scene),!this.modelMaps.get(s)){const e=o.sClone();this.modelMaps.set(s,e)}r(o)}),(e=>{i(e)}))}else if("FBX"===a){this.fbxLoader||(this.fbxLoader=new Rf);const e=this.fbxLoader.parse(t,""),{animations:n}=e;if(n&&n.length>0&&(o.animations=n),e.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),o.add(e),!this.modelMaps.get(s)){const e=o.sClone();this.modelMaps.set(s,e)}r(o)}else i(`In soonspacejs: 加载通用模型资源(${s})格式错误,当前支持 fbx、gltf、glb !`)}))}clone(e,t,n){return new Promise(((r,i)=>Nu(this,void 0,void 0,(function*(){"Model"!==e.stype&&i("In soonspacejs: 方法 cloneModel 参入对象类型错误!");const{id:o,name:s,level:a,visible:l,position:c,rotation:h,scale:u,onClick:d,onDblClick:p,onRightClick:f,onLoad:m,userData:g}=t;function v(e,t,n){n(e,t);for(var r=0;r<e.children.length;r++)v(e.children[r],t.children[r],n)}const y=yield function(e){const t=new Map,n=new Map;let r;return r=e instanceof su||e instanceof ou?e.sClone():e.clone(),v(e,r,(function(e,r){t.set(r,e),n.set(e,r)})),r.traverse((function(e){if(e instanceof Fi){const r=e,i=t.get(e),o=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=o.map((function(e){return n.get(e)})),r.bind(r.skeleton,r.bindMatrix)}})),r}(e);y.animations=yield y.animations.map((e=>e.clone())),yield this._copyMaterial(y),o&&(y.sid=o),s&&(y.name=s),a&&(y.level=a),!1===l&&y.hide(),c&&y.position.set(c.x,c.y,c.z),h&&y.rotation.set(h.x,h.y,h.z),u&&y.scale.set(u.x,u.y,u.z),y.onClick=d?d.bind(y):null,y.onDblClick=p?p.bind(y):null,y.onRightClick=f?f.bind(y):null,y.onLoad=m?m.bind(y):null,y.onLoad&&y.onLoad(y),g&&(y.userData=g),null!==n&&this.viewport.scener.addObject(y,n||e.parent||this.scene),r(y)}))))}loadToGroup(e,t){return new Promise((n=>Nu(this,void 0,void 0,(function*(){const r=new lu(e);for(let e=0;e<t.length;e++){const n=yield this._loadItem(t[e],null);r.add(n)}this.viewport.scener.addObject(r,this.scene),n(r)}))))}addForGroup(e,t){return new Promise((n=>Nu(this,void 0,void 0,(function*(){const r=this.getGroupById(e);if(r){for(let e=0;e<t.length;e++){const n=yield this._loadItem(t[e],null);r.add(n)}this.viewport.scener.addObject(r,this.scene)}n(r)}))))}clearIdb(){return this.store.clear()}_loadItem(e,t=this.scene){return Nu(this,void 0,void 0,(function*(){const{url:n}=e,{useIndexedDB:r}=this.viewport.options,i=n.slice(n.lastIndexOf(".")+1),o=this.modelMaps.get(n);let s=null;if(o)return this.clone(o,e,t);r&&(s=yield this.store.getItem(n)),s||(s=yield this._fetchBuffer(e));const a=yield this.parse(i,s,e);return null!==t&&this.viewport.scener.addObject(a,t||this.scene),Promise.resolve(a)}))}_fetchBuffer(e){const{url:t}=e,{useIndexedDB:n}=this.viewport.options;return fetch(t).then((e=>e.arrayBuffer())).then((e=>(n&&this.store.setItem(t,e),Promise.resolve(e))))}_copyMaterial(e){e.traverse((e=>{e instanceof Rt&&(Fh(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof Ge&&(e.material=e.material.clone()))}))}}class Nf extends Np{constructor(e){super("Poi",e),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new wp(t,e);return this.viewport.scener.addObject(n,this.scene),n}clone(e,t,n){"Poi"!==e.stype&&console.error("In soonspacejs: 方法 clonePoi 参入对象类型错误!");const{id:r,name:i,level:o,visible:s,position:a,rotation:l,scale:c,onClick:h,onDblClick:u,onRightClick:d,userData:p}=t,f=e.sClone();return this._copyMaterial(f),r&&(f.sid=r),i&&(f.name=i),o&&(f.level=o),Ph(s)&&(f.visible=s),a&&f.position.set(a.x,a.y,a.z),l&&f.rotation.set(l.x,l.y,l.z),c&&f.scale.set(c.x,c.y,c.z),f.onClick=h?h.bind(f):null,f.onDblClick=u?u.bind(f):null,f.onRightClick=d?d.bind(f):null,p&&(f.userData=p),null!==n&&this.viewport.scener.addObject(f,n||this.scene||e.parent),f}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{const t=this._createMaterial(e.url),r=new wp(t,e);n.add(r)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&(t.forEach((e=>{const t=this._createMaterial(e.url),r=new wp(t,e);n.add(r)})),this.viewport.scener.addObject(n,this.scene)),n}_createMaterial(e){const t=this.materials.get(e);if(!t){const t=(new ba).load(e);t.flipY=!0;const n=new ci({map:t,color:16777215});return this.materials.set(e,n),n}return t}_copyMaterial(e){e.traverse((e=>{(e instanceof Rt||e instanceof Mi)&&(Fh(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof Ge&&(e.material=e.material.clone()))}))}}class Df extends Np{constructor(e){super("PoiNode",e)}create(e){this._openEnableRenderCss(e);const t=new Ou(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{this._openEnableRenderCss(e);const t=new Ou(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&(t.forEach((e=>{const t=new Ou(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene)),n}_openEnableRenderCss(e){switch(e.type){case"2d":case"2D":this.viewport.rendererManager.setInternalState("enableRenderCss2D",!0);break;case"2.5d":case"2.5D":this.viewport.rendererManager.setInternalState("enableRenderCss2DHalf",!0);break;case"3d":case"3D":this.viewport.rendererManager.setInternalState("enableRenderCss3D",!0)}}}class Bf extends Np{constructor(e){super("Canvas3D",e)}create(e){const t=new Ip(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{const t=new Ip(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&(t.forEach((e=>{const t=new Ip(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene)),n}}class Uf{constructor(){this.graph=[],this.queue=null,this.distance=[],this.previous=[]}setGraph(e){if(!Fh(e))return console.error("In soonspacejs: 内容错误 - 路径计算! ( dijkstra setGraph method graph isn't an array )");if(!(e.length<1))for(let t=0;t<e.length;t++){const n=e[t];if(2!==n.length)return console.error(`In soonspacejs: 内容错误 - 路径计算! ( dijkstra setGraph method graph item must be an array and contain 2 values [name, vertices], Failed at index: ${t} )`);const r=n[0],i=n[1];this.graph[r]=[];for(let e=0;e<i.length;e++){const t=i[e],n=t[0],o=t[1];this.graph[r][n]=o}}}getPath(e,t){if(void 0===this.graph[e])return console.error(`In soonspacejs: 内容错误 - 路径计算! ( dijkstra getPath method source ${e} doesn't exist )`),[];if(void 0===this.graph[t])return console.error(`In soonspacejs: 内容错误 - 路径计算! ( dijkstra getPath method target ${t} doesn't exist )`),[];if(e===t)return[];let n;for(this.queue=new wh,this.queue.add(e,0),this.previous[e]=null;n=this.queue.shift();){if(n===t){const e=[];for(;Lh(n)&&null!==this.previous[n];)e.unshift(n),n=this.previous[n];return e}const e=this.queue.getDistance(n);if(e===1/0)return[];for(let t in this.graph[n]){const r=this.queue.getDistance(Number(t)),i=e+this.graph[n][t];i<r&&(this.queue.update(Number(t),i),this.previous[t]=n)}}return[]}}class kf extends Np{constructor(e){super("Topology",e),this.dijkstra=new Uf}createFromGml(e){const{url:t,linkWidth:n=20,linkColor:r=65280,renderNode:i=!0,nodeColor:o=255}=e;return Hp(t).then((t=>{if(!t||!t.MultiLayeredGraph)return Promise.reject('In soonspace: createTopologyFromGml "url" path error!');const s=[],a=new Map;let l=[],c=[];const h=t.MultiLayeredGraph.SpaceLayerMember.SpaceLayer.X_floor;Fh(h)?h.forEach((e=>{l=[...l,...e.state],c=[...c,...e.transition]})):(l=[...l,...h.state],c=[...c,...h.transition]),l.forEach(((e,t)=>{const n=e.State._attributes["gml:id"],r=e.State.topoNode["gml:Node"].node_name;s.push({id:Eh(n)?n:"",name:Eh(r)?r:"",position:{x:Number(e.State.topoNode["gml:Node"].xcoord["#text"]),y:Number(e.State.topoNode["gml:Node"].zcoord["#text"]),z:-1*Number(e.State.topoNode["gml:Node"].ycoord["#text"])},graphs:[]}),a.set(n,t)})),c.forEach((e=>{const t=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][0]._attributes["xlink:href"],n=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][1]._attributes["xlink:href"],r=e.Transition.topoEdge["gml:Edge"].length["#text"],i=e.Transition.topoEdge["gml:Edge"].restrict["#text"],o=e.Transition.topoEdge["gml:Edge"].passable["#text"],l=a.get(t),c=a.get(n),h=e.Transition._attributes["gml:id"],u=e.Transition.topoEdge["gml:Edge"].link_name["#text"];void 0!==l&&void 0!==c&&("2"!==o&&"3"!==o&&s[l].graphs.push({targetNodeId:n,linkInfo:{id:h,name:u},enable:!0,length:parseInt(r),restrict:parseInt(i),passable:parseInt(o)}),"1"!==o&&"3"!==o&&s[c].graphs.push({targetNodeId:t,linkInfo:{id:h,name:u},enable:!0,length:parseInt(r),restrict:parseInt(i),passable:parseInt(o)}))})),this.setDijkstraGraph(s);const u=new Ep(Object.assign(Object.assign({},e),{type:"network",nodes:s,linkWidth:n,renderLink:!0,linkColor:r,renderNode:i,nodeColor:o}));return this.viewport.scener.addObject(u,this.scene),Promise.resolve(u)}))}create(e){const t=this.generateLineTopologyInfoNodeGraphs(e);this.setDijkstraGraph(t.nodes);const n=new Ep(t);return this.viewport.scener.addObject(n,this.scene),n}resetNodes(e,t){const n=this.generateLineTopologyInfoNodeGraphs(Object.assign(Object.assign({},e.info),{nodes:t}));return e.resetNodes(n.nodes),this.viewport.signals.objectChanged.dispatch(),e}createToGroup(e,t){const n=new lu(e);return t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e);this.setDijkstraGraph(t.nodes);const r=new Ep(t);n.add(r)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){const n=this.getGroupById(e);return n&&t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e);this.setDijkstraGraph(t.nodes);const r=new Ep(t);n.add(r)})),n}getShortestPath(e,t){const{nodes:n}=e.info,r=ph(t.start),i=ph(t.end);let o=null,s=1/0,a=null,l=1/0;if(n.forEach((e=>{if(e.graphs.length>0){const t=ph(e.position),n=t.distanceTo(r),c=t.distanceTo(i);n<s&&(s=n,o=Number(e.id)),c<l&&(l=c,a=Number(e.id))}})),o&&a){const s=this.dijkstra.getPath(o,a);if(s.length>0){const o=[{id:"startPoint",position:r,graphs:[]}];s.forEach((e=>{const t=n.find((t=>t.id==e));t&&o.push(t)})),o.push({id:"endPoint",position:i,graphs:[]});for(let e=0;e<o.length;e++)o[e].position.y+=1;const a=Object.assign(Object.assign(Object.assign({},t),{type:"line",nodes:o}),e.getSpaceAttribute(!0));this.generateLineTopologyInfoNodeGraphs(a);const l=new Ep(a);return this.viewport.scener.addObject(l,this.scene),l}}return null}getShortestPathByMultipleStartPoints(e,t){const{nodes:n}=e.info,r=[];t.start.forEach((e=>{const i=ph(e),o=ph(t.end);let s=null,a=1/0,l=null,c=1/0;if(n.forEach((e=>{if(e.graphs.length>0){const t=ph(e.position),n=t.distanceTo(i),r=t.distanceTo(o);n<a&&(a=n,s=Number(e.id)),r<c&&(c=r,l=Number(e.id))}})),s&&l){let e=0;const t=this.dijkstra.getPath(s,l);if(t.length>0){const s=[{id:"startPoint",position:i,graphs:[]}];t.forEach(((t,r)=>{const o=n.find((e=>e.id==t));o&&(e+=0===r?ph(o.position).distanceTo(i):ph(o.position).distanceTo(ph(s[s.length-1].position)),s.push(o))})),s.push({id:"endPoint",position:o,graphs:[]}),e+=o.distanceTo(ph(s[s.length-1].position)),r.push({nodeInfo:s,pathLength:e})}}}));let i=[],o=1/0;if(r.forEach((({nodeInfo:e,pathLength:t})=>{t<o&&(o=t,i=e)})),i.length){for(let e=0;e<i.length;e++)i[e].position.y+=1;const n=Object.assign(Object.assign({},t),{type:"line",nodes:i,position:e.getWorldPosition(new v),rotation:(new $).setFromQuaternion(e.getWorldQuaternion(new g)),scale:e.getWorldScale(new v)});this.generateLineTopologyInfoNodeGraphs(n);const r=new Ep(n);return this.viewport.scener.addObject(r,this.scene),r}return null}getShortestPathByMultipleEndPoints(e,t){const{nodes:n}=e.info,r=[];t.end.forEach((e=>{const i=ph(t.start),o=ph(e);let s=null,a=1/0,l=null,c=1/0;if(n.forEach((e=>{if(e.graphs.length>0){const t=ph(e.position),n=t.distanceTo(i),r=t.distanceTo(o);n<a&&(a=n,s=Number(e.id)),r<c&&(c=r,l=Number(e.id))}})),s&&l){let e=0;const t=this.dijkstra.getPath(s,l);if(t.length>0){const s=[{id:"startPoint",position:i,graphs:[]}];t.forEach(((t,r)=>{const o=n.find((e=>e.id==t));o&&(e+=0===r?ph(o.position).distanceTo(i):ph(o.position).distanceTo(ph(s[s.length-1].position)),s.push(o))})),s.push({id:"endPoint",position:o,graphs:[]}),e+=o.distanceTo(ph(s[s.length-1].position)),r.push({nodeInfo:s,pathLength:e})}}}));let i=[],o=1/0;if(r.forEach((({nodeInfo:e,pathLength:t})=>{t<o&&(o=t,i=e)})),i.length){for(let e=0;e<i.length;e++)i[e].position.y+=1;const n=Object.assign(Object.assign({},t),{type:"line",nodes:i,position:e.getWorldPosition(new v),rotation:(new $).setFromQuaternion(e.getWorldQuaternion(new g)),scale:e.getWorldScale(new v)});this.generateLineTopologyInfoNodeGraphs(n);const r=new Ep(n);return this.viewport.scener.addObject(r,this.scene),r}return null}setDijkstraGraph(e){const t=[];e.forEach((n=>{if(n.graphs&&n.graphs.length>0){const r=[];n.graphs.forEach((t=>{const i=e.find((e=>e.id===t.targetNodeId));i&&r.push([Number(t.targetNodeId),t.length||ph(n.position).distanceTo(ph(i.position))])})),t.push([Number(n.id),r])}})),t.length>0&&this.dijkstra.setGraph(t)}generateLineTopologyInfoNodeGraphs(e){if("line"===e.type)for(let t=0;t<e.nodes.length;t++)if(t===e.nodes.length-1)e.nodes[t].graphs=[];else{const n=e.nodes[t],r=e.nodes[t+1];e.nodes[t].graphs=[{targetNodeId:r.id.toString(),linkInfo:{id:`${n.id}_to_${r.id}`,name:`${n.name||n.id}_to_${r.name||r.id}`},enable:!0,length:ph(e.nodes[t].position).distanceTo(ph(r.position)),restrict:0,passable:0}]}return e}}class zf extends Np{constructor(e){super("Helper",e)}addGridHelper(e){const{id:t,size:n=1e3,divisions:r=20,color:i="#fff",position:o={x:0,y:0,z:0},rotation:s={x:0,y:0,z:0},scale:a={x:1,y:1,z:1}}=e,l=new _c(n,r,i,i);return l.position.set(o.x,o.y,o.z),l.rotation.set(s.x,s.y,s.z),l.scale.set(a.x,a.y,a.z),l.userData.sid=t,l.userData.stype="Helper",this.viewport.scener.addObject(l,this.scene),l}addAxesHelper(e){const{id:t,axesLength:n=1e3}=e,r=new Nc(n);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addBoxHelper(e){const{id:t,box:n,color:r="#00ff00"}=e,i=new Rc(n,new Ue(r));return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addPlaneHelper(e){const{id:t,width:n=500,height:r=500,color:i="#00ff00",opacity:o=.2,position:s={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1}}=e,c=new ou(new Zt(n,r),new He({color:i,opacity:o,transparent:!0,side:2}),{id:t,position:s,rotation:a,scale:l});return c.userData.sid=t,c.userData.stype="Helper",this.viewport.scener.addObject(c,this.scene),c}addGroundHelper(e){const{imgUrl:t,id:n,width:r=500,height:i=500,opacity:o=1,position:s={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},repeat:c={x:10,y:10}}=e,h=(new ba).load(t),u=new Zt(r,i);u.computeBoundingBox();const d=new ks({side:2,map:h,transparent:!0,opacity:o,roughness:.8});d.map&&(d.map.repeat.set(c.x,c.x),d.map.wrapS=1e3,d.map.wrapT=1e3,d.map.version++),a.x-=Math.PI/2,d.version++;const p=new Fp(u,d,{id:n,position:s,rotation:a,scale:l});return p.userData.sid=n,p.userData.stype="Helper",this.viewport.scener.addObject(p,this.scene),p}addDirectionalLightHelper(e){const{id:t,light:n,color:r,size:i=50}=e,o=new Tc(n,i,r);return o.userData.sid=t,o.userData.stype="Helper",this.viewport.scener.addObject(o,this.scene),o}addHemisphereLightHelper(e){const{id:t,light:n,color:r,size:i=20}=e,o=new bc(n,i,r);return o.userData.sid=t,o.userData.stype="Helper",this.viewport.scener.addObject(o,this.scene),o}addSpotLightHelper(e){const{id:t,light:n,color:r}=e,i=new hc(n,r);return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addPointLightHelper(e){const{id:t,light:n,color:r,size:i=20}=e,o=new gc(n,i,r);return o.userData.sid=t,o.userData.stype="Helper",this.viewport.scener.addObject(o,this.scene),o}}class Gf extends Np{constructor(e){super("PluginObject",e)}createObject(e,t){const n=new cu(e);return t&&n.add(t),this.viewport.scener.addObject(n,this.scene),n}addToObject(e,t){const n=this.getById(e);return n?(this.viewport.scener.addObject(t,n),n):null}}class Hf{constructor(e){this.viewport=e,this.needUpdate=!1,this.store={LightManager:new Dp(e),sbmManager:new jp(e),modelManager:new Of(e),poiManager:new Nf(e),poiNodeManager:new Df(e),canvas3DManager:new Bf(e),topologyManager:new kf(e),helperManager:new zf(e),pluginObjectManager:new Gf(e)},this.postUpdate=new Map;for(let e in this.store)this.postUpdate.set(e,this.store[e].update.bind(this.store[e]));e.postUpdate.set("ManagerRender",this.update.bind(this))}update(){const e=performance.now();this.postUpdate.forEach((e=>e())),this.viewport.signals.lodRendered.dispatch(performance.now()-e)}clearObject(){this.store.sbmManager.clear(),this.store.modelManager.clear(),this.store.poiManager.clear(),this.store.poiNodeManager.clear(),this.store.canvas3DManager.clear(),this.store.topologyManager.clear(),this.store.helperManager.clear(),this.store.pluginObjectManager.clear()}clear(){this.clearObject(),this.store.LightManager.clear()}}export default class{constructor(e){this.THREE=uh,this.version=t,this.animation=iu,this.library=Op,this.utils=Gh,this.plugins={};const{el:n,options:r={},events:i={}}=e;if(this.domElement=document.querySelector(n),this.options=Object.assign(Object.assign({},{showInfo:!1,showGrid:!1,background:{color:0,alpha:!1},fog:!1,controls:{},hoverEnabled:!1,closeInfoLog:!1,closeWarnLog:!0,useIndexedDB:!0,logarithmicDepthBuffer:!0}),r),this.viewport=new mp(this.options),this.signals=this.viewport.signals,this.manager=new Hf(this.viewport),!this.domElement)throw new Error(`In SoonSpace: Can't find element by "${n}"!`);this.domElement.appendChild(this.viewport.container),this._init(),this._initEvents(i),this._initDefaultLight()}_init(){const{showGrid:t,background:n,fog:r,controls:i,closeInfoLog:o,closeWarnLog:s,useIndexedDB:a}=this.options;if(!o){dh(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),dh(e,{color:"#3eaf7c","font-size":"24px"}),dh(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),dh("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),dh("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),dh("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}t&&this.addGridHelper(!0===t?{id:"defaultGridHelper"}:t),(null==n?void 0:n.skyBox)?Eh(null==n?void 0:n.skyBox)?this.setSphereSkyBackground(null==n?void 0:n.skyBox):Oh(null==n?void 0:n.skyBox)&&this.setSkyBackground(n.skyBox.dirPath,n.skyBox.fileNames):(null==n?void 0:n.img)?this.setBackgroundImage(n.img):(null==n?void 0:n.color)&&this.setBackgroundColor(n.color),r&&this.openSceneFog(!0===r?void 0:r),i&&this.setControlsOptions(i),s&&(window.console.warn=function(){}),a&&!window.indexedDB&&(this.options.useIndexedDB=!1,window.console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."))}_initEvents(e){const{modelHover:t,modelUnHover:n,modelClick:r,modelRightClick:i,modelDblClick:o,poiHover:s,poiUnHover:a,poiClick:l,poiRightClick:c,poiDblClick:h,selectPosition:u,sceneClick:d,resize:p}=e;t&&this.signals.modelHover.add(t),n&&this.signals.modelUnHover.add(n),r&&this.signals.modelClick.add(r),i&&this.signals.modelRightClick.add(i),o&&this.signals.modelDblClick.add(o),s&&this.signals.poiHover.add(s),a&&this.signals.poiUnHover.add(a),l&&this.signals.poiClick.add(l),c&&this.signals.poiRightClick.add(c),h&&this.signals.poiDblClick.add(h),u&&this.signals.selectPosition.add(u),d&&this.signals.sceneClick.add(d),p&&this.signals.windowResize.add(p),this.signals.windowResize.dispatch(),window.addEventListener("resize",(()=>this.signals.windowResize.dispatch()),!1)}_initDefaultLight(){this.createAmbientLight({id:"defaultAmbientLight",name:"defaultAmbientLight"}),this.createDirectionalLight({id:"defaultDirectionalLight",name:"defaultDirectionalLight"}),this.createHemisphereLight({id:"defaultHemisphereLight",name:"defaulHemisphereLight",intensity:.1})}registerPlugin(e,t){const n=new e(this);return this.plugins[t]=n,n}getPlugin(e){return this.plugins[e]?this.plugins[e]:null}createPluginObject(e,t){return this.manager.store.pluginObjectManager.createObject(e,t)}addToPluginObject(e,t){return this.manager.store.pluginObjectManager.addToObject(e,t)}getPluginObjectById(e){return this.manager.store.pluginObjectManager.getById(e)}getPluginObjectByName(e){return this.manager.store.pluginObjectManager.getByName(e)}removePluginObjectById(e){return this.manager.store.pluginObjectManager.removeById(e)}setHoverEnabled(e){this.viewport.setHoverEnabled(e)}setBackgroundColor(e){this.viewport.setBackgroundColor(e)}setBackgroundImage(e){this.viewport.setBackgroundImage(e)}setSphereSkyBackground(e){this.viewport.setSphereSkyBackground(e)}setSkyBackground(e,t){this.viewport.setSkyBackground(e,t)}playModelAnimation(e,t){return this.viewport.playModelAnimation(e,t)}stopModelAnimation(e,t){this.viewport.stopModelAnimation(e,t)}getOffsetByPosition(e){return this.viewport.getOffsetByPosition(e)}getPositionByOffset(e,t){return this.viewport.getPositionByOffset(e,t)}render(e){return this.viewport.render(e)}clearSignals(){this.viewport.clearSignals()}dispose(){return this.clear(),this.clearSignals(),this.viewport.dispose()}getCameraViewpoint(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraViewpoint(e){this.viewport.cameraManager.setCameraViewpoint(e)}flyTo(e,t="frontTop",n){return this.viewport.cameraManager.flyTo(e,t,n)}flyToBoundingBox(e,t="frontTop",n){return this.viewport.cameraManager.flyToBoundingBox(e,t,n)}flyToObj(e,t="frontTop",n){return this.viewport.cameraManager.flyToObj(e,t,n)}flyMainViewpoint(e="frontTop",t){return this.flyToObj(this.viewport.scene,e,t)}surroundOnTarget(e,t){return this.viewport.cameraManager.surroundOnTarget(e,t)}surroundOnObject(e,t){return this.viewport.cameraManager.surroundOnObject(e,t)}getObjectLabelPos(e,t="frontTop",n){return this.viewport.cameraManager.getObjectLabelPos(e,t,n)}setControlsOptions(e){return this.viewport.controls.setOptions(e)}addObject(e,t){this.viewport.scener.addObject(e,t)}removeObject(e){this.viewport.scener.removeObject(e)}openSceneFog(e){this.viewport.scener.openSceneFog(e)}closeSceneFog(){this.viewport.scener.closeSceneFog()}edgeShow(e,t){return this.viewport.scener.edgeShow(e,t)}unEdgeShow(e){return this.viewport.scener.unEdgeShow(e)}strokeShow(e,t){return this.viewport.scener.strokeShow(e,t)}unStrokeShow(e){return this.viewport.scener.unStrokeShow(e)}opacityShow(e,t){return this.viewport.scener.opacityShow(e,t)}unOpacityShow(e){return this.viewport.scener.unOpacityShow(e)}highlightShow(e,t){return this.viewport.scener.highlightShow(e,t)}unHighlightShow(e){return this.viewport.scener.unHighlightShow(e)}emissiveShow(e,t){return this.viewport.scener.emissiveShow(e,t)}unEmissiveShow(e){return this.viewport.scener.unEmissiveShow(e)}clearObject(){this.manager.clearObject()}clear(){this.manager.clear()}createAmbientLight(e){return this.manager.store.LightManager.createAmbientLight(e)}setAmbientLight(e){return this.manager.store.LightManager.setAmbientLight(e)}createDirectionalLight(e){return this.manager.store.LightManager.createDirectionalLight(e)}setDirectionalLight(e){return this.manager.store.LightManager.setDirectionalLight(e)}createHemisphereLight(e){return this.manager.store.LightManager.createHemisphereLight(e)}setHemisphereLight(e){return this.manager.store.LightManager.setHemisphereLight(e)}createSpotLight(e){return this.manager.store.LightManager.createSpotLight(e)}setSpotLight(e){return this.manager.store.LightManager.setSpotLight(e)}createPointLight(e){return this.manager.store.LightManager.createPointLight(e)}setPointLight(e){return this.manager.store.LightManager.setPointLight(e)}getLightById(e){return this.manager.store.LightManager.getById(e)}removeLightById(e){return this.manager.store.LightManager.removeById(e)}getAllLight(){return this.manager.store.LightManager.getAll()}clearLight(){return this.manager.store.LightManager.clear()}showAllLight(){return this.manager.store.LightManager.showAll()}hideAllLight(){return this.manager.store.LightManager.hideAll()}loadSbm(e,t){return this.manager.store.sbmManager.load(e,t)}parseSbm(e,t,n){return this.manager.store.sbmManager.parse(e,t,n)}cloneSbm(e,t,n){return this.manager.store.sbmManager.clone(e,t,n)}getSbmById(e){return this.manager.store.sbmManager.getById(e)}getSbmByName(e){return this.manager.store.sbmManager.getByName(e)}getSbmByUserDataProperty(e,t){return this.manager.store.sbmManager.getByUserDataProperty(e,t)}removeSbmById(e){return this.manager.store.sbmManager.removeById(e)}createGroupForSbm(e){return this.manager.store.sbmManager.createGroup(e)}loadSbmToGroup(e,t,n){return this.manager.store.sbmManager.loadToGroup(e,t,n)}addSbmForGroup(e,t,n){return this.manager.store.sbmManager.addForGroup(e,t,n)}createSbmGroupFromXml(e,t){return this.manager.store.sbmManager.createGroupFromXml(e,t)}getSbmGroupById(e){return this.manager.store.sbmManager.getGroupById(e)}getSbmGroupByName(e){return this.manager.store.sbmManager.getGroupByName(e)}getAllSbmGroup(){return this.manager.store.sbmManager.getAllGroup()}removeSbmGroupById(e){return this.manager.store.sbmManager.removeGroupById(e)}clearSbm(){return this.manager.store.sbmManager.clear()}getAllSbm(){return this.manager.store.sbmManager.getAll()}showAllSbm(){return this.manager.store.sbmManager.showAll()}hideAllSbm(){return this.manager.store.sbmManager.hideAll()}getSbmModelMaps(){return this.manager.store.sbmManager.modelMaps}setSbmModelMaps(e){this.manager.store.sbmManager.modelMaps=e}clearIdb(){return Promise.all([this.manager.store.sbmManager.clearIdb(),this.manager.store.modelManager.clearIdb()])}setModelDracoDecoderPath(e){return this.manager.store.modelManager.setDracoDecoderPath(e)}loadModel(e){return this.manager.store.modelManager.load(e)}cloneModel(e,t,n){return this.manager.store.modelManager.clone(e,t,n)}getModelById(e){return this.manager.store.modelManager.getById(e)}getModelByName(e){return this.manager.store.modelManager.getByName(e)}getModelByUserDataProperty(e,t){return this.manager.store.modelManager.getByUserDataProperty(e,t)}removeModelById(e){return this.manager.store.modelManager.removeById(e)}createGroupForModel(e){return this.manager.store.modelManager.createGroup(e)}loadModelToGroup(e,t){return this.manager.store.modelManager.loadToGroup(e,t)}addModelForGroup(e,t){return this.manager.store.modelManager.addForGroup(e,t)}getModelGroupById(e){return this.manager.store.modelManager.getGroupById(e)}getModelGroupByName(e){return this.manager.store.modelManager.getGroupByName(e)}getAllModelGroup(){return this.manager.store.modelManager.getAllGroup()}removeModelGroupById(e){return this.manager.store.modelManager.removeGroupById(e)}clearModel(){return this.manager.store.modelManager.clear()}getAllModel(){return this.manager.store.modelManager.getAll()}showAllModel(){return this.manager.store.modelManager.showAll()}hideAllModel(){return this.manager.store.modelManager.hideAll()}createPoi(e){return this.manager.store.poiManager.create(e)}clonePoi(e,t,n){return this.manager.store.poiManager.clone(e,t,n)}getPoiById(e){return this.manager.store.poiManager.getById(e)}getPoiByName(e){return this.manager.store.poiManager.getByName(e)}getPoiByUserDataProperty(e,t){return this.manager.store.poiManager.getByUserDataProperty(e,t)}removePoiById(e){return this.manager.store.poiManager.removeById(e)}createGroupForPoi(e){return this.manager.store.poiManager.createGroup(e)}createPoiToGroup(e,t){return this.manager.store.poiManager.createToGroup(e,t)}addPoiForGroup(e,t){return this.manager.store.poiManager.addForGroup(e,t)}getPoiGroupById(e){return this.manager.store.poiManager.getGroupById(e)}getPoiGroupByName(e){return this.manager.store.poiManager.getGroupByName(e)}getAllPoiGroup(){return this.manager.store.poiManager.getAllGroup()}removePoiGroupById(e){return this.manager.store.poiManager.removeGroupById(e)}clearPoi(){return this.manager.store.poiManager.clear()}getAllPoi(){return this.manager.store.poiManager.getAll()}showAllPoi(){return this.manager.store.poiManager.showAll()}hideAllPoi(){return this.manager.store.poiManager.hideAll()}createPoiNode(e){return this.manager.store.poiNodeManager.create(e)}getPoiNodeById(e){return this.manager.store.poiNodeManager.getById(e)}getPoiNodeByName(e){return this.manager.store.poiNodeManager.getByName(e)}getPoiNodeByUserDataProperty(e,t){return this.manager.store.poiNodeManager.getByUserDataProperty(e,t)}removePoiNodeById(e){return this.manager.store.poiNodeManager.removeById(e)}createGroupForPoiNode(e){return this.manager.store.poiNodeManager.createGroup(e)}createPoiNodeToGroup(e,t){return this.manager.store.poiNodeManager.createToGroup(e,t)}addPoiNodeForGroup(e,t){return this.manager.store.poiNodeManager.addForGroup(e,t)}getPoiNodeGroupById(e){return this.manager.store.poiNodeManager.getGroupById(e)}getPoiNodeGroupByName(e){return this.manager.store.poiNodeManager.getGroupByName(e)}getAllPoiNodeGroup(){return this.manager.store.poiNodeManager.getAllGroup()}removePoiNodeGroupById(e){return this.manager.store.poiNodeManager.removeGroupById(e)}clearPoiNode(){return this.manager.store.poiNodeManager.clear()}getAllPoiNode(){return this.manager.store.poiNodeManager.getAll()}showAllPoiNode(){return this.manager.store.poiNodeManager.showAll()}hideAllPoiNode(){return this.manager.store.poiNodeManager.hideAll()}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return this.manager.store.canvas3DManager.getById(e)}getCanvas3DByName(e){return this.manager.store.canvas3DManager.getByName(e)}getCanvas3DByUserDataProperty(e,t){return this.manager.store.canvas3DManager.getByUserDataProperty(e,t)}removeCanvas3DById(e){return this.manager.store.canvas3DManager.removeById(e)}createGroupForCanvas3D(e){return this.manager.store.canvas3DManager.createGroup(e)}createCanvas3DToGroup(e,t){return this.manager.store.canvas3DManager.createToGroup(e,t)}addCanvas3DForGroup(e,t){return this.manager.store.canvas3DManager.addForGroup(e,t)}getCanvas3DGroupById(e){return this.manager.store.canvas3DManager.getGroupById(e)}getCanvas3DGroupByName(e){return this.manager.store.canvas3DManager.getGroupByName(e)}getAllCanvas3DGroup(){return this.manager.store.canvas3DManager.getAllGroup()}removeCanvas3DGroupById(e){return this.manager.store.canvas3DManager.removeGroupById(e)}clearCanvas3D(){return this.manager.store.canvas3DManager.clear()}getAllCanvas3D(){return this.manager.store.canvas3DManager.getAll()}showAllCanvas3D(){return this.manager.store.canvas3DManager.showAll()}hideAllCanvas3D(){return this.manager.store.canvas3DManager.hideAll()}getShortestPath(e,t){return this.manager.store.topologyManager.getShortestPath(e,t)}getShortestPathByMultipleStartPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleStartPoints(e,t)}getShortestPathByMultipleEndPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleEndPoints(e,t)}createTopologyFromGml(e){return this.manager.store.topologyManager.createFromGml(e)}createTopology(e){return this.manager.store.topologyManager.create(e)}resetTopologyNodes(e,t){return this.manager.store.topologyManager.resetNodes(e,t)}getTopologyById(e){return this.manager.store.topologyManager.getById(e)}getTopologyByName(e){return this.manager.store.topologyManager.getByName(e)}getTopologyByUserDataProperty(e,t){return this.manager.store.topologyManager.getByUserDataProperty(e,t)}removeTopologyById(e){return this.manager.store.topologyManager.removeById(e)}createGroupForTopology(e){return this.manager.store.topologyManager.createGroup(e)}createTopologyToGroup(e,t){return this.manager.store.topologyManager.createToGroup(e,t)}addTopologyForGroup(e,t){return this.manager.store.topologyManager.addForGroup(e,t)}getTopologyGroupById(e){return this.manager.store.topologyManager.getGroupById(e)}getTopologyGroupByName(e){return this.manager.store.topologyManager.getGroupByName(e)}getAllTopologyGroup(){return this.manager.store.topologyManager.getAllGroup()}removeTopologyGroupById(e){return this.manager.store.topologyManager.removeGroupById(e)}clearTopology(){return this.manager.store.topologyManager.clear()}getAllTopology(){return this.manager.store.topologyManager.getAll()}showAllTopology(){return this.manager.store.topologyManager.showAll()}hideAllTopology(){return this.manager.store.topologyManager.hideAll()}addGridHelper(e){return this.manager.store.helperManager.addGridHelper(e)}addAxesHelper(e){return this.manager.store.helperManager.addAxesHelper(e)}addBoxHelper(e){return this.manager.store.helperManager.addBoxHelper(e)}addPlaneHelper(e){return this.manager.store.helperManager.addPlaneHelper(e)}createGround(e){return console.warn("In soonspacejs: 'createGround' 已弃用,请使用 'addGroundHelper'!"),this.addGroundHelper(e)}addGroundHelper(e){return this.manager.store.helperManager.addGroundHelper(e)}addDirectionalLightHelper(e){return this.manager.store.helperManager.addDirectionalLightHelper(e)}addHemisphereLightHelper(e){return this.manager.store.helperManager.addHemisphereLightHelper(e)}addSpotLightHelper(e){return this.manager.store.helperManager.addSpotLightHelper(e)}addPointLightHelper(e){return this.manager.store.helperManager.addPointLightHelper(e)}getHelperById(e){return this.manager.store.helperManager.getById(e)}removeHelperById(e){return this.manager.store.helperManager.removeById(e)}clearHelper(){return this.manager.store.helperManager.clear()}showAllHelper(){return this.manager.store.helperManager.showAll()}hideAllHelper(){return this.manager.store.helperManager.hideAll()}}export{ou as BaseMesh,su as BaseObject3D,Ip as Canvas3D,Tp as Circle,Fp as Ground,lu as Group,fh as IVector3ToEuler,ph as IVector3ToVector3,_p as Icon,Lp as Line,Ap as Link,wh as MinHeap,xp as Model,Sp as Node,cu as PluginObject,wp as Poi,Ou as PoiNode,Mp as Point,Rp as Polygon,vp as Sbm,au as SceneManage,Ep as Topology,yh as deg2Euler,xh as euler2Deg,kh as getAsciiString,mh as getBoundingBox,Mh as getCubeTexture,bh as getSpaceAttributeFromObject,Ah as hasOwn,Fh as isArray,Ph as isBoolean,Ih as isDate,Nh as isFunction,Ch as isNull,Lh as isNumber,Oh as isObject,Dh as isPromise,Eh as isString,Rh as isSymbol,dh as log,Sh as parseSbmx,vh as rotationAFix,gh as rotationAxisFix,Uh as sleep,_h as syncSpaceAttributeToObject,Bh as typeJudge};