Newer
Older
urbanLifeline_YanAn / public / static / libs / mapbox / threebox.js
@zhangqy zhangqy on 3 Oct 834 KB first commit
!function(){var e,t,n=function(e){var t;return function(n){return t||e(t={exports:{},parent:n},t.exports),t.exports}}((function(e,t){(function(e,n){(function(){var i=N.nextTick,r=(Function.prototype.apply,Array.prototype.slice),a={},o=0;function s(e,t){this._id=e,this._clearFn=t}s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(window,this._id)},t.setImmediate="function"==typeof e?e:function(e){var n=o++,s=!(arguments.length<2)&&r.call(arguments,1);return a[n]=!0,i((function(){a[n]&&(s?e.apply(null,s):e.call(null),t.clearImmediate(n))})),n},t.clearImmediate="function"==typeof n?n:function(e){delete a[e]}}).call(this)}).call(this,n({}).setImmediate,n({}).clearImmediate)})),i={exports:{}};e=this,t=function(e){"use strict";const t="127",n=100,i=300,r=301,a=302,o=303,s=304,l=306,c=307,u=1e3,h=1001,d=1002,p=1003,f=1004,m=1005,g=1006,v=1007,y=1008,x=1009,b=1012,w=1014,_=1015,M=1016,S=1020,T=1022,E=1023,A=1026,L=1027,R=33776,C=33777,P=33778,I=33779,D=35840,O=35841,N=35842,F=35843,B=37492,z=37496,k=2300,H=2301,U=2302,G=2400,j=2401,V=2402,W=2500,q=2501,X=3e3,Z=3001,Y=3007,J=3002,K=3004,Q=3005,$=3006,ee=35044,te=35048,ne="300 es";function ie(){}Object.assign(ie.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,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}});const re=[];for(let Uu=0;Uu<256;Uu++)re[Uu]=(Uu<16?"0":"")+Uu.toString(16);let ae=1234567;const oe={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(re[255&e]+re[e>>8&255]+re[e>>16&255]+re[e>>24&255]+"-"+re[255&t]+re[t>>8&255]+"-"+re[t>>16&15|64]+re[t>>24&255]+"-"+re[63&n|128]+re[n>>8&255]+"-"+re[n>>16&255]+re[n>>24&255]+re[255&i]+re[i>>8&255]+re[i>>16&255]+re[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,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:function(e,t,n){return(1-n)*e+n*t},damp:function(e,t,n,i){return oe.lerp(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(oe.euclideanModulo(e,2*t)-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&&(ae=e%2147483647),((ae=16807*ae%2147483647)-1)/2147483646},degToRad:function(e){return e*oe.DEG2RAD},radToDeg:function(e){return e*oe.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,i,r){const a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((t+i)/2),u=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*u,l*h,l*d,s*c);break;case"YZY":e.set(l*d,s*u,l*h,s*c);break;case"ZXZ":e.set(l*h,l*d,s*u,s*c);break;case"XZX":e.set(s*u,l*f,l*p,s*c);break;case"YXY":e.set(l*p,s*u,l*f,s*c);break;case"ZYZ":e.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};class se{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return 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,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return 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),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}se.prototype.isVector2=!0;class le{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,a,o,s,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*y+s*w,r[6]=a*g+o*x+s*_,r[1]=l*f+c*v+u*b,r[4]=l*m+c*y+u*w,r[7]=l*g+c*x+u*_,r[2]=h*f+d*v+p*b,r[5]=h*m+d*y+p*w,r[8]=h*g+d*x+p*_,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=c*a-o*l,h=o*s-c*r,d=l*r-a*s,p=t*u+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=u*f,e[1]=(i*l-c*n)*f,e[2]=(o*n-i*a)*f,e[3]=h*f,e[4]=(c*t-i*s)*f,e[5]=(i*r-o*t)*f,e[6]=d*f,e[7]=(n*s-l*t)*f,e[8]=(a*t-n*r)*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).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],l=i[4],c=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*s,i[4]=-n*a+t*l,i[7]=-n*o+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 i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}let ce;le.prototype.isMatrix3=!0;const ue={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===ce&&(ce=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),ce.width=e.width,ce.height=e.height;const n=ce.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ce}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}};let he=0;class de extends ie{constructor(e=de.DEFAULT_IMAGE,t=de.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,o=1023,s=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:he++}),this.uuid=oe.generateUUID(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=s,this.offset=new se(0,0),this.repeat=new se(1,1),this.center=new se(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new le,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this}toJSON(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 i=this.image;if(void 0===i.uuid&&(i.uuid=oe.generateUUID()),!t&&void 0===e.images[i.uuid]){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(pe(i[e].image)):t.push(pe(i[e]))}else t=pe(i);e.images[i.uuid]={uuid:i.uuid,url:t}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==i)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case u:e.x=e.x-Math.floor(e.x);break;case h:e.x=e.x<0?0:1;break;case d: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 u:e.y=e.y-Math.floor(e.y);break;case h:e.y=e.y<0?0:1;break;case d: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}set needsUpdate(e){!0===e&&this.version++}}function pe(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ue.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."),{})}de.DEFAULT_IMAGE=void 0,de.DEFAULT_MAPPING=i,de.prototype.isTexture=!0;class fe{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const a=.01,o=e.elements,s=o[0],l=o[4],c=o[8],u=o[1],h=o[5],d=o[9],p=o[2],f=o[6],m=o[10];if(Math.abs(l-u)<a&&Math.abs(c-p)<a&&Math.abs(d-f)<a){if(Math.abs(l+u)<.1&&Math.abs(c+p)<.1&&Math.abs(d+f)<.1&&Math.abs(s+h+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const e=(s+1)/2,o=(h+1)/2,g=(m+1)/2,v=(l+u)/4,y=(c+p)/4,x=(d+f)/4;return e>o&&e>g?e<a?(n=0,i=.707106781,r=.707106781):(i=v/(n=Math.sqrt(e)),r=y/n):o>g?o<a?(n=.707106781,i=0,r=.707106781):(n=v/(i=Math.sqrt(o)),r=x/i):g<a?(n=.707106781,i=.707106781,r=0):(n=y/(r=Math.sqrt(g)),i=x/r),this.set(n,i,r,t),this}let g=Math.sqrt((f-d)*(f-d)+(c-p)*(c-p)+(u-l)*(u-l));return Math.abs(g)<.001&&(g=1),this.x=(f-d)/g,this.y=(c-p)/g,this.z=(u-l)/g,this.w=Math.acos((s+h+m-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}}fe.prototype.isVector4=!0;class me extends ie{constructor(e,t,n){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new fe(0,0,e,t),this.scissorTest=!1,this.viewport=new fe(0,0,e,t),n=n||{},this.texture=new de(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.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:g,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}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}me.prototype.isWebGLRenderTarget=!0;class ge extends me{constructor(e,t,n){super(e,t,n),this.samples=4}copy(e){return super.copy.call(this,e),this.samples=e.samples,this}}ge.prototype.isWebGLMultisampleRenderTarget=!0;class ve{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,r,a,o){let s=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3];const h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=c,void(e[t+3]=u);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=f);if(u!==f||s!==h||l!==d||c!==p){let e=1-o;const t=s*h+l*d+c*p+u*f,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,o=Math.sin(o*a)/r}const r=o*n;if(s=s*e+h*r,l=l*e+d*r,c=c*e+p*r,u=u*e+f*r,e===1-o){const e=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=e,l*=e,c*=e,u*=e}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],u=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=o*p+c*u+s*d-l*h,e[t+1]=s*p+c*h+l*u-o*d,e[t+2]=l*p+c*d+o*h-s*u,e[t+3]=c*p-o*u-s*h-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,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),u=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);switch(a){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],c=t[6],u=t[10],h=n+o+u;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(c-s)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>o&&n>u){const e=2*Math.sqrt(1+n-o-u);this._w=(c-s)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(o>u){const e=2*Math.sqrt(1+o-n-u);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(s+c)/e}else{const e=2*Math.sqrt(1+u-n-o);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(s+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(oe.clamp(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 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,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),u=Math.sin((1-t)*c)/l,h=Math.sin(t*c)/l;return this._w=a*u+this._w*h,this._x=n*u+this._x*h,this._y=i*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}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(){}}ve.prototype.isQuaternion=!0;class ye{constructor(e=0,t=0,n=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(be.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(be.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,u=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+c*-o-u*-a,this.y=c*s+h*-a+u*-r-l*-o,this.z=u*s+h*-o+l*-a-c*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return 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,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,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 xe.copy(this).projectOnVector(e),this.sub(xe)}reflect(e){return this.sub(xe.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(oe.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,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,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}}ye.prototype.isVector3=!0;const xe=new ye,be=new ve;class we{constructor(e=new ye(1/0,1/0,1/0),t=new ye(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0;for(let s=0,l=e.length;s<l;s+=3){const l=e[s],c=e[s+1],u=e[s+2];l<t&&(t=l),c<n&&(n=c),u<i&&(i=u),l>r&&(r=l),c>a&&(a=c),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0;for(let s=0,l=e.count;s<l;s++){const l=e.getX(s),c=e.getY(s),u=e.getZ(s);l<t&&(t=l),c<n&&(n=c),u<i&&(i=u),l>r&&(r=l),c>a&&(a=c),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),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=Me.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 ye),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 ye),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(),Se.copy(t.boundingBox),Se.applyMatrix4(e.matrixWorld),this.union(Se));const n=e.children;for(let i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new ye),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,Me),Me.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(Pe),Ie.subVectors(this.max,Pe),Te.subVectors(e.a,Pe),Ee.subVectors(e.b,Pe),Ae.subVectors(e.c,Pe),Le.subVectors(Ee,Te),Re.subVectors(Ae,Ee),Ce.subVectors(Te,Ae);let t=[0,-Le.z,Le.y,0,-Re.z,Re.y,0,-Ce.z,Ce.y,Le.z,0,-Le.x,Re.z,0,-Re.x,Ce.z,0,-Ce.x,-Le.y,Le.x,0,-Re.y,Re.x,0,-Ce.y,Ce.x,0];return!!Ne(t,Te,Ee,Ae,Ie)&&!!Ne(t=[1,0,0,0,1,0,0,0,1],Te,Ee,Ae,Ie)&&(De.crossVectors(Le,Re),Ne(t=[De.x,De.y,De.z],Te,Ee,Ae,Ie))}clampPoint(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new ye),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Me.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(Me).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()||(_e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_e)),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)}}we.prototype.isBox3=!0;const _e=[new ye,new ye,new ye,new ye,new ye,new ye,new ye,new ye],Me=new ye,Se=new we,Te=new ye,Ee=new ye,Ae=new ye,Le=new ye,Re=new ye,Ce=new ye,Pe=new ye,Ie=new ye,De=new ye,Oe=new ye;function Ne(e,t,n,i,r){for(let a=0,o=e.length-3;a<=o;a+=3){Oe.fromArray(e,a);const o=r.x*Math.abs(Oe.x)+r.y*Math.abs(Oe.y)+r.z*Math.abs(Oe.z),s=t.dot(Oe),l=n.dot(Oe),c=i.dot(Oe);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const Fe=new we,Be=new ye,ze=new ye,ke=new ye;class He{constructor(e=new ye,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Fe.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new ye),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 we),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){ke.subVectors(e,this.center);const t=ke.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(ke.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return ze.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Be.copy(e.center).add(ze)),this.expandByPoint(Be.copy(e.center).sub(ze)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ue=new ye,Ge=new ye,je=new ye,Ve=new ye,We=new ye,qe=new ye,Xe=new ye;class Ze{constructor(e=new ye,t=new ye(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new ye),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,Ue)),this}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new ye),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=Ue.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ue.copy(this.direction).multiplyScalar(t).add(this.origin),Ue.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ge.copy(e).add(t).multiplyScalar(.5),je.copy(t).sub(e).normalize(),Ve.copy(this.origin).sub(Ge);const r=.5*e.distanceTo(t),a=-this.direction.dot(je),o=Ve.dot(this.direction),s=-Ve.dot(je),l=Ve.lengthSq(),c=Math.abs(1-a*a);let u,h,d,p;if(c>0)if(h=a*o-s,p=r*c,(u=a*s-o)>=0)if(h>=-p)if(h<=p){const e=1/c;d=(u*=e)*(u+a*(h*=e)+2*o)+h*(a*u+h+2*s)+l}else h=r,d=-(u=Math.max(0,-(a*h+o)))*u+h*(h+2*s)+l;else h=-r,d=-(u=Math.max(0,-(a*h+o)))*u+h*(h+2*s)+l;else h<=-p?d=-(u=Math.max(0,-(-a*r+o)))*u+(h=u>0?-r:Math.min(Math.max(-r,-s),r))*(h+2*s)+l:h<=p?(u=0,d=(h=Math.min(Math.max(-r,-s),r))*(h+2*s)+l):d=-(u=Math.max(0,-(a*r+o)))*u+(h=u>0?r:Math.min(Math.max(-r,-s),r))*(h+2*s)+l;else h=a>0?-r:r,d=-(u=Math.max(0,-(a*h+o)))*u+h*(h+2*s)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(je).multiplyScalar(h).add(Ge),d}intersectSphere(e,t){Ue.subVectors(e.center,this.origin);const n=Ue.dot(this.direction),i=Ue.dot(Ue)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(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);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),c>=0?(r=(e.min.y-h.y)*c,a=(e.max.y-h.y)*c):(r=(e.max.y-h.y)*c,a=(e.min.y-h.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Ue)}intersectTriangle(e,t,n,i,r){We.subVectors(t,e),qe.subVectors(n,e),Xe.crossVectors(We,qe);let a,o=this.direction.dot(Xe);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Ve.subVectors(this.origin,e);const s=a*this.direction.dot(qe.crossVectors(Ve,qe));if(s<0)return null;const l=a*this.direction.dot(We.cross(Ve));if(l<0)return null;if(s+l>o)return null;const c=-a*Ve.dot(Xe);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ye{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,a,o,s,l,c,u,h,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=l,g[6]=c,g[10]=u,g[14]=h,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 Ye).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Je.setFromMatrixColumn(e,0).length(),r=1/Je.setFromMatrixColumn(e,1).length(),a=1/Je.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*u,i=o*c,r=o*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*s,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*s}else if("YXZ"===e.order){const e=s*c,n=s*u,i=l*c,r=l*u;t[0]=e+r*o,t[4]=i*o-n,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=a*s}else if("ZXY"===e.order){const e=s*c,n=s*u,i=l*c,r=l*u;t[0]=e-r*o,t[4]=-a*u,t[8]=i+n*o,t[1]=n+i*o,t[5]=a*c,t[9]=r-e*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){const e=a*c,n=a*u,i=o*c,r=o*u;t[0]=s*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=s*u,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=r-e*u,t[8]=i*u+n,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*u+i,t[10]=e-r*u}else if("XZY"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=e*u+r,t[5]=a*c,t[9]=n*u-i,t[2]=i*u-n,t[6]=o*c,t[10]=r*u+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(Qe,e,$e)}lookAt(e,t,n){const i=this.elements;return nt.subVectors(e,t),0===nt.lengthSq()&&(nt.z=1),nt.normalize(),et.crossVectors(n,nt),0===et.lengthSq()&&(1===Math.abs(n.z)?nt.x+=1e-4:nt.z+=1e-4,nt.normalize(),et.crossVectors(n,nt)),et.normalize(),tt.crossVectors(nt,et),i[0]=et.x,i[4]=tt.x,i[8]=nt.x,i[1]=et.y,i[5]=tt.y,i[9]=nt.y,i[2]=et.z,i[6]=tt.z,i[10]=nt.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,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=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],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],I=i[14],D=i[3],O=i[7],N=i[11],F=i[15];return r[0]=a*w+o*T+s*R+l*D,r[4]=a*_+o*E+s*C+l*O,r[8]=a*M+o*A+s*P+l*N,r[12]=a*S+o*L+s*I+l*F,r[1]=c*w+u*T+h*R+d*D,r[5]=c*_+u*E+h*C+d*O,r[9]=c*M+u*A+h*P+d*N,r[13]=c*S+u*L+h*I+d*F,r[2]=p*w+f*T+m*R+g*D,r[6]=p*_+f*E+m*C+g*O,r[10]=p*M+f*A+m*P+g*N,r[14]=p*S+f*L+m*I+g*F,r[3]=v*w+y*T+x*R+b*D,r[7]=v*_+y*E+x*C+b*O,r[11]=v*M+y*A+x*P+b*N,r[15]=v*S+y*L+x*I+b*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+r*s*u-i*l*u-r*o*h+n*l*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+r*a*h-i*a*d+i*l*c-r*s*c)+e[11]*(+t*l*u-t*o*d-r*a*u+n*a*d+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*u+t*o*h+i*a*u-n*a*h+n*s*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 i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=u*m*l-f*h*l+f*s*d-o*m*d-u*s*g+o*h*g,y=p*h*l-c*m*l-p*s*d+a*m*d+c*s*g-a*h*g,x=c*f*l-p*u*l+p*o*d-a*f*d-c*o*g+a*u*g,b=p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*m,w=t*v+n*y+i*x+r*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return e[0]=v*_,e[1]=(f*h*r-u*m*r-f*i*d+n*m*d+u*i*g-n*h*g)*_,e[2]=(o*m*r-f*s*r+f*i*l-n*m*l-o*i*g+n*s*g)*_,e[3]=(u*s*r-o*h*r-u*i*l+n*h*l+o*i*d-n*s*d)*_,e[4]=y*_,e[5]=(c*m*r-p*h*r+p*i*d-t*m*d-c*i*g+t*h*g)*_,e[6]=(p*s*r-a*m*r-p*i*l+t*m*l+a*i*g-t*s*g)*_,e[7]=(a*h*r-c*s*r+c*i*l-t*h*l-a*i*d+t*s*d)*_,e[8]=x*_,e[9]=(p*u*r-c*f*r-p*n*d+t*f*d+c*n*g-t*u*g)*_,e[10]=(a*f*r-p*o*r+p*n*l-t*f*l-a*n*g+t*o*g)*_,e[11]=(c*o*r-a*u*r-c*n*l+t*u*l+a*n*d-t*o*d)*_,e[12]=b*_,e[13]=(c*f*i-p*u*i+p*n*h-t*f*h-c*n*m+t*u*m)*_,e[14]=(p*o*i-a*f*i-p*n*s+t*f*s+a*n*m-t*o*m)*_,e[15]=(a*u*i-c*o*i+c*n*s-t*u*s-a*n*h+t*o*h)*_,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+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 i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,u=o+o,h=r*l,d=r*c,p=r*u,f=a*c,m=a*u,g=o*u,v=s*l,y=s*c,x=s*u,b=n.x,w=n.y,_=n.z;return i[0]=(1-(f+g))*b,i[1]=(d+x)*b,i[2]=(p-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(h+g))*w,i[6]=(m+v)*w,i[7]=0,i[8]=(p+y)*_,i[9]=(m-v)*_,i[10]=(1-(h+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Je.set(i[0],i[1],i[2]).length();const a=Je.set(i[4],i[5],i[6]).length(),o=Je.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Ke.copy(this);const s=1/r,l=1/a,c=1/o;return Ke.elements[0]*=s,Ke.elements[1]*=s,Ke.elements[2]*=s,Ke.elements[4]*=l,Ke.elements[5]*=l,Ke.elements[6]*=l,Ke.elements[8]*=c,Ke.elements[9]*=c,Ke.elements[10]*=c,t.setFromRotationMatrix(Ke),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,s=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),u=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,a){const o=this.elements,s=1/(t-e),l=1/(n-i),c=1/(a-r),u=(t+e)*s,h=(n+i)*l,d=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Ye.prototype.isMatrix4=!0;const Je=new ye,Ke=new Ye,Qe=new ye(0,0,0),$e=new ye(1,1,1),et=new ye,tt=new ye,nt=new ye,it=new Ye,rt=new ve;class at{constructor(e=0,t=0,n=0,i=at.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(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 i=oe.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],p=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),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 it.makeRotationFromQuaternion(e),this.setFromRotationMatrix(it,t,n)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return rt.setFromEuler(this),this.setFromQuaternion(rt,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 ye(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}at.prototype.isEuler=!0,at.DefaultOrder="XYZ",at.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class ot{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 st=0;const lt=new ye,ct=new ve,ut=new Ye,ht=new ye,dt=new ye,pt=new ye,ft=new ve,mt=new ye(1,0,0),gt=new ye(0,1,0),vt=new ye(0,0,1),yt={type:"added"},xt={type:"removed"};function bt(){Object.defineProperty(this,"id",{value:st++}),this.uuid=oe.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bt.DefaultUp.clone();const e=new ye,t=new at,n=new ve,i=new ye(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:i},modelViewMatrix:{value:new Ye},normalMatrix:{value:new le}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=bt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ot,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}bt.DefaultUp=new ye(0,1,0),bt.DefaultMatrixAutoUpdate=!0,bt.prototype=Object.assign(Object.create(ie.prototype),{constructor:bt,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 ct.setFromAxisAngle(e,t),this.quaternion.multiply(ct),this},rotateOnWorldAxis:function(e,t){return ct.setFromAxisAngle(e,t),this.quaternion.premultiply(ct),this},rotateX:function(e){return this.rotateOnAxis(mt,e)},rotateY:function(e){return this.rotateOnAxis(gt,e)},rotateZ:function(e){return this.rotateOnAxis(vt,e)},translateOnAxis:function(e,t){return lt.copy(e).applyQuaternion(this.quaternion),this.position.add(lt.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(mt,e)},translateY:function(e){return this.translateOnAxis(gt,e)},translateZ:function(e){return this.translateOnAxis(vt,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(ut.copy(this.matrixWorld).invert())},lookAt:function(e,t,n){e.isVector3?ht.copy(e):ht.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),dt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ut.lookAt(dt,ht,this.up):ut.lookAt(ht,dt,this.up),this.quaternion.setFromRotationMatrix(ut),i&&(ut.extractRotation(i.matrixWorld),ct.setFromRotationMatrix(ut),this.quaternion.premultiply(ct.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(yt)):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(xt)),this},clear:function(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(xt)}return this.children.length=0,this},attach:function(e){return this.updateWorldMatrix(!0,!1),ut.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),ut.multiply(e.parent.matrixWorld)),e.applyMatrix4(ut),this.add(e),e.updateWorldMatrix(!1,!0),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,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new ye),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 ve),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dt,e,pt),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new ye),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dt,ft,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new ye),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,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;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,i=t.length;n<i;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 i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isMesh||this.isLine||this.isPoints){i.geometry=r(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,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=a(e.geometries),i=a(e.materials),r=a(e.textures),o=a(e.images),s=a(e.shapes),l=a(e.skeletons),c=a(e.animations);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}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 n=0;n<e.children.length;n++){const t=e.children[n];this.add(t.clone())}return this}});const wt=new ye,_t=new ye,Mt=new le;class St{constructor(e=new ye(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=wt.subVectors(n,t).cross(_t.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new ye),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 ye);const n=e.delta(wt),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).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 ye),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Mt.getNormalMatrix(e),i=this.coplanarPoint(wt).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}St.prototype.isPlane=!0;const Tt=new ye,Et=new ye,At=new ye,Lt=new ye,Rt=new ye,Ct=new ye,Pt=new ye,It=new ye,Dt=new ye,Ot=new ye;class Nt{constructor(e=new ye,t=new ye,n=new ye){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new ye),i.subVectors(n,t),Tt.subVectors(e,t),i.cross(Tt);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Tt.subVectors(i,t),Et.subVectors(n,t),At.subVectors(e,t);const a=Tt.dot(Tt),o=Tt.dot(Et),s=Tt.dot(At),l=Et.dot(Et),c=Et.dot(At),u=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new ye),0===u)return r.set(-2,-1,-1);const h=1/u,d=(l*s-o*c)*h,p=(a*c-o*s)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Lt),Lt.x>=0&&Lt.y>=0&&Lt.x+Lt.y<=1}static getUV(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,Lt),s.set(0,0),s.addScaledVector(r,Lt.x),s.addScaledVector(a,Lt.y),s.addScaledVector(o,Lt.z),s}static isFrontFacing(e,t,n,i){return Tt.subVectors(n,t),Et.subVectors(e,t),Tt.cross(Et).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}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 Tt.subVectors(this.c,this.b),Et.subVectors(this.a,this.b),.5*Tt.cross(Et).length()}getMidpoint(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new ye),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nt.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 St),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Nt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return Nt.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Nt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nt.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 ye);const n=this.a,i=this.b,r=this.c;let a,o;Rt.subVectors(i,n),Ct.subVectors(r,n),It.subVectors(e,n);const s=Rt.dot(It),l=Ct.dot(It);if(s<=0&&l<=0)return t.copy(n);Dt.subVectors(e,i);const c=Rt.dot(Dt),u=Ct.dot(Dt);if(c>=0&&u<=c)return t.copy(i);const h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return a=s/(s-c),t.copy(n).addScaledVector(Rt,a);Ot.subVectors(e,r);const d=Rt.dot(Ot),p=Ct.dot(Ot);if(p>=0&&d<=p)return t.copy(r);const f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(Ct,o);const m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return Pt.subVectors(r,i),o=(u-c)/(u-c+(d-p)),t.copy(i).addScaledVector(Pt,o);const g=1/(m+f+h);return a=f*g,o=h*g,t.copy(n).addScaledVector(Rt,a).addScaledVector(Ct,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Ft=0;function Bt(){Object.defineProperty(this,"id",{value:Ft++}),this.uuid=oe.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=n,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Bt.prototype=Object.assign(Object.create(ie.prototype),{constructor:Bt,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 i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.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 i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}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,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.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),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),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.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&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.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}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.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 i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Bt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});const zt={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},kt={h:0,s:0,l:0},Ht={h:0,s:0,l:0};function Ut(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 Gt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function jt(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Vt{constructor(e,t,n){return 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=oe.euclideanModulo(e,1),t=oe.clamp(t,0,1),n=oe.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Ut(r,i,e+1/3),this.g=Ut(r,i,e),this.b=Ut(r,i,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?)\(([^\)]*)\)/.exec(e)){let e;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(e[1])/360,i=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,i,r)}}}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=zt[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=Gt(e.r),this.g=Gt(e.g),this.b=Gt(e.b),this}copyLinearToSRGB(e){return this.r=jt(e.r),this.g=jt(e.g),this.b=jt(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,i=this.b,r=Math.max(t,n,i),a=Math.min(t,n,i);let o,s;const l=(a+r)/2;if(a===r)o=0,s=0;else{const e=r-a;switch(s=l<=.5?e/(r+a):e/(2-r-a),r){case t:o=(n-i)/e+(n<i?6:0);break;case n:o=(i-t)/e+2;break;case i:o=(t-n)/e+4}o/=6}return e.h=o,e.s=s,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(kt),kt.h+=e,kt.s+=t,kt.l+=n,this.setHSL(kt.h,kt.s,kt.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(kt),e.getHSL(Ht);const n=oe.lerp(kt.h,Ht.h,t),i=oe.lerp(kt.s,Ht.s,t),r=oe.lerp(kt.l,Ht.l,t);return this.setHSL(n,i,r),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()}}Vt.NAMES=zt,Vt.prototype.isColor=!0,Vt.prototype.r=1,Vt.prototype.g=1,Vt.prototype.b=1;class Wt extends Bt{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new Vt(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)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this}}Wt.prototype.isMeshBasicMaterial=!0;const qt=new ye,Xt=new se;function Zt(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=ee,this.updateRange={offset:0,count:-1},this.version=0}function Yt(e,t,n){Zt.call(this,new Int8Array(e),t,n)}function Jt(e,t,n){Zt.call(this,new Uint8Array(e),t,n)}function Kt(e,t,n){Zt.call(this,new Uint8ClampedArray(e),t,n)}function Qt(e,t,n){Zt.call(this,new Int16Array(e),t,n)}function $t(e,t,n){Zt.call(this,new Uint16Array(e),t,n)}function en(e,t,n){Zt.call(this,new Int32Array(e),t,n)}function tn(e,t,n){Zt.call(this,new Uint32Array(e),t,n)}function nn(e,t,n){Zt.call(this,new Uint16Array(e),t,n)}function rn(e,t,n){Zt.call(this,new Float32Array(e),t,n)}function an(e,t,n){Zt.call(this,new Float64Array(e),t,n)}function on(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(Zt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Zt.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 i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let r=e[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new Vt),t[n++]=r.r,t[n++]=r.g,t[n++]=r.b}return this},copyVector2sArray:function(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let r=e[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new se),t[n++]=r.x,t[n++]=r.y}return this},copyVector3sArray:function(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let r=e[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new ye),t[n++]=r.x,t[n++]=r.y,t[n++]=r.z}return this},copyVector4sArray:function(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let r=e[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new fe),t[n++]=r.x,t[n++]=r.y,t[n++]=r.z,t[n++]=r.w}return this},applyMatrix3:function(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)Xt.fromBufferAttribute(this,t),Xt.applyMatrix3(e),this.setXY(t,Xt.x,Xt.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)qt.fromBufferAttribute(this,t),qt.applyMatrix3(e),this.setXYZ(t,qt.x,qt.y,qt.z);return this},applyMatrix4:function(e){for(let t=0,n=this.count;t<n;t++)qt.x=this.getX(t),qt.y=this.getY(t),qt.z=this.getZ(t),qt.applyMatrix4(e),this.setXYZ(t,qt.x,qt.y,qt.z);return this},applyNormalMatrix:function(e){for(let t=0,n=this.count;t<n;t++)qt.x=this.getX(t),qt.y=this.getY(t),qt.z=this.getZ(t),qt.applyNormalMatrix(e),this.setXYZ(t,qt.x,qt.y,qt.z);return this},transformDirection:function(e){for(let t=0,n=this.count;t<n;t++)qt.x=this.getX(t),qt.y=this.getY(t),qt.z=this.getZ(t),qt.transformDirection(e),this.setXYZ(t,qt.x,qt.y,qt.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,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ee&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}),Yt.prototype=Object.create(Zt.prototype),Yt.prototype.constructor=Yt,Jt.prototype=Object.create(Zt.prototype),Jt.prototype.constructor=Jt,Kt.prototype=Object.create(Zt.prototype),Kt.prototype.constructor=Kt,Qt.prototype=Object.create(Zt.prototype),Qt.prototype.constructor=Qt,$t.prototype=Object.create(Zt.prototype),$t.prototype.constructor=$t,en.prototype=Object.create(Zt.prototype),en.prototype.constructor=en,tn.prototype=Object.create(Zt.prototype),tn.prototype.constructor=tn,nn.prototype=Object.create(Zt.prototype),nn.prototype.constructor=nn,nn.prototype.isFloat16BufferAttribute=!0,rn.prototype=Object.create(Zt.prototype),rn.prototype.constructor=rn,an.prototype=Object.create(Zt.prototype),an.prototype.constructor=an;const sn={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ln(e,t){return new sn[e](t)}let cn=0;const un=new Ye,hn=new bt,dn=new ye,pn=new we,fn=new we,mn=new ye;function gn(){Object.defineProperty(this,"id",{value:cn++}),this.uuid=oe.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={}}gn.prototype=Object.assign(Object.create(ie.prototype),{constructor:gn,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(on(e)>65535?tn:$t)(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 le).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return un.makeRotationX(e),this.applyMatrix4(un),this},rotateY:function(e){return un.makeRotationY(e),this.applyMatrix4(un),this},rotateZ:function(e){return un.makeRotationZ(e),this.applyMatrix4(un),this},translate:function(e,t,n){return un.makeTranslation(e,t,n),this.applyMatrix4(un),this},scale:function(e,t,n){return un.makeScale(e,t,n),this.applyMatrix4(un),this},lookAt:function(e){return hn.lookAt(e),hn.updateMatrix(),this.applyMatrix4(hn.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(dn).negate(),this.translate(dn.x,dn.y,dn.z),this},setFromPoints:function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new rn(t,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new we);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 ye(-1/0,-1/0,-1/0),new ye(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const e=t[n];pn.setFromBufferAttribute(e),this.morphTargetsRelative?(mn.addVectors(this.boundingBox.min,pn.min),this.boundingBox.expandByPoint(mn),mn.addVectors(this.boundingBox.max,pn.max),this.boundingBox.expandByPoint(mn)):(this.boundingBox.expandByPoint(pn.min),this.boundingBox.expandByPoint(pn.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 He);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 ye,1/0);if(e){const n=this.boundingSphere.center;if(pn.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){const n=t[e];fn.setFromBufferAttribute(n),this.morphTargetsRelative?(mn.addVectors(pn.min,fn.min),pn.expandByPoint(mn),mn.addVectors(pn.max,fn.max),pn.expandByPoint(mn)):(pn.expandByPoint(fn.min),pn.expandByPoint(fn.max))}pn.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)mn.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(mn));if(t)for(let r=0,a=t.length;r<a;r++){const a=t[r],o=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)mn.fromBufferAttribute(a,t),o&&(dn.fromBufferAttribute(e,t),mn.add(dn)),i=Math.max(i,n.distanceToSquared(mn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeTangents:function(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.array,i=t.position.array,r=t.normal.array,a=t.uv.array,o=i.length/3;void 0===t.tangent&&this.setAttribute("tangent",new Zt(new Float32Array(4*o),4));const s=t.tangent.array,l=[],c=[];for(let T=0;T<o;T++)l[T]=new ye,c[T]=new ye;const u=new ye,h=new ye,d=new ye,p=new se,f=new se,m=new se,g=new ye,v=new ye;function y(e,t,n){u.fromArray(i,3*e),h.fromArray(i,3*t),d.fromArray(i,3*n),p.fromArray(a,2*e),f.fromArray(a,2*t),m.fromArray(a,2*n),h.sub(u),d.sub(u),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(r),v.copy(d).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(r),l[e].add(g),l[t].add(g),l[n].add(g),c[e].add(v),c[t].add(v),c[n].add(v))}let x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(let T=0,E=x.length;T<E;++T){const e=x[T],t=e.start;for(let i=t,r=t+e.count;i<r;i+=3)y(n[i+0],n[i+1],n[i+2])}const b=new ye,w=new ye,_=new ye,M=new ye;function S(e){_.fromArray(r,3*e),M.copy(_);const t=l[e];b.copy(t),b.sub(_.multiplyScalar(_.dot(t))).normalize(),w.crossVectors(M,t);const n=w.dot(c[e])<0?-1:1;s[4*e]=b.x,s[4*e+1]=b.y,s[4*e+2]=b.z,s[4*e+3]=n}for(let T=0,E=x.length;T<E;++T){const e=x[T],t=e.start;for(let i=t,r=t+e.count;i<r;i+=3)S(n[i+0]),S(n[i+1]),S(n[i+2])}},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 Zt(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 i=new ye,r=new ye,a=new ye,o=new ye,s=new ye,l=new ye,c=new ye,u=new ye;if(e)for(let h=0,d=e.count;h<d;h+=3){const d=e.getX(h+0),p=e.getX(h+1),f=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),c.subVectors(a,r),u.subVectors(i,r),c.cross(u),o.fromBufferAttribute(n,d),s.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),o.add(c),s.add(c),l.add(c),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,h=t.count;e<h;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),u.subVectors(i,r),c.cross(u),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 i in n){if(void 0===e.attributes[i])continue;const r=n[i].array,a=e.attributes[i],o=a.array,s=a.itemSize*t,l=Math.min(o.length,r.length-s);for(let e=0,t=s;e<l;e++,t++)r[t]=o[e]}return this},normalizeNormals:function(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)mn.fromBufferAttribute(e,t),mn.normalize(),e.setXYZ(t,mn.x,mn.y,mn.z)},toNonIndexed:function(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i);let o=0,s=0;for(let l=0,c=t.length;l<c;l++){o=t[l]*i;for(let e=0;e<i;e++)a[s++]=n[o++]}return new Zt(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new gn,n=this.index.array,i=this.attributes;for(const o in i){const r=e(i[o],n);t.setAttribute(o,r)}const r=this.morphAttributes;for(const o in r){const i=[],a=r[o];for(let t=0,r=a.length;t<r;t++){const r=e(a[t],n);i.push(r)}t.morphAttributes[o]=i}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,s=a.length;o<s;o++){const e=a[o];t.addGroup(e.start,e.count,e.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 s in n){const t=n[s];e.data.attributes[s]=t.toJSON(e.data)}const i={};let r=!1;for(const s in this.morphAttributes){const t=this.morphAttributes[s],n=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];n.push(r.toJSON(e.data))}n.length>0&&(i[s]=n,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e},clone:function(){return(new gn).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 i=e.attributes;for(const l in i){const e=i[l];this.setAttribute(l,e.clone(t))}const r=e.morphAttributes;for(const l in r){const e=[],n=r[l];for(let i=0,r=n.length;i<r;i++)e.push(n[i].clone(t));this.morphAttributes[l]=e}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,c=a.length;l<c;l++){const e=a[l];this.addGroup(e.start,e.count,e.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=e.boundingSphere;return null!==s&&(this.boundingSphere=s.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 vn=new Ye,yn=new Ze,xn=new He,bn=new ye,wn=new ye,_n=new ye,Mn=new ye,Sn=new ye,Tn=new ye,En=new ye,An=new ye,Ln=new ye,Rn=new se,Cn=new se,Pn=new se,In=new ye,Dn=new ye;function On(e=new gn,t=new Wt){bt.call(this),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}function Nn(e,t,n,i,r,a,o,s,l,c,u,h){bn.fromBufferAttribute(r,c),wn.fromBufferAttribute(r,u),_n.fromBufferAttribute(r,h);const d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){En.set(0,0,0),An.set(0,0,0),Ln.set(0,0,0);for(let e=0,t=a.length;e<t;e++){const t=d[e],n=a[e];0!==t&&(Mn.fromBufferAttribute(n,c),Sn.fromBufferAttribute(n,u),Tn.fromBufferAttribute(n,h),o?(En.addScaledVector(Mn,t),An.addScaledVector(Sn,t),Ln.addScaledVector(Tn,t)):(En.addScaledVector(Mn.sub(bn),t),An.addScaledVector(Sn.sub(wn),t),Ln.addScaledVector(Tn.sub(_n),t)))}bn.add(En),wn.add(An),_n.add(Ln)}e.isSkinnedMesh&&t.skinning&&(e.boneTransform(c,bn),e.boneTransform(u,wn),e.boneTransform(h,_n));const p=function(e,t,n,i,r,a,o,s){let l;if(null===(l=1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,2!==t.side,s)))return null;Dn.copy(s),Dn.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Dn);return c<n.near||c>n.far?null:{distance:c,point:Dn.clone(),object:e}}(e,t,n,i,bn,wn,_n,In);if(p){s&&(Rn.fromBufferAttribute(s,c),Cn.fromBufferAttribute(s,u),Pn.fromBufferAttribute(s,h),p.uv=Nt.getUV(In,bn,wn,_n,Rn,Cn,Pn,new se)),l&&(Rn.fromBufferAttribute(l,c),Cn.fromBufferAttribute(l,u),Pn.fromBufferAttribute(l,h),p.uv2=Nt.getUV(In,bn,wn,_n,Rn,Cn,Pn,new se));const e={a:c,b:u,c:h,normal:new ye,materialIndex:0};Nt.getNormal(bn,wn,_n,e.normal),p.face=e}return p}On.prototype=Object.assign(Object.create(bt.prototype),{constructor:On,isMesh:!0,copy:function(e){return bt.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,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),xn.copy(n.boundingSphere),xn.applyMatrix4(r),!1===e.ray.intersectsSphere(xn))return;if(vn.copy(r).invert(),yn.copy(e.ray).applyMatrix4(vn),null!==n.boundingBox&&!1===yn.intersectsBox(n.boundingBox))return;let a;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,s=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,u=n.attributes.uv2,h=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=h.length;n<p;n++){const p=h[n],f=i[p.materialIndex];for(let n=Math.max(p.start,d.start),i=Math.min(p.start+p.count,d.start+d.count);n<i;n+=3){const i=r.getX(n),h=r.getX(n+1),d=r.getX(n+2);(a=Nn(this,f,e,yn,o,s,l,c,u,i,h,d))&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=p.materialIndex,t.push(a))}}else for(let n=Math.max(0,d.start),p=Math.min(r.count,d.start+d.count);n<p;n+=3){const h=r.getX(n),d=r.getX(n+1),p=r.getX(n+2);(a=Nn(this,i,e,yn,o,s,l,c,u,h,d,p))&&(a.faceIndex=Math.floor(n/3),t.push(a))}else if(void 0!==o)if(Array.isArray(i))for(let n=0,p=h.length;n<p;n++){const r=h[n],p=i[r.materialIndex];for(let n=Math.max(r.start,d.start),i=Math.min(r.start+r.count,d.start+d.count);n<i;n+=3)(a=Nn(this,p,e,yn,o,s,l,c,u,n,n+1,n+2))&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=r.materialIndex,t.push(a))}else for(let n=Math.max(0,d.start),p=Math.min(o.count,d.start+d.count);n<p;n+=3)(a=Nn(this,i,e,yn,o,s,l,c,u,n,n+1,n+2))&&(a.faceIndex=Math.floor(n/3),t.push(a))}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}});class Fn extends gn{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],u=[];let h=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){const y=a/m,x=p/g,b=a/2,w=p/2,_=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new ye;for(let o=0;o<S;o++){const a=o*x-w;for(let s=0;s<M;s++){const h=s*y-b;A[e]=h*i,A[t]=a*r,A[n]=_,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),u.push(s/m),u.push(1-o/g),T+=1}}for(let o=0;o<g;o++)for(let e=0;e<m;e++){const t=h+e+M*o,n=h+e+M*(o+1),i=h+(e+1)+M*(o+1),r=h+(e+1)+M*o;s.push(t,n,r),s.push(n,i,r),E+=6}o.addGroup(d,E,v),d+=E,h+=T}p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new rn(l,3)),this.setAttribute("normal",new rn(c,3)),this.setAttribute("uv",new rn(u,2))}}function Bn(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function zn(e){const t={};for(let n=0;n<e.length;n++){const i=Bn(e[n]);for(const e in i)t[e]=i[e]}return t}const kn={clone:Bn,merge:zn};function Hn(e){Bt.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 Un(){bt.call(this),this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye}function Gn(e=50,t=1,n=.1,i=2e3){Un.call(this),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Hn.prototype=Object.create(Bt.prototype),Hn.prototype.constructor=Hn,Hn.prototype.isShaderMaterial=!0,Hn.prototype.copy=function(e){return Bt.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Bn(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},Hn.prototype.toJSON=function(e){const t=Bt.prototype.toJSON.call(this,e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t},Un.prototype=Object.assign(Object.create(bt.prototype),{constructor:Un,isCamera:!0,copy:function(e,t){return bt.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 ye),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){bt.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(e,t){bt.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Gn.prototype=Object.assign(Object.create(Un.prototype),{constructor:Gn,isPerspectiveCamera:!0,copy:function(e,t){return Un.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*oe.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){const e=Math.tan(.5*oe.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*oe.RAD2DEG*Math.atan(Math.tan(.5*oe.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,i,r,a){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=i,this.view.width=r,this.view.height=a,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*oe.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,o=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/o,i*=a.width/e,n*=a.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(e){const t=bt.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}});class jn extends bt{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new Gn(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new ye(1,0,0)),this.add(i);const r=new Gn(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new ye(-1,0,0)),this.add(r);const a=new Gn(90,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new ye(0,1,0)),this.add(a);const o=new Gn(90,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new ye(0,-1,0)),this.add(o);const s=new Gn(90,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new ye(0,0,1)),this.add(s);const l=new Gn(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new ye(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,a,o,s,l]=this.children,c=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.xr.enabled=c}}class Vn extends de{constructor(e,t,n,i,a,o,s,l,c,u){super(e=void 0!==e?e:[],t=void 0!==t?t:r,n,i,a,o,s=void 0!==s?s:T,l,c,u),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Vn.prototype.isCubeTexture=!0;class Wn extends me{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new Vn(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:g,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=E,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n=new Fn(5,5,5),i=new Hn({name:"CubemapFromEquirect",uniforms:Bn({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:1,blending:0});i.uniforms.tEquirect.value=t;const r=new On(n,i),a=t.minFilter;return t.minFilter===y&&(t.minFilter=g),new jn(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}Wn.prototype.isWebGLCubeRenderTarget=!0;class qn extends de{constructor(e,t,n,i,r,a,o,s,l,c,u,h){super(null,a,o,s,l,c,i,r,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:p,this.minFilter=void 0!==c?c:p,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}qn.prototype.isDataTexture=!0;const Xn=new He,Zn=new ye;class Yn{constructor(e=new St,t=new St,n=new St,i=new St,r=new St,a=new St){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=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(o-i,u-s,f-h,y-m).normalize(),t[1].setComponents(o+i,u+s,f+h,y+m).normalize(),t[2].setComponents(o+r,u+l,f+d,y+g).normalize(),t[3].setComponents(o-r,u-l,f-d,y-g).normalize(),t[4].setComponents(o-a,u-c,f-p,y-v).normalize(),t[5].setComponents(o+a,u+c,f+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Xn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Xn)}intersectsSprite(e){return Xn.center.set(0,0,0),Xn.radius=.7071067811865476,Xn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xn)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Zn.x=i.normal.x>0?e.max.x:e.min.x,Zn.y=i.normal.y>0?e.max.y:e.min.y,Zn.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Zn)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Jn(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Kn(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version<t.version)&&i.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}))}t.isInterleavedBufferAttribute&&(t=t.data);const a=i.get(t);void 0===a?i.set(t,function(t,i){const r=t.array,a=t.usage,o=e.createBuffer();e.bindBuffer(i,o),e.bufferData(i,r,a),t.onUploadCallback();let s=5126;return r instanceof Float32Array?s=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?t.isFloat16BufferAttribute?n?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:r instanceof Int16Array?s=5122:r instanceof Uint32Array?s=5125:r instanceof Int32Array?s=5124:r instanceof Int8Array?s=5120:r instanceof Uint8Array&&(s=5121),{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(t,r)):a.version<t.version&&(function(t,i,r){const a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,t,r),a.version=t.version)}}}class Qn extends gn{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),s=Math.floor(i),l=o+1,c=s+1,u=e/o,h=t/s,d=[],p=[],f=[],m=[];for(let g=0;g<c;g++){const e=g*h-a;for(let t=0;t<l;t++){const n=t*u-r;p.push(n,-e,0),f.push(0,0,1),m.push(t/o),m.push(1-g/s)}}for(let g=0;g<s;g++)for(let e=0;e<o;e++){const t=e+l*g,n=e+l*(g+1),i=e+1+l*(g+1),r=e+1+l*g;d.push(t,n,r),d.push(n,i,r)}this.setIndex(d),this.setAttribute("position",new rn(p,3)),this.setAttribute("normal",new rn(f,3)),this.setAttribute("uv",new rn(m,2))}}const $n={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, float faceDirection ) {\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 ) * faceDirection;\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:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\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(\t\t0, 1,\t\t0 ),\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:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#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 * faceDirection;\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 * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\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 * faceDirection;\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, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\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, float faceDirection ) {\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\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\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, faceDirection );\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\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.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\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.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(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.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}"},ei={common:{diffuse:{value:new Vt(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new le},uv2Transform:{value:new le},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 se(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 Vt(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 Vt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new le}},sprite:{diffuse:{value:new Vt(15658734)},opacity:{value:1},center:{value:new se(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new le}}},ti={basic:{uniforms:zn([ei.common,ei.specularmap,ei.envmap,ei.aomap,ei.lightmap,ei.fog]),vertexShader:$n.meshbasic_vert,fragmentShader:$n.meshbasic_frag},lambert:{uniforms:zn([ei.common,ei.specularmap,ei.envmap,ei.aomap,ei.lightmap,ei.emissivemap,ei.fog,ei.lights,{emissive:{value:new Vt(0)}}]),vertexShader:$n.meshlambert_vert,fragmentShader:$n.meshlambert_frag},phong:{uniforms:zn([ei.common,ei.specularmap,ei.envmap,ei.aomap,ei.lightmap,ei.emissivemap,ei.bumpmap,ei.normalmap,ei.displacementmap,ei.fog,ei.lights,{emissive:{value:new Vt(0)},specular:{value:new Vt(1118481)},shininess:{value:30}}]),vertexShader:$n.meshphong_vert,fragmentShader:$n.meshphong_frag},standard:{uniforms:zn([ei.common,ei.envmap,ei.aomap,ei.lightmap,ei.emissivemap,ei.bumpmap,ei.normalmap,ei.displacementmap,ei.roughnessmap,ei.metalnessmap,ei.fog,ei.lights,{emissive:{value:new Vt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$n.meshphysical_vert,fragmentShader:$n.meshphysical_frag},toon:{uniforms:zn([ei.common,ei.aomap,ei.lightmap,ei.emissivemap,ei.bumpmap,ei.normalmap,ei.displacementmap,ei.gradientmap,ei.fog,ei.lights,{emissive:{value:new Vt(0)}}]),vertexShader:$n.meshtoon_vert,fragmentShader:$n.meshtoon_frag},matcap:{uniforms:zn([ei.common,ei.bumpmap,ei.normalmap,ei.displacementmap,ei.fog,{matcap:{value:null}}]),vertexShader:$n.meshmatcap_vert,fragmentShader:$n.meshmatcap_frag},points:{uniforms:zn([ei.points,ei.fog]),vertexShader:$n.points_vert,fragmentShader:$n.points_frag},dashed:{uniforms:zn([ei.common,ei.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$n.linedashed_vert,fragmentShader:$n.linedashed_frag},depth:{uniforms:zn([ei.common,ei.displacementmap]),vertexShader:$n.depth_vert,fragmentShader:$n.depth_frag},normal:{uniforms:zn([ei.common,ei.bumpmap,ei.normalmap,ei.displacementmap,{opacity:{value:1}}]),vertexShader:$n.normal_vert,fragmentShader:$n.normal_frag},sprite:{uniforms:zn([ei.sprite,ei.fog]),vertexShader:$n.sprite_vert,fragmentShader:$n.sprite_frag},background:{uniforms:{uvTransform:{value:new le},t2D:{value:null}},vertexShader:$n.background_vert,fragmentShader:$n.background_frag},cube:{uniforms:zn([ei.envmap,{opacity:{value:1}}]),vertexShader:$n.cube_vert,fragmentShader:$n.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$n.equirect_vert,fragmentShader:$n.equirect_frag},distanceRGBA:{uniforms:zn([ei.common,ei.displacementmap,{referencePosition:{value:new ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$n.distanceRGBA_vert,fragmentShader:$n.distanceRGBA_frag},shadow:{uniforms:zn([ei.lights,ei.fog,{color:{value:new Vt(0)},opacity:{value:1}}]),vertexShader:$n.shadow_vert,fragmentShader:$n.shadow_frag}};function ni(e,t,n,i,r){const a=new Vt(0);let o,s,c=0,u=null,h=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),p(a,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){p(a,c=e)},render:function(n,r,f,m){let g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));const v=e.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(g=null),null===g?p(a,c):g&&g.isColor&&(p(g,1),m=!0),(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===l)?(void 0===s&&((s=new On(new Fn(1,1,1),new Hn({name:"BackgroundCubeMaterial",uniforms:Bn(ti.cube.uniforms),vertexShader:ti.cube.vertexShader,fragmentShader:ti.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(s)),s.material.uniforms.envMap.value=g,s.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g._needsFlipEnvMap?-1:1,u===g&&h===g.version&&d===e.toneMapping||(s.material.needsUpdate=!0,u=g,h=g.version,d=e.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):g&&g.isTexture&&(void 0===o&&((o=new On(new Qn(2,2),new Hn({name:"BackgroundMaterial",uniforms:Bn(ti.background.uniforms),vertexShader:ti.background.vertexShader,fragmentShader:ti.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),o.material.uniforms.uvTransform.value.copy(g.matrix),u===g&&h===g.version&&d===e.toneMapping||(o.material.needsUpdate=!0,u=g,h=g.version,d=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function ii(e,t,n,i){const r=e.getParameter(34921),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==a,s={},l=d(null);let c=l;function u(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function h(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function d(e){const t=[],n=[],i=[];for(let a=0;a<r;a++)t[a]=0,n[a]=0,i[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:i,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,r){const a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==r&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),s[n]=r)}function g(){const t=c.newAttributes,n=c.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function v(t,n,r,a,o,s){!0!==i.isWebGL2||5124!==r&&5125!==r?e.vertexAttribPointer(t,n,r,a,o,s):e.vertexAttribIPointer(t,n,r,o,s)}function y(){x(),c!==l&&u((c=l).object)}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,h,y,x){let b=!1;if(o){const t=function(t,n,r){const o=!0===r.wireframe;let l=s[t.id];void 0===l&&(l={},s[t.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let u=c[o];return void 0===u&&(u=d(i.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),c[o]=u),u}(y,h,l);c!==t&&u((c=t).object),(b=function(e,t){const n=c.attributes,i=e.attributes;let r=0;for(const a in i){const e=n[a],t=i[a];if(void 0===e)return!0;if(e.attribute!==t)return!0;if(e.data!==t.data)return!0;r++}return c.attributesNum!==r||c.index!==t}(y,x))&&function(e,t){const n={},i=y.attributes;let r=0;for(const a in i){const e=i[a],t={};t.attribute=e,e.data&&(t.data=e.data),n[a]=t,r++}c.attributes=n,c.attributesNum=r,c.index=t}(0,x)}else{const e=!0===l.wireframe;c.geometry===y.id&&c.program===h.id&&c.wireframe===e||(c.geometry=y.id,c.program=h.id,c.wireframe=e,b=!0)}!0===r.isInstancedMesh&&(b=!0),null!==x&&n.update(x,34963),b&&(function(r,a,o,s){if(!1===i.isWebGL2&&(r.isInstancedMesh||s.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;p();const l=s.attributes,c=o.getAttributes(),u=a.defaultAttributeValues;for(const t in c){const i=c[t];if(i>=0){const a=l[t];if(void 0!==a){const t=a.normalized,r=a.itemSize,o=n.get(a);if(void 0===o)continue;const l=o.buffer,c=o.type,u=o.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,o=n.stride,h=a.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),e.bindBuffer(34962,l),v(i,r,c,t,o*u,h*u)}else a.isInstancedBufferAttribute?(m(i,a.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)):f(i),e.bindBuffer(34962,l),v(i,r,c,t,0,0)}else if("instanceMatrix"===t){const t=n.get(r.instanceMatrix);if(void 0===t)continue;const a=t.buffer,o=t.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),e.bindBuffer(34962,a),e.vertexAttribPointer(i+0,4,o,!1,64,0),e.vertexAttribPointer(i+1,4,o,!1,64,16),e.vertexAttribPointer(i+2,4,o,!1,64,32),e.vertexAttribPointer(i+3,4,o,!1,64,48)}else if("instanceColor"===t){const t=n.get(r.instanceColor);if(void 0===t)continue;const a=t.buffer,o=t.type;m(i,1),e.bindBuffer(34962,a),e.vertexAttribPointer(i,3,o,!1,12,0)}else if(void 0!==u){const n=u[t];if(void 0!==n)switch(n.length){case 2:e.vertexAttrib2fv(i,n);break;case 3:e.vertexAttrib3fv(i,n);break;case 4:e.vertexAttrib4fv(i,n);break;default:e.vertexAttrib1fv(i,n)}}}}g()}(r,l,h,y),null!==x&&e.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const e in s){const t=s[e];for(const e in t){const n=t[e];for(const e in n)h(n[e].object),delete n[e];delete t[e]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0===s[e.id])return;const t=s[e.id];for(const n in t){const e=t[n];for(const t in e)h(e[t].object),delete e[t];delete t[n]}delete s[e.id]},releaseStatesOfProgram:function(e){for(const t in s){const n=s[t];if(void 0===n[e.id])continue;const i=n[e.id];for(const e in i)h(i[e].object),delete i[e];delete n[e.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function ri(e,t,n,i){const r=i.isWebGL2;let a;this.setMode=function(e){a=e},this.render=function(t,i){e.drawArrays(a,t,i),n.update(i,a,1)},this.renderInstances=function(i,o,s){if(0===s)return;let l,c;if(r)l=e,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](a,i,o,s),n.update(o,a,s)}}function ai(e,t,n){let i;function r(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 a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=u>0,y=a||t.has("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function oi(e){const t=this;let n=null,i=0,r=!1,a=!1;const o=new St,s=new le,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function u(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;s.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let n=0,l=i;n!==a;++n,l+=4)o.copy(e[n]).applyMatrix4(r,s),o.normal.toArray(c,l),c[l+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,a){const o=0!==e.length||t||0!==i||r;return r=t,n=u(e,a,0),i=e.length,o},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,c()},this.setState=function(t,o,s){const h=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows,f=e.get(t);if(!r||null===h||0===h.length||a&&!p)a?u(null):c();else{const e=a?0:i,t=4*e;let r=f.clippingState||null;l.value=r,r=u(h,o,t,s);for(let i=0;i!==t;++i)r[i]=n[i];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}}}function si(e){let t=new WeakMap;function n(e,t){return t===o?e.mapping=r:t===s&&(e.mapping=a),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===o||a===s){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const o=e.getRenderTarget(),s=new Wn(a.height/2);return s.fromEquirectangularTexture(e,r),t.set(r,s),e.setRenderTarget(o),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}function li(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=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":i=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":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function ci(e,t,n,i){const r={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const n in s.attributes)t.remove(s.attributes[n]);s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}const s=new(on(n)>65535?tn:$t)(n,1);s.version=o;const l=a.get(e);l&&t.remove(l),a.set(e,s)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(e){const n=e.attributes;for(const r in n)t.update(n[r],34962);const i=e.morphAttributes;for(const r in i){const e=i[r];for(let n=0,i=e.length;n<i;n++)t.update(e[n],34962)}},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function ui(e,t,n,i){const r=i.isWebGL2;let a,o,s;this.setMode=function(e){a=e},this.setIndex=function(e){o=e.type,s=e.bytesPerElement},this.render=function(t,i){e.drawElements(a,i,o,t*s),n.update(i,a,1)},this.renderInstances=function(i,l,c){if(0===c)return;let u,h;if(r)u=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[h](a,l,o,i*s,c),n.update(l,a,c)}}function hi(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,i){switch(t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function di(e,t){return e[0]-t[0]}function pi(e,t){return Math.abs(t[1])-Math.abs(e[1])}function fi(e){const t={},n=new Float32Array(8),i=[];for(let r=0;r<8;r++)i[r]=[r,0];return{update:function(r,a,o,s){const l=r.morphTargetInfluences,c=void 0===l?0:l.length;let u=t[a.id];if(void 0===u){u=[];for(let e=0;e<c;e++)u[e]=[e,0];t[a.id]=u}for(let e=0;e<c;e++){const t=u[e];t[0]=e,t[1]=l[e]}u.sort(pi);for(let e=0;e<8;e++)e<c&&u[e][1]?(i[e][0]=u[e][0],i[e][1]=u[e][1]):(i[e][0]=Number.MAX_SAFE_INTEGER,i[e][1]=0);i.sort(di);const h=o.morphTargets&&a.morphAttributes.position,d=o.morphNormals&&a.morphAttributes.normal;let p=0;for(let e=0;e<8;e++){const t=i[e],r=t[0],o=t[1];r!==Number.MAX_SAFE_INTEGER&&o?(h&&a.getAttribute("morphTarget"+e)!==h[r]&&a.setAttribute("morphTarget"+e,h[r]),d&&a.getAttribute("morphNormal"+e)!==d[r]&&a.setAttribute("morphNormal"+e,d[r]),n[e]=o,p+=o):(h&&!0===a.hasAttribute("morphTarget"+e)&&a.deleteAttribute("morphTarget"+e),d&&!0===a.hasAttribute("morphNormal"+e)&&a.deleteAttribute("morphNormal"+e),n[e]=0)}const f=a.morphTargetsRelative?1:1-p;s.getUniforms().setValue(e,"morphTargetBaseInfluence",f),s.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function mi(e,t,n,i){let r=new WeakMap;function a(e){const t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){const o=i.render.frame,s=e.geometry,l=t.get(e,s);return r.get(l)!==o&&(t.update(l),r.set(l,o)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",a)&&e.addEventListener("dispose",a),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}ti.physical={uniforms:zn([ti.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new se(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Vt(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:$n.meshphysical_vert,fragmentShader:$n.meshphysical_frag};class gi extends de{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=p,this.minFilter=p,this.wrapR=h,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}gi.prototype.isDataTexture2DArray=!0;class vi extends de{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=p,this.minFilter=p,this.wrapR=h,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}vi.prototype.isDataTexture3D=!0;const yi=new de,xi=new gi,bi=new vi,wi=new Vn,_i=[],Mi=[],Si=new Float32Array(16),Ti=new Float32Array(9),Ei=new Float32Array(4);function Ai(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let a=_i[r];if(void 0===a&&(a=new Float32Array(r),_i[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function Li(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Ri(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function Ci(e,t){let n=Mi[t];void 0===n&&(n=new Int32Array(t),Mi[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function Pi(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ii(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(Li(n,t))return;e.uniform2fv(this.addr,t),Ri(n,t)}}function Di(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(Li(n,t))return;e.uniform3fv(this.addr,t),Ri(n,t)}}function Oi(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(Li(n,t))return;e.uniform4fv(this.addr,t),Ri(n,t)}}function Ni(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(Li(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ri(n,t)}else{if(Li(n,i))return;Ei.set(i),e.uniformMatrix2fv(this.addr,!1,Ei),Ri(n,i)}}function Fi(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(Li(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ri(n,t)}else{if(Li(n,i))return;Ti.set(i),e.uniformMatrix3fv(this.addr,!1,Ti),Ri(n,i)}}function Bi(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(Li(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ri(n,t)}else{if(Li(n,i))return;Si.set(i),e.uniformMatrix4fv(this.addr,!1,Si),Ri(n,i)}}function zi(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function ki(e,t){const n=this.cache;Li(n,t)||(e.uniform2iv(this.addr,t),Ri(n,t))}function Hi(e,t){const n=this.cache;Li(n,t)||(e.uniform3iv(this.addr,t),Ri(n,t))}function Ui(e,t){const n=this.cache;Li(n,t)||(e.uniform4iv(this.addr,t),Ri(n,t))}function Gi(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function ji(e,t){const n=this.cache;Li(n,t)||(e.uniform2uiv(this.addr,t),Ri(n,t))}function Vi(e,t){const n=this.cache;Li(n,t)||(e.uniform3uiv(this.addr,t),Ri(n,t))}function Wi(e,t){const n=this.cache;Li(n,t)||(e.uniform4uiv(this.addr,t),Ri(n,t))}function qi(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||yi,r)}function Xi(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||bi,r)}function Zi(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||wi,r)}function Yi(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||xi,r)}function Ji(e,t){e.uniform1fv(this.addr,t)}function Ki(e,t){const n=Ai(t,this.size,2);e.uniform2fv(this.addr,n)}function Qi(e,t){const n=Ai(t,this.size,3);e.uniform3fv(this.addr,n)}function $i(e,t){const n=Ai(t,this.size,4);e.uniform4fv(this.addr,n)}function er(e,t){const n=Ai(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function tr(e,t){const n=Ai(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function nr(e,t){const n=Ai(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function ir(e,t){e.uniform1iv(this.addr,t)}function rr(e,t){e.uniform2iv(this.addr,t)}function ar(e,t){e.uniform3iv(this.addr,t)}function or(e,t){e.uniform4iv(this.addr,t)}function sr(e,t){e.uniform1uiv(this.addr,t)}function lr(e,t){e.uniform2uiv(this.addr,t)}function cr(e,t){e.uniform3uiv(this.addr,t)}function ur(e,t){e.uniform4uiv(this.addr,t)}function hr(e,t,n){const i=t.length,r=Ci(n,i);e.uniform1iv(this.addr,r);for(let a=0;a!==i;++a)n.safeSetTexture2D(t[a]||yi,r[a])}function dr(e,t,n){const i=t.length,r=Ci(n,i);e.uniform1iv(this.addr,r);for(let a=0;a!==i;++a)n.safeSetTextureCube(t[a]||wi,r[a])}function pr(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(t.type){case 5126:return Pi;case 35664:return Ii;case 35665:return Di;case 35666:return Oi;case 35674:return Ni;case 35675:return Fi;case 35676:return Bi;case 5124:case 35670:return zi;case 35667:case 35671:return ki;case 35668:case 35672:return Hi;case 35669:case 35673:return Ui;case 5125:return Gi;case 36294:return ji;case 36295:return Vi;case 36296:return Wi;case 35678:case 36198:case 36298:case 36306:case 35682:return qi;case 35679:case 36299:case 36307:return Xi;case 35680:case 36300:case 36308:case 36293:return Zi;case 36289:case 36303:case 36311:case 36292:return Yi}}()}function fr(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(t.type){case 5126:return Ji;case 35664:return Ki;case 35665:return Qi;case 35666:return $i;case 35674:return er;case 35675:return tr;case 35676:return nr;case 5124:case 35670:return ir;case 35667:case 35671:return rr;case 35668:case 35672:return ar;case 35669:case 35673:return or;case 5125:return sr;case 36294:return lr;case 36295:return cr;case 36296:return ur;case 35678:case 36198:case 36298:case 36306:case 35682:return hr;case 35680:case 36300:case 36308:case 36293:return dr}}()}function mr(e){this.id=e,this.seq=[],this.map={}}fr.prototype.updateCache=function(e){const t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ri(t,e)},mr.prototype.setValue=function(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(e,t[a.id],n)}};const gr=/(\w+)(\])?(\[|\.)?/g;function vr(e,t){e.seq.push(t),e.map[t.id]=t}function yr(e,t,n){const i=e.name,r=i.length;for(gr.lastIndex=0;;){const a=gr.exec(i),o=gr.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){vr(n,void 0===c?new pr(s,e,t):new fr(s,e,t));break}{let e=n.map[s];void 0===e&&vr(n,e=new mr(s)),n=e}}}function xr(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,35718);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);yr(n,e.getUniformLocation(t,n.name),this)}}function br(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}xr.prototype.setValue=function(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)},xr.prototype.setOptional=function(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)},xr.upload=function(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,i)}},xr.seqWithValue=function(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n};let wr=0;function _r(e){switch(e){case X:return["Linear","( value )"];case Z:return["sRGB","( value )"];case J:return["RGBE","( value )"];case K:return["RGBM","( value, 7.0 )"];case Q:return["RGBM","( value, 16.0 )"];case $:return["RGBD","( value, 256.0 )"];case Y: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 i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){const t=e.split("\n");for(let n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Sr(e,t){const n=_r(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Tr(e,t){const n=_r(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Er(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 Ar(e){return""!==e}function Lr(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 Rr(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Cr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pr(e){return e.replace(Cr,Ir)}function Ir(e,t){const n=$n[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Pr(n)}const Dr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Or=/#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 Nr(e){return e.replace(Or,Br).replace(Dr,Fr)}function Fr(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Br(e,t,n,i)}function Br(e,t,n,i){let r="";for(let a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function zr(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 kr(e,t,n,i){const o=e.getContext(),s=n.defines;let u=n.vertexShader,h=n.fragmentShader;const d=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),p=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case r:case a:t="ENVMAP_TYPE_CUBE";break;case l:case c:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),f=function(e){let t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case a:case c:t="ENVMAP_MODE_REFRACTION"}return t}(n),m=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),g=e.gammaFactor>0?e.gammaFactor:1,v=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(Ar).join("\n")}(n),y=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),x=o.createProgram();let b,w,_=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((b=[y].filter(Ar).join("\n")).length>0&&(b+="\n"),(w=[v,y].filter(Ar).join("\n")).length>0&&(w+="\n")):(b=[zr(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#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 "+f:"",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.vertexAlphas?"#define USE_COLOR_ALPHA":"",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 "+d:"",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","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( 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(Ar).join("\n"),w=[v,zr(n),"#define SHADER_NAME "+n.shaderName,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,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 "+p:"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",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.vertexAlphas?"#define USE_COLOR_ALPHA":"",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 "+d:"",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?$n.tonemapping_pars_fragment:"",0!==n.toneMapping?Er("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",$n.encodings_pars_fragment,n.map?Sr("mapTexelToLinear",n.mapEncoding):"",n.matcap?Sr("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Sr("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Sr("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Sr("lightMapTexelToLinear",n.lightMapEncoding):"",Tr("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ar).join("\n")),u=Rr(u=Lr(u=Pr(u),n),n),h=Rr(h=Lr(h=Pr(h),n),n),u=Nr(u),h=Nr(h),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",b=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+b,w=["#define varying in",n.glslVersion===ne?"":"out highp vec4 pc_fragColor;",n.glslVersion===ne?"":"#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"+w);const M=_+w+h,S=br(o,35633,_+b+u),T=br(o,35632,M);if(o.attachShader(x,S),o.attachShader(x,T),void 0!==n.index0AttributeName?o.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(x,0,"position"),o.linkProgram(x),e.debug.checkShaderErrors){const e=o.getProgramInfoLog(x).trim(),t=o.getShaderInfoLog(S).trim(),n=o.getShaderInfoLog(T).trim();let i=!0,r=!0;if(!1===o.getProgramParameter(x,35714)){i=!1;const t=Mr(o,S,"vertex"),n=Mr(o,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",o.getError(),"35715",o.getProgramParameter(x,35715),"gl.getProgramInfoLog",e,t,n)}else""!==e?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e):""!==t&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:b},fragmentShader:{log:n,prefix:w}})}let E,A;return o.deleteShader(S),o.deleteShader(T),this.getUniforms=function(){return void 0===E&&(E=new xr(o,x)),E},this.getAttributes=function(){return void 0===A&&(A=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r).name;n[i]=e.getAttribLocation(t,i)}return n}(o,x)),A},this.destroy=function(){i.releaseStatesOfProgram(this),o.deleteProgram(x),this.program=void 0},this.name=n.shaderName,this.id=wr++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=S,this.fragmentShader=T,this}function Hr(e,t,n,i,r,a){const o=[],s=i.isWebGL2,u=i.logarithmicDepthBuffer,h=i.floatVertexTextures,d=i.maxVertexUniforms,p=i.vertexTextures;let f=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function v(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=X,t}return{getParameters:function(r,o,g,y,x){const b=y.fog,w=r.isMeshStandardMaterial?y.environment:null,_=t.get(r.envMap||w),M=m[r.type],S=x.isSkinnedMesh?function(e){const t=x.skeleton.bones;if(h)return 1024;{const e=d,n=Math.floor((e-20)/4),i=Math.min(n,t.length);return i<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}}():0;let T,E;if(null!==r.precision&&(f=i.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",f,"instead."),M){const e=ti[M];T=e.vertexShader,E=e.fragmentShader}else T=r.vertexShader,E=r.fragmentShader;const A=e.getRenderTarget();return{isWebGL2:s,shaderID:M,shaderName:r.type,vertexShader:T,fragmentShader:E,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:f,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:p,outputEncoding:null!==A?v(A.texture):e.outputEncoding,map:!!r.map,mapEncoding:v(r.map),matcap:!!r.matcap,matcapEncoding:v(r.matcap),envMap:!!_,envMapMode:_&&_.mapping,envMapEncoding:v(_),envMapCubeUV:!!_&&(_.mapping===l||_.mapping===c),lightMap:!!r.lightMap,lightMapEncoding:v(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:v(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmissionMap:!!r.transmissionMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&x.geometry.attributes.color&&4===x.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmissionMap||!r.displacementMap),fog:!!b,useFog:r.fog,fogExp2:b&&b.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:u,skinning:r.skinning&&S>0,maxBones:S,useVertexTexture:h,morphTargets:r.morphTargets,morphNormals:r.morphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&g.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.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<g.length;e++)n.push(t[g[e]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=m[e.type];let n;if(t){const e=ti[t];n=kn.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,r=o.length;e<r;e++){const t=o[e];if(t.cacheKey===n){++(i=t).usedTimes;break}}return void 0===i&&(i=new kr(e,n,t,r),o.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=o.indexOf(e);o[t]=o[o.length-1],o.pop(),e.destroy()}},programs:o}}function Ur(){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,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function Gr(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 jr(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 Vr(e){const t=[];let n=0;const i=[],r=[],a={id:-1};function o(i,r,o,s,l,c){let u=t[n];const h=e.get(o);return void 0===u?(u={id:i.id,object:i,geometry:r,material:o,program:h.program||a,groupOrder:s,renderOrder:i.renderOrder,z:l,group:c},t[n]=u):(u.id=i.id,u.object=i,u.geometry=r,u.material=o,u.program=h.program||a,u.groupOrder=s,u.renderOrder=i.renderOrder,u.z=l,u.group=c),n++,u}return{opaque:i,transparent:r,init:function(){n=0,i.length=0,r.length=0},push:function(e,t,n,a,s,l){const c=o(e,t,n,a,s,l);(!0===n.transparent?r:i).push(c)},unshift:function(e,t,n,a,s,l){const c=o(e,t,n,a,s,l);(!0===n.transparent?r:i).unshift(c)},finish:function(){for(let e=n,i=t.length;e<i;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){i.length>1&&i.sort(e||Gr),r.length>1&&r.sort(t||jr)}}}function Wr(e){let t=new WeakMap;return{get:function(n,i){let r;return!1===t.has(n)?(r=new Vr(e),t.set(n,[r])):i>=t.get(n).length?(r=new Vr(e),t.get(n).push(r)):r=t.get(n)[i],r},dispose:function(){t=new WeakMap}}}function qr(){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 ye,color:new Vt};break;case"SpotLight":n={position:new ye,direction:new ye,color:new Vt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ye,color:new Vt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ye,skyColor:new Vt,groundColor:new Vt};break;case"RectAreaLight":n={color:new Vt,position:new ye,halfWidth:new ye,halfHeight:new ye}}return e[t.id]=n,n}}}let Xr=0;function Zr(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Yr(e,t){const n=new qr,i=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 se};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)r.probe.push(new ye);const a=new ye,o=new Ye,s=new Ye;return{setup:function(a){let o=0,s=0,l=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,u=0,h=0,d=0,p=0,f=0,m=0,g=0;a.sort(Zr);for(let e=0,t=a.length;e<t;e++){const t=a[e],v=t.color,y=t.intensity,x=t.distance,b=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)o+=v.r*y,s+=v.g*y,l+=v.b*y;else if(t.isLightProbe)for(let e=0;e<9;e++)r.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=i.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,r.directionalShadow[c]=n,r.directionalShadowMap[c]=b,r.directionalShadowMatrix[c]=t.shadow.matrix,f++}r.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=i.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,r.spotShadow[h]=n,r.spotShadowMap[h]=b,r.spotShadowMatrix[h]=t.shadow.matrix,g++}r.spot[h]=e,h++}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),r.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=i.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,r.pointShadow[u]=n,r.pointShadowMap[u]=b,r.pointShadowMatrix[u]=t.shadow.matrix,m++}r.point[u]=e,u++}else if(t.isHemisphereLight){const e=n.get(t);e.skyColor.copy(t.color).multiplyScalar(y),e.groundColor.copy(t.groundColor).multiplyScalar(y),r.hemi[p]=e,p++}}d>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=ei.LTC_FLOAT_1,r.rectAreaLTC2=ei.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=ei.LTC_HALF_1,r.rectAreaLTC2=ei.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=s,r.ambient[2]=l;const v=r.hash;v.directionalLength===c&&v.pointLength===u&&v.spotLength===h&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(r.directional.length=c,r.spot.length=h,r.rectArea.length=d,r.point.length=u,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=u,v.spotLength=h,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=Xr++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,u=0;const h=t.matrixWorldInverse;for(let d=0,p=e.length;d<p;d++){const t=e[d];if(t.isDirectionalLight){const e=r.directional[n];e.direction.setFromMatrixPosition(t.matrixWorld),a.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(h),n++}else if(t.isSpotLight){const e=r.spot[l];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(h),e.direction.setFromMatrixPosition(t.matrixWorld),a.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(h),l++}else if(t.isRectAreaLight){const e=r.rectArea[c];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(h),s.identity(),o.copy(t.matrixWorld),o.premultiply(h),s.extractRotation(o),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),e.halfWidth.applyMatrix4(s),e.halfHeight.applyMatrix4(s),c++}else if(t.isPointLight){const e=r.point[i];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(h),i++}else if(t.isHemisphereLight){const e=r.hemi[u];e.direction.setFromMatrixPosition(t.matrixWorld),e.direction.transformDirection(h),e.direction.normalize(),u++}}},state:r}}function Jr(e,t){const n=new Yr(e,t),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(){n.setup(i)},setupLightsView:function(e){n.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function Kr(e,t){let n=new WeakMap;return{get:function(i,r=0){let a;return!1===n.has(i)?(a=new Jr(e,t),n.set(i,[a])):r>=n.get(i).length?(a=new Jr(e,t),n.get(i).push(a)):a=n.get(i)[r],a},dispose:function(){n=new WeakMap}}}class Qr extends Bt{constructor(e){super(),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)}copy(e){return super.copy(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}}Qr.prototype.isMeshDepthMaterial=!0;class $r extends Bt{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new ye,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)}copy(e){return super.copy(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 ea(e,t,n){let i=new Yn;const r=new se,a=new se,o=new fe,s=[],l=[],c={},u=n.maxTextureSize,h={0:1,1:0,2:2},d=new Hn({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new se},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}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new gn;m.setAttribute("position",new Zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new On(m,d),y=this;function x(n,i){const r=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(i,null,r,d,v,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,f,v,null)}function b(e,t,n){const i=e<<0|t<<1|n<<2;let r=s[i];return void 0===r&&(r=new Qr({depthPacking:3201,morphTargets:e,skinning:t}),s[i]=r),r}function w(e,t,n){const i=e<<0|t<<1|n<<2;let r=l[i];return void 0===r&&(r=new $r({morphTargets:e,skinning:t}),l[i]=r),r}function _(t,n,i,r,a,o,s){let l=null,u=b,d=t.customDepthMaterial;if(!0===r.isPointLight&&(u=w,d=t.customDistanceMaterial),void 0===d){let e=!1;!0===i.morphTargets&&(e=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let r=!1;!0===t.isSkinnedMesh&&(!0===i.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(e,r,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const e=l.uuid,t=i.uuid;let n=c[e];void 0===n&&(n={},c[e]=n);let r=n[t];void 0===r&&(r=l.clone(),n[t]=r),l=r}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function M(n,r,a,o,s){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let l=0,c=t.length;l<c;l++){const c=t[l],u=r[c.materialIndex];if(u&&u.visible){const t=_(n,i,u,o,a.near,a.far,s);e.renderBufferDirect(a,null,i,t,n,c)}}}else if(r.visible){const t=_(n,i,r,o,a.near,a.far,s);e.renderBufferDirect(a,null,i,t,n,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)M(l[e],r,a,o,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,n,s){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),h=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 f=0,m=t.length;f<m;f++){const l=t[f],c=l.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;r.copy(c.mapSize);const h=c.getFrameExtents();if(r.multiply(h),a.copy(c.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(a.x=Math.floor(u/h.x),r.x=a.x*h.x,c.mapSize.x=a.x),r.y>u&&(a.y=Math.floor(u/h.y),r.y=a.y*h.y,c.mapSize.y=a.y)),null===c.map&&!c.isPointLightShadow&&3===this.type){const e={minFilter:g,magFilter:g,format:E};c.map=new me(r.x,r.y,e),c.map.texture.name=l.name+".shadowMap",c.mapPass=new me(r.x,r.y,e),c.camera.updateProjectionMatrix()}if(null===c.map){const e={minFilter:p,magFilter:p,format:E};c.map=new me(r.x,r.y,e),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}e.setRenderTarget(c.map),e.clear();const m=c.getViewportCount();for(let e=0;e<m;e++){const t=c.getViewport(e);o.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),d.viewport(o),c.updateMatrices(l,e),i=c.getFrustum(),M(n,s,c.camera,l,this.type)}c.isPointLightShadow||3!==this.type||x(c,s),c.needsUpdate=!1}y.needsUpdate=!1,e.setRenderTarget(l,c,h)}}function ta(e,t,i){const r=i.isWebGL2,a=new function(){let t=!1;const n=new fe;let i=null;const r=new fe(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},o=new function(){let t=!1,n=null,i=null,r=null;return{setTest:function(e){e?F(2929):B(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==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);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},s=new function(){let t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?F(2960):B(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}};let l={},c=null,u={},h=null,d=!1,p=null,f=null,m=null,g=null,v=null,y=null,x=null,b=!1,w=null,_=null,M=null,S=null,T=null;const E=e.getParameter(35661);let A=!1,L=0;const R=e.getParameter(7938);-1!==R.indexOf("WebGL")?(L=parseFloat(/^WebGL (\d)/.exec(R)[1]),A=L>=1):-1!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),A=L>=2);let C=null,P={};const I=new fe(0,0,e.canvas.width,e.canvas.height),D=new fe(0,0,e.canvas.width,e.canvas.height);function O(t,n,i){const r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let o=0;o<i;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,r);return a}const N={};function F(t){!0!==l[t]&&(e.enable(t),l[t]=!0)}function B(t){!1!==l[t]&&(e.disable(t),l[t]=!1)}N[3553]=O(3553,3553,1),N[34067]=O(34067,34069,6),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),F(2929),o.setFunc(3),U(!1),G(1),F(2884),H(0);const z={[n]:32774,101:32778,102:32779};if(r)z[103]=32775,z[104]=32776;else{const e=t.get("EXT_blend_minmax");null!==e&&(z[103]=e.MIN_EXT,z[104]=e.MAX_EXT)}const k={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function H(t,i,r,a,o,s,l,c){if(0!==t){if(!1===d&&(F(3042),d=!0),5===t)o=o||i,s=s||r,l=l||a,i===f&&o===v||(e.blendEquationSeparate(z[i],z[o]),f=i,v=o),r===m&&a===g&&s===y&&l===x||(e.blendFuncSeparate(k[r],k[a],k[s],k[l]),m=r,g=a,y=s,x=l),p=t,b=null;else if(t!==p||c!==b){if(f===n&&v===n||(e.blendEquation(32774),f=n,v=n),c)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)}m=null,g=null,y=null,x=null,p=t,b=c}}else!0===d&&(B(3042),d=!1)}function U(t){w!==t&&(t?e.frontFace(2304):e.frontFace(2305),w=t)}function G(t){0!==t?(F(2884),t!==_&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):B(2884),_=t}function j(t,n,i){t?(F(32823),S===n&&T===i||(e.polygonOffset(n,i),S=n,T=i)):B(32823)}function V(t){void 0===t&&(t=33984+E-1),C!==t&&(e.activeTexture(t),C=t)}return{buffers:{color:a,depth:o,stencil:s},enable:F,disable:B,bindFramebuffer:function(t,n){null===n&&null!==c&&(n=c),u[t]!==n&&(e.bindFramebuffer(t,n),u[t]=n)},bindXRFramebuffer:function(t){t!==c&&(e.bindFramebuffer(36160,t),c=t)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:H,setMaterial:function(e,t){2===e.side?B(2884):F(2884);let n=1===e.side;t&&(n=!n),U(n),1===e.blending&&!1===e.transparent?H(0):H(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),a.setMask(e.colorWrite);const i=e.stencilWrite;s.setTest(i),i&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),j(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?F(32926):B(32926)},setFlipSided:U,setCullFace:G,setLineWidth:function(t){t!==M&&(A&&e.lineWidth(t),M=t)},setPolygonOffset:j,setScissorTest:function(e){e?F(3089):B(3089)},activeTexture:V,bindTexture:function(t,n){null===C&&V();let i=P[C];void 0===i&&(i={type:void 0,texture:void 0},P[C]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n||N[t]),i.type=t,i.texture=n)},unbindTexture:function(){const t=P[C];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===I.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),I.copy(t))},viewport:function(t){!1===D.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),D.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===r&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),l={},C=null,P={},c=null,u={},h=null,d=!1,p=null,f=null,m=null,g=null,v=null,y=null,x=null,b=!1,w=null,_=null,M=null,S=null,T=null,I.set(0,0,e.canvas.width,e.canvas.height),D.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}}}function na(e,t,n,i,r,a,o){const s=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,x=r.maxTextureSize,R=r.maxSamples,C=new WeakMap;let P,I=!1;try{I="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function D(e,t){return I?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function O(e,t,n,i){let r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?oe.floorPowerOfTwo:Math.floor,a=i(r*e.width),o=i(r*e.height);void 0===P&&(P=D(a,o));const s=n?D(a,o):P;return s.width=a,s.height=o,s.getContext("2d").drawImage(e,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+o+")."),s}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function N(e){return oe.isPowerOfTwo(e.width)&&oe.isPowerOfTwo(e.height)}function F(e,t){return e.generateMipmaps&&t&&e.minFilter!==p&&e.minFilter!==g}function B(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log2(Math.max(r,a))}function z(n,i,r){if(!1===s)return i;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 a=i;return 6403===i&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===i&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===i&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function k(e){return e===p||e===f||e===m?9728:9729}function H(t){const n=t.target;n.removeEventListener("dispose",H),function(t){const n=i.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),i.remove(t))}(n),n.isVideoTexture&&C.delete(n),o.memory.textures--}function U(t){const n=t.target;n.removeEventListener("dispose",U),function(t){const n=t.texture,r=i.get(t),a=i.get(n);if(t){if(void 0!==a.__webglTexture&&e.deleteTexture(a.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);i.remove(n),i.remove(t)}}(n),o.memory.textures--}let G=0;function j(e,t){const r=i.get(e);if(e.isVideoTexture&&function(e){const t=o.render.frame;C.get(e)!==t&&(C.set(e,t),e.update())}(e),e.version>0&&r.__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 Y(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function V(t,r){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;Z(t,i),n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const o=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,u=[];for(let e=0;e<6;e++)u[e]=o||l?l?i.image[e].image:i.image[e]:O(i.image[e],!1,!0,c);const h=u[0],d=N(h)||s,p=a.convert(i.format),f=a.convert(i.type),m=z(i.internalFormat,p,f);let g;if(X(34067,i,d),o){for(let e=0;e<6;e++){g=u[e].mipmaps;for(let t=0;t<g.length;t++){const r=g[t];i.format!==E&&i.format!==T?null!==p?n.compressedTexImage2D(34069+e,t,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+e,t,m,r.width,r.height,0,p,f,r.data)}}t.__maxMipLevel=g.length-1}else{g=i.mipmaps;for(let e=0;e<6;e++)if(l){n.texImage2D(34069+e,0,m,u[e].width,u[e].height,0,p,f,u[e].data);for(let t=0;t<g.length;t++){const i=g[t].image[e].image;n.texImage2D(34069+e,t+1,m,i.width,i.height,0,p,f,i.data)}}else{n.texImage2D(34069+e,0,m,p,f,u[e]);for(let t=0;t<g.length;t++){const i=g[t];n.texImage2D(34069+e,t+1,m,p,f,i.image[e])}}t.__maxMipLevel=g.length}F(i,d)&&B(34067,i,h.width,h.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}(o,t,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))}const W={[u]:10497,[h]:33071,[d]:33648},q={[p]:9728,[f]:9984,[m]:9986,[g]:9729,[v]:9985,[y]:9987};function X(n,a,o){if(o?(e.texParameteri(n,10242,W[a.wrapS]),e.texParameteri(n,10243,W[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,W[a.wrapR]),e.texParameteri(n,10240,q[a.magFilter]),e.texParameteri(n,10241,q[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===h&&a.wrapT===h||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,k(a.magFilter)),e.texParameteri(n,10241,k(a.minFilter)),a.minFilter!==p&&a.minFilter!==g&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){const o=t.get("EXT_texture_filter_anisotropic");if(a.type===_&&!1===t.has("OES_texture_float_linear"))return;if(!1===s&&a.type===M&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function Z(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",H),t.__webglTexture=e.createTexture(),o.memory.textures++)}function Y(t,i,r){let o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),Z(t,i),n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const l=function(e){return!s&&(e.wrapS!==h||e.wrapT!==h||e.minFilter!==p&&e.minFilter!==g)}(i)&&!1===N(i.image),c=O(i.image,l,!1,x),u=N(c)||s,d=a.convert(i.format);let f,m=a.convert(i.type),v=z(i.internalFormat,d,m);X(o,i,u);const y=i.mipmaps;if(i.isDepthTexture)v=6402,s?v=i.type===_?36012:i.type===w?33190:i.type===S?35056:33189:i.type===_&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===A&&6402===v&&i.type!==b&&i.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=b,m=a.convert(i.type)),i.format===L&&6402===v&&(v=34041,i.type!==S&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=S,m=a.convert(i.type))),n.texImage2D(3553,0,v,c.width,c.height,0,d,m,null);else if(i.isDataTexture)if(y.length>0&&u){for(let e=0,t=y.length;e<t;e++)f=y[e],n.texImage2D(3553,e,v,f.width,f.height,0,d,m,f.data);i.generateMipmaps=!1,t.__maxMipLevel=y.length-1}else n.texImage2D(3553,0,v,c.width,c.height,0,d,m,c.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(let e=0,t=y.length;e<t;e++)f=y[e],i.format!==E&&i.format!==T?null!==d?n.compressedTexImage2D(3553,e,v,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,e,v,f.width,f.height,0,d,m,f.data);t.__maxMipLevel=y.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,v,c.width,c.height,c.depth,0,d,m,c.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,v,c.width,c.height,c.depth,0,d,m,c.data),t.__maxMipLevel=0;else if(y.length>0&&u){for(let e=0,t=y.length;e<t;e++)f=y[e],n.texImage2D(3553,e,v,d,m,f);i.generateMipmaps=!1,t.__maxMipLevel=y.length-1}else n.texImage2D(3553,0,v,d,m,c),t.__maxMipLevel=0;F(i,u)&&B(o,i,c.width,c.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function J(t,r,o,s){const l=r.texture,c=a.convert(l.format),u=a.convert(l.type),h=z(l.internalFormat,c,u);32879===s||35866===s?n.texImage3D(s,0,h,r.width,r.height,r.depth,0,c,u,null):n.texImage2D(s,0,h,r.width,r.height,0,c,u,null),n.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,i.get(l).__webglTexture,0),n.bindFramebuffer(36160,null)}function K(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i){const t=n.depthTexture;t&&t.isDepthTexture&&(t.type===_?r=36012:t.type===w&&(r=33190));const i=Q(n);e.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){const t=Q(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=n.texture,r=a.convert(t.format),o=a.convert(t.type),s=z(t.internalFormat,r,o);if(i){const t=Q(n);e.renderbufferStorageMultisample(36161,t,s,n.width,n.height)}else e.renderbufferStorage(36161,s,n.width,n.height)}e.bindRenderbuffer(36161,null)}function Q(e){return s&&e.isWebGLMultisampleRenderTarget?Math.min(R,e.samples):0}let $=!1,ee=!1;this.allocateTextureUnit=function(){const e=G;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),G+=1,e},this.resetTextureUnits=function(){G=0},this.setTexture2D=j,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?Y(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?Y(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=V,this.setupRenderTarget=function(t){const r=t.texture,l=i.get(t),c=i.get(r);t.addEventListener("dispose",U),c.__webglTexture=e.createTexture(),c.__version=r.version,o.memory.textures++;const u=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,d=r.isDataTexture3D||r.isDataTexture2DArray,p=N(t)||s;if(!s||r.format!==T||r.type!==_&&r.type!==M||(r.format=E,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){l.__webglFramebuffer=[];for(let t=0;t<6;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),h)if(s){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const i=a.convert(r.format),o=a.convert(r.type),s=z(r.internalFormat,i,o),c=Q(t);e.renderbufferStorageMultisample(36161,c,s,t.width,t.height),n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),K(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){n.bindTexture(34067,c.__webglTexture),X(34067,r,p);for(let e=0;e<6;e++)J(l.__webglFramebuffer[e],t,36064,34069+e);F(r,p)&&B(34067,r,t.width,t.height),n.bindTexture(34067,null)}else{let e=3553;d&&(s?e=r.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(e,c.__webglTexture),X(e,r,p),J(l.__webglFramebuffer,t,36064,e),F(r,p)&&B(3553,r,t.width,t.height),n.bindTexture(3553,null)}t.depthBuffer&&function(t){const r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),j(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===A)e.framebufferTexture2D(36160,36096,3553,a,0);else{if(r.depthTexture.format!==L)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(36160,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=e.createRenderbuffer(),K(r.__webglDepthbuffer[i],t,!1)}else n.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),K(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){const t=e.texture;if(F(t,N(e)||s)){const r=e.isWebGLCubeRenderTarget?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(r,a),B(r,t,e.width,e.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(s){const r=i.get(t);n.bindFramebuffer(36008,r.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,r.__webglFramebuffer);const a=t.width,o=t.height;let s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024),e.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728),n.bindFramebuffer(36160,r.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===$&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),$=!0),e=e.texture),j(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===ee&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),ee=!0),e=e.texture),V(e,t)}}function ia(e,t,n){const i=n.isWebGL2;return{convert:function(e){let n;if(e===x)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(e===b)return 5123;if(1013===e)return 5124;if(e===w)return 5125;if(e===_)return 5126;if(e===M)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(e===T)return 6407;if(e===E)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(e===A)return 6402;if(e===L)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(e===R||e===C||e===P||e===I){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===R)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===C)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===P)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===I)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===D||e===O||e===N||e===F){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===D)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===O)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===N)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===F)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===B||e===z)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(e===B)return n.COMPRESSED_RGB8_ETC2;if(e===z)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?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===S?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}$r.prototype.isMeshDistanceMaterial=!0;class ra extends Gn{constructor(e=[]){super(),this.cameras=e}}ra.prototype.isArrayCamera=!0;class aa extends bt{constructor(){super(),this.type="Group"}}function oa(){this._targetRay=null,this._grip=null,this._hand=null}function sa(e,t){const n=this,i=e.state;let r=null,a=1,o=null,s="local-floor",l=null;const c=[],u=new Map,h=new Gn;h.layers.enable(1),h.viewport=new fe;const d=new Gn;d.layers.enable(2),d.viewport=new fe;const p=[h,d],f=new ra;f.layers.enable(1),f.layers.enable(2);let m=null,g=null;function v(e){const t=u.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function y(){u.forEach((function(e,t){e.disconnect(t)})),u.clear(),m=null,g=null,i.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function x(e){const t=r.inputSources;for(let n=0;n<c.length;n++)u.set(t[n],c[n]);for(let n=0;n<e.removed.length;n++){const t=e.removed[n],i=u.get(t);i&&(i.dispatchEvent({type:"disconnected",data:t}),u.delete(t))}for(let n=0;n<e.added.length;n++){const t=e.added[n],i=u.get(t);i&&i.dispatchEvent({type:"connected",data:t})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=c[e];return void 0===t&&(t=new oa,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=c[e];return void 0===t&&(t=new oa,c[e]=t),t.getGripSpace()},this.getHand=function(e){let t=c[e];return void 0===t&&(t=new oa,c[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=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=async function(e){if(null!==(r=e)){r.addEventListener("select",v),r.addEventListener("selectstart",v),r.addEventListener("selectend",v),r.addEventListener("squeeze",v),r.addEventListener("squeezestart",v),r.addEventListener("squeezeend",v),r.addEventListener("end",y),r.addEventListener("inputsourceschange",x);const e=t.getContextAttributes();!0!==e.xrCompatible&&await t.makeXRCompatible();const i={antialias:e.antialias,alpha:e.alpha,depth:e.depth,stencil:e.stencil,framebufferScaleFactor:a},l=new XRWebGLLayer(r,t,i);r.updateRenderState({baseLayer:l}),o=await r.requestReferenceSpace(s),S.setContext(r),S.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const b=new ye,w=new ye;function _(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=d.near=h.near=e.near,f.far=d.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;_(f,t);for(let r=0;r<n.length;r++)_(n[r],t);e.matrixWorld.copy(f.matrixWorld),e.matrix.copy(f.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale);const i=e.children;for(let r=0,a=i.length;r<a;r++)i[r].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);const i=b.distanceTo(w),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=i/(-u+h),m=f*-u;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=o+f,v=s+f,y=d-m,x=p+(i-m),_=l*s/v*g,M=c*s/v*g;e.projectionMatrix.makePerspective(y,x,_,M,g,v)}(f,h,d):f.projectionMatrix.copy(h.projectionMatrix),f};let M=null;const S=new Jn;S.setAnimationLoop((function(e,t){if(null!==(l=t.getViewerPose(o))){const e=l.views,t=r.renderState.baseLayer;i.bindXRFramebuffer(t.framebuffer);let n=!1;e.length!==f.cameras.length&&(f.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i],a=t.getViewport(r),o=p[i];o.matrix.fromArray(r.transform.matrix),o.projectionMatrix.fromArray(r.projectionMatrix),o.viewport.set(a.x,a.y,a.width,a.height),0===i&&f.matrix.copy(o.matrix),!0===n&&f.cameras.push(o)}}const n=r.inputSources;for(let i=0;i<c.length;i++){const e=c[i],r=n[i];e.update(r,t,o)}M&&M(e,t)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function la(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 i=e.get(n).envMap;if(i){t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture&&i._needsFlipEnvMap?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio;const r=e.get(i).__maxMipLevel;void 0!==r&&(t.maxMipLevel.value=r)}let r,a;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?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(r=n.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?a=n.aoMap:n.lightMap&&(a=n.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),t.uv2Transform.value.copy(a.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,i,r,a){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),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,i)):i.isMeshPhongMaterial?(t(e,i),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,i)):i.isMeshStandardMaterial?(t(e,i),i.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,i):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),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,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),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,i)):i.isMeshNormalMaterial?(t(e,i),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,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,a):i.isSpriteMaterial?function(e,t){let n;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),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,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ca(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,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let h=null,d=null;const p=[],f=[];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=X,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const m=this;let g=!1,v=0,y=0,b=null,w=-1,S=null;const T=new fe,A=new fe;let L=null,R=t.width,C=t.height,P=1,I=null,D=null;const O=new fe(0,0,R,C),N=new fe(0,0,R,C);let F=!1;const B=new Yn;let z=!1,k=!1;const H=new Ye,U=new ye,G={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===b?P:1}let V,W,q,Z,Y,J,K,Q,$,ee,te,ne,ie,re,ae,le,ce,ue,he,de,pe,me,ge=n;function ve(e,n){for(let i=0;i<e.length;i++){const r=e[i],a=t.getContext(r,n);if(null!==a)return a}return null}try{const e={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(t.addEventListener("webglcontextlost",we,!1),t.addEventListener("webglcontextrestored",_e,!1),null===ge){const t=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&t.shift(),null===(ge=ve(t,e)))throw ve(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ge.getShaderPrecisionFormat&&(ge.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function xe(){V=new li(ge),W=new ai(ge,V,e),V.init(W),pe=new ia(ge,V,W),q=new ta(ge,V,W),Z=new hi(ge),Y=new Ur,J=new na(ge,V,q,Y,W,pe,Z),K=new si(m),Q=new Kn(ge,W),me=new ii(ge,V,Q,W),$=new ci(ge,Q,Z,me),ee=new mi(ge,$,Q,Z),ue=new fi(ge),ae=new oi(Y),te=new Hr(m,K,V,W,me,ae),ne=new la(Y),ie=new Wr(Y),re=new Kr(V,W),ce=new ni(m,K,q,ee,s),le=new ea(m,ee,W),he=new ri(ge,V,Z,W),de=new ui(ge,V,Z,W),Z.programs=te.programs,m.capabilities=W,m.extensions=V,m.properties=Y,m.renderLists=ie,m.shadowMap=le,m.state=q,m.info=Z}xe();const be=new sa(m,ge);function we(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function _e(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const e=Z.autoReset,t=le.enabled,n=le.autoUpdate,i=le.needsUpdate,r=le.type;xe(),Z.autoReset=e,le.enabled=t,le.autoUpdate=n,le.needsUpdate=i,le.type=r}function Me(e){const t=e.target;t.removeEventListener("dispose",Me),function(e){(function(e){const t=Y.get(e).programs;void 0!==t&&t.forEach((function(e){te.releaseProgram(e)}))})(e),Y.remove(e)}(t)}this.xr=be,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){const e=V.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=V.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(e){void 0!==e&&(P=e,this.setSize(R,C,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new se),e.set(R,C)},this.setSize=function(e,n,i){be.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=e,C=n,t.width=Math.floor(e*P),t.height=Math.floor(n*P),!1!==i&&(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 se),e.set(R*P,C*P).floor()},this.setDrawingBufferSize=function(e,n,i){R=e,C=n,P=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),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 fe),e.copy(T)},this.getViewport=function(e){return e.copy(O)},this.setViewport=function(e,t,n,i){e.isVector4?O.set(e.x,e.y,e.z,e.w):O.set(e,t,n,i),q.viewport(T.copy(O).multiplyScalar(P).floor())},this.getScissor=function(e){return e.copy(N)},this.setScissor=function(e,t,n,i){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,n,i),q.scissor(A.copy(N).multiplyScalar(P).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(e){q.setScissorTest(F=e)},this.setOpaqueSort=function(e){I=e},this.setTransparentSort=function(e){D=e},this.getClearColor=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),e=new Vt),e.copy(ce.getClearColor())},this.setClearColor=function(){ce.setClearColor.apply(ce,arguments)},this.getClearAlpha=function(){return ce.getClearAlpha()},this.setClearAlpha=function(){ce.setClearAlpha.apply(ce,arguments)},this.clear=function(e,t,n){let i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===n||n)&&(i|=1024),ge.clear(i)},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",we,!1),t.removeEventListener("webglcontextrestored",_e,!1),ie.dispose(),re.dispose(),Y.dispose(),K.dispose(),ee.dispose(),me.dispose(),be.dispose(),be.removeEventListener("sessionstart",Te),be.removeEventListener("sessionend",Ee),Ae.stop()},this.renderBufferImmediate=function(e,t){me.initAttributes();const n=Y.get(e);e.hasPositions&&!n.position&&(n.position=ge.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=ge.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=ge.createBuffer()),e.hasColors&&!n.color&&(n.color=ge.createBuffer());const i=t.getAttributes();e.hasPositions&&(ge.bindBuffer(34962,n.position),ge.bufferData(34962,e.positionArray,35048),me.enableAttribute(i.position),ge.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(ge.bindBuffer(34962,n.normal),ge.bufferData(34962,e.normalArray,35048),me.enableAttribute(i.normal),ge.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(ge.bindBuffer(34962,n.uv),ge.bufferData(34962,e.uvArray,35048),me.enableAttribute(i.uv),ge.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(ge.bindBuffer(34962,n.color),ge.bufferData(34962,e.colorArray,35048),me.enableAttribute(i.color),ge.vertexAttribPointer(i.color,3,5126,!1,0,0)),me.disableUnusedAttributes(),ge.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=G);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=Ie(e,t,i,r);q.setMaterial(i,o);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 u,h=1;!0===i.wireframe&&(l=$.getWireframeAttribute(n),h=2),(i.morphTargets||i.morphNormals)&&ue.update(r,n,i,s),me.setup(r,i,s,n,l);let d=he;null!==l&&(u=Q.get(l),(d=de).setIndex(u));const p=null!==l?l.count:c.count,f=n.drawRange.start*h,m=n.drawRange.count*h,g=null!==a?a.start*h:0,v=null!==a?a.count*h: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(r.isMesh)!0===i.wireframe?(q.setLineWidth(i.wireframeLinewidth*j()),d.setMode(1)):d.setMode(4);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),q.setLineWidth(e*j()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(y,b,r.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){(d=re.get(e)).init(),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(),e.traverse((function(t){const n=t.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++)Ce(n[i],e,t);else Ce(n,e,t)}))};let Se=null;function Te(){Ae.stop()}function Ee(){Ae.start()}const Ae=new Jn;function Le(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){const a=e[r],o=a.object,s=a.geometry,l=null===i?a.material:i,c=a.group;if(n.isArrayCamera){const e=n.cameras;for(let n=0,i=e.length;n<i;n++){const i=e[n];o.layers.test(i.layers)&&(q.viewport(T.copy(i.viewport)),d.setupLightsView(i),Re(o,t,i,s,l,c))}}else Re(o,t,n,s,l,c)}}function Re(e,t,n,i,r,a){if(e.onBeforeRender(m,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){const i=Ie(n,t,r,e);q.setMaterial(r),me.reset(),function(e,t){e.render((function(e){m.renderBufferImmediate(e,t)}))}(e,i)}else m.renderBufferDirect(n,t,i,r,e,a);e.onAfterRender(m,t,n,i,r,a)}function Ce(e,t,n){!0!==t.isScene&&(t=G);const i=Y.get(e),r=d.state.lights,a=d.state.shadowsArray,o=r.state.version,s=te.getParameters(e,r.state,a,t,n),l=te.getProgramCacheKey(s);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=K.get(e.envMap||i.environment),void 0===c&&(e.addEventListener("dispose",Me),c=new Map,i.programs=c);let u=c.get(l);if(void 0!==u){if(i.currentProgram===u&&i.lightsStateVersion===o)return Pe(e,s),u}else s.uniforms=te.getUniforms(e),e.onBeforeCompile(s,m),u=te.acquireProgram(s,l),c.set(l,u),i.uniforms=s.uniforms;const h=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=ae.uniform),Pe(e,s),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotShadowMatrix.value=r.state.spotShadowMatrix,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=u.getUniforms(),f=xr.seqWithValue(p.seq,h);return i.currentProgram=u,i.uniformsList=f,u}function Pe(e,t){const n=Y.get(e);n.outputEncoding=t.outputEncoding,n.instancing=t.instancing,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas}function Ie(e,t,n,i){!0!==t.isScene&&(t=G),J.resetTextureUnits();const r=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===b?m.outputEncoding:b.texture.encoding,s=K.get(n.envMap||a),l=!0===n.vertexColors&&i.geometry.attributes.color&&4===i.geometry.attributes.color.itemSize,c=Y.get(n),u=d.state.lights;if(!0===z&&(!0===k||e!==S)){const t=e===S&&n.id===w;ae.setState(n,e,t)}let h=!1;n.version===c.__version?c.needsLights&&c.lightsStateVersion!==u.state.version||c.outputEncoding!==o||i.isInstancedMesh&&!1===c.instancing?h=!0:i.isInstancedMesh||!0!==c.instancing?c.envMap!==s||n.fog&&c.fog!==r?h=!0:void 0===c.numClippingPlanes||c.numClippingPlanes===ae.numPlanes&&c.numIntersection===ae.numIntersection?c.vertexAlphas!==l&&(h=!0):h=!0:h=!0:(h=!0,c.__version=n.version);let p=c.currentProgram;!0===h&&(p=Ce(n,t,i));let f=!1,g=!1,v=!1;const y=p.getUniforms(),x=c.uniforms;if(q.useProgram(p.program)&&(f=!0,g=!0,v=!0),n.id!==w&&(w=n.id,g=!0),f||S!==e){if(y.setValue(ge,"projectionMatrix",e.projectionMatrix),W.logarithmicDepthBuffer&&y.setValue(ge,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),S!==e&&(S=e,g=!0,v=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const t=y.map.cameraPosition;void 0!==t&&t.setValue(ge,U.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&y.setValue(ge,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&y.setValue(ge,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){y.setOptional(ge,i,"bindMatrix"),y.setOptional(ge,i,"bindMatrixInverse");const e=i.skeleton;if(e){const t=e.bones;if(W.floatVertexTextures){if(null===e.boneTexture){let n=Math.sqrt(4*t.length);n=oe.ceilPowerOfTwo(n),n=Math.max(n,4);const i=new Float32Array(n*n*4);i.set(e.boneMatrices);const r=new qn(i,n,n,E,_);e.boneMatrices=i,e.boneTexture=r,e.boneTextureSize=n}y.setValue(ge,"boneTexture",e.boneTexture,J),y.setValue(ge,"boneTextureSize",e.boneTextureSize)}else y.setOptional(ge,e,"boneMatrices")}}var M,T;return(g||c.receiveShadow!==i.receiveShadow)&&(c.receiveShadow=i.receiveShadow,y.setValue(ge,"receiveShadow",i.receiveShadow)),g&&(y.setValue(ge,"toneMappingExposure",m.toneMappingExposure),c.needsLights&&(T=v,(M=x).ambientLightColor.needsUpdate=T,M.lightProbe.needsUpdate=T,M.directionalLights.needsUpdate=T,M.directionalLightShadows.needsUpdate=T,M.pointLights.needsUpdate=T,M.pointLightShadows.needsUpdate=T,M.spotLights.needsUpdate=T,M.spotLightShadows.needsUpdate=T,M.rectAreaLights.needsUpdate=T,M.hemisphereLights.needsUpdate=T),r&&n.fog&&ne.refreshFogUniforms(x,r),ne.refreshMaterialUniforms(x,n,P,C),xr.upload(ge,c.uniformsList,x,J)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(xr.upload(ge,c.uniformsList,x,J),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&y.setValue(ge,"center",i.center),y.setValue(ge,"modelViewMatrix",i.modelViewMatrix),y.setValue(ge,"normalMatrix",i.normalMatrix),y.setValue(ge,"modelMatrix",i.matrixWorld),p}Ae.setAnimationLoop((function(e){Se&&Se(e)})),"undefined"!=typeof window&&Ae.setContext(window),this.setAnimationLoop=function(e){Se=e,be.setAnimationLoop(e),null===e?Ae.stop():Ae.start()},be.addEventListener("sessionstart",Te),be.addEventListener("sessionend",Ee),this.render=function(e,t){let n,i;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."),i=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===g)return;!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===be.enabled&&!0===be.isPresenting&&(t=be.getCamera(t)),!0===e.isScene&&e.onBeforeRender(m,e,t,n||b),(d=re.get(e,f.length)).init(),f.push(d),H.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),B.setFromProjectionMatrix(H),k=this.localClippingEnabled,z=ae.init(this.clippingPlanes,k,t),(h=ie.get(e,p.length)).init(),p.push(h),function e(t,n,i,r){if(!1===t.visible)return;if(t.layers.test(n.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(n);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||B.intersectsSprite(t)){r&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=ee.update(t),n=t.material;n.visible&&h.push(t,e,n,i,U.z,null)}}else if(t.isImmediateRenderObject)r&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H),h.push(t,null,t.material,i,U.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==Z.render.frame&&(t.skeleton.update(),t.skeleton.frame=Z.render.frame),!t.frustumCulled||B.intersectsObject(t))){r&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=ee.update(t),n=t.material;if(Array.isArray(n)){const r=e.groups;for(let a=0,o=r.length;a<o;a++){const o=r[a],s=n[o.materialIndex];s&&s.visible&&h.push(t,e,s,i,U.z,o)}}else n.visible&&h.push(t,e,n,i,U.z,null)}const a=t.children;for(let o=0,s=a.length;o<s;o++)e(a[o],n,i,r)}(e,t,0,m.sortObjects),h.finish(),!0===m.sortObjects&&h.sort(I,D),!0===z&&ae.beginShadows();const r=d.state.shadowsArray;le.render(r,e,t),d.setupLights(),d.setupLightsView(t),!0===z&&ae.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),ce.render(h,e,t,i);const a=h.opaque,o=h.transparent;a.length>0&&Le(a,e,t),o.length>0&&Le(o,e,t),null!==b&&(J.updateRenderTargetMipmap(b),J.updateMultisampleRenderTarget(b)),!0===e.isScene&&e.onAfterRender(m,e,t),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),me.resetDefaultState(),w=-1,S=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return b},this.setRenderTarget=function(e,t=0,n=0){b=e,v=t,y=n,e&&void 0===Y.get(e).__webglFramebuffer&&J.setupRenderTarget(e);let i=null,r=!1,a=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const o=Y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=o[t],r=!0):i=e.isWebGLMultisampleRenderTarget?Y.get(e).__webglMultisampledFramebuffer:o,T.copy(e.viewport),A.copy(e.scissor),L=e.scissorTest}else T.copy(O).multiplyScalar(P).floor(),A.copy(N).multiplyScalar(P).floor(),L=F;if(q.bindFramebuffer(36160,i),q.viewport(T),q.scissor(A),q.setScissorTest(L),r){const i=Y.get(e.texture);ge.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(a){const i=Y.get(e.texture),r=t||0;ge.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=Y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){q.bindFramebuffer(36160,s);try{const o=e.texture,s=o.format,l=o.type;if(s!==E&&pe.convert(s)!==ge.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===M&&(V.has("EXT_color_buffer_half_float")||W.isWebGL2&&V.has("EXT_color_buffer_float"));if(!(l===x||pe.convert(l)===ge.getParameter(35738)||l===_&&(W.isWebGL2||V.has("OES_texture_float")||V.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ge.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ge.readPixels(t,n,i,r,pe.convert(s),pe.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==b?Y.get(b).__webglFramebuffer:null;q.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=pe.convert(t.format);J.setTexture2D(t,0),ge.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),q.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,a=t.image.height,o=pe.convert(n.format),s=pe.convert(n.type);J.setTexture2D(n,0),ge.pixelStorei(37440,n.flipY),ge.pixelStorei(37441,n.premultiplyAlpha),ge.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ge.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?ge.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ge.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&ge.generateMipmap(3553),q.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:a,height:o,data:s}=n.image,l=pe.convert(i.format),c=pe.convert(i.type);let u;if(i.isDataTexture3D)J.setTexture3D(i,0),u=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");J.setTexture2DArray(i,0),u=35866}ge.pixelStorei(37440,i.flipY),ge.pixelStorei(37441,i.premultiplyAlpha),ge.pixelStorei(3317,i.unpackAlignment);const h=ge.getParameter(3314),d=ge.getParameter(32878),p=ge.getParameter(3316),f=ge.getParameter(3315),g=ge.getParameter(32877);ge.pixelStorei(3314,a),ge.pixelStorei(32878,o),ge.pixelStorei(3316,e.min.x),ge.pixelStorei(3315,e.min.y),ge.pixelStorei(32877,e.min.z),ge.texSubImage3D(u,r,t.x,t.y,t.z,e.max.x-e.min.x+1,e.max.y-e.min.y+1,e.max.z-e.min.z+1,l,c,s),ge.pixelStorei(3314,h),ge.pixelStorei(32878,d),ge.pixelStorei(3316,p),ge.pixelStorei(3315,f),ge.pixelStorei(32877,g),0===r&&i.generateMipmaps&&ge.generateMipmap(u),q.unbindTexture()},this.initTexture=function(e){J.setTexture2D(e,0),q.unbindTexture()},this.resetState=function(){v=0,y=0,b=null,q.reset(),me.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}aa.prototype.isGroup=!0,Object.assign(oa.prototype,{constructor:oa,getHandSpace:function(){return null===this._hand&&(this._hand=new aa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new aa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new aa,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 i=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==o&&null!==(i=t.getPose(e.targetRaySpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),l&&e.hand){a=!0;for(const a of e.hand.values()){const e=t.getJointPose(a,n);if(void 0===l.joints[a.jointName]){const e=new aa;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[a.jointName]=e,l.add(e)}const i=l.joints[a.jointName];null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=e.radius),i.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale));return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}}),Object.assign(sa.prototype,ie.prototype);class ua extends ca{}ua.prototype.isWebGL1Renderer=!0;class ha{constructor(e,t=25e-5){this.name="",this.color=new Vt(e),this.density=t}clone(){return new ha(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}ha.prototype.isFogExp2=!0;class da{constructor(e,t=1,n=1e3){this.name="",this.color=new Vt(e),this.near=t,this.far=n}clone(){return new da(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}da.prototype.isFog=!0;class pa extends bt{constructor(){super(),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 fa(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ee,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=oe.generateUUID()}pa.prototype.isScene=!0,Object.defineProperty(fa.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(fa.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 i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];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=oe.generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new fa(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=oe.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 ma=new ye;function ga(e,t,n,i){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}Object.defineProperties(ga.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(ga.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(let t=0,n=this.data.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.applyMatrix4(e),this.setXYZ(t,ma.x,ma.y,ma.z);return this},applyNormalMatrix:function(e){for(let t=0,n=this.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.applyNormalMatrix(e),this.setXYZ(t,ma.x,ma.y,ma.z);return this},transformDirection:function(e){for(let t=0,n=this.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.transformDirection(e),this.setXYZ(t,ma.x,ma.y,ma.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,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,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]=i,this.data.array[e+3]=r,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 Zt(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 ga(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}}});class va extends Bt{constructor(e){super(),this.type="SpriteMaterial",this.color=new Vt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}let ya;va.prototype.isSpriteMaterial=!0;const xa=new ye,ba=new ye,wa=new ye,_a=new se,Ma=new se,Sa=new Ye,Ta=new ye,Ea=new ye,Aa=new ye,La=new se,Ra=new se,Ca=new se;class Pa extends bt{constructor(e){if(super(),this.type="Sprite",void 0===ya){ya=new gn;const e=new fa(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);ya.setIndex([0,1,2,0,2,3]),ya.setAttribute("position",new ga(e,3,0,!1)),ya.setAttribute("uv",new ga(e,2,3,!1))}this.geometry=ya,this.material=void 0!==e?e:new va,this.center=new se(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ba.setFromMatrixScale(this.matrixWorld),Sa.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),wa.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ba.multiplyScalar(-wa.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const a=this.center;Ia(Ta.set(-.5,-.5,0),wa,a,ba,i,r),Ia(Ea.set(.5,-.5,0),wa,a,ba,i,r),Ia(Aa.set(.5,.5,0),wa,a,ba,i,r),La.set(0,0),Ra.set(1,0),Ca.set(1,1);let o=e.ray.intersectTriangle(Ta,Ea,Aa,!1,xa);if(null===o&&(Ia(Ea.set(-.5,.5,0),wa,a,ba,i,r),Ra.set(0,1),null===(o=e.ray.intersectTriangle(Ta,Aa,Ea,!1,xa))))return;const s=e.ray.origin.distanceTo(xa);s<e.near||s>e.far||t.push({distance:s,point:xa.clone(),uv:Nt.getUV(xa,Ta,Ea,Aa,La,Ra,Ca,new se),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Ia(e,t,n,i,r,a){_a.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Ma.x=a*_a.x-r*_a.y,Ma.y=r*_a.x+a*_a.y):Ma.copy(_a),e.copy(t),e.x+=Ma.x,e.y+=Ma.y,e.applyMatrix4(Sa)}Pa.prototype.isSprite=!0;const Da=new ye,Oa=new ye;class Na extends bt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const e=t[n];this.addLevel(e.object.clone(),e.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Da.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Da);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Da.setFromMatrixPosition(e.matrixWorld),Oa.setFromMatrixPosition(this.matrixWorld);const n=Da.distanceTo(Oa)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const e=n[i];t.object.levels.push({object:e.object.uuid,distance:e.distance})}return t}}const Fa=new ye,Ba=new fe,za=new fe,ka=new ye,Ha=new Ye;function Ua(e,t){On.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ye,this.bindMatrixInverse=new Ye}function Ga(){bt.call(this),this.type="Bone"}Ua.prototype=Object.assign(Object.create(On.prototype),{constructor:Ua,isSkinnedMesh:!0,copy:function(e){return On.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 fe,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){On.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,i=this.geometry;Ba.fromBufferAttribute(i.attributes.skinIndex,e),za.fromBufferAttribute(i.attributes.skinWeight,e),Fa.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const e=za.getComponent(r);if(0!==e){const i=Ba.getComponent(r);Ha.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(ka.copy(Fa).applyMatrix4(Ha),e)}}return t.applyMatrix4(this.bindMatrixInverse)}}),Ga.prototype=Object.assign(Object.create(bt.prototype),{constructor:Ga,isBone:!0});const ja=new Ye,Va=new Ye;class Wa{constructor(e=[],t=[]){this.uuid=oe.generateUUID(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(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 Ye)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new Ye;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){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(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const i=e[r]?e[r].matrixWorld:Va;ja.multiplyMatrices(i,t[r]),ja.toArray(n,16*r)}null!==i&&(i.needsUpdate=!0)}clone(){return new Wa(this.bones,this.boneInverses)}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Ga),this.bones.push(r),this.boneInverses.push((new Ye).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}const qa=new Ye,Xa=new Ye,Za=[],Ya=new On;function Ja(e,t,n){On.call(this,e,t),this.instanceMatrix=new Zt(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}Ja.prototype=Object.assign(Object.create(On.prototype),{constructor:Ja,isInstancedMesh:!0,copy:function(e){return On.prototype.copy.call(this,e),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),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,i=this.count;if(Ya.geometry=this.geometry,Ya.material=this.material,void 0!==Ya.material)for(let r=0;r<i;r++){this.getMatrixAt(r,qa),Xa.multiplyMatrices(n,qa),Ya.matrixWorld=Xa,Ya.raycast(e,Za);for(let e=0,n=Za.length;e<n;e++){const n=Za[e];n.instanceId=r,n.object=this,t.push(n)}Za.length=0}},setColorAt:function(e,t){null===this.instanceColor&&(this.instanceColor=new Zt(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"})}});class Ka extends Bt{constructor(e){super(),this.type="LineBasicMaterial",this.color=new Vt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this}}Ka.prototype.isLineBasicMaterial=!0;const Qa=new ye,$a=new ye,eo=new Ye,to=new Ze,no=new He;function io(e=new gn,t=new Ka){bt.call(this),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}io.prototype=Object.assign(Object.create(bt.prototype),{constructor:io,isLine:!0,copy:function(e){return bt.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,i=t.count;e<i;e++)Qa.fromBufferAttribute(t,e-1),$a.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Qa.distanceTo($a);e.setAttribute("lineDistance",new rn(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),no.copy(n.boundingSphere),no.applyMatrix4(i),no.radius+=r,!1===e.ray.intersectsSphere(no))return;eo.copy(i).invert(),to.copy(e.ray).applyMatrix4(eo);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new ye,c=new ye,u=new ye,h=new ye,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i)for(let n=Math.max(0,a.start),o=Math.min(i.count,a.start+a.count)-1;n<o;n+=d){const a=i.getX(n),o=i.getX(n+1);if(l.fromBufferAttribute(r,a),c.fromBufferAttribute(r,o),to.distanceSqToSegment(l,c,h,u)>s)continue;h.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(h);d<e.near||d>e.far||t.push({distance:d,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,a.start),o=Math.min(r.count,a.start+a.count)-1;n<o;n+=d){if(l.fromBufferAttribute(r,n),c.fromBufferAttribute(r,n+1),to.distanceSqToSegment(l,c,h,u)>s)continue;h.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(h);i<e.near||i>e.far||t.push({distance:i,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},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 ro=new ye,ao=new ye;function oo(e,t){io.call(this,e,t),this.type="LineSegments"}oo.prototype=Object.assign(Object.create(io.prototype),{constructor:oo,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,i=t.count;e<i;e+=2)ro.fromBufferAttribute(t,e),ao.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+ro.distanceTo(ao);e.setAttribute("lineDistance",new rn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}});class so extends io{constructor(e,t){super(e,t),this.type="LineLoop"}}so.prototype.isLineLoop=!0;class lo extends Bt{constructor(e){super(),this.type="PointsMaterial",this.color=new Vt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this}}lo.prototype.isPointsMaterial=!0;const co=new Ye,uo=new Ze,ho=new He,po=new ye;function fo(e=new gn,t=new lo){bt.call(this),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}function mo(e,t,n,i,r,a,o){const s=uo.distanceSqToPoint(e);if(s<n){const n=new ye;uo.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o})}}fo.prototype=Object.assign(Object.create(bt.prototype),{constructor:fo,isPoints:!0,copy:function(e){return bt.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},raycast:function(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ho.copy(n.boundingSphere),ho.applyMatrix4(i),ho.radius+=r,!1===e.ray.intersectsSphere(ho))return;co.copy(i).invert(),uo.copy(e.ray).applyMatrix4(co);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position;if(null!==r)for(let n=Math.max(0,a.start),l=Math.min(r.count,a.start+a.count);n<l;n++){const a=r.getX(n);po.fromBufferAttribute(o,a),mo(po,a,s,i,e,t,this)}else for(let n=Math.max(0,a.start),l=Math.min(o.count,a.start+a.count);n<l;n++)po.fromBufferAttribute(o,n),mo(po,n,s,i,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},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.")}}});class go extends de{constructor(e,t,n,i,r,a,o,s,l){super(e,t,n,i,r,a,o,s,l),this.format=void 0!==o?o:T,this.minFilter=void 0!==a?a:g,this.magFilter=void 0!==r?r:g,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;0=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}go.prototype.isVideoTexture=!0;class vo extends de{constructor(e,t,n,i,r,a,o,s,l,c,u,h){super(null,a,o,s,l,c,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}vo.prototype.isCompressedTexture=!0;class yo extends de{constructor(e,t,n,i,r,a,o,s,l){super(e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}}yo.prototype.isCanvasTexture=!0;class xo extends de{constructor(e,t,n,i,r,a,o,s,l,c){if((c=void 0!==c?c:A)!==A&&c!==L)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===A&&(n=b),void 0===n&&c===L&&(n=S),super(null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:p,this.minFilter=void 0!==s?s:p,this.flipY=!1,this.generateMipmaps=!1}}xo.prototype.isDepthTexture=!0;class bo extends gn{constructor(e=1,t=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],a=[],o=[],s=[],l=new ye,c=new se;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let u=0,h=3;u<=t;u++,h+=3){const r=n+u/t*i;l.x=e*Math.cos(r),l.y=e*Math.sin(r),a.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(a[h]/e+1)/2,c.y=(a[h+1]/e+1)/2,s.push(c.x,c.y)}for(let u=1;u<=t;u++)r.push(u,u+1,0);this.setIndex(r),this.setAttribute("position",new rn(a,3)),this.setAttribute("normal",new rn(o,3)),this.setAttribute("uv",new rn(s,2))}}class wo extends gn{constructor(e=1,t=1,n=1,i=8,r=1,a=!1,o=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],u=[],h=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const r=p,a=new se,f=new ye;let v=0;const y=!0===n?e:t,x=!0===n?1:-1;for(let e=1;e<=i;e++)u.push(0,m*x,0),h.push(0,x,0),d.push(.5,.5),p++;const b=p;for(let e=0;e<=i;e++){const t=e/i*s+o,n=Math.cos(t),r=Math.sin(t);f.x=y*r,f.y=m*x,f.z=y*n,u.push(f.x,f.y,f.z),h.push(0,x,0),a.x=.5*n+.5,a.y=.5*r*x+.5,d.push(a.x,a.y),p++}for(let e=0;e<i;e++){const t=r+e,i=b+e;!0===n?c.push(i,i+1,t):c.push(i+1,i,t),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}!function(){const a=new ye,v=new ye;let y=0;const x=(t-e)/n;for(let l=0;l<=r;l++){const c=[],g=l/r,y=g*(t-e)+e;for(let e=0;e<=i;e++){const t=e/i,r=t*s+o,l=Math.sin(r),f=Math.cos(r);v.x=y*l,v.y=-g*n+m,v.z=y*f,u.push(v.x,v.y,v.z),a.set(l,x,f).normalize(),h.push(a.x,a.y,a.z),d.push(t,1-g),c.push(p++)}f.push(c)}for(let e=0;e<i;e++)for(let t=0;t<r;t++){const n=f[t][e],i=f[t+1][e],r=f[t+1][e+1],a=f[t][e+1];c.push(n,i,a),c.push(i,r,a),y+=6}l.addGroup(g,y,0),g+=y}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new rn(u,3)),this.setAttribute("normal",new rn(h,3)),this.setAttribute("uv",new rn(d,2))}}class _o extends wo{constructor(e=1,t=1,n=8,i=1,r=!1,a=0,o=2*Math.PI){super(0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}}class Mo extends gn{constructor(e,t,n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];function o(e,t,n,i){const r=i+1,a=[];for(let o=0;o<=r;o++){a[o]=[];const i=e.clone().lerp(n,o/r),s=t.clone().lerp(n,o/r),l=r-o;for(let e=0;e<=l;e++)a[o][e]=0===e&&o===r?i:i.clone().lerp(s,e/l)}for(let o=0;o<r;o++)for(let e=0;e<2*(r-o)-1;e++){const t=Math.floor(e/2);e%2==0?(s(a[o][t+1]),s(a[o+1][t]),s(a[o][t])):(s(a[o][t+1]),s(a[o+1][t+1]),s(a[o+1][t]))}}function s(e){r.push(e.x,e.y,e.z)}function l(t,n){const i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}!function(e){const n=new ye,i=new ye,r=new ye;for(let a=0;a<t.length;a+=3)l(t[a+0],n),l(t[a+1],i),l(t[a+2],r),o(n,i,r,e)}(i),function(e){const t=new ye;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){const e=new ye;for(let n=0;n<r.length;n+=3){e.x=r[n+0],e.y=r[n+1],e.z=r[n+2];const i=u(e)/2/Math.PI+.5,o=(t=e,Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5);a.push(i,1-o)}var t;(function(){const e=new ye,t=new ye,n=new ye,i=new ye,o=new se,s=new se,l=new se;for(let h=0,d=0;h<r.length;h+=9,d+=6){e.set(r[h+0],r[h+1],r[h+2]),t.set(r[h+3],r[h+4],r[h+5]),n.set(r[h+6],r[h+7],r[h+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),l.set(a[d+4],a[d+5]),i.copy(e).add(t).add(n).divideScalar(3);const p=u(i);c(o,d+0,e,p),c(s,d+2,t,p),c(l,d+4,n,p)}})(),function(){for(let e=0;e<a.length;e+=6){const t=a[e+0],n=a[e+2],i=a[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new rn(r,3)),this.setAttribute("normal",new rn(r.slice(),3)),this.setAttribute("uv",new rn(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}}class So extends Mo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}}const To=new ye,Eo=new ye,Ao=new ye,Lo=new Nt;class Ro extends gn{constructor(e,t){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1,!0===e.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),i=Math.cos(oe.DEG2RAD*t),r=e.getIndex(),a=e.getAttribute("position"),o=r?r.count:a.count,s=[0,0,0],l=["a","b","c"],c=new Array(3),u={},h=[];for(let d=0;d<o;d+=3){r?(s[0]=r.getX(d),s[1]=r.getX(d+1),s[2]=r.getX(d+2)):(s[0]=d,s[1]=d+1,s[2]=d+2);const{a:e,b:t,c:o}=Lo;if(e.fromBufferAttribute(a,s[0]),t.fromBufferAttribute(a,s[1]),o.fromBufferAttribute(a,s[2]),Lo.getNormal(Ao),c[0]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,c[1]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,c[2]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let n=0;n<3;n++){const e=(n+1)%3,t=c[n],r=c[e],a=Lo[l[n]],o=Lo[l[e]],d=`${t}_${r}`,p=`${r}_${t}`;p in u&&u[p]?(Ao.dot(u[p].normal)<=i&&(h.push(a.x,a.y,a.z),h.push(o.x,o.y,o.z)),u[p]=null):d in u||(u[d]={index0:s[n],index1:s[e],normal:Ao.clone()})}}for(const d in u)if(u[d]){const{index0:e,index1:t}=u[d];To.fromBufferAttribute(a,e),Eo.fromBufferAttribute(a,t),h.push(To.x,To.y,To.z),h.push(Eo.x,Eo.y,Eo.z)}this.setAttribute("position",new rn(h,3))}}function Co(e,t,n,i,r){let a,o;if(r===function(e,t,n,i){let r=0;for(let a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=Ko(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=Ko(a,e[a],e[a+1],o);return o&&Wo(o,o.next)&&(Qo(o),o=o.next),o}function Po(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Wo(i,i.next)&&0!==Vo(i.prev,i,i.next))i=i.next;else{if(Qo(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function Io(e,t,n,i,r,a,o){if(!e)return;!o&&a&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=Ho(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,a);let s,l,c=e;for(;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Oo(e,i,r,a):Do(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Qo(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Io(e=No(Po(e),t,n),t,n,i,r,a,2):2===o&&Fo(e,t,n,i,r,a):Io(Po(e),t,n,i,r,a,1);break}}function Do(e){const t=e.prev,n=e,i=e.next;if(Vo(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(Go(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Vo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Oo(e,t,n,i){const r=e.prev,a=e,o=e.next;if(Vo(r,a,o)>=0)return!1;const s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,l=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,c=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,u=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,h=Ho(s,l,t,n,i),d=Ho(c,u,t,n,i);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Go(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Vo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Go(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Vo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Go(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Vo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Go(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Vo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function No(e,t,n){let i=e;do{const r=i.prev,a=i.next.next;!Wo(r,a)&&qo(r,i,i.next,a)&&Yo(r,a)&&Yo(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),Qo(i),Qo(i.next),i=e=a),i=i.next}while(i!==e);return Po(i)}function Fo(e,t,n,i,r,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&jo(o,e)){let s=Jo(o,e);return o=Po(o,o.next),s=Po(s,s.next),Io(o,t,n,i,r,a),void Io(s,t,n,i,r,a)}e=e.next}o=o.next}while(o!==e)}function Bo(e,t){return e.x-t.x}function zo(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let a,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}a=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!a)return null;if(i===o)return a;const s=a,l=a.x,c=a.y;let u,h=1/0;n=a;do{i>=n.x&&n.x>=l&&i!==n.x&&Go(r<c?i:o,r,l,c,r<c?o:i,r,n.x,n.y)&&(u=Math.abs(r-n.y)/(i-n.x),Yo(n,e)&&(u<h||u===h&&(n.x>a.x||n.x===a.x&&ko(a,n)))&&(a=n,h=u)),n=n.next}while(n!==s);return a}(e,t)){const n=Jo(t,e);Po(t,t.next),Po(n,n.next)}}function ko(e,t){return Vo(e.prev,e,t.prev)<0&&Vo(t.next,e,e.next)<0}function Ho(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Uo(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 Go(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function jo(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)&&(Yo(e,t)&&Yo(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Vo(e.prev,e,t.prev)||Vo(e,t.prev,t))||Wo(e,t)&&Vo(e.prev,e,e.next)>0&&Vo(t.prev,t,t.next)>0)}function Vo(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Wo(e,t){return e.x===t.x&&e.y===t.y}function qo(e,t,n,i){const r=Zo(Vo(e,t,n)),a=Zo(Vo(e,t,i)),o=Zo(Vo(n,i,e)),s=Zo(Vo(n,i,t));return r!==a&&o!==s||!(0!==r||!Xo(e,n,t))||!(0!==a||!Xo(e,i,t))||!(0!==o||!Xo(n,e,i))||!(0!==s||!Xo(n,t,i))}function Xo(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 Zo(e){return e>0?1:e<0?-1:0}function Yo(e,t){return Vo(e.prev,e,e.next)<0?Vo(e,t,e.next)>=0&&Vo(e,e.prev,t)>=0:Vo(e,t,e.prev)<0||Vo(e,e.next,t)<0}function Jo(e,t){const n=new $o(e.i,e.x,e.y),i=new $o(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Ko(e,t,n,i){const r=new $o(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Qo(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 $o(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 es={area:function(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return es.area(e)<0},triangulateShape:function(e,t){const n=[],i=[],r=[];ts(e),ns(n,e);let a=e.length;t.forEach(ts);for(let s=0;s<t.length;s++)i.push(a),a+=t[s].length,ns(n,t[s]);const o=function(e,t,n){n=n||2;const i=t&&t.length,r=i?t[0]*n:e.length;let a=Co(e,0,r,n,!0);const o=[];if(!a||a.next===a.prev)return o;let s,l,c,u,h,d,p;if(i&&(a=function(e,t,n,i){const r=[];let a,o,s,l,c;for(a=0,o=t.length;a<o;a++)(c=Co(e,s=t[a]*i,l=a<o-1?t[a+1]*i:e.length,i,!1))===c.next&&(c.steiner=!0),r.push(Uo(c));for(r.sort(Bo),a=0;a<r.length;a++)zo(r[a],n),n=Po(n,n.next);return n}(e,t,a,n)),e.length>80*n){s=c=e[0],l=u=e[1];for(let t=n;t<r;t+=n)(h=e[t])<s&&(s=h),(d=e[t+1])<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=0!==(p=Math.max(c-s,u-l))?1/p:0}return Io(a,o,n,s,l,p),o}(n,i);for(let s=0;s<o.length;s+=3)r.push(o.slice(s,s+3));return r}};function ts(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ns(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class is extends gn{constructor(e,t){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let o=0,s=e.length;o<s;o++)a(e[o]);function a(e){const a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1;let l=void 0!==t.depth?t.depth:100,c=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,h=void 0!==t.bevelSize?t.bevelSize:u-2,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:rs;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=t.amount);let g,v,y,x,b,w=!1;f&&(g=f.getSpacedPoints(s),w=!0,c=!1,v=f.computeFrenetFrames(s,!1),y=new ye,x=new ye,b=new ye),c||(p=0,u=0,h=0,d=0);const _=e.extractPoints(o);let M=_.shape;const S=_.holes;if(!es.isClockWise(M)){M=M.reverse();for(let e=0,t=S.length;e<t;e++){const t=S[e];es.isClockWise(t)&&(S[e]=t.reverse())}}const T=es.triangulateShape(M,S),E=M;for(let t=0,n=S.length;t<n;t++){const e=S[t];M=M.concat(e)}function A(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}const L=M.length,R=T.length;function C(e,t,n){let i,r,a;const o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=o*o+s*s,h=o*c-s*l;if(Math.abs(h)>Number.EPSILON){const h=Math.sqrt(u),d=Math.sqrt(l*l+c*c),p=t.x-s/h,f=t.y+o/h,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(o*c-s*l),g=(i=p+o*m-e.x)*i+(r=f+s*m-e.y)*r;if(g<=2)return new se(i,r);a=Math.sqrt(g/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(s)===Math.sign(c)&&(e=!0),e?(i=-s,r=o,a=Math.sqrt(u)):(i=o,r=s,a=Math.sqrt(u/2))}return new se(i/a,r/a)}const P=[];for(let t=0,n=E.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),P[t]=C(E[t],E[i],E[r]);const I=[];let D,O=P.concat();for(let t=0,n=S.length;t<n;t++){const e=S[t];D=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[t]=C(e[t],e[i],e[r]);I.push(D),O=O.concat(D)}for(let t=0;t<p;t++){const e=t/p,n=u*Math.cos(e*Math.PI/2),i=h*Math.sin(e*Math.PI/2)+d;for(let t=0,r=E.length;t<r;t++){const e=A(E[t],P[t],i);B(e.x,e.y,-n)}for(let t=0,r=S.length;t<r;t++){const e=S[t];D=I[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],D[t],i);B(r.x,r.y,-n)}}}const N=h+d;for(let t=0;t<L;t++){const e=c?A(M[t],O[t],N):M[t];w?(x.copy(v.normals[0]).multiplyScalar(e.x),y.copy(v.binormals[0]).multiplyScalar(e.y),b.copy(g[0]).add(x).add(y),B(b.x,b.y,b.z)):B(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<L;e++){const n=c?A(M[e],O[e],N):M[e];w?(x.copy(v.normals[t]).multiplyScalar(n.x),y.copy(v.binormals[t]).multiplyScalar(n.y),b.copy(g[t]).add(x).add(y),B(b.x,b.y,b.z)):B(n.x,n.y,l/s*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=u*Math.cos(e*Math.PI/2),i=h*Math.sin(e*Math.PI/2)+d;for(let t=0,r=E.length;t<r;t++){const e=A(E[t],P[t],i);B(e.x,e.y,l+n)}for(let t=0,r=S.length;t<r;t++){const e=S[t];D=I[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],D[t],i);w?B(r.x,r.y+g[s-1].y,g[s-1].x+n):B(r.x,r.y,l+n)}}}function F(e,t){let n=e.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=s+2*p;e<n;e++){const n=L*e,a=L*(e+1);k(t+i+n,t+r+n,t+r+a,t+i+a)}}}function B(e,t,n){a.push(e),a.push(t),a.push(n)}function z(e,t,r){H(e),H(t),H(r);const a=i.length/3,o=m.generateTopUV(n,i,a-3,a-2,a-1);U(o[0]),U(o[1]),U(o[2])}function k(e,t,r,a){H(e),H(t),H(a),H(t),H(r),H(a);const o=i.length/3,s=m.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);U(s[0]),U(s[1]),U(s[3]),U(s[1]),U(s[2]),U(s[3])}function H(e){i.push(a[3*e+0]),i.push(a[3*e+1]),i.push(a[3*e+2])}function U(e){r.push(e.x),r.push(e.y)}!function(){const e=i.length/3;if(c){let e=0,t=L*e;for(let n=0;n<R;n++){const e=T[n];z(e[2]+t,e[1]+t,e[0]+t)}t=L*(e=s+2*p);for(let n=0;n<R;n++){const e=T[n];z(e[0]+t,e[1]+t,e[2]+t)}}else{for(let e=0;e<R;e++){const t=T[e];z(t[2],t[1],t[0])}for(let e=0;e<R;e++){const t=T[e];z(t[0]+L*s,t[1]+L*s,t[2]+L*s)}}n.addGroup(e,i.length/3-e,0)}(),function(){const e=i.length/3;let t=0;F(E,t),t+=E.length;for(let n=0,i=S.length;n<i;n++){const e=S[n];F(e,t),t+=e.length}n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new rn(i,3)),this.setAttribute("uv",new rn(r,2)),this.computeVertexNormals()}toJSON(){const e=gn.prototype.toJSON.call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let i=0,r=e.length;i<r;i++){const t=e[i];n.shapes.push(t.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}const rs={generateTopUV:function(e,t,n,i,r){const a=t[3*n],o=t[3*n+1],s=t[3*i],l=t[3*i+1],c=t[3*r],u=t[3*r+1];return[new se(a,o),new se(s,l),new se(c,u)]},generateSideWallUV:function(e,t,n,i,r,a){const o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*i],u=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-u)<.01?[new se(o,1-l),new se(c,1-h),new se(d,1-f),new se(m,1-v)]:[new se(s,1-l),new se(u,1-h),new se(p,1-f),new se(g,1-v)]}};class as extends Mo{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="IcosahedronGeometry",this.parameters={radius:e,detail:t}}}class os extends gn{constructor(e,t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=oe.clamp(i,0,2*Math.PI);const r=[],a=[],o=[],s=1/t,l=new ye,c=new se;for(let u=0;u<=t;u++){const r=n+u*s*i,h=Math.sin(r),d=Math.cos(r);for(let n=0;n<=e.length-1;n++)l.x=e[n].x*h,l.y=e[n].y,l.z=e[n].x*d,a.push(l.x,l.y,l.z),c.x=u/t,c.y=n/(e.length-1),o.push(c.x,c.y)}for(let u=0;u<t;u++)for(let t=0;t<e.length-1;t++){const n=t+u*e.length,i=n,a=n+e.length,o=n+e.length+1,s=n+1;r.push(i,a,s),r.push(a,o,s)}if(this.setIndex(r),this.setAttribute("position",new rn(a,3)),this.setAttribute("uv",new rn(o,2)),this.computeVertexNormals(),i===2*Math.PI){const n=this.attributes.normal.array,i=new ye,r=new ye,a=new ye,o=t*e.length*3;for(let t=0,s=0;t<e.length;t++,s+=3)i.x=n[s+0],i.y=n[s+1],i.z=n[s+2],r.x=n[o+s+0],r.y=n[o+s+1],r.z=n[o+s+2],a.addVectors(i,r).normalize(),n[s+0]=n[o+s+0]=a.x,n[s+1]=n[o+s+1]=a.y,n[s+2]=n[o+s+2]=a.z}}}class ss extends Mo{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="OctahedronGeometry",this.parameters={radius:e,detail:t}}}function ls(e,t,n){gn.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n};const i=[],r=[],a=[],o=[],s=1e-5,l=new ye,c=new ye,u=new ye,h=new ye,d=new ye;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=t+1;for(let f=0;f<=n;f++){const i=f/n;for(let n=0;n<=t;n++){const p=n/t;e(p,i,c),r.push(c.x,c.y,c.z),p-s>=0?(e(p-s,i,u),h.subVectors(c,u)):(e(p+s,i,u),h.subVectors(u,c)),i-s>=0?(e(p,i-s,u),d.subVectors(c,u)):(e(p,i+s,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),a.push(l.x,l.y,l.z),o.push(p,i)}}for(let f=0;f<n;f++)for(let e=0;e<t;e++){const t=f*p+e,n=f*p+e+1,r=(f+1)*p+e+1,a=(f+1)*p+e;i.push(t,n,a),i.push(n,r,a)}this.setIndex(i),this.setAttribute("position",new rn(r,3)),this.setAttribute("normal",new rn(a,3)),this.setAttribute("uv",new rn(o,2))}ls.prototype=Object.create(gn.prototype),ls.prototype.constructor=ls;class cs extends gn{constructor(e=.5,t=1,n=8,i=1,r=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n);const o=[],s=[],l=[],c=[];let u=e;const h=(t-e)/(i=Math.max(1,i)),d=new ye,p=new se;for(let f=0;f<=i;f++){for(let e=0;e<=n;e++){const i=r+e/n*a;d.x=u*Math.cos(i),d.y=u*Math.sin(i),s.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,c.push(p.x,p.y)}u+=h}for(let f=0;f<i;f++){const e=f*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,a=i+n+1,s=i+n+2,l=i+1;o.push(r,a,l),o.push(a,s,l)}}this.setIndex(o),this.setAttribute("position",new rn(s,3)),this.setAttribute("normal",new rn(l,3)),this.setAttribute("uv",new rn(c,2))}}class us extends gn{constructor(e,t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],a=[];let o=0,s=0;if(!1===Array.isArray(e))l(e);else for(let c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;function l(e){const o=i.length/3,l=e.extractPoints(t);let c=l.shape;const u=l.holes;!1===es.isClockWise(c)&&(c=c.reverse());for(let t=0,n=u.length;t<n;t++){const e=u[t];!0===es.isClockWise(e)&&(u[t]=e.reverse())}const h=es.triangulateShape(c,u);for(let t=0,n=u.length;t<n;t++){const e=u[t];c=c.concat(e)}for(let t=0,n=c.length;t<n;t++){const e=c[t];i.push(e.x,e.y,0),r.push(0,0,1),a.push(e.x,e.y)}for(let t=0,i=h.length;t<i;t++){const e=h[t],i=e[0]+o,r=e[1]+o,a=e[2]+o;n.push(i,r,a),s+=3}}this.setIndex(n),this.setAttribute("position",new rn(i,3)),this.setAttribute("normal",new rn(r,3)),this.setAttribute("uv",new rn(a,2))}toJSON(){const e=gn.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}class hs extends gn{constructor(e=1,t=8,n=6,i=0,r=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const s=Math.min(a+o,Math.PI);let l=0;const c=[],u=new ye,h=new ye,d=[],p=[],f=[],m=[];for(let g=0;g<=n;g++){const d=[],v=g/n;let y=0;0==g&&0==a?y=.5/t:g==n&&s==Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const s=n/t;u.x=-e*Math.cos(i+s*r)*Math.sin(a+v*o),u.y=e*Math.cos(a+v*o),u.z=e*Math.sin(i+s*r)*Math.sin(a+v*o),p.push(u.x,u.y,u.z),h.copy(u).normalize(),f.push(h.x,h.y,h.z),m.push(s+y,1-v),d.push(l++)}c.push(d)}for(let g=0;g<n;g++)for(let e=0;e<t;e++){const t=c[g][e+1],i=c[g][e],r=c[g+1][e],o=c[g+1][e+1];(0!==g||a>0)&&d.push(t,i,o),(g!==n-1||s<Math.PI)&&d.push(i,r,o)}this.setIndex(d),this.setAttribute("position",new rn(p,3)),this.setAttribute("normal",new rn(f,3)),this.setAttribute("uv",new rn(m,2))}}class ds extends Mo{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="TetrahedronGeometry",this.parameters={radius:e,detail:t}}}class ps extends is{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 gn;const i=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(i,t),this.type="TextGeometry"}}class fs extends gn{constructor(e=1,t=.4,n=8,i=6,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],s=[],l=[],c=new ye,u=new ye,h=new ye;for(let d=0;d<=n;d++)for(let a=0;a<=i;a++){const p=a/i*r,f=d/n*Math.PI*2;u.x=(e+t*Math.cos(f))*Math.cos(p),u.y=(e+t*Math.cos(f))*Math.sin(p),u.z=t*Math.sin(f),o.push(u.x,u.y,u.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),h.subVectors(u,c).normalize(),s.push(h.x,h.y,h.z),l.push(a/i),l.push(d/n)}for(let d=1;d<=n;d++)for(let e=1;e<=i;e++){const t=(i+1)*d+e-1,n=(i+1)*(d-1)+e-1,r=(i+1)*(d-1)+e,o=(i+1)*d+e;a.push(t,n,o),a.push(n,r,o)}this.setIndex(a),this.setAttribute("position",new rn(o,3)),this.setAttribute("normal",new rn(s,3)),this.setAttribute("uv",new rn(l,2))}}class ms extends gn{constructor(e=1,t=.4,n=64,i=8,r=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],s=[],l=[],c=[],u=new ye,h=new ye,d=new ye,p=new ye,f=new ye,m=new ye,g=new ye;for(let y=0;y<=n;++y){const o=y/n*r*Math.PI*2;v(o,r,a,e,d),v(o+.01,r,a,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<=i;++e){const r=e/i*Math.PI*2,a=-t*Math.cos(r),o=t*Math.sin(r);u.x=d.x+(a*g.x+o*f.x),u.y=d.y+(a*g.y+o*f.y),u.z=d.z+(a*g.z+o*f.z),s.push(u.x,u.y,u.z),h.subVectors(u,d).normalize(),l.push(h.x,h.y,h.z),c.push(y/n),c.push(e/i)}}for(let y=1;y<=n;y++)for(let e=1;e<=i;e++){const t=(i+1)*(y-1)+(e-1),n=(i+1)*y+(e-1),r=(i+1)*y+e,a=(i+1)*(y-1)+e;o.push(t,n,a),o.push(n,r,a)}function v(e,t,n,i,r){const a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(s)*.5}this.setIndex(o),this.setAttribute("position",new rn(s,3)),this.setAttribute("normal",new rn(l,3)),this.setAttribute("uv",new rn(c,2))}}class gs extends gn{constructor(e,t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new ye,s=new ye,l=new se;let c=new ye;const u=[],h=[],d=[],p=[];function f(r){c=e.getPointAt(r/t,c);const l=a.normals[r],d=a.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),a=-Math.cos(t);s.x=a*l.x+r*d.x,s.y=a*l.y+r*d.y,s.z=a*l.z+r*d.z,s.normalize(),h.push(s.x,s.y,s.z),o.x=c.x+n*s.x,o.y=c.y+n*s.y,o.z=c.z+n*s.z,u.push(o.x,o.y,o.z)}}!function(){for(let e=0;e<t;e++)f(e);f(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),a=(i+1)*e+t,o=(i+1)*(e-1)+t;p.push(n,r,o),p.push(r,a,o)}}()}(),this.setIndex(p),this.setAttribute("position",new rn(u,3)),this.setAttribute("normal",new rn(h,3)),this.setAttribute("uv",new rn(d,2))}toJSON(){const e=gn.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e}}class vs extends gn{constructor(e){if(super(),this.type="WireframeGeometry",!0===e.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const t=[],n=[0,0],i={},r=new ye;if(null!==e.index){const a=e.attributes.position,o=e.index;let s=e.groups;0===s.length&&(s=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,t=s.length;e<t;++e){const t=s[e],r=t.start;for(let e=r,a=r+t.count;e<a;e+=3)for(let t=0;t<3;t++){const r=o.getX(e+t),a=o.getX(e+(t+1)%3);n[0]=Math.min(r,a),n[1]=Math.max(r,a);const s=n[0]+","+n[1];void 0===i[s]&&(i[s]={index1:n[0],index2:n[1]})}}for(const e in i){const n=i[e];r.fromBufferAttribute(a,n.index1),t.push(r.x,r.y,r.z),r.fromBufferAttribute(a,n.index2),t.push(r.x,r.y,r.z)}}else{const n=e.attributes.position;for(let e=0,i=n.count/3;e<i;e++)for(let a=0;a<3;a++){const i=3*e+a;r.fromBufferAttribute(n,i),t.push(r.x,r.y,r.z);const o=3*e+(a+1)%3;r.fromBufferAttribute(n,o),t.push(r.x,r.y,r.z)}}this.setAttribute("position",new rn(t,3))}}var ys=Object.freeze({__proto__:null,BoxGeometry:Fn,BoxBufferGeometry:Fn,CircleGeometry:bo,CircleBufferGeometry:bo,ConeGeometry:_o,ConeBufferGeometry:_o,CylinderGeometry:wo,CylinderBufferGeometry:wo,DodecahedronGeometry:So,DodecahedronBufferGeometry:So,EdgesGeometry:Ro,ExtrudeGeometry:is,ExtrudeBufferGeometry:is,IcosahedronGeometry:as,IcosahedronBufferGeometry:as,LatheGeometry:os,LatheBufferGeometry:os,OctahedronGeometry:ss,OctahedronBufferGeometry:ss,ParametricGeometry:ls,ParametricBufferGeometry:ls,PlaneGeometry:Qn,PlaneBufferGeometry:Qn,PolyhedronGeometry:Mo,PolyhedronBufferGeometry:Mo,RingGeometry:cs,RingBufferGeometry:cs,ShapeGeometry:us,ShapeBufferGeometry:us,SphereGeometry:hs,SphereBufferGeometry:hs,TetrahedronGeometry:ds,TetrahedronBufferGeometry:ds,TextGeometry:ps,TextBufferGeometry:ps,TorusGeometry:fs,TorusBufferGeometry:fs,TorusKnotGeometry:ms,TorusKnotBufferGeometry:ms,TubeGeometry:gs,TubeBufferGeometry:gs,WireframeGeometry:vs});class xs extends Bt{constructor(e){super(),this.type="ShadowMaterial",this.color=new Vt(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}xs.prototype.isShadowMaterial=!0;class bs extends Hn{constructor(e){super(e),this.type="RawShaderMaterial"}}function ws(e){Bt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Vt(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 Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new se(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.flatShading=!1,this.vertexTangents=!1,this.setValues(e)}function _s(e){ws.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new se(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=oe.clamp(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(e)}bs.prototype.isRawShaderMaterial=!0,ws.prototype=Object.create(Bt.prototype),ws.prototype.constructor=ws,ws.prototype.isMeshStandardMaterial=!0,ws.prototype.copy=function(e){return Bt.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.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this},_s.prototype=Object.create(ws.prototype),_s.prototype.constructor=_s,_s.prototype.isMeshPhysicalMaterial=!0,_s.prototype.copy=function(e){return ws.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 Vt).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this};class Ms extends Bt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Vt(16777215),this.specular=new Vt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new se(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.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Ms.prototype.isMeshPhongMaterial=!0;class Ss extends Bt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Vt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new se(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)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Ss.prototype.isMeshToonMaterial=!0;class Ts extends Bt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new se(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.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Ts.prototype.isMeshNormalMaterial=!0;class Es extends Bt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new Vt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vt(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)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Es.prototype.isMeshLambertMaterial=!0;class As extends Bt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Vt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}As.prototype.isMeshMatcapMaterial=!0;class Ls extends Ka{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Ls.prototype.isLineDashedMaterial=!0;var Rs=Object.freeze({__proto__:null,ShadowMaterial:xs,SpriteMaterial:va,RawShaderMaterial:bs,ShaderMaterial:Hn,PointsMaterial:lo,MeshPhysicalMaterial:_s,MeshStandardMaterial:ws,MeshPhongMaterial:Ms,MeshToonMaterial:Ss,MeshNormalMaterial:Ts,MeshLambertMaterial:Es,MeshDepthMaterial:Qr,MeshDistanceMaterial:$r,MeshBasicMaterial:Wt,MeshMatcapMaterial:As,LineDashedMaterial:Ls,LineBasicMaterial:Ka,Material:Bt});const Cs={arraySlice:function(e,t,n){return Cs.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 i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,o=0;o!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)},subclip:function(e,t,n,i,r=30){const a=e.clone();a.name=t;const o=[];for(let l=0;l<a.tracks.length;++l){const e=a.tracks[l],t=e.getValueSize(),s=[],c=[];for(let a=0;a<e.times.length;++a){const o=e.times[a]*r;if(!(o<n||o>=i)){s.push(e.times[a]);for(let n=0;n<t;++n)c.push(e.values[a*t+n])}}0!==s.length&&(e.times=Cs.convertArray(s,e.times.constructor),e.values=Cs.convertArray(c,e.values.constructor),o.push(e))}a.tracks=o;let s=1/0;for(let l=0;l<a.tracks.length;++l)s>a.tracks[l].times[0]&&(s=a.tracks[l].times[0]);for(let l=0;l<a.tracks.length;++l)a.tracks[l].shift(-1*s);return a.resetDuration(),a},makeClipAdditive:function(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,a=t/i;for(let o=0;o<r;++o){const t=n.tracks[o],i=t.ValueTypeName;if("bool"===i||"string"===i)continue;const r=e.tracks.find((function(e){return e.name===t.name&&e.ValueTypeName===i}));if(void 0===r)continue;let s=0;const l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);let c=0;const u=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const h=t.times.length-1;let d;if(a<=t.times[0]){const e=s,n=l-s;d=Cs.arraySlice(t.values,e,n)}else if(a>=t.times[h]){const e=h*l+s,n=e+l-s;d=Cs.arraySlice(t.values,e,n)}else{const e=t.createInterpolant(),n=s,i=l-s;e.evaluate(a),d=Cs.arraySlice(e.resultBuffer,n,i)}"quaternion"===i&&(new ve).fromArray(d).normalize().conjugate().toArray(d);const p=r.times.length;for(let e=0;e<p;++e){const t=e*u+c;if("quaternion"===i)ve.multiplyQuaternionsFlat(r.values,t,d,0,r.values,t);else{const e=u-2*c;for(let n=0;n<e;++n)r.values[t+n]-=d[n]}}}return e.blendMode=q,e}};function Ps(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Is(e,t,n,i){Ps.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ds(e,t,n,i){Ps.call(this,e,t,n,i)}function Os(e,t,n,i){Ps.call(this,e,t,n,i)}Object.assign(Ps.prototype,{evaluate:function(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===a)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===a)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}}for(;n<a;){const i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Ps.prototype,{beforeStart_:Ps.prototype.copySampleValue_,afterEnd_:Ps.prototype.copySampleValue_}),Is.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Is,DefaultSettings_:{endingStart:G,endingEnd:G},intervalChanged_:function(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case j:r=e,o=2*t-n;break;case V:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case j:a=e,s=2*n-t;break;case V:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let b=0;b!==o;++b)r[b]=g*a[c+b]+v*a[l+b]+y*a[s+b]+x*a[u+b];return r}}),Ds.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Ds,interpolate_:function(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),u=1-c;for(let h=0;h!==o;++h)r[h]=a[l+h]*u+a[s+h]*c;return r}}),Os.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Os,interpolate_:function(e){return this.copySampleValue_(e-1)}});class Ns{constructor(e,t,n,i){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=Cs.convertArray(t,this.TimeBufferType),this.values=Cs.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Cs.convertArray(e.times,Array),values:Cs.convertArray(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Os(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ds(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Is(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case k:t=this.InterpolantFactoryMethodDiscrete;break;case H:t=this.InterpolantFactoryMethodLinear;break;case U: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(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return k;case this.InterpolantFactoryMethodLinear:return H;case this.InterpolantFactoryMethodSmooth:return U}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);const e=this.getValueSize();this.times=Cs.arraySlice(n,r,a),this.values=Cs.arraySlice(this.values,r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const t=n[o];if("number"==typeof t&&isNaN(t)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,t),e=!1;break}if(null!==a&&a>t){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,t,a),e=!1;break}a=t}if(void 0!==i&&Cs.isTypedArray(i))for(let o=0,s=i.length;o!==s;++o){const t=i[o];if(isNaN(t)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,t),e=!1;break}}return e}optimize(){const e=Cs.arraySlice(this.times),t=Cs.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===U,r=e.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=e[o];if(s!==e[o+1]&&(1!==o||s!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,a=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[a+o]){r=!0;break}}}if(r){if(o!==a){e[a]=e[o];const i=o*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,o=0;o!==n;++o)t[i+o]=t[e+o];++a}return a!==e.length?(this.times=Cs.arraySlice(e,0,a),this.values=Cs.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}clone(){const e=Cs.arraySlice(this.times,0),t=Cs.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Ns.prototype.TimeBufferType=Float32Array,Ns.prototype.ValueBufferType=Float32Array,Ns.prototype.DefaultInterpolation=H;class Fs extends Ns{}Fs.prototype.ValueTypeName="bool",Fs.prototype.ValueBufferType=Array,Fs.prototype.DefaultInterpolation=k,Fs.prototype.InterpolantFactoryMethodLinear=void 0,Fs.prototype.InterpolantFactoryMethodSmooth=void 0;class Bs extends Ns{}Bs.prototype.ValueTypeName="color";class zs extends Ns{}function ks(e,t,n,i){Ps.call(this,e,t,n,i)}zs.prototype.ValueTypeName="number",ks.prototype=Object.assign(Object.create(Ps.prototype),{constructor:ks,interpolate_:function(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t);let l=e*o;for(let c=l+o;l!==c;l+=4)ve.slerpFlat(r,0,a,l-o,a,l,s);return r}});class Hs extends Ns{InterpolantFactoryMethodLinear(e){return new ks(this.times,this.values,this.getValueSize(),e)}}Hs.prototype.ValueTypeName="quaternion",Hs.prototype.DefaultInterpolation=H,Hs.prototype.InterpolantFactoryMethodSmooth=void 0;class Us extends Ns{}Us.prototype.ValueTypeName="string",Us.prototype.ValueBufferType=Array,Us.prototype.DefaultInterpolation=k,Us.prototype.InterpolantFactoryMethodLinear=void 0,Us.prototype.InterpolantFactoryMethodSmooth=void 0;class Gs extends Ns{}Gs.prototype.ValueTypeName="vector";class js{constructor(e,t=-1,n,i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=oe.generateUUID(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Vs(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,a=n.length;r!==a;++r)t.push(Ns.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let o=0;o<r;o++){let e=[],s=[];e.push((o+r-1)%r,o,(o+1)%r),s.push(0,1,0);const l=Cs.getKeyframeOrder(e);e=Cs.sortedArray(e,1,l),s=Cs.sortedArray(s,1,l),i||0!==e[0]||(e.push(r),s.push(s[0])),a.push(new zs(".morphTargetInfluences["+t[o].name+"]",e,s).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,s=e.length;o<s;o++){const t=e[o],n=t.name.match(r);if(n&&n.length>1){const e=n[1];let r=i[e];r||(i[e]=r=[]),r.push(t)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],o=[];Cs.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let s=e.length||-1;const l=e.hierarchy||[];for(let c=0;c<l.length;c++){const e=l[c].keys;if(e&&0!==e.length)if(e[0].morphTargets){const t={};let n;for(n=0;n<e.length;n++)if(e[n].morphTargets)for(let i=0;i<e[n].morphTargets.length;i++)t[e[n].morphTargets[i]]=-1;for(const r in t){const t=[],a=[];for(let i=0;i!==e[n].morphTargets.length;++i){const i=e[n];t.push(i.time),a.push(i.morphTarget===r?1:0)}i.push(new zs(".morphTargetInfluence["+r+"]",t,a))}s=t.length*(a||1)}else{const r=".bones["+t[c].name+"]";n(Gs,r+".position",e,"pos",i),n(Hs,r+".quaternion",e,"rot",i),n(Gs,r+".scale",e,"scl",i)}}return 0===i.length?null:new this(r,s,i,o)}resetDuration(){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(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Vs(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 zs;case"vector":case"vector2":case"vector3":case"vector4":return Gs;case"color":return Bs;case"quaternion":return Hs;case"bool":case"boolean":return Fs;case"string":return Us}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Cs.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)}const Ws={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 qs(e,t,n){const i=this;let r,a=!1,o=0,s=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=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],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}const Xs=new qs;function Zs(e){this.manager=void 0!==e?e:Xs,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Zs.prototype,{load:function(){},loadAsync:function(e,t){const n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))},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 Ys={};function Js(e){Zs.call(this,e)}function Ks(e){Zs.call(this,e)}Js.prototype=Object.assign(Object.create(Zs.prototype),{constructor:Js,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ws.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0!==Ys[e])return void Ys[e].push({onLoad:t,onProgress:n,onError:i});const o=e.match(/^data:(.*?)(;base64)?,(.*)$/);let s;if(o){const n=o[1],a=!!o[2];let s=o[3];s=decodeURIComponent(s),a&&(s=atob(s));try{let i;const a=(this.responseType||"").toLowerCase();switch(a){case"arraybuffer":case"blob":const e=new Uint8Array(s.length);for(let n=0;n<s.length;n++)e[n]=s.charCodeAt(n);i="blob"===a?new Blob([e.buffer],{type:n}):e.buffer;break;case"document":const t=new DOMParser;i=t.parseFromString(s,n);break;case"json":i=JSON.parse(s);break;default:i=s}setTimeout((function(){t&&t(i),r.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}),0)}}else{Ys[e]=[],Ys[e].push({onLoad:t,onProgress:n,onError:i}),(s=new XMLHttpRequest).open("GET",e,!0),s.addEventListener("load",(function(t){const n=this.response,i=Ys[e];if(delete Ys[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ws.add(e,n);for(let e=0,t=i.length;e<t;e++){const t=i[e];t.onLoad&&t.onLoad(n)}r.manager.itemEnd(e)}else{for(let e=0,n=i.length;e<n;e++){const n=i[e];n.onError&&n.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}}),!1),s.addEventListener("progress",(function(t){const n=Ys[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onProgress&&i.onProgress(t)}}),!1),s.addEventListener("error",(function(t){const n=Ys[e];delete Ys[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),s.addEventListener("abort",(function(t){const n=Ys[e];delete Ys[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const e in this.requestHeader)s.setRequestHeader(e,this.requestHeader[e]);s.send(null)}return r.manager.itemStart(e),s},setResponseType:function(e){return this.responseType=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Ks.prototype=Object.assign(Object.create(Zs.prototype),{constructor:Ks,load:function(e,t,n,i){const r=this,a=[],o=new vo,s=new Js(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials);let l=0;function c(c){s.load(e[c],(function(e){const n=r.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=g),o.image=a,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(Array.isArray(e))for(let u=0,h=e.length;u<h;++u)c(u);else s.load(e,(function(e){const n=r.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)a[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),a[t].format=n.format,a[t].width=n.width,a[t].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=g),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}});class Qs extends Zs{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ws.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),Ws.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class $s extends Zs{constructor(e){super(e)}load(e,t,n,i){const r=new Vn,a=new Qs(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function s(n){a.load(e[n],(function(e){r.images[n]=e,6==++o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(let l=0;l<e.length;++l)s(l);return r}}function el(e){Zs.call(this,e)}function tl(e){Zs.call(this,e)}function nl(){this.type="Curve",this.arcLengthDivisions=200}el.prototype=Object.assign(Object.create(Zs.prototype),{constructor:el,load:function(e,t,n,i){const r=this,a=new qn,o=new Js(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){const n=r.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:h,a.wrapT=void 0!==n.wrapT?n.wrapT:h,a.magFilter=void 0!==n.magFilter?n.magFilter:g,a.minFilter=void 0!==n.minFilter?n.minFilter:g,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=y),1===n.mipmapCount&&(a.minFilter=g),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n))}),n,i),a}}),tl.prototype=Object.assign(Object.create(Zs.prototype),{constructor:tl,load:function(e,t,n,i){const r=new de,a=new Qs(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){r.image=n;const i=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?T:E,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}),Object.assign(nl.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,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)r+=(n=this.getPoint(a/e)).distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){const n=this.getLengths();let i=0;const r=n.length;let a;a=t||e*n[r-1];let o,s=0,l=r-1;for(;s<=l;)if((o=n[i=Math.floor(s+(l-s)/2)]-a)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(n[i=l]===a)return i/(r-1);const c=n[i];return(i+(a-c)/(n[i+1]-c))/(r-1)},getTangent:function(e,t){let n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new se:new ye);return o.copy(a).sub(r).normalize(),o},getTangentAt:function(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){const n=new ye,i=[],r=[],a=[],o=new ye,s=new Ye;for(let d=0;d<=e;d++){const t=d/e;i[d]=this.getTangentAt(t,new ye),i[d].normalize()}r[0]=new ye,a[0]=new ye;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),h<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(i[d-1],i[d]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(oe.clamp(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(s.makeRotationAxis(o,e))}a[d].crossVectors(i[d],r[d])}if(!0===t){let t=Math.acos(oe.clamp(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(s.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}},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}});class il extends nl{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,o=!1,s=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t){const n=t||new se,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);const o=this.aStartAngle+e*r;let s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,i=l-this.aY;s=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(s,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}il.prototype.isEllipseCurve=!0;class rl extends il{constructor(e,t,n,i,r,a){super(e,t,n,n,i,r,a),this.type="ArcCurve"}}function al(){let e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){let l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,c*=o)},calc:function(r){const a=r*r;return e+t*r+n*a+i*(a*r)}}}rl.prototype.isArcCurve=!0;const ol=new ye,sl=new al,ll=new al,cl=new al;class ul extends nl{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new ye){const n=t,i=this.points,r=i.length,a=(r-(this.closed?0:1))*e;let o,s,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(ol.subVectors(i[0],i[1]).add(i[0]),o=ol);const u=i[l%r],h=i[(l+1)%r];if(this.closed||l+2<r?s=i[(l+2)%r]:(ol.subVectors(i[r-1],i[r-2]).add(i[r-1]),s=ol),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(o.distanceToSquared(u),e),n=Math.pow(u.distanceToSquared(h),e),i=Math.pow(h.distanceToSquared(s),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),sl.initNonuniformCatmullRom(o.x,u.x,h.x,s.x,t,n,i),ll.initNonuniformCatmullRom(o.y,u.y,h.y,s.y,t,n,i),cl.initNonuniformCatmullRom(o.z,u.z,h.z,s.z,t,n,i)}else"catmullrom"===this.curveType&&(sl.initCatmullRom(o.x,u.x,h.x,s.x,this.tension),ll.initCatmullRom(o.y,u.y,h.y,s.y,this.tension),cl.initCatmullRom(o.z,u.z,h.z,s.z,this.tension));return n.set(sl.calc(c),ll.calc(c),cl.calc(c)),n}copy(e){super.copy(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}toJSON(){const e=super.toJSON();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}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new ye).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function hl(e,t,n,i,r){const a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function dl(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*n}(e)+function(e,t){return e*e*i}(e)}function pl(e,t,n,i,r){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*i}(e)+function(e,t){return e*e*e*r}(e)}ul.prototype.isCatmullRomCurve3=!0;class fl extends nl{constructor(e=new se,t=new se,n=new se,i=new se){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new se){const n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(pl(e,i.x,r.x,a.x,o.x),pl(e,i.y,r.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}fl.prototype.isCubicBezierCurve=!0;class ml extends nl{constructor(e=new ye,t=new ye,n=new ye,i=new ye){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ye){const n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(pl(e,i.x,r.x,a.x,o.x),pl(e,i.y,r.y,a.y,o.y),pl(e,i.z,r.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}ml.prototype.isCubicBezierCurve3=!0;class gl extends nl{constructor(e=new se,t=new se){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new se){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new se;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}gl.prototype.isLineCurve=!0;class vl extends nl{constructor(e=new ye,t=new ye){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new ye){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class yl extends nl{constructor(e=new se,t=new se,n=new se){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new se){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(dl(e,i.x,r.x,a.x),dl(e,i.y,r.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}yl.prototype.isQuadraticBezierCurve=!0;class xl extends nl{constructor(e=new ye,t=new ye,n=new ye){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ye){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(dl(e,i.x,r.x,a.x),dl(e,i.y,r.y,a.y),dl(e,i.z,r.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}xl.prototype.isQuadraticBezierCurve3=!0;class bl extends nl{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new se){const n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],c=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(hl(o,s.x,l.x,c.x,u.x),hl(o,s.y,l.y,c.y,u.y)),n}copy(e){super.copy(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}toJSON(){const e=super.toJSON();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}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new se).fromArray(n))}return this}}bl.prototype.isSplineCurve=!0;var wl=Object.freeze({__proto__:null,ArcCurve:rl,CatmullRomCurve3:ul,CubicBezierCurve:fl,CubicBezierCurve3:ml,EllipseCurve:il,LineCurve:gl,LineCurve3:vl,QuadraticBezierCurve:yl,QuadraticBezierCurve3:xl,SplineCurve:bl});class _l extends nl{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new gl(t,e))}getPoint(e){const t=e*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=t){const e=n[i]-t,r=this.curves[i],a=r.getLength(),o=0===a?0:1-e/a;return r.getPointAt(o)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const a=r[i],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){const i=s[e];n&&n.equals(i)||(t.push(i),n=i)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new wl[n.type]).fromJSON(n))}return this}}class Ml extends _l{constructor(e){super(),this.type="Path",this.currentPoint=new se,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new gl(this.currentPoint.clone(),new se(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new yl(this.currentPoint.clone(),new se(e,t),new se(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,a){const o=new fl(this.currentPoint.clone(),new se(e,t),new se(n,i),new se(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new bl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this}absarc(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}ellipse(e,t,n,i,r,a,o,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,a,o,s),this}absellipse(e,t,n,i,r,a,o,s){const l=new il(e,t,n,i,r,a,o,s);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(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Sl extends Ml{constructor(e){super(e),this.uuid=oe.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new Ml).fromJSON(n))}return this}}class Tl extends bt{constructor(e,t=1){super(),this.type="Light",this.color=new Vt(e),this.intensity=t}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,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}}Tl.prototype.isLight=!0;class El extends Tl{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(bt.DefaultUp),this.updateMatrix(),this.groundColor=new Vt(t)}copy(e){return Tl.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}El.prototype.isHemisphereLight=!0;const Al=new Ye,Ll=new ye,Rl=new ye;class Cl{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new se(512,512),this.map=null,this.mapPass=null,this.matrix=new Ye,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yn,this._frameExtents=new se(1,1),this._viewportCount=1,this._viewports=[new fe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Ll.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ll),Rl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Rl),t.updateMatrixWorld(),Al.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Al),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 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}}class Pl extends Cl{constructor(){super(new Gn(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=2*oe.RAD2DEG*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Pl.prototype.isSpotLightShadow=!0;class Il extends Tl{constructor(e,t,n=0,i=Math.PI/3,r=0,a=1){super(e,t),this.type="SpotLight",this.position.copy(bt.DefaultUp),this.updateMatrix(),this.target=new bt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.shadow=new Pl}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Il.prototype.isSpotLight=!0;const Dl=new Ye,Ol=new ye,Nl=new ye;class Fl extends Cl{constructor(){super(new Gn(90,1,.5,500)),this._frameExtents=new se(4,2),this._viewportCount=6,this._viewports=[new fe(2,1,1,1),new fe(0,1,1,1),new fe(3,1,1,1),new fe(1,1,1,1),new fe(3,0,1,1),new fe(1,0,1,1)],this._cubeDirections=[new ye(1,0,0),new ye(-1,0,0),new ye(0,0,1),new ye(0,0,-1),new ye(0,1,0),new ye(0,-1,0)],this._cubeUps=[new ye(0,1,0),new ye(0,1,0),new ye(0,1,0),new ye(0,1,0),new ye(0,0,1),new ye(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ol.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ol),Nl.copy(n.position),Nl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Nl),n.updateMatrixWorld(),i.makeTranslation(-Ol.x,-Ol.y,-Ol.z),Dl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Dl)}}Fl.prototype.isPointLightShadow=!0;class Bl extends Tl{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Fl}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Bl.prototype.isPointLight=!0;class zl extends Un{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){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=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=i+t,s=i-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;a=(r+=e*this.view.offsetX)+e*this.view.width,s=(o-=t*this.view.offsetY)-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=bt.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}}zl.prototype.isOrthographicCamera=!0;class kl extends Cl{constructor(){super(new zl(-5,5,5,-5,.5,500))}}kl.prototype.isDirectionalLightShadow=!0;class Hl extends Tl{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(bt.DefaultUp),this.updateMatrix(),this.target=new bt,this.shadow=new kl}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Hl.prototype.isDirectionalLight=!0;class Ul extends Tl{constructor(e,t){super(e,t),this.type="AmbientLight"}}Ul.prototype.isAmbientLight=!0;class Gl extends Tl{constructor(e,t,n=10,i=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=i}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}Gl.prototype.isRectAreaLight=!0;class jl{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ye)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}jl.prototype.isSphericalHarmonics3=!0;class Vl extends Tl{constructor(e=new jl,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Vl.prototype.isLightProbe=!0;class Wl extends Zs{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,a=new Js(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const i=new Rs[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new Vt).setHex(e.sheen)),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const r in e.uniforms){const t=e.uniforms[r];switch(i.uniforms[r]={},t.type){case"t":i.uniforms[r].value=n(t.value);break;case"c":i.uniforms[r].value=(new Vt).setHex(t.value);break;case"v2":i.uniforms[r].value=(new se).fromArray(t.value);break;case"v3":i.uniforms[r].value=(new ye).fromArray(t.value);break;case"v4":i.uniforms[r].value=(new fe).fromArray(t.value);break;case"m3":i.uniforms[r].value=(new le).fromArray(t.value);break;case"m4":i.uniforms[r].value=(new Ye).fromArray(t.value);break;default:i.uniforms[r].value=t.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new se).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new se).fromArray(e.clearcoatNormalScale)),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),i}setTextures(e){return this.textures=e,this}}const ql={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){const t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function Xl(){gn.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Zl(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Zt.call(this,e,t,n),this.meshPerAttribute=i||1}Xl.prototype=Object.assign(Object.create(gn.prototype),{constructor:Xl,isInstancedBufferGeometry:!0,copy:function(e){return gn.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const e=gn.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),Zl.prototype=Object.assign(Object.create(Zt.prototype),{constructor:Zl,isInstancedBufferAttribute:!0,copy:function(e){return Zt.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){const e=Zt.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}});class Yl extends Zs{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Js(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],a=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),o=new fa(ln(r.type,a),r.stride);return o.uuid=r.uuid,t[i]=o,o}const r=e.isInstancedBufferGeometry?new Xl:new gn,a=e.data.index;if(void 0!==a){const e=ln(a.type,a.array);r.setIndex(new Zt(e,1))}const o=e.data.attributes;for(const u in o){const t=o[u];let n;if(t.isInterleavedBufferAttribute)n=new ga(i(e.data,t.data),t.itemSize,t.offset,t.normalized);else{const e=ln(t.type,t.array);n=new(t.isInstancedBufferAttribute?Zl:Zt)(e,t.itemSize,t.normalized)}void 0!==t.name&&(n.name=t.name),void 0!==t.usage&&n.setUsage(t.usage),void 0!==t.updateRange&&(n.updateRange.offset=t.updateRange.offset,n.updateRange.count=t.updateRange.count),r.setAttribute(u,n)}const s=e.data.morphAttributes;if(s)for(const u in s){const t=s[u],n=[];for(let r=0,a=t.length;r<a;r++){const a=t[r];let o;o=a.isInterleavedBufferAttribute?new ga(i(e.data,a.data),a.itemSize,a.offset,a.normalized):new Zt(ln(a.type,a.array),a.itemSize,a.normalized),void 0!==a.name&&(o.name=a.name),n.push(o)}r.morphAttributes[u]=n}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let u=0,h=l.length;u!==h;++u){const e=l[u];r.addGroup(e.start,e.count,e.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new ye;void 0!==c.center&&e.fromArray(c.center),r.boundingSphere=new He(e,c.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}const Jl={UVMapping:i,CubeReflectionMapping:r,CubeRefractionMapping:a,EquirectangularReflectionMapping:o,EquirectangularRefractionMapping:s,CubeUVReflectionMapping:l,CubeUVRefractionMapping:c},Kl={RepeatWrapping:u,ClampToEdgeWrapping:h,MirroredRepeatWrapping:d},Ql={NearestFilter:p,NearestMipmapNearestFilter:f,NearestMipmapLinearFilter:m,LinearFilter:g,LinearMipmapNearestFilter:v,LinearMipmapLinearFilter:y};function $l(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Zs.call(this,e),this.options={premultiplyAlpha:"none"}}$l.prototype=Object.assign(Object.create(Zs.prototype),{constructor:$l,isImageBitmapLoader:!0,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ws.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){Ws.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}});class ec{constructor(){this.type="ShapePath",this.color=new Vt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ml,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new Sl;r.curves=i.curves,t.push(r)}return t}function i(e,t){const n=t.length;let i=!1;for(let r=n-1,a=0;a<n;r=a++){let n=t[r],o=t[a],s=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[a],s=-s,o=t[r],l=-l),e.y<n.y||e.y>o.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-s*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const r=es.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);let o,s,l;const c=[];if(1===a.length)return s=a[0],(l=new Sl).curves=s.curves,c.push(l),c;let u=!r(a[0].getPoints());u=e?!u:u;const h=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let v=0,y=a.length;v<y;v++)o=r(p=(s=a[v]).getPoints()),(o=e?!o:o)?(!u&&d[g]&&g++,d[g]={s:new Sl,p:p},d[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:p[0]});if(!d[0])return n(a);if(d.length>1){let e=!1;const t=[];for(let n=0,i=d.length;n<i;n++)h[n]=[];for(let n=0,r=d.length;n<r;n++){const r=m[n];for(let a=0;a<r.length;a++){const o=r[a];let s=!0;for(let r=0;r<d.length;r++)i(o.p,d[r].p)&&(n!==r&&t.push({froms:n,tos:r,hole:a}),s?(s=!1,h[r].push(o)):e=!0);s&&h[n].push(o)}}t.length>0&&(e||(m=h))}for(let v=0,y=d.length;v<y;v++){l=d[v].s,c.push(l),f=m[v];for(let e=0,t=f.length;e<t;e++)l.holes.push(f[e].h)}return c}}class tc{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],i=function(e,t,n){const i=Array.from(e),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[];let s=0,l=0;for(let c=0;c<i.length;c++){const e=i[c];if("\n"===e)s=0,l-=a;else{const t=nc(e,r,s,l,n);s+=t.offsetX,o.push(t.path)}}return o}(e,t,this.data);for(let r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}function nc(e,t,n,i,r){const a=r.glyphs[e]||r.glyphs["?"];if(!a)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".");const o=new ec;let s,l,c,u,h,d,p,f;if(a.o){const e=a._cachedOutline||(a._cachedOutline=a.o.split(" "));for(let r=0,a=e.length;r<a;)switch(e[r++]){case"m":s=e[r++]*t+n,l=e[r++]*t+i,o.moveTo(s,l);break;case"l":s=e[r++]*t+n,l=e[r++]*t+i,o.lineTo(s,l);break;case"q":c=e[r++]*t+n,u=e[r++]*t+i,h=e[r++]*t+n,d=e[r++]*t+i,o.quadraticCurveTo(h,d,c,u);break;case"b":c=e[r++]*t+n,u=e[r++]*t+i,h=e[r++]*t+n,d=e[r++]*t+i,p=e[r++]*t+n,f=e[r++]*t+i,o.bezierCurveTo(h,d,p,f,c,u)}}return{offsetX:a.ha*t,path:o}}let ic;tc.prototype.isFont=!0;const rc={getContext:function(){return void 0===ic&&(ic=new(window.AudioContext||window.webkitAudioContext)),ic},setContext:function(e){ic=e}};class ac extends Zs{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Js(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{const e=n.slice(0);rc.getContext().decodeAudioData(e,(function(e){t(e)}))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}}class oc extends Vl{constructor(e,t,n=1){super(void 0,n);const i=(new Vt).set(e),r=(new Vt).set(t),a=new ye(i.r,i.g,i.b),o=new ye(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}}oc.prototype.isHemisphereLightProbe=!0;class sc extends Vl{constructor(e,t=1){super(void 0,t);const n=(new Vt).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}sc.prototype.isAmbientLightProbe=!0;const lc=new Ye,cc=new Ye;class uc{constructor(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=hc(),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=hc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function hc(){return("undefined"==typeof performance?Date:performance).now()}const dc=new ye,pc=new ve,fc=new ye,mc=new ye;class gc extends bt{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 vc=new ye,yc=new ve,xc=new ye,bc=new ye;class wc{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class _c{constructor(e,t,n){let i,r,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let a=this.cumulativeWeight;if(0===a){for(let e=0;e!==i;++e)n[r+e]=n[e];a=t}else{const e=t/(a+=t);this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let s=t,l=t+t;s!==l;++s)if(n[s]!==n[s+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){ve.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const a=this._workIndex*r;ve.multiplyQuaternionsFlat(e,a,e,t,e,n),ve.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){const a=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]+e[n+a]*i}}}const Mc=new RegExp("[\\[\\]\\.:\\/]","g"),Sc="[^\\[\\]\\.:\\/]",Tc="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Ec=/((?:WC+[\/:])*)/.source.replace("WC",Sc),Ac=/(WCOD+)?/.source.replace("WCOD",Tc),Lc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Sc),Rc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Sc),Cc=new RegExp("^"+Ec+Ac+Lc+Rc+"$"),Pc=["material","materials","bones"];function Ic(e,t,n){const i=n||Dc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function Dc(e,t,n){this.path=t,this.parsedPath=n||Dc.parseTrackName(t),this.node=Dc.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}Object.assign(Ic.prototype,{getValue:function(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].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(Dc,{Composite:Ic,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Dc.Composite(e,t,n):new Dc(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(Mc,"")},parseTrackName:function(e){const t=Cc.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Pc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),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 i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}}),Object.assign(Dc.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 i=0,r=n.length;i!==r;++i)e[t++]=n[i]},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 i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Dc.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 i=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===i){i=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!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const a=e[i];if(void 0===a){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){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[r]&&(r=e.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Dc.prototype,{_getValue_unbound:Dc.prototype.getValue,_setValue_unbound:Dc.prototype.setValue});class Oc{constructor(){this.uuid=oe.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length;let o,s=e.length,l=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],h=u.uuid;let d=t[h];if(void 0===d){d=s++,t[h]=d,e.push(u);for(let e=0,t=a;e!==t;++e)r[e].push(new Dc(u,n[e],i[e]))}else if(d<l){o=e[d];const s=--l,c=e[s];t[c.uuid]=d,e[d]=c,t[h]=s,e[s]=u;for(let e=0,t=a;e!==t;++e){const t=r[e],a=t[s];let o=t[d];t[d]=a,void 0===o&&(o=new Dc(u,n[e],i[e])),t[s]=o}}else e[d]!==o&&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(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a],s=o.uuid,l=t[s];if(void 0!==l&&l>=r){const a=r++,c=e[a];t[c.uuid]=l,e[l]=c,t[s]=a,e[a]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[a],r=t[l];t[l]=i,t[a]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,a=e.length;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o].uuid,l=t[s];if(void 0!==l)if(delete t[s],l<r){const o=--r,s=e[o],c=--a,u=e[c];t[s.uuid]=l,e[l]=s,t[u.uuid]=o,e[o]=u,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[o],r=t[c];t[l]=i,t[o]=r,t.pop()}}else{const r=--a,o=e[r];r>0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(u);for(let h=c,d=s.length;h!==d;++h){const n=s[h];u[h]=new Dc(n,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}Oc.prototype.isAnimationObjectGroup=!0;class Nc{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,o=new Array(a),s={endingStart:G,endingEnd:G};for(let l=0;l!==a;++l){const e=r[l].createInterpolant(null);o[l]=e,e.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),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,i=e._clip.duration,r=i/n,a=n/i;e.warp(1,r,t),this.warp(a,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 i=this._mixer,r=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const s=o.parameterPositions,l=o.sampleValues;return s[0]=r,s[1]=r+n,l[0]=e/a,l[1]=t/a,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,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;if(i<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case q:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulateAdditive(o);break;case W:default:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;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 i=this.time+e,r=this._loopCount;const a=2202===n;if(0===e)return-1===r?i:a&&1==(1&r)?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(a&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=j,i.endingEnd=j):(i.endingStart=e?this.zeroSlopeAtStart?j:G:V,i.endingEnd=t?this.zeroSlopeAtEnd?j:G:V)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}class Fc extends ie{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName;let c=l[s];void 0===c&&(c={},l[s]=c);for(let u=0;u!==r;++u){const e=i[u],r=e.name;let l=c[r];if(void 0!==l)a[u]=l;else{if(void 0!==(l=a[u])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,s,r));continue}const i=t&&t._propertyBindings[u].binding.parsedPath;++(l=new _c(Dc.create(n,r,i),e.ValueTypeName,e.getValueSize())).referenceCount,this._addInactiveBinding(l,s,r),a[u]=l}o[u].resultBuffer=l.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.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(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(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{const t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const e=t[n];0==--e.referenceCount&&this._removeInactiveBinding(e)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let a=i[t];void 0===a&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&((n=new Ds(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let a="string"==typeof e?js.findByName(i,e):e;const o=null!==a?a.uuid:e,s=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==a?a.blendMode:W),void 0!==s){const e=s.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;const c=new Nc(this,a,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(e,t){const n=t||this._root,i=n.uuid,r="string"==typeof e?js.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,a);const o=this._bindings,s=this._nActiveBindings;for(let l=0;l!==s;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){const i=e[n];this._deactivateAction(i);const r=i._cacheIndex,a=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,a._cacheIndex=r,t[r]=a,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const r in n){const e=n[r].actionByRoot[t];void 0!==e&&(this._deactivateAction(e),this._removeInactiveAction(e))}const i=this._bindingsByRootAndName[t];if(void 0!==i)for(const r in i){const e=i[r];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}Fc.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Bc{constructor(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Bc(void 0===this.value.clone?this.value:this.value.clone())}}function zc(e,t,n){fa.call(this,e,t),this.meshPerAttribute=n||1}function kc(e,t,n,i,r){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}function Hc(e,t,n=0,i=1/0){this.ray=new Ze(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new ot,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 Uc(e,t){return e.distance-t.distance}function Gc(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)Gc(i[e],t,n,!0)}}zc.prototype=Object.assign(Object.create(fa.prototype),{constructor:zc,isInstancedInterleavedBuffer:!0,copy:function(e){return fa.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},clone:function(e){const t=fa.prototype.clone.call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t},toJSON:function(e){const t=fa.prototype.toJSON.call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}),Object.defineProperty(kc.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(kc.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(Hc.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=!1,n=[]){return Gc(e,this,n,t),n.sort(Uc),n},intersectObjects:function(e,t=!1,n=[]){for(let i=0,r=e.length;i<r;i++)Gc(e[i],this,n,t);return n.sort(Uc),n}});const jc=new se;class Vc{constructor(e=new se(1/0,1/0),t=new se(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=jc.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 se),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 se),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 se),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 se),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return jc.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)}}Vc.prototype.isBox2=!0;const Wc=new ye,qc=new ye;class Xc{constructor(e=new ye,t=new ye){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new ye),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 ye),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 ye),this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Wc.subVectors(e,this.start),qc.subVectors(this.end,this.start);const n=qc.dot(qc);let i=qc.dot(Wc)/n;return t&&(i=oe.clamp(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new ye),this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Zc(e){bt.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}Zc.prototype=Object.create(bt.prototype),Zc.prototype.constructor=Zc,Zc.prototype.isImmediateRenderObject=!0;const Yc=new ye,Jc=new ye,Kc=new Ye,Qc=new Ye;class $c extends oo{constructor(e){const t=function e(t){const n=[];t&&t.isBone&&n.push(t);for(let i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new gn,i=[],r=[],a=new Vt(0,0,1),o=new Vt(0,1,0);for(let s=0;s<t.length;s++){const e=t[s];e.parent&&e.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new rn(i,3)),n.setAttribute("color",new rn(r,3)),super(n,new Ka({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,i=n.getAttribute("position");Qc.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const e=t[r];e.parent&&e.parent.isBone&&(Kc.multiplyMatrices(Qc,e.matrixWorld),Jc.setFromMatrixPosition(Kc),i.setXYZ(a,Jc.x,Jc.y,Jc.z),Kc.multiplyMatrices(Qc,e.parent.matrixWorld),Jc.setFromMatrixPosition(Kc),i.setXYZ(a+1,Jc.x,Jc.y,Jc.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}const eu=new ye,tu=new Vt,nu=new Vt;class iu extends oo{constructor(e=10,t=10,n=4473924,i=8947848){n=new Vt(n),i=new Vt(i);const r=t/2,a=e/t,o=e/2,s=[],l=[];for(let u=0,h=0,d=-o;u<=t;u++,d+=a){s.push(-o,0,d,o,0,d),s.push(d,0,-o,d,0,o);const e=u===r?n:i;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const c=new gn;c.setAttribute("position",new rn(s,3)),c.setAttribute("color",new rn(l,3)),super(c,new Ka({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}const ru=new ye,au=new ye,ou=new ye,su=new ye,lu=new Un;function cu(e,t,n,i,r,a,o){su.set(r,a,o).unproject(i);const s=t[e];if(void 0!==s){const e=n.getAttribute("position");for(let t=0,n=s.length;t<n;t++)e.setXYZ(s[t],su.x,su.y,su.z)}}const uu=new we;class hu extends oo{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new gn;r.setIndex(new Zt(n,1)),r.setAttribute("position",new Zt(i,3)),super(r,new Ka({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&&uu.setFromObject(this.object),uu.isEmpty())return;const t=uu.min,n=uu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return oo.prototype.copy.call(this,e),this.object=e.object,this}}const du=new ye;let pu,fu;class mu extends oo{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 gn;n.setAttribute("position",new rn(t,3)),n.setAttribute("color",new rn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new Ka({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}const gu=new Float32Array(1),vu=new Int32Array(gu.buffer),yu={toHalfFloat:function(e){gu[0]=e;const t=vu[0];let n=t>>16&32768,i=t>>12&2047;const r=t>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&t):r<113?n|=((i|=2048)>>114-r)+(i>>113-r&1):(n|=r-112<<10|i>>1,n+=1&i)}},xu=Math.pow(2,8),bu=[.125,.215,.35,.446,.526,.582],wu=5+bu.length,_u={[X]:0,[Z]:1,[J]:2,[K]:3,[Q]:4,[$]:5,[Y]:6},Mu=new Wt({side:1,depthWrite:!1,depthTest:!1}),Su=new On(new Fn,Mu),Tu=new zl,{_lodPlanes:Eu,_sizeLods:Au,_sigmas:Lu}=function(){const e=[],t=[],n=[];let i=8;for(let r=0;r<wu;r++){const a=Math.pow(2,i);t.push(a);let o=1/a;r>4?o=bu[r-8+4-1]:0==r&&(o=0),n.push(o);const s=1/(a-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*h),v=new Float32Array(f*d*h),y=new Float32Array(m*d*h);for(let e=0;e<h;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[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(i,p*d*e),v.set(u,f*d*e);const r=[e,e,e,e,e,e];y.set(r,m*d*e)}const x=new gn;x.setAttribute("position",new Zt(g,p)),x.setAttribute("uv",new Zt(v,f)),x.setAttribute("faceIndex",new Zt(y,m)),e.push(x),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Ru=new Vt;let Cu=null;const Pu=(1+Math.sqrt(5))/2,Iu=1/Pu,Du=[new ye(1,1,1),new ye(-1,1,1),new ye(1,1,-1),new ye(-1,1,-1),new ye(0,Pu,Iu),new ye(0,Pu,-Iu),new ye(Iu,0,Pu),new ye(-Iu,0,Pu),new ye(Pu,Iu,0),new ye(-Pu,Iu,0)];function Ou(e){const t=Math.max(e.r,e.g,e.b),n=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return e.multiplyScalar(Math.pow(2,-n)),(n+128)/255}function Nu(e){return void 0!==e&&e.type===x&&(e.encoding===X||e.encoding===Z||e.encoding===Y)}function Fu(e){const t=new me(3*xu,3*xu,e);return t.texture.mapping=l,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Bu(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function zu(){const e=new se(1,1);return new bs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:_u[3e3]},outputEncoding:{value:_u[3e3]}},vertexShader:"\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",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\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\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 ku(){return new bs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:_u[3e3]},outputEncoding:{value:_u[3e3]}},vertexShader:"\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",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\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\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})}nl.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(nl.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Ml.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},iu.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},$c.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Zs.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ql.extractUrlBase(e)},Zs.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.")}},Vc.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},Vc.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Vc.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Vc.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},we.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},we.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},we.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},we.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},we.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},He.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Yn.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Xc.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},oe.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},oe.nearestPowerOfTwo=function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),oe.floorPowerOfTwo(e)},oe.nextPowerOfTwo=function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),oe.ceilPowerOfTwo(e)},le.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},le.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},le.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},le.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},le.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},le.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Ye.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Ye.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Ye.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new ye).setFromMatrixColumn(this,3)},Ye.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Ye.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Ye.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Ye.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Ye.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Ye.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Ye.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Ye.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Ye.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Ye.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Ye.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Ye.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Ye.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Ye.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Ye.prototype.makeFrustum=function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)},Ye.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},St.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},ve.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},ve.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Ze.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Ze.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Ze.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},Nt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Nt.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},Nt.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},Nt.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},Nt.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},Nt.barycoordFromPoint=function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Nt.getBarycoord(e,t,n,i,r)},Nt.normal=function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Nt.getNormal(e,t,n,i)},Sl.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Sl.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new is(this,e)},Sl.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new us(this,e)},se.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},se.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},se.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ye.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},ye.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},ye.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},ye.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},ye.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},ye.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},ye.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},ye.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},ye.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},fe.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},fe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},bt.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},bt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},bt.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},bt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},bt.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(bt.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.")}}}),On.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(On.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.")}}}),Ua.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(nl.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}}),Gn.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(Tl.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(Zt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===te},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(te)}}}),Zt.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?te:ee),this},Zt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Zt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gn.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},gn.prototype.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 Zt(arguments[1],arguments[2])))},gn.prototype.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)},gn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},gn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},gn.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},gn.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(gn.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(Xl.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(Hc.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(fa.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===te},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),fa.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?te:ee),this},fa.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},is.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},is.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},is.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},pa.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Bc.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Bt.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 Vt}},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(_s.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(Hn.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}}}),ca.prototype.clearTarget=function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},ca.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},ca.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ca.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ca.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ca.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ca.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ca.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ca.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ca.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ca.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ca.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ca.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ca.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ca.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},ca.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ca.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ca.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ca.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ca.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ca.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ca.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ca.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ca.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ca.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ca.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?Z:X}},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(ea.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(me.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}}}),gc.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new ac).load(e,(function(e){t.setBuffer(e)})),this},wc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},jn.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},jn.prototype.clear=function(e,t,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,i)},ue.crossOrigin=void 0,ue.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new tl;r.setCrossOrigin(this.crossOrigin);const a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},ue.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new $s;r.setCrossOrigin(this.crossOrigin);const a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},ue.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ue.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Hu={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:t}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t),e.ACESFilmicToneMapping=4,e.AddEquation=n,e.AddOperation=2,e.AdditiveAnimationBlendMode=q,e.AdditiveBlending=2,e.AlphaFormat=1021,e.AlwaysDepth=1,e.AlwaysStencilFunc=519,e.AmbientLight=Ul,e.AmbientLightProbe=sc,e.AnimationClip=js,e.AnimationLoader=class extends Zs{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Js(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=js.parse(e[n]);t.push(i)}return t}},e.AnimationMixer=Fc,e.AnimationObjectGroup=Oc,e.AnimationUtils=Cs,e.ArcCurve=rl,e.ArrayCamera=ra,e.ArrowHelper=class extends bt{constructor(e=new ye(0,0,1),t=new ye(0,0,0),n=1,i=16776960,r=.2*n,a=.2*r){super(),this.type="ArrowHelper",void 0===pu&&((pu=new gn).setAttribute("position",new rn([0,0,0,0,1,0],3)),(fu=new wo(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new io(pu,new Ka({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new On(fu,new Wt({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}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{du.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(du,t)}}setLength(e,t=.2*e,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}},e.Audio=gc,e.AudioAnalyser=wc,e.AudioContext=rc,e.AudioListener=class extends bt{constructor(){super(),this.type="AudioListener",this.context=rc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uc}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(dc,pc,fc),mc.set(0,0,-1).applyQuaternion(pc),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(dc.x,e),t.positionY.linearRampToValueAtTime(dc.y,e),t.positionZ.linearRampToValueAtTime(dc.z,e),t.forwardX.linearRampToValueAtTime(mc.x,e),t.forwardY.linearRampToValueAtTime(mc.y,e),t.forwardZ.linearRampToValueAtTime(mc.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition(dc.x,dc.y,dc.z),t.setOrientation(mc.x,mc.y,mc.z,n.x,n.y,n.z)}},e.AudioLoader=ac,e.AxesHelper=mu,e.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new mu(e)},e.BackSide=1,e.BasicDepthPacking=3200,e.BasicShadowMap=0,e.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new el(e)},e.Bone=Ga,e.BooleanKeyframeTrack=Fs,e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new hu(e,t)},e.Box2=Vc,e.Box3=we,e.Box3Helper=class extends oo{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new gn;i.setIndex(new Zt(n,1)),i.setAttribute("position",new rn([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(i,new Ka({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))}},e.BoxBufferGeometry=Fn,e.BoxGeometry=Fn,e.BoxHelper=hu,e.BufferAttribute=Zt,e.BufferGeometry=gn,e.BufferGeometryLoader=Yl,e.ByteType=1010,e.Cache=Ws,e.Camera=Un,e.CameraHelper=class extends oo{constructor(e){const t=new gn,n=new Ka({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={},o=new Vt(16755200),s=new Vt(16711680),l=new Vt(43775),c=new Vt(16777215),u=new Vt(3355443);function h(e,t,n){d(e,n),d(t,n)}function d(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),h("c","t",c),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.setAttribute("position",new rn(i,3)),t.setAttribute("color",new rn(r,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=a,this.update()}update(){const e=this.geometry,t=this.pointMap;lu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),cu("c",t,e,lu,0,0,-1),cu("t",t,e,lu,0,0,1),cu("n1",t,e,lu,-1,-1,-1),cu("n2",t,e,lu,1,-1,-1),cu("n3",t,e,lu,-1,1,-1),cu("n4",t,e,lu,1,1,-1),cu("f1",t,e,lu,-1,-1,1),cu("f2",t,e,lu,1,-1,1),cu("f3",t,e,lu,-1,1,1),cu("f4",t,e,lu,1,1,1),cu("u1",t,e,lu,.7,1.1,-1),cu("u2",t,e,lu,-.7,1.1,-1),cu("u3",t,e,lu,0,2,-1),cu("cf1",t,e,lu,-1,0,1),cu("cf2",t,e,lu,1,0,1),cu("cf3",t,e,lu,0,-1,1),cu("cf4",t,e,lu,0,1,1),cu("cn1",t,e,lu,-1,0,-1),cu("cn2",t,e,lu,1,0,-1),cu("cn3",t,e,lu,0,-1,-1),cu("cn4",t,e,lu,0,1,-1),e.getAttribute("position").needsUpdate=!0}},e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},e.CanvasTexture=yo,e.CatmullRomCurve3=ul,e.CineonToneMapping=3,e.CircleBufferGeometry=bo,e.CircleGeometry=bo,e.ClampToEdgeWrapping=h,e.Clock=uc,e.Color=Vt,e.ColorKeyframeTrack=Bs,e.CompressedTexture=vo,e.CompressedTextureLoader=Ks,e.ConeBufferGeometry=_o,e.ConeGeometry=_o,e.CubeCamera=jn,e.CubeReflectionMapping=r,e.CubeRefractionMapping=a,e.CubeTexture=Vn,e.CubeTextureLoader=$s,e.CubeUVReflectionMapping=l,e.CubeUVRefractionMapping=c,e.CubicBezierCurve=fl,e.CubicBezierCurve3=ml,e.CubicInterpolant=Is,e.CullFaceBack=1,e.CullFaceFront=2,e.CullFaceFrontBack=3,e.CullFaceNone=0,e.Curve=nl,e.CurvePath=_l,e.CustomBlending=5,e.CustomToneMapping=5,e.CylinderBufferGeometry=wo,e.CylinderGeometry=wo,e.Cylindrical=class{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}},e.DataTexture=qn,e.DataTexture2DArray=gi,e.DataTexture3D=vi,e.DataTextureLoader=el,e.DataUtils=yu,e.DecrementStencilOp=7683,e.DecrementWrapStencilOp=34056,e.DefaultLoadingManager=Xs,e.DepthFormat=A,e.DepthStencilFormat=L,e.DepthTexture=xo,e.DirectionalLight=Hl,e.DirectionalLightHelper=class extends bt{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 i=new gn;i.setAttribute("position",new rn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Ka({fog:!1,toneMapped:!1});this.lightPlane=new io(i,r),this.add(this.lightPlane),(i=new gn).setAttribute("position",new rn([0,0,0,0,0,1],3)),this.targetLine=new io(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){ru.setFromMatrixPosition(this.light.matrixWorld),au.setFromMatrixPosition(this.light.target.matrixWorld),ou.subVectors(au,ru),this.lightPlane.lookAt(au),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(au),this.targetLine.scale.z=ou.length()}},e.DiscreteInterpolant=Os,e.DodecahedronBufferGeometry=So,e.DodecahedronGeometry=So,e.DoubleSide=2,e.DstAlphaFactor=206,e.DstColorFactor=208,e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Zt(e,t).setUsage(te)},e.DynamicCopyUsage=35050,e.DynamicDrawUsage=te,e.DynamicReadUsage=35049,e.EdgesGeometry=Ro,e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new oo(new Ro(e.geometry),new Ka({color:void 0!==t?t:16777215}))},e.EllipseCurve=il,e.EqualDepth=4,e.EqualStencilFunc=514,e.EquirectangularReflectionMapping=o,e.EquirectangularRefractionMapping=s,e.Euler=at,e.EventDispatcher=ie,e.ExtrudeBufferGeometry=is,e.ExtrudeGeometry=is,e.FaceColors=1,e.FileLoader=Js,e.FlatShading=1,e.Float16BufferAttribute=nn,e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new rn(e,t)},e.Float32BufferAttribute=rn,e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new an(e,t)},e.Float64BufferAttribute=an,e.FloatType=_,e.Fog=da,e.FogExp2=ha,e.Font=tc,e.FontLoader=class extends Zs{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Js(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials),a.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 i=r.parse(n);t&&t(i)}),n,i)}parse(e){return new tc(e)}},e.FrontSide=0,e.Frustum=Yn,e.GLBufferAttribute=kc,e.GLSL1="100",e.GLSL3=ne,e.GammaEncoding=Y,e.GreaterDepth=6,e.GreaterEqualDepth=5,e.GreaterEqualStencilFunc=518,e.GreaterStencilFunc=516,e.GridHelper=iu,e.Group=aa,e.HalfFloatType=M,e.HemisphereLight=El,e.HemisphereLightHelper=class extends bt{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new ss(t);i.rotateY(.5*Math.PI),this.material=new Wt({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new Zt(a,3)),this.add(new On(i,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");tu.copy(this.light.color),nu.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const i=e<n/2?tu:nu;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(eu.setFromMatrixPosition(this.light.matrixWorld).negate())}},e.HemisphereLightProbe=oc,e.IcosahedronBufferGeometry=as,e.IcosahedronGeometry=as,e.ImageBitmapLoader=$l,e.ImageLoader=Qs,e.ImageUtils=ue,e.ImmediateRenderObject=Zc,e.IncrementStencilOp=7682,e.IncrementWrapStencilOp=34055,e.InstancedBufferAttribute=Zl,e.InstancedBufferGeometry=Xl,e.InstancedInterleavedBuffer=zc,e.InstancedMesh=Ja,e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Qt(e,t)},e.Int16BufferAttribute=Qt,e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new en(e,t)},e.Int32BufferAttribute=en,e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Yt(e,t)},e.Int8BufferAttribute=Yt,e.IntType=1013,e.InterleavedBuffer=fa,e.InterleavedBufferAttribute=ga,e.Interpolant=Ps,e.InterpolateDiscrete=k,e.InterpolateLinear=H,e.InterpolateSmooth=U,e.InvertStencilOp=5386,e.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},e.KeepStencilOp=7680,e.KeyframeTrack=Ns,e.LOD=Na,e.LatheBufferGeometry=os,e.LatheGeometry=os,e.Layers=ot,e.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},e.LessDepth=2,e.LessEqualDepth=3,e.LessEqualStencilFunc=515,e.LessStencilFunc=513,e.Light=Tl,e.LightProbe=Vl,e.Line=io,e.Line3=Xc,e.LineBasicMaterial=Ka,e.LineCurve=gl,e.LineCurve3=vl,e.LineDashedMaterial=Ls,e.LineLoop=so,e.LinePieces=1,e.LineSegments=oo,e.LineStrip=0,e.LinearEncoding=X,e.LinearFilter=g,e.LinearInterpolant=Ds,e.LinearMipMapLinearFilter=1008,e.LinearMipMapNearestFilter=1007,e.LinearMipmapLinearFilter=y,e.LinearMipmapNearestFilter=v,e.LinearToneMapping=1,e.Loader=Zs,e.LoaderUtils=ql,e.LoadingManager=qs,e.LogLuvEncoding=3003,e.LoopOnce=2200,e.LoopPingPong=2202,e.LoopRepeat=2201,e.LuminanceAlphaFormat=1025,e.LuminanceFormat=1024,e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},e.Material=Bt,e.MaterialLoader=Wl,e.Math=oe,e.MathUtils=oe,e.Matrix3=le,e.Matrix4=Ye,e.MaxEquation=104,e.Mesh=On,e.MeshBasicMaterial=Wt,e.MeshDepthMaterial=Qr,e.MeshDistanceMaterial=$r,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MeshLambertMaterial=Es,e.MeshMatcapMaterial=As,e.MeshNormalMaterial=Ts,e.MeshPhongMaterial=Ms,e.MeshPhysicalMaterial=_s,e.MeshStandardMaterial=ws,e.MeshToonMaterial=Ss,e.MinEquation=103,e.MirroredRepeatWrapping=d,e.MixOperation=1,e.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},e.MultiplyBlending=4,e.MultiplyOperation=0,e.NearestFilter=p,e.NearestMipMapLinearFilter=1005,e.NearestMipMapNearestFilter=1004,e.NearestMipmapLinearFilter=m,e.NearestMipmapNearestFilter=f,e.NeverDepth=0,e.NeverStencilFunc=512,e.NoBlending=0,e.NoColors=0,e.NoToneMapping=0,e.NormalAnimationBlendMode=W,e.NormalBlending=1,e.NotEqualDepth=7,e.NotEqualStencilFunc=517,e.NumberKeyframeTrack=zs,e.Object3D=bt,e.ObjectLoader=class extends Zs{constructor(e){super(e)}load(e,t,n,i){const r=this,a=""===this.path?ql.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new Js(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){let a=null;try{a=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,i)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,s,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),void 0!==t){let e=!1;for(const t in a)if(a[t]instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}parseShapes(e){const t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){const i=(new Sl).fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse((function(e){e.isBone&&(i[e.uuid]=e)})),void 0!==e)for(let r=0,a=e.length;r<a;r++){const t=(new Wa).fromJSON(e[r],i);n[t.uuid]=t}return n}parseGeometries(e,t){const n={};let i;if(void 0!==e){const r=new Yl;for(let a=0,o=e.length;a<o;a++){let o;const s=e[a];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new ys[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":o=new ys[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new ys[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new ys[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new ys[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new ys[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new ys[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new ys[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new ys[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new ys[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new ys[s.type]((new wl[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new ys[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new ys[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":i=[];for(let n=0,r=s.shapes.length;n<r;n++){const e=t[s.shapes[n]];i.push(e)}o=new ys[s.type](i,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":i=[];for(let n=0,r=s.shapes.length;n<r;n++){const e=t[s.shapes[n]];i.push(e)}const e=s.options.extrudePath;void 0!==e&&(s.options.extrudePath=(new wl[e.type]).fromJSON(e)),o=new ys[s.type](i,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}}return n}parseMaterials(e,t){const n={},i={};if(void 0!==e){const r=new Wl;r.setTextures(t);for(let t=0,a=e.length;t<a;t++){const a=e[t];if("MultiMaterial"===a.type){const e=[];for(let t=0;t<a.materials.length;t++){const i=a.materials[t];void 0===n[i.uuid]&&(n[i.uuid]=r.parse(i)),e.push(n[i.uuid])}i[a.uuid]=e}else void 0===n[a.uuid]&&(n[a.uuid]=r.parse(a)),i[a.uuid]=n[a.uuid]}}return i}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const i=e[n],r=js.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function a(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),r.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:ln(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new qs(t);(r=new Qs(n)).setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){const n=e[t],r=n.url;if(Array.isArray(r)){i[n.uuid]=[];for(let e=0,t=r.length;e<t;e++){const t=a(r[e]);null!==t&&(t instanceof HTMLImageElement?i[n.uuid].push(t):i[n.uuid].push(new qn(t.data,t.width,t.height)))}}else{const e=a(n.url);null!==e&&(i[n.uuid]=e)}}}return i}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 i={};if(void 0!==e)for(let r=0,a=e.length;r<a;r++){const a=e[r];let o;void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const s=t[a.image];Array.isArray(s)?(o=new Vn(s),6===s.length&&(o.needsUpdate=!0)):(o=s&&s.data?new qn(s.data,s.width,s.height):new de(s),s&&(o.needsUpdate=!0)),o.uuid=a.uuid,void 0!==a.name&&(o.name=a.name),void 0!==a.mapping&&(o.mapping=n(a.mapping,Jl)),void 0!==a.offset&&o.offset.fromArray(a.offset),void 0!==a.repeat&&o.repeat.fromArray(a.repeat),void 0!==a.center&&o.center.fromArray(a.center),void 0!==a.rotation&&(o.rotation=a.rotation),void 0!==a.wrap&&(o.wrapS=n(a.wrap[0],Kl),o.wrapT=n(a.wrap[1],Kl)),void 0!==a.format&&(o.format=a.format),void 0!==a.type&&(o.type=a.type),void 0!==a.encoding&&(o.encoding=a.encoding),void 0!==a.minFilter&&(o.minFilter=n(a.minFilter,Ql)),void 0!==a.magFilter&&(o.magFilter=n(a.magFilter,Ql)),void 0!==a.anisotropy&&(o.anisotropy=a.anisotropy),void 0!==a.flipY&&(o.flipY=a.flipY),void 0!==a.premultiplyAlpha&&(o.premultiplyAlpha=a.premultiplyAlpha),void 0!==a.unpackAlignment&&(o.unpackAlignment=a.unpackAlignment),i[a.uuid]=o}return i}parseObject(e,t,n,i){let r,a,o;function s(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 i=0,r=e.length;i<r;i++){const r=e[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(n[r])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":r=new pa,void 0!==e.background&&Number.isInteger(e.background)&&(r.background=new Vt(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new da(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new ha(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new Gn(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(r.focus=e.focus),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.filmGauge&&(r.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(r.filmOffset=e.filmOffset),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new zl(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"AmbientLight":r=new Ul(e.color,e.intensity);break;case"DirectionalLight":r=new Hl(e.color,e.intensity);break;case"PointLight":r=new Bl(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new Gl(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new Il(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new El(e.color,e.groundColor,e.intensity);break;case"LightProbe":r=(new Vl).fromJSON(e);break;case"SkinnedMesh":r=new Ua(a=s(e.geometry),o=l(e.material)),void 0!==e.bindMode&&(r.bindMode=e.bindMode),void 0!==e.bindMatrix&&r.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(r.skeleton=e.skeleton);break;case"Mesh":r=new On(a=s(e.geometry),o=l(e.material));break;case"InstancedMesh":a=s(e.geometry),o=l(e.material);const t=e.count,n=e.instanceMatrix,i=e.instanceColor;(r=new Ja(a,o,t)).instanceMatrix=new Zt(new Float32Array(n.array),16),void 0!==i&&(r.instanceColor=new Zt(new Float32Array(i.array),i.itemSize));break;case"LOD":r=new Na;break;case"Line":r=new io(s(e.geometry),l(e.material));break;case"LineLoop":r=new so(s(e.geometry),l(e.material));break;case"LineSegments":r=new oo(s(e.geometry),l(e.material));break;case"PointCloud":case"Points":r=new fo(s(e.geometry),l(e.material));break;case"Sprite":r=new Pa(l(e.material));break;case"Group":r=new aa;break;case"Bone":r=new Ga;break;default:r=new bt}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(r.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(r.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.frustumCulled&&(r.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(r.renderOrder=e.renderOrder),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.layers&&(r.layers.mask=e.layers),void 0!==e.children){const a=e.children;for(let e=0;e<a.length;e++)r.add(this.parseObject(a[e],t,n,i))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];r.animations.push(i[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(r.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],i=r.getObjectByProperty("uuid",n.object);void 0!==i&&r.addLevel(i,n.distance)}}return r}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)}},e.ObjectSpaceNormalMap=1,e.OctahedronBufferGeometry=ss,e.OctahedronGeometry=ss,e.OneFactor=201,e.OneMinusDstAlphaFactor=207,e.OneMinusDstColorFactor=209,e.OneMinusSrcAlphaFactor=205,e.OneMinusSrcColorFactor=203,e.OrthographicCamera=zl,e.PCFShadowMap=1,e.PCFSoftShadowMap=2,e.PMREMGenerator=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(20),n=new ye(0,1,0);return new bs({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:_u[3e3]},outputEncoding:{value:_u[3e3]}},vertexShader:"\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",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\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\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})}(),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Cu=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=ku(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=zu(),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<Eu.length;e++)Eu[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Cu),e.scissorTest=!1,Bu(e,0,0,e.width,e.height)}_fromTexture(e){Cu=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:p,minFilter:p,generateMipmaps:!1,type:x,format:1023,encoding:Nu(e)?e.encoding:J,depthBuffer:!1},n=Fu(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Fu(t),n}_compileMaterial(e){const t=new On(Eu[0],e);this._renderer.compile(t,Tu)}_sceneToCubeUV(e,t,n,i){const r=new Gn(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.outputEncoding,u=s.toneMapping;s.getClearColor(Ru),s.toneMapping=0,s.outputEncoding=X,s.autoClear=!1;let h=!1;const d=e.background;if(d){if(d.isColor){Mu.color.copy(d).convertSRGBToLinear(),e.background=null;const t=Ou(Mu.color);Mu.opacity=t,h=!0}}else{Mu.color.copy(Ru).convertSRGBToLinear();const e=Ou(Mu.color);Mu.opacity=e,h=!0}for(let p=0;p<6;p++){const t=p%3;0==t?(r.up.set(0,a[p],0),r.lookAt(o[p],0,0)):1==t?(r.up.set(0,0,a[p]),r.lookAt(0,o[p],0)):(r.up.set(0,a[p],0),r.lookAt(0,0,o[p])),Bu(i,t*xu,p>2?xu:0,xu,xu),s.setRenderTarget(i),h&&s.render(Su,r),s.render(e,r)}s.toneMapping=u,s.outputEncoding=c,s.autoClear=l}_textureToCubeUV(e,t){const n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=ku()):null==this._equirectShader&&(this._equirectShader=zu());const i=e.isCubeTexture?this._cubemapShader:this._equirectShader,r=new On(Eu[0],i),a=i.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=_u[e.encoding],a.outputEncoding.value=_u[t.texture.encoding],Bu(t,0,0,3*xu,2*xu),n.setRenderTarget(t),n.render(r,Tu)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<wu;i++){const t=Math.sqrt(Lu[i]*Lu[i]-Lu[i-1]*Lu[i-1]),n=Du[(i-1)%Du.length];this._blur(e,i-1,i,t,n)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new On(Eu[i],l),u=l.uniforms,h=Au[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, 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 y=0;y<20;++y){const e=y/p,t=Math.exp(-e*e/2);m.push(t),0==y?g+=t:y<f&&(g+=2*t)}for(let y=0;y<m.length;y++)m[y]=m[y]/g;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o),u.dTheta.value=d,u.mipInt.value=8-n,u.inputEncoding.value=_u[e.texture.encoding],u.outputEncoding.value=_u[e.texture.encoding];const v=Au[i];Bu(t,3*Math.max(0,xu-2*v),(0===i?0:2*xu)+2*v*(i>4?i-8+4:0),3*v,2*v),s.setRenderTarget(t),s.render(c,Tu)}},e.ParametricBufferGeometry=ls,e.ParametricGeometry=ls,e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Pa(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new lo(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new fo(e,t)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new lo(e)},e.Path=Ml,e.PerspectiveCamera=Gn,e.Plane=St,e.PlaneBufferGeometry=Qn,e.PlaneGeometry=Qn,e.PlaneHelper=class extends io{constructor(e,t=1,n=16776960){const i=n,r=new gn;r.setAttribute("position",new rn([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)),r.computeBoundingSphere(),super(r,new Ka({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=new gn;a.setAttribute("position",new rn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new On(a,new Wt({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}},e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new fo(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new lo(e)},e.PointLight=Bl,e.PointLightHelper=class extends On{constructor(e,t,n){super(new hs(t,4,2),new Wt({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)}},e.Points=fo,e.PointsMaterial=lo,e.PolarGridHelper=class extends oo{constructor(e=10,t=16,n=8,i=64,r=4473924,a=8947848){r=new Vt(r),a=new Vt(a);const o=[],s=[];for(let c=0;c<=t;c++){const n=c/t*(2*Math.PI),i=Math.sin(n)*e,l=Math.cos(n)*e;o.push(0,0,0),o.push(i,0,l);const u=1&c?r:a;s.push(u.r,u.g,u.b),s.push(u.r,u.g,u.b)}for(let c=0;c<=n;c++){const t=1&c?r:a,l=e-e/n*c;for(let e=0;e<i;e++){let n=e/i*(2*Math.PI),r=Math.sin(n)*l,a=Math.cos(n)*l;o.push(r,0,a),s.push(t.r,t.g,t.b),n=(e+1)/i*(2*Math.PI),r=Math.sin(n)*l,a=Math.cos(n)*l,o.push(r,0,a),s.push(t.r,t.g,t.b)}}const l=new gn;l.setAttribute("position",new rn(o,3)),l.setAttribute("color",new rn(s,3)),super(l,new Ka({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}},e.PolyhedronBufferGeometry=Mo,e.PolyhedronGeometry=Mo,e.PositionalAudio=class extends gc{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(vc,yc,xc),bc.set(0,0,1).applyQuaternion(yc);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(vc.x,e),t.positionY.linearRampToValueAtTime(vc.y,e),t.positionZ.linearRampToValueAtTime(vc.z,e),t.orientationX.linearRampToValueAtTime(bc.x,e),t.orientationY.linearRampToValueAtTime(bc.y,e),t.orientationZ.linearRampToValueAtTime(bc.z,e)}else t.setPosition(vc.x,vc.y,vc.z),t.setOrientation(bc.x,bc.y,bc.z)}},e.PropertyBinding=Dc,e.PropertyMixer=_c,e.QuadraticBezierCurve=yl,e.QuadraticBezierCurve3=xl,e.Quaternion=ve,e.QuaternionKeyframeTrack=Hs,e.QuaternionLinearInterpolant=ks,e.REVISION=t,e.RGBADepthPacking=3201,e.RGBAFormat=E,e.RGBAIntegerFormat=1033,e.RGBA_ASTC_10x10_Format=37819,e.RGBA_ASTC_10x5_Format=37816,e.RGBA_ASTC_10x6_Format=37817,e.RGBA_ASTC_10x8_Format=37818,e.RGBA_ASTC_12x10_Format=37820,e.RGBA_ASTC_12x12_Format=37821,e.RGBA_ASTC_4x4_Format=37808,e.RGBA_ASTC_5x4_Format=37809,e.RGBA_ASTC_5x5_Format=37810,e.RGBA_ASTC_6x5_Format=37811,e.RGBA_ASTC_6x6_Format=37812,e.RGBA_ASTC_8x5_Format=37813,e.RGBA_ASTC_8x6_Format=37814,e.RGBA_ASTC_8x8_Format=37815,e.RGBA_BPTC_Format=36492,e.RGBA_ETC2_EAC_Format=z,e.RGBA_PVRTC_2BPPV1_Format=F,e.RGBA_PVRTC_4BPPV1_Format=N,e.RGBA_S3TC_DXT1_Format=C,e.RGBA_S3TC_DXT3_Format=P,e.RGBA_S3TC_DXT5_Format=I,e.RGBDEncoding=$,e.RGBEEncoding=J,e.RGBEFormat=1023,e.RGBFormat=T,e.RGBIntegerFormat=1032,e.RGBM16Encoding=Q,e.RGBM7Encoding=K,e.RGB_ETC1_Format=36196,e.RGB_ETC2_Format=B,e.RGB_PVRTC_2BPPV1_Format=O,e.RGB_PVRTC_4BPPV1_Format=D,e.RGB_S3TC_DXT1_Format=R,e.RGFormat=1030,e.RGIntegerFormat=1031,e.RawShaderMaterial=bs,e.Ray=Ze,e.Raycaster=Hc,e.RectAreaLight=Gl,e.RedFormat=1028,e.RedIntegerFormat=1029,e.ReinhardToneMapping=2,e.RepeatWrapping=u,e.ReplaceStencilOp=7681,e.ReverseSubtractEquation=102,e.RingBufferGeometry=cs,e.RingGeometry=cs,e.SRGB8_ALPHA8_ASTC_10x10_Format=37851,e.SRGB8_ALPHA8_ASTC_10x5_Format=37848,e.SRGB8_ALPHA8_ASTC_10x6_Format=37849,e.SRGB8_ALPHA8_ASTC_10x8_Format=37850,e.SRGB8_ALPHA8_ASTC_12x10_Format=37852,e.SRGB8_ALPHA8_ASTC_12x12_Format=37853,e.SRGB8_ALPHA8_ASTC_4x4_Format=37840,e.SRGB8_ALPHA8_ASTC_5x4_Format=37841,e.SRGB8_ALPHA8_ASTC_5x5_Format=37842,e.SRGB8_ALPHA8_ASTC_6x5_Format=37843,e.SRGB8_ALPHA8_ASTC_6x6_Format=37844,e.SRGB8_ALPHA8_ASTC_8x5_Format=37845,e.SRGB8_ALPHA8_ASTC_8x6_Format=37846,e.SRGB8_ALPHA8_ASTC_8x8_Format=37847,e.Scene=pa,e.SceneUtils=Hu,e.ShaderChunk=$n,e.ShaderLib=ti,e.ShaderMaterial=Hn,e.ShadowMaterial=xs,e.Shape=Sl,e.ShapeBufferGeometry=us,e.ShapeGeometry=us,e.ShapePath=ec,e.ShapeUtils=es,e.ShortType=1011,e.Skeleton=Wa,e.SkeletonHelper=$c,e.SkinnedMesh=Ua,e.SmoothShading=2,e.Sphere=He,e.SphereBufferGeometry=hs,e.SphereGeometry=hs,e.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}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(oe.clamp(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}},e.SphericalHarmonics3=jl,e.SplineCurve=bl,e.SpotLight=Il,e.SpotLightHelper=class extends bt{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new gn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,s=32;a<s;a++,o++){const e=a/s*Math.PI*2,t=o/s*Math.PI*2;i.push(Math.cos(e),Math.sin(e),1,Math.cos(t),Math.sin(t),1)}n.setAttribute("position",new rn(i,3));const r=new Ka({fog:!1,toneMapped:!1});this.cone=new oo(n,r),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),Yc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Yc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},e.Sprite=Pa,e.SpriteMaterial=va,e.SrcAlphaFactor=204,e.SrcAlphaSaturateFactor=210,e.SrcColorFactor=202,e.StaticCopyUsage=35046,e.StaticDrawUsage=ee,e.StaticReadUsage=35045,e.StereoCamera=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Gn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Gn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;const n=e.projectionMatrix.clone(),i=t.eyeSep/2,r=i*t.near/t.focus,a=t.near*Math.tan(oe.DEG2RAD*t.fov*.5)/t.zoom;let o,s;cc.elements[12]=-i,lc.elements[12]=i,o=-a*t.aspect+r,s=a*t.aspect+r,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(n),o=-a*t.aspect-r,s=a*t.aspect-r,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(cc),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(lc)}},e.StreamCopyUsage=35042,e.StreamDrawUsage=35040,e.StreamReadUsage=35041,e.StringKeyframeTrack=Us,e.SubtractEquation=101,e.SubtractiveBlending=3,e.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},e.TangentSpaceNormalMap=0,e.TetrahedronBufferGeometry=ds,e.TetrahedronGeometry=ds,e.TextBufferGeometry=ps,e.TextGeometry=ps,e.Texture=de,e.TextureLoader=tl,e.TorusBufferGeometry=fs,e.TorusGeometry=fs,e.TorusKnotBufferGeometry=ms,e.TorusKnotGeometry=ms,e.Triangle=Nt,e.TriangleFanDrawMode=2,e.TriangleStripDrawMode=1,e.TrianglesDrawMode=0,e.TubeBufferGeometry=gs,e.TubeGeometry=gs,e.UVMapping=i,e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new $t(e,t)},e.Uint16BufferAttribute=$t,e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new tn(e,t)},e.Uint32BufferAttribute=tn,e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Jt(e,t)},e.Uint8BufferAttribute=Jt,e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Kt(e,t)},e.Uint8ClampedBufferAttribute=Kt,e.Uniform=Bc,e.UniformsLib=ei,e.UniformsUtils=kn,e.UnsignedByteType=x,e.UnsignedInt248Type=S,e.UnsignedIntType=w,e.UnsignedShort4444Type=1017,e.UnsignedShort5551Type=1018,e.UnsignedShort565Type=1019,e.UnsignedShortType=b,e.VSMShadowMap=3,e.Vector2=se,e.Vector3=ye,e.Vector4=fe,e.VectorKeyframeTrack=Gs,e.Vertex=function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new ye(e,t,n)},e.VertexColors=2,e.VideoTexture=go,e.WebGL1Renderer=ua,e.WebGLCubeRenderTarget=Wn,e.WebGLMultisampleRenderTarget=ge,e.WebGLRenderTarget=me,e.WebGLRenderTargetCube=function(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Wn(e,n)},e.WebGLRenderer=ca,e.WebGLUtils=ia,e.WireframeGeometry=vs,e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new oo(new vs(e.geometry),new Ka({color:void 0!==t?t:16777215}))},e.WrapAroundEnding=V,e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Js(e)},e.ZeroCurvatureEnding=G,e.ZeroFactor=200,e.ZeroSlopeEnding=j,e.ZeroStencilOp=0,e.sRGBEncoding=Z,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof i.exports?t(i.exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE={}),i=i.exports;var r={};const a=.1/180*Math.PI,s=Math.atan(.75);r=r={WORLD_SIZE:1024e3,PROJECTION_WORLD_SIZE:1024e3/(6371008.8*Math.PI*2),MERCATOR_A:6371008.8,DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,EARTH_RADIUS:6371008.8,EARTH_CIRCUMFERENCE:2*Math.PI*6371008.8,EARTH_CIRCUMFERENCE_EQUATOR:40075017,FOV_ORTHO:a,FOV:s,FOV_DEGREES:180*s/Math.PI,TILE_SIZE:512};var l={};function c(){}c.prototype={Coords:function(e){if(e.constructor===Array)if(e.length<2)console.error("Coords length must be at least 2");else{for(const t of e)if(t.constructor!==Number)return void console.error("Coords values must be numbers");if(!(Math.abs(e[1])>90))return e;console.error("Latitude must be between -90 and 90")}else console.error("Coords must be an array")},Line:function(e){if(e.constructor===Array){for(const t of e)if(!this.Coords(t))return void console.error("Each coordinate in a line must be a valid Coords type");return e}console.error("Line must be an array")},Rotation:function(e){if(e.constructor===Number)e={z:e};else{if(e.constructor!==Object)return void console.error("Rotation must be an object or a number");for(const t of Object.keys(e)){if(!["x","y","z"].includes(t))return void console.error("Rotation parameters must be x, y, or z");if(e[t].constructor!==Number)return void console.error("Individual rotation values must be numbers")}}return e},Scale:function(e){if(e.constructor===Number)e={x:e,y:e,z:e};else{if(e.constructor!==Object)return void console.error("Scale must be an object or a number");for(const t of Object.keys(e)){if(!["x","y","z"].includes(t))return void console.error("Scale parameters must be x, y, or z");if(e[t].constructor!==Number)return void console.error("Individual scale values must be numbers")}}return e}},l=l=c;var u={},h={prettyPrintMatrix:function(e){for(var t=0;t<4;t++){var n=[e[t],e[t+4],e[t+8],e[t+12]];console.log(n.map((function(e){return e.toFixed(4)})))}},makePerspectiveMatrix:function(e,t,n,r){var a=new i.Matrix4,o=1/Math.tan(e/2),s=1/(n-r),l=[o/t,0,0,0,0,o,0,0,0,0,(r+n)*s,-1,0,0,2*r*n*s,0];return a.elements=l,a},makeOrthographicMatrix:function(e,t,n,r,a,o){var s=new i.Matrix4;const l=1/(t-e),c=1/(n-r),u=1/(o-a);var h=[2*l,0,0,0,0,2*c,0,0,0,0,-1*u,0,-(t+e)*l,-(n+r)*c,-a*u,1];return s.elements=h,s},radify:function(e){function t(e){return e=e||0,2*Math.PI*e/360}return"object"==typeof e?e.length>0?e.map((function(e){return t(e)})):[t(e.x),t(e.y),t(e.z)]:t(e)},degreeify:function(e){function t(e){return 360*(e=e||0)/(2*Math.PI)}return"object"==typeof e?[t(e.x),t(e.y),t(e.z)]:t(e)},projectToWorld:function(e){var t=[-r.MERCATOR_A*r.DEG2RAD*e[0]*r.PROJECTION_WORLD_SIZE,-r.MERCATOR_A*Math.log(Math.tan(.25*Math.PI+.5*r.DEG2RAD*e[1]))*r.PROJECTION_WORLD_SIZE];if(e[2]){var n=this.projectedUnitsPerMeter(e[1]);t.push(e[2]*n)}else t.push(0);return new i.Vector3(t[0],t[1],t[2])},projectedUnitsPerMeter:function(e){return Math.abs(r.WORLD_SIZE/Math.cos(r.DEG2RAD*e)/r.EARTH_CIRCUMFERENCE)},_circumferenceAtLatitude:function(e){return r.EARTH_CIRCUMFERENCE*Math.cos(e*Math.PI/180)},mercatorZfromAltitude:function(e,t){return e/this._circumferenceAtLatitude(t)},_scaleVerticesToMeters:function(e,t){for(var n=this.projectedUnitsPerMeter(e[1]),i=(this.projectToWorld(e),0);i<t.length;i++)t[i].multiplyScalar(n);return t},projectToScreen:function(e){console.log("WARNING: Projecting to screen coordinates is not yet implemented")},unprojectFromScreen:function(e){console.log("WARNING: unproject is not yet implemented")},unprojectFromWorld:function(e){var t=[-e.x/(r.MERCATOR_A*r.DEG2RAD*r.PROJECTION_WORLD_SIZE),2*(Math.atan(Math.exp(e.y/(r.PROJECTION_WORLD_SIZE*-r.MERCATOR_A)))-Math.PI/4)/r.DEG2RAD],n=this.projectedUnitsPerMeter(t[1]),i=e.z||0;return t.push(i/n),t},toScreenPosition:function(e,t){var n=new i.Vector3,r=.5*renderer.context.canvas.width,a=.5*renderer.context.canvas.height;return e.updateMatrixWorld(),n.setFromMatrixPosition(e.matrixWorld),n.project(t),n.x=n.x*r+r,n.y=-n.y*a+a,{x:n.x,y:n.y}},getFeatureCenter:function(e,t,n){let i=[],r=0,a=0,o=0,s=[...e.geometry.coordinates[0]];return"Point"===e.geometry.type?i=[...s[0]]:("MultiPolygon"===e.geometry.type&&(s=s[0]),s.splice(-1,1),s.forEach((function(e){r+=e[0],a+=e[1]})),i=[r/s.length,a/s.length]),o=this.getObjectHeightOnFloor(e,t,n),i.length<3?i.push(o):i[2]=o,i},getObjectHeightOnFloor:function(e,t,n=e.properties.level||0){let i=n*(e.properties.levelHeight||0),r=e.properties.base_height||e.properties.min_height||0;return i+((t&&t.model?0:e.properties.height-r)+r)},_flipMaterialSides:function(e){},normalizeVertices(e){let t=new i.BufferGeometry,n=[];for(var r=0;r<e.length;r++){let t=e[r];n.push(t.x,t.y,t.z),n.push(t.x,t.y,t.z)}t.setAttribute("position",new i.BufferAttribute(new Float32Array(n),3)),t.computeBoundingSphere();var a=t.boundingSphere.center;return{vertices:e.map((function(e){return e.sub(a)})),position:a}},flattenVectors(e){var t=[];for(let n of e)t.push(n.x,n.y,n.z);return t},lnglatsToWorld:function(e){return e.map((function(e){var t=h.projectToWorld(e);return new i.Vector3(t.x,t.y,t.z)}))},extend:function(e,t){for(let n in t)e[n]=t[n]},clone:function(e){var t={};for(let n in e)t[n]=e[n];return t},clamp:function(e,t,n){return Math.min(n,Math.max(t,e))},types:{rotation:function(e,t){e||(e=0),"number"==typeof e&&(e={z:e});var n=this.applyDefault([e.x,e.y,e.z],t);return h.radify(n)},scale:function(e,t){return e||(e=1),"number"==typeof e?[e,e,e]:this.applyDefault([e.x,e.y,e.z],t)},applyDefault:function(e,t){return e.map((function(e,n){return e||t[n]}))}},toDecimal:function(e,t){return Number(e.toFixed(t))},equal:function(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(0==n.length&&0==i.length&&n!==i)return!1;for(const r of n){const n=e[r],i=t[r],a=this.isObject(n)&&this.isObject(i);if(a&&!equal(n,i)||!a&&n!==i)return!1}return!0},isObject:function(e){return null!=e&&"object"==typeof e},curveToLine:(e,t)=>{let{width:n,color:r}=t,a=(new i.BufferGeometry).setFromPoints(e.getPoints(100)),o=new i.LineBasicMaterial({color:r,linewidth:n});return new i.Line(a,o)},curvesToLines:e=>{var t=[16711680,2031360,2490623];return e.map((e,n)=>curveToLine(e,{width:3,color:t[n]||"purple"}))},_validate:function(e,t){e=e||{};var n={};h.extend(n,e);for(let i of Object.keys(t))if(void 0===e[i]){if(null===t[i])return void console.error(i+" is required");n[i]=t[i]}else n[i]=e[i];return n},Validator:new l,exposedMethods:["projectToWorld","projectedUnitsPerMeter","extend","unprojectFromWorld"]};u=u=h;var d={};function p(e,t,n){this.map=e,this.camera=t,this.active=!0,this.camera.matrixAutoUpdate=!1,this.world=n||new i.Group,this.world.position.x=this.world.position.y=r.WORLD_SIZE/2,this.world.matrixAutoUpdate=!1,this.state={translateCenter:(new i.Matrix4).makeTranslation(r.WORLD_SIZE/2,-r.WORLD_SIZE/2,0),worldSizeRatio:r.TILE_SIZE/r.WORLD_SIZE,worldSize:r.TILE_SIZE*this.map.transform.scale};let a=this;this.map.on("move",(function(){a.updateCamera()})).on("resize",(function(){a.setupCamera()})),this.setupCamera()}p.prototype={setupCamera:function(){this.state.fov=this.map.transform._fov;const e=this.map.transform;this.camera.aspect=e.width/e.height,this.camera.updateProjectionMatrix(),this.halfFov=this.state.fov/2;const t={x:e.width/2,y:e.height/2},n=.5/Math.tan(this.halfFov)*e.height,r=e._maxPitch*Math.PI/180;this.acuteAngle=Math.PI/2-r,this.state.cameraToCenterDistance=n,this.state.offset=t,this.state.cameraTranslateZ=(new i.Matrix4).makeTranslation(0,0,this.state.cameraToCenterDistance),this.state.maxFurthestDistance=.95*this.state.cameraToCenterDistance*(Math.cos(this.acuteAngle)*Math.sin(this.halfFov)/Math.sin(Math.max(.01,Math.min(Math.PI-.01,this.acuteAngle-this.halfFov)))+1),this.updateCamera()},updateCamera:function(e){if(!this.camera)return void console.log("nocamera");const t=this.map.transform;let n=0,r=0;this.state.fov=t._fov,this.halfFov=this.state.fov/2;const a=Math.PI/2+t._pitch,o=Math.cos(Math.PI/2-t._pitch);if(this.cameraToCenterDistance=.5/Math.tan(this.halfFov)*t.height,window.mapboxgl&&parseFloat(window.mapboxgl.version)>=2){const e=this.worldSize(t),i=(this.mercatorZfromAltitude(1,t.center.lat),this.fovAboveCenter(t)),s=0,l=(t._camera.position[2]*e-s)/Math.cos(t._pitch);r=o*(Math.sin(i)*l/Math.sin(u.clamp(Math.PI-a-i,.01,Math.PI-.01)))+l;const c=l*(1/t._horizonShift);n=Math.min(1.01*r,c)}else n=1.01*(r=o*(Math.sin(this.halfFov)*this.state.cameraToCenterDistance/Math.sin(Math.PI-a-this.halfFov))+this.state.cameraToCenterDistance);this.state.cameraTranslateZ=(new i.Matrix4).makeTranslation(0,0,this.cameraToCenterDistance);const s=t.height/50,l=Math.max(s*o,s),c=t.height,h=t.width;this.camera instanceof i.OrthographicCamera?this.camera.projectionMatrix=u.makeOrthographicMatrix(h/-2,h/2,c/2,c/-2,l,n):this.camera.projectionMatrix=u.makePerspectiveMatrix(this.state.fov,h/c,l,n);let d=this.calcCameraMatrix(t._pitch,t.angle);this.camera.matrixWorld.copy(d);let f=t.scale*this.state.worldSizeRatio,m=new i.Matrix4,g=new i.Matrix4,v=new i.Matrix4;m.makeScale(f,f,f);let y=t.x||t.point.x,x=t.y||t.point.y;g.makeTranslation(-y,x,0),v.makeRotationZ(Math.PI),this.world.matrix=(new i.Matrix4).premultiply(v).premultiply(this.state.translateCenter).premultiply(m).premultiply(g),this.map.fire("CameraSynced",{detail:{nearZ:l,farZ:n,pitch:t._pitch,angle:t.angle,furthestDistance:r,maxFurthestDistance:this.state.maxFurthestDistance,cameraToCenterDistance:this.cameraToCenterDistance,t:this.map.transform,tbProjMatrix:this.camera.projectionMatrix.elements,tbWorldMatrix:this.world.matrix.elements,cameraSyn:p}})},worldSize:e=>e.tileSize*e.scale,fovAboveCenter:e=>e._fov*(.5+e.centerOffset.y/e.height),mercatorZfromAltitude(e,t){return e/this.circumferenceAtLatitude(t)},circumferenceAtLatitude:e=>r.EARTH_CIRCUMFERENCE*Math.cos(e*Math.PI/180),calcCameraMatrix(e,t,n){const r=this.map.transform,a=void 0===e?r._pitch:e,o=void 0===t?r.angle:t,s=void 0===n?this.state.cameraTranslateZ:n;return(new i.Matrix4).premultiply(s).premultiply((new i.Matrix4).makeRotationX(a)).premultiply((new i.Matrix4).makeRotationZ(o))}},d=d=p;var f={};!function(){"use strict";var e=Math.PI,t=Math.sin,n=Math.cos,i=Math.tan,r=Math.asin,a=Math.atan2,o=Math.acos,s=e/180;function l(e){return e.valueOf()/864e5-.5+2440588}function c(e){return new Date(864e5*(e+.5-2440588))}function u(e){return l(e)-2451545}var h=23.4397*s;function d(e,r){return a(t(e)*n(h)-i(r)*t(h),n(e))}function p(e,i){return r(t(i)*n(h)+n(i)*t(h)*t(e))}function m(e,r,o){return a(t(e),n(e)*t(r)-i(o)*n(r))}function g(e,i,a){return r(t(i)*t(a)+n(i)*n(a)*n(e))}function v(e,t){return s*(280.16+360.9856235*e)-t}function y(e){return s*(357.5291+.98560028*e)}function x(n){return n+s*(1.9148*t(n)+.02*t(2*n)+3e-4*t(3*n))+102.9372*s+e}function b(e){var t=x(y(e));return{dec:p(t,0),ra:d(t,0)}}var w={getPosition:function(e,t,n){var i=s*-n,r=s*t,a=u(e),o=b(a),l=v(a,i)-o.ra;return{azimuth:m(l,r,o.dec),altitude:g(l,r,o.dec)}},toJulian:function(e){return l(e)}},_=w.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];w.addTime=function(e,t,n){_.push([e,t,n])};function M(t,n,i){return 9e-4+(t+n)/(2*e)+i}function S(e,n,i){return 2451545+e+.0053*t(n)-.0069*t(2*i)}function T(e,i,r,a,s,l,c){return S(M(function(e,i,r){return o((t(e)-t(i)*t(r))/(n(i)*n(r)))}(e,r,a),i,s),l,c)}function E(e){var i=s*(134.963+13.064993*e),r=s*(93.272+13.22935*e),a=s*(218.316+13.176396*e)+6.289*s*t(i),o=5.128*s*t(r),l=385001-20905*n(i);return{ra:d(a,o),dec:p(a,o),dist:l}}function A(e,t){return new Date(e.valueOf()+864e5*t/24)}w.getTimes=function(t,n,i,r){var a,o,l,h,d,f=s*-i,m=s*n,g=function(e){return-2.076*Math.sqrt(e)/60}(r=r||0),v=function(t,n){return Math.round(t-9e-4-n/(2*e))}(u(t),f),b=M(0,f,v),w=y(b),E=x(w),A=p(E,0),L=S(b,w,E),R={solarNoon:c(L),nadir:c(L-.5)};for(a=0,o=_.length;a<o;a+=1)d=L-((h=T(((l=_[a])[0]+g)*s,f,m,A,v,w,E))-L),R[l[1]]=c(d),R[l[2]]=c(h);return R},w.getMoonPosition=function(e,r,o){var l=s*-o,c=s*r,h=u(e),d=E(h),p=v(h,l)-d.ra,f=g(p,c,d.dec),y=a(t(p),i(c)*n(d.dec)-t(d.dec)*n(p));return f+=function(e){return e<0&&(e=0),2967e-7/Math.tan(e+.00312536/(e+.08901179))}(f),{azimuth:m(p,c,d.dec),altitude:f,distance:d.dist,parallacticAngle:y}},w.getMoonIllumination=function(e){var i=u(e||new Date),r=b(i),s=E(i),l=o(t(r.dec)*t(s.dec)+n(r.dec)*n(s.dec)*n(r.ra-s.ra)),c=a(149598e3*t(l),s.dist-149598e3*n(l)),h=a(n(r.dec)*t(r.ra-s.ra),t(r.dec)*n(s.dec)-n(r.dec)*t(s.dec)*n(r.ra-s.ra));return{fraction:(1+n(c))/2,phase:.5+.5*c*(h<0?-1:1)/Math.PI,angle:h}},w.getMoonTimes=function(e,t,n,i){var r=new Date(e);i?r.setUTCHours(0,0,0,0):r.setHours(0,0,0,0);for(var a,o,l,c,u,h,d,p,f,m,g,v,y,x=.133*s,b=w.getMoonPosition(r,t,n).altitude-x,_=1;_<=24&&(a=w.getMoonPosition(A(r,_),t,n).altitude-x,p=((u=(b+(o=w.getMoonPosition(A(r,_+1),t,n).altitude-x))/2-a)*(d=-(h=(o-b)/2)/(2*u))+h)*d+a,m=0,(f=h*h-4*u*a)>=0&&(g=d-(y=Math.sqrt(f)/(2*Math.abs(u))),v=d+y,Math.abs(g)<=1&&m++,Math.abs(v)<=1&&m++,g<-1&&(g=v)),1===m?b<0?l=_+g:c=_+g:2===m&&(l=_+(p<0?v:g),c=_+(p<0?g:v)),!l||!c);_+=2)b=o;var M={};return l&&(M.rise=A(r,l)),c&&(M.set=A(r,c)),l||c||(M[p>0?"alwaysUp":"alwaysDown"]=!0),M},f=f=w}();var g={},v={material:"MeshBasicMaterial",color:"black",opacity:1};g=g=function(e){var t;function n(){return new i[v.material]({color:v.color})}return e?((t=(e=u._validate(e,v)).material&&e.material.isMaterial?e.material:e.material||e.color||e.opacity?new i[e.material]({color:e.color,transparent:e.opacity<1}):n()).opacity=e.opacity,e.side&&(t.side=e.side)):t=n(),t};var y={};function x(e){this.map=e,this.enrolledObjects=[],this.previousFrameTime}x.prototype={unenroll:function(e){this.enrolledObjects.splice(this.enrolledObjects.indexOf(e),1)},enroll:function(e){if(e.clock=new i.Clock,e.hasDefaultAnimation=!1,e.defaultAction,e.actions=[],e.mixer,e.animations&&e.animations.length>0){e.hasDefaultAnimation=!0;let n=e.userData.defaultAnimation?e.userData.defaultAnimation:0;e.mixer=new i.AnimationMixer(e),t(n)}function t(t){for(let n=0;n<e.animations.length;n++){t>e.animations.length&&console.log("The animation index "+t+" doesn't exist for this object");let i=e.animations[n],r=e.mixer.clipAction(i);e.actions.push(r),t===n?(e.defaultAction=r,r.setEffectiveWeight(1)):r.setEffectiveWeight(0),r.play()}}let n=!1;Object.defineProperty(e,"isPlaying",{get:()=>n,set(t){n!=t&&(n=t,e.dispatchEvent({type:"IsPlayingChanged",detail:e}))}}),this.enrolledObjects.push(e),e.animationQueue=[],e.set=function(t){if(t.duration>0){let n={start:Date.now(),expiration:Date.now()+t.duration,endState:{}};u.extend(t,n);let r=t.coords,a=t.rotation,o=t.scale||t.scaleX||t.scaleY||t.scaleZ;if(a){let n=e.rotation;t.startRotation=[n.x,n.y,n.z],t.endState.rotation=u.types.rotation(t.rotation,t.startRotation),t.rotationPerMs=t.endState.rotation.map((function(e,n){return(e-t.startRotation[n])/t.duration}))}if(o){let n=e.scale;t.startScale=[n.x,n.y,n.z],t.endState.scale=u.types.scale(t.scale,t.startScale),t.scalePerMs=t.endState.scale.map((function(e,n){return(e-t.startScale[n])/t.duration}))}r&&(t.pathCurve=new i.CatmullRomCurve3(u.lnglatsToWorld([e.coordinates,t.coords])));let s={type:"set",parameters:t};this.animationQueue.push(s),tb.map.repaint=!0}else this.stop(),t.rotation=u.radify(t.rotation),this._setObject(t);return this},e.animationMethod=null,e.stop=function(t){return e.mixer&&(e.isPlaying=!1,cancelAnimationFrame(e.animationMethod)),this.animationQueue=[],this},e.followPath=function(e,t){let n={type:"followPath",parameters:u._validate(e,b.followPath)};return u.extend(n.parameters,{pathCurve:new i.CatmullRomCurve3(u.lnglatsToWorld(e.path)),start:Date.now(),expiration:Date.now()+n.parameters.duration,cb:t}),this.animationQueue.push(n),tb.map.repaint=!0,this},e._setObject=function(t){e.setScale();let n=t.position,r=t.rotation,a=t.scale,o=t.worldCoordinates,s=t.quaternion,l=t.translate,c=t.worldTranslate;if(n){this.coordinates=n;let e=u.projectToWorld(n);this.position.copy(e)}if(l){this.coordinates=[this.coordinates[0]+l[0],this.coordinates[1]+l[1],this.coordinates[2]+l[2]];let e=u.projectToWorld(l);this.position.copy(e),t.position=this.coordinates}if(c){this.translateX(c.x),this.translateY(c.y),this.translateZ(c.z);let e=u.unprojectFromWorld(this.position);this.coordinates=t.position=e}if(r&&(this.rotation.set(r[0],r[1],r[2]),t.rotation=new i.Vector3(r[0],r[1],r[2])),a&&(this.scale.set(a[0],a[1],a[2]),t.scale=this.scale),s&&(this.quaternion.setFromAxisAngle(s[0],s[1]),t.rotation=s[0].multiplyScalar(s[1])),o){this.position.copy(o);let e=u.unprojectFromWorld(o);this.coordinates=t.position=e}this.setBoundingBoxShadowFloor(),this.setReceiveShadowFloor(),this.updateMatrixWorld(),tb.map.repaint=!0;let h={type:"ObjectChanged",detail:{object:this,action:{position:t.position,rotation:t.rotation,scale:t.scale}}};this.dispatchEvent(h)},e.playDefault=function(t){if(e.mixer&&e.hasDefaultAnimation){let n={start:Date.now(),expiration:Date.now()+t.duration,endState:{}};u.extend(t,n),e.mixer.timeScale=t.speed||1;let i={type:"playDefault",parameters:t};return this.animationQueue.push(i),tb.map.repaint=!0,this}},e.playAnimation=function(n){e.mixer&&(n.animation&&t(n.animation),e.playDefault(n))},e.pauseAllActions=function(){e.mixer&&e.actions.forEach((function(e){e.paused=!0}))},e.unPauseAllActions=function(){e.mixer&&e.actions.forEach((function(e){e.paused=!1}))},e.deactivateAllActions=function(){e.mixer&&e.actions.forEach((function(e){e.stop()}))},e.activateAllActions=function(){e.mixer&&e.actions.forEach((function(e){e.play()}))},e.idle=function(){return e.mixer&&e.mixer.update(.01),tb.map.repaint=!0,this}},update:function(e){if(void 0===this.previousFrameTime&&(this.previousFrameTime=e),!this.enrolledObjects)return!1;for(let t=this.enrolledObjects.length-1;t>=0;t--){let n=this.enrolledObjects[t];if(n.animationQueue&&0!==n.animationQueue.length)for(let t=n.animationQueue.length-1;t>=0;t--){let r=n.animationQueue[t];if(!r)continue;let a=r.parameters;if(!a.expiration)return n.animationQueue.splice(t,1),void(n.animationQueue[t]&&(n.animationQueue[t].parameters.start=e));if(e>=a.expiration)a.expiration=!1,"playDefault"===r.type?n.stop():(a.endState&&n._setObject(a.endState),void 0!==a.cb&&a.cb());else{let t=(e-a.start)/a.duration;if("set"===r.type){let e={};a.pathCurve&&(e.worldCoordinates=a.pathCurve.getPoint(t)),a.rotationPerMs&&(e.rotation=a.startRotation.map((function(e,n){return e+a.rotationPerMs[n]*t*a.duration}))),a.scalePerMs&&(e.scale=a.startScale.map((function(e,n){return e+a.scalePerMs[n]*t*a.duration}))),n._setObject(e)}if("followPath"===r.type){let e={worldCoordinates:a.pathCurve.getPointAt(t)};if(a.trackHeading){let n=a.pathCurve.getTangentAt(t).normalize(),r=new i.Vector3(0,0,0),o=new i.Vector3(0,1,0);r.crossVectors(o,n).normalize();let s=Math.acos(o.dot(n));e.quaternion=[r,s]}n._setObject(e)}"playDefault"===r.type&&(n.activateAllActions(),n.isPlaying=!0,n.animationMethod=requestAnimationFrame(this.update),n.mixer.update(n.clock.getDelta()),tb.map.repaint=!0)}}}this.previousFrameTime=e}};const b={followPath:{path:null,duration:1e3,trackHeading:!0}};y=y=x;var w={};i.CSS2DObject=function(e){i.Object3D.call(this),this.element=e||document.createElement("div"),this.element.style.position="absolute",this.alwaysVisible=!1,Object.defineProperty(this,"layer",{get(){return this.parent&&this.parent.parent?this.parent.parent.layer:null}}),this.dispose=function(){this.remove(),this.element=null},this.remove=function(){this.element instanceof Element&&null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)},this.addEventListener("removed",(function(){this.remove()}))},i.CSS2DObject.prototype=Object.assign(Object.create(i.Object3D.prototype),{constructor:i.CSS2DObject,copy:function(e,t){return i.Object3D.prototype.copy.call(this,e,t),this.element=e.element.cloneNode(!0),this}}),i.CSS2DRenderer=function(){var e,t,n,r,a=this,o=new i.Vector3,s=new i.Matrix4,l=new i.Matrix4,c={objects:new WeakMap,list:new Map};this.cacheList=c.list;var u=document.createElement("div");u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:e,height:t}},this.setSize=function(i,a){n=(e=i)/2,r=(t=a)/2,u.style.width=i+"px",u.style.height=a+"px"},this.renderObject=function(e,t,s){if(e instanceof i.CSS2DObject)if(e.visible){e.onBeforeRender(a,t,s),o.setFromMatrixPosition(e.matrixWorld),o.applyMatrix4(l);var h=e.element,d="translate(-50%,-50%) translate("+(o.x*n+n)+"px,"+(-o.y*r+r)+"px)";h.style.WebkitTransform=d,h.style.MozTransform=d,h.style.oTransform=d,h.style.transform=d,h.style.display=e.visible&&o.z>=-1&&o.z<=1?"":"none";var f={distanceToCameraSquared:p(s,e)};c.objects.set({key:e.uuid},f),c.list.set(e.uuid,e),h.parentNode!==u&&u.appendChild(h),e.onAfterRender(a,t,s)}else c.objects.delete({key:e.uuid}),c.list.delete(e.uuid),e.remove();for(var m=0,g=e.children.length;m<g;m++)this.renderObject(e.children[m],t,s)};var h,d,p=(h=new i.Vector3,d=new i.Vector3,function(e,t){return h.setFromMatrixPosition(e.matrixWorld),d.setFromMatrixPosition(t.matrixWorld),h.distanceToSquared(d)});this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),s.copy(t.matrixWorldInverse),l.multiplyMatrices(t.projectionMatrix,s),this.renderObject(e,e,t),function(e){for(var t=function(e){var t=[];return e.traverse((function(e){e instanceof i.CSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){let n=c.objects.get({key:e.uuid}),i=c.objects.get({key:t.uuid});if(n&&i)return n.distanceToCameraSquared-i.distanceToCameraSquared})),n=t.length,r=0,a=t.length;r<a;r++)t[r].element.style.zIndex=n-r}(e)}},w=w={CSS2DRenderer:i.CSS2DRenderer,CSS2DObject:i.CSS2DObject};var _={};const M=i;function S(){}S.prototype={line:function(e){e=u._validate(e,this._defaults.line);var t=u.lnglatsToWorld(e.geometry),n=u.normalizeVertices(t),i=u.flattenVectors(n.vertices),r=new Float32Array(i),a=new M.BufferGeometry;a.setAttribute("position",new M.BufferAttribute(r,3));var o=new M.LineBasicMaterial({color:16711680,linewidth:21}),s=new M.Line(a,o);return s.options=options||{},s.position.copy(n.position),s},extrusion:function(e){},unenroll:function(e,t){t||this.animationManager.unenroll(e)},_addMethods:function(e,t){var n=this;if(t);else{function i(e,t,n,i){let r=u.radify(i);e.position.sub(t),e.position.applyAxisAngle(n,r),e.position.add(t),e.rotateOnAxis(n,r),tb.map.repaint=!0}e.coordinates||(e.coordinates=[0,0,0]),Object.defineProperty(e,"model",{get:()=>e.getObjectByName("model")}),Object.defineProperty(e,"animations",{get(){const t=e.model;return t?t.animations:null}}),n.animationManager.enroll(e),e.setCoords=function(t){return e.userData.topMargin&&e.userData.feature&&(t[2]+=((e.userData.feature.properties.height||0)-(e.userData.feature.properties.base_height||e.userData.feature.properties.min_height||0))*(e.userData.topMargin||0)),e.coordinates=t,e.set({position:t}),e},e.setTranslate=function(t){return e.set({translate:t}),e},e.setRotation=function(t){"number"==typeof t&&(t={z:t});var n={x:u.radify(t.x)||e.rotation.x,y:u.radify(t.y)||e.rotation.y,z:u.radify(t.z)||e.rotation.z};e._setObject({rotation:[n.x,n.y,n.z]})},e.calculateAdjustedPosition=function(t,n,i){let r=t.slice(),a=u.unprojectFromWorld(e.modelSize);return i?(r[0]-=0!=n.x?a[0]/n.x:0,r[1]-=0!=n.y?a[1]/n.y:0,r[2]-=0!=n.z?a[2]/n.z:0):(r[0]+=0!=n.x?a[0]/n.x:0,r[1]+=0!=n.y?a[1]/n.y:0,r[2]+=0!=n.z?a[2]/n.z:0),r},e.setRotationAxis=function(t){"number"==typeof t&&(t={z:t});let n=e.modelBox(),r=new M.Vector3(n.max.x,n.max.y,n.min.z);0!=t.x&&i(e,r,new M.Vector3(0,0,1),t.x),0!=t.y&&i(e,r,new M.Vector3(0,0,1),t.y),0!=t.z&&i(e,r,new M.Vector3(0,0,1),t.z)},Object.defineProperty(e,"scaleGroup",{get:()=>e.getObjectByName("scaleGroup")}),Object.defineProperty(e,"boxGroup",{get:()=>e.getObjectByName("boxGroup")}),Object.defineProperty(e,"boundingBox",{get:()=>e.getObjectByName("boxModel")}),Object.defineProperty(e,"boundingBoxShadow",{get:()=>e.getObjectByName("boxShadow")}),e.drawBoundingBox=function(){let t=e.box3(),n=new M.Group;n.name="boxGroup",n.updateMatrixWorld(!0);let i=new M.Box3Helper(t,S.prototype._defaults.colors.yellow);i.name="boxModel",n.add(i),i.layers.disable(0);let r=t.clone();r.max.z=r.min.z;let a=new M.Box3Helper(r,S.prototype._defaults.colors.black);a.name="boxShadow",n.add(a),a.layers.disable(0),n.visible=!1,e.scaleGroup.add(n),e.setBoundingBoxShadowFloor()},e.setBoundingBoxShadowFloor=function(){if(e.boundingBoxShadow){let t=-e.modelHeight,n=e.rotation,i=e.boundingBoxShadow;i.box.max.z=i.box.min.z=t,i.rotation.y=n.y,i.rotation.x=-n.x}},e.setAnchor=function(t){const n=e.box3(),i=n.getCenter(new M.Vector3);switch(e.none={x:0,y:0,z:0},e.center={x:i.x,y:i.y,z:n.min.z},e.bottom={x:i.x,y:n.max.y,z:n.min.z},e.bottomLeft={x:n.max.x,y:n.max.y,z:n.min.z},e.bottomRight={x:n.min.x,y:n.max.y,z:n.min.z},e.top={x:i.x,y:n.min.y,z:n.min.z},e.topLeft={x:n.max.x,y:n.min.y,z:n.min.z},e.topRight={x:n.min.x,y:n.min.y,z:n.min.z},e.left={x:n.max.x,y:i.y,z:n.min.z},e.right={x:n.min.x,y:i.y,z:n.min.z},t){case"center":e.anchor=e.center;break;case"top":e.anchor=e.top;break;case"top-left":e.anchor=e.topLeft;break;case"top-right":e.anchor=e.topRight;break;case"left":e.anchor=e.left;break;case"right":e.anchor=e.right;break;case"bottom":e.anchor=e.bottom;break;case"bottom-left":default:e.anchor=e.bottomLeft;break;case"bottom-right":e.anchor=e.bottomRight;break;case"auto":case"none":e.anchor=e.none}e.model.position.set(-e.anchor.x,-e.anchor.y,-e.anchor.z)},e.setCenter=function(t){if(t&&(0!=t.x||0!=t.y||0!=t.z)){let n=e.getSize();e.anchor={x:e.anchor.x-n.x*t.x,y:e.anchor.y-n.y*t.y,z:e.anchor.z-n.z*t.z},e.model.position.set(-e.anchor.x,-e.anchor.y,-e.anchor.z)}},Object.defineProperty(e,"label",{get:()=>e.getObjectByName("label")}),Object.defineProperty(e,"tooltip",{get:()=>e.getObjectByName("tooltip")}),Object.defineProperty(e,"help",{get:()=>e.getObjectByName("help")}),Object.defineProperty(e,"visibility",{get:()=>e.visible,set(t){let n=t;if("visible"==t||1==t)n=!0,e.label&&(e.label.visible=n);else{if("none"!=t&&0!=t)return;n=!1,e.label&&e.label.alwaysVisible&&(e.label.visible=n),e.tooltip&&(e.tooltip.visible=n)}e.visible!=n&&(e.visible=n,e.model&&e.model.traverse((function(t){"Mesh"!=t.type&&"SkinnedMesh"!=t.type||(n&&e.raycasted?t.layers.enable(0):t.layers.disable(0)),"LineSegments"==t.type&&t.layers.disableAll()})))}}),e.addLabel=function(t,n,i,r){t&&e.drawLabelHTML(t,n,i,r)},e.removeLabel=function(){e.removeCSS2D("label")},e.drawLabelHTML=function(t,i=!1,r=e.anchor,a=.5){let o=n.drawLabelHTML(t,S.prototype._defaults.label.cssClass),s=e.addCSS2D(o,"label",r,a);return s.alwaysVisible=i,s.visible=i,s},e.addTooltip=function(t,n,i,r=!0,a=1){let o=e.addHelp(t,"tooltip",n,i,a);o.visible=!1,o.custom=r},e.removeTooltip=function(){e.removeCSS2D("tooltip")},e.addHelp=function(t,i="help",r=!1,a=e.anchor,o=0){let s=n.drawTooltip(t,r),l=e.addCSS2D(s,i,a,o);return l.visible=!0,l},e.removeHelp=function(){e.removeCSS2D("help")},e.addCSS2D=function(t,n,i=e.anchor,r=1){if(t){const a=e.box3(),o=a.getSize(new M.Vector3);let s={x:a.max.x,y:a.max.y,z:a.min.z};e.removeCSS2D(n);let l=new w.CSS2DObject(t);return l.name=n,l.position.set(.5*-o.x-e.model.position.x-i.x+s.x,.5*-o.y-e.model.position.y-i.y+s.y,o.z*r),l.visible=!1,e.scaleGroup.add(l),l}},e.removeCSS2D=function(t){let n=e.getObjectByName(t);if(n){n.dispose();let t=e.scaleGroup.children;t.splice(t.indexOf(n),1)}},Object.defineProperty(e,"shadowPlane",{get:()=>e.getObjectByName("shadowPlane")});let t=!1;Object.defineProperty(e,"castShadow",{get:()=>t,set(n){if(e.model&&t!==n){if(e.model.traverse((function(e){e.isMesh&&(e.castShadow=!0)})),n){const t=e.modelSize,i=[t.x,t.y,t.z,e.modelHeight],r=10*Math.max(...i),a=new M.PlaneBufferGeometry(r,r),o=new M.ShadowMaterial;o.opacity=.5;let s=new M.Mesh(a,o);s.name="shadowPlane",s.layers.enable(1),s.layers.disable(0),s.receiveShadow=n,e.add(s)}else e.traverse((function(t){t.isMesh&&t.material instanceof M.ShadowMaterial&&e.remove(t)}));t=n}}}),e.setReceiveShadowFloor=function(){if(e.castShadow){let t=e.shadowPlane,n=t.position,i=t.rotation;if(n.z=-e.modelHeight,i.y=e.rotation.y,i.x=-e.rotation.x,"meters"===e.userData.units){const i=e.modelSize,r=[i.x,i.y,i.z,-n.z],a=10*Math.max(...r)/t.geometry.parameters.width;t.scale.set(a,a,a)}}};let r=!1;Object.defineProperty(e,"receiveShadow",{get:()=>r,set(t){e.model&&r!==t&&(e.model.traverse((function(e){e.isMesh&&(e.receiveShadow=!0)})),r=t)}});let a=!1;Object.defineProperty(e,"wireframe",{get:()=>a,set(t){e.model&&a!==t&&(e.model.traverse((function(e){if("Mesh"==e.type||"SkinnedMesh"==e.type){let n=[];Array.isArray(e.material)?n=e.material:n.push(e.material);let i=n[0];t?(e.userData.materials=i,e.material=i.clone(),e.material.wireframe=e.material.transparent=t,e.material.opacity=.3):(e.material.dispose(),e.material=e.userData.materials,e.userData.materials.dispose(),e.userData.materials=null),t?(e.layers.disable(0),e.layers.enable(1)):(e.layers.disable(1),e.layers.enable(0))}"LineSegments"==e.type&&e.layers.disableAll()})),a=t,e.dispatchEvent({type:"Wireframed",detail:e}))}});let o=null;Object.defineProperty(e,"color",{get:()=>o,set(t){e.model&&o!==t&&(e.model.traverse((function(e){if("Mesh"==e.type||"SkinnedMesh"==e.type){let n=[];Array.isArray(e.material)?n=e.material:n.push(e.material);let i=n[0];t?(e.userData.materials=i,e.material=new M.MeshStandardMaterial,e.material.color.setHex(t)):(e.material.dispose(),e.material=e.userData.materials,e.userData.materials.dispose(),e.userData.materials=null)}})),o=t)}});let s=!1;Object.defineProperty(e,"selected",{get:()=>s,set(t){t?(e.userData.bbox&&!e.boundingBox&&e.drawBoundingBox(),e.boxGroup&&(e.boundingBox.material=S.prototype._defaults.materials.boxSelectedMaterial,e.boundingBox.parent.visible=!0,e.boundingBox.layers.enable(1),e.boundingBoxShadow.layers.enable(1)),e.label&&!e.label.alwaysVisible&&(e.label.visible=!0)):(e.boxGroup&&e.remove(e.boxGroup),e.label&&!e.label.alwaysVisible&&(e.label.visible=!1),e.removeHelp()),e.tooltip&&(e.tooltip.visible=t),s!=t&&(s=t,e.dispatchEvent({type:"SelectedChange",detail:e}))}});let l=!0;Object.defineProperty(e,"raycasted",{get:()=>l,set(t){e.model&&l!==t&&(e.model.traverse((function(e){"Mesh"!=e.type&&"SkinnedMesh"!=e.type||(t?(e.layers.disable(1),e.layers.enable(0)):(e.layers.disable(0),e.layers.enable(1)))})),l=t)}});let c=!1;Object.defineProperty(e,"over",{get:()=>c,set(t){t?(e.selected||(e.userData.bbox&&!e.boundingBox&&e.drawBoundingBox(),e.userData.tooltip&&!e.tooltip&&e.addTooltip(e.uuid,!0,e.anchor,!1),e.boxGroup&&(e.boundingBox.material=S.prototype._defaults.materials.boxOverMaterial,e.boundingBox.parent.visible=!0,e.boundingBox.layers.enable(1),e.boundingBoxShadow.layers.enable(1))),e.label&&!e.label.alwaysVisible&&(e.label.visible=!0),e.dispatchEvent({type:"ObjectMouseOver",detail:e})):(e.selected||(e.boxGroup&&(e.remove(e.boxGroup),e.tooltip&&!e.tooltip.custom&&e.removeTooltip()),e.label&&!e.label.alwaysVisible&&(e.label.visible=!1)),e.dispatchEvent({type:"ObjectMouseOut",detail:e})),e.tooltip&&(e.tooltip.visible=t||e.selected),c=t}}),e.box3=function(){let t;if(e.updateMatrix(),e.updateMatrixWorld(!0,!0),e.model){let n=e.clone(!0),i=e.model.clone();if(t=(new M.Box3).setFromObject(i),e.parent){let r=new M.Matrix4,a=new M.Matrix4;e.matrix.extractRotation(r),a.copy(r).invert(),n.setRotationFromMatrix(a),t=(new M.Box3).setFromObject(i)}}return t},e.modelBox=function(){return e.box3()},e.getSize=function(){return e.box3().getSize(new M.Vector3(0,0,0))};let h=!1;Object.defineProperty(e,"modelSize",{get:()=>h=e.getSize(),set(e){h!=e&&(h=e)}}),Object.defineProperty(e,"modelHeight",{get(){let t=e.coordinates[2]||0;return"scene"===e.userData.units&&(t*=e.unitsPerMeter/e.scale.x),t}}),Object.defineProperty(e,"unitsPerMeter",{get:()=>Number(u.projectedUnitsPerMeter(e.coordinates[1]).toFixed(7))}),Object.defineProperty(e,"fixedZoom",{get:()=>e.userData.fixedZoom,set(t){e.userData.fixedZoom!==t&&(e.userData.fixedZoom=t,e.userData.units=t?"scene":"meters")}}),e.setFixedZoom=function(t){if(null!=e.fixedZoom){t||(t=e.userData.mapScale);let i=(n=e.fixedZoom,Math.pow(2,n));if(i>t){let n=i/t;e.scale.set(n,n,n)}else e.scale.set(1,1,1)}var n},e.setScale=function(t){if("meters"!==e.userData.units||e.fixedZoom)e.fixedZoom?(t&&(e.userData.mapScale=t),e.setFixedZoom(e.userData.mapScale)):e.scale.set(1,1,1);else{let t=e.unitsPerMeter;e.scale.set(t,t,t)}},e.setObjectScale=function(t){e.setScale(t),e.setBoundingBoxShadowFloor(),e.setReceiveShadowFloor()}}e.add=function(t){return e.scaleGroup.add(t),t.position.z=e.coordinates[2]?-e.coordinates[2]:0,t},e.remove=function(t){t&&(t.traverse(e=>{if(e.geometry&&e.geometry.dispose(),e.material)if(e.material.isMaterial)r(e.material);else for(const t of e.material)r(t);e.dispose&&e.dispose()}),e.scaleGroup.remove(t),tb.map.repaint=!0)},e.duplicate=function(t){let i=e.clone(!0);if(i.getObjectByName("model").animations=e.animations,i.userData.feature&&(t&&t.feature&&(i.userData.feature=t.feature),i.userData.feature.properties.uuid=i.uuid),n._addMethods(i),!t||u.equal(t.scale,e.userData.scale))return i.copyAnchor(e),i;{i.userData=t,i.userData.isGeoGroup=!0,i.remove(i.boxGroup);const e=u.types.rotation(t.rotation,[0,0,0]),n=u.types.scale(t.scale,[1,1,1]);return i.model.position.set(0,0,0),i.model.rotation.set(e[0],e[1],e[2]),i.model.scale.set(n[0],n[1],n[2]),i.setAnchor(t.anchor),i.setCenter(t.adjustment),i}},e.copyAnchor=function(t){e.anchor=t.anchor,e.none={x:0,y:0,z:0},e.center=t.center,e.bottom=t.bottom,e.bottomLeft=t.bottomLeft,e.bottomRight=t.bottomRight,e.top=t.top,e.topLeft=t.topLeft,e.topRight=t.topRight,e.left=t.left,e.right=t.right},e.dispose=function(){S.prototype.unenroll(e),e.traverse(e=>{if((!e.parent||"world"!=e.parent.name)&&"threeboxObject"!==e.name){if(e.geometry&&e.geometry.dispose(),e.material)if(e.material.isMaterial)r(e.material);else for(const t of e.material)r(t);e.dispose&&e.dispose()}}),e.children=[]};const r=e=>{e.dispose();for(const n of Object.keys(e)){const t=e[n];t&&"object"==typeof t&&"minFilter"in t&&t.dispose()}let t=e;(t.map||t.alphaMap||t.aoMap||t.bumpMap||t.displacementMap||t.emissiveMap||t.envMap||t.lightMap||t.metalnessMap||t.normalMap||t.roughnessMap)&&(t.map&&t.map.dispose(),t.alphaMap&&t.alphaMap.dispose(),t.aoMap&&t.aoMap.dispose(),t.bumpMap&&t.bumpMap.dispose(),t.displacementMap&&t.displacementMap.dispose(),t.emissiveMap&&t.emissiveMap.dispose(),t.envMap&&t.envMap.dispose(),t.lightMap&&t.lightMap.dispose(),t.metalnessMap&&t.metalnessMap.dispose(),t.normalMap&&t.normalMap.dispose(),t.roughnessMap&&t.roughnessMap.dispose())};return e},_makeGroup:function(e,t){let n=new M.Group;n.name="scaleGroup",n.add(e);var i=new M.Group;if(i.userData=t||{},i.userData.isGeoGroup=!0,i.userData.feature&&(i.userData.feature.properties.uuid=i.uuid),n.length)for(o of n)i.add(o);else i.add(n);return i.name="threeboxObject",i},animationManager:new y,drawTooltip:function(e,t=!1){if(e){let n;if(t){let t=document.createElement("div");t.className="mapboxgl-popup-content";let i=document.createElement("strong");i.innerHTML=e,t.appendChild(i);let r=document.createElement("div");r.className="mapboxgl-popup-tip";let a=document.createElement("div");a.className="marker mapboxgl-popup-anchor-bottom",a.appendChild(r),a.appendChild(t),(n=document.createElement("div")).className+="label3D",n.appendChild(a)}else(n=document.createElement("span")).className=this._defaults.tooltip.cssClass,n.innerHTML=e;return n}},drawLabelHTML:function(e,t){let n=document.createElement("div");return n.className+=t,n.innerHTML="string"==typeof e?e:e.outerHTML,n},_defaults:{colors:{red:new M.Color(16711680),yellow:new M.Color(16776960),green:new M.Color(65280),black:new M.Color(0)},materials:{boxNormalMaterial:new M.LineBasicMaterial({color:new M.Color(16711680)}),boxOverMaterial:new M.LineBasicMaterial({color:new M.Color(16776960)}),boxSelectedMaterial:new M.LineBasicMaterial({color:new M.Color(65280)})},line:{geometry:null,color:"black",width:1,opacity:1},label:{htmlElement:null,cssClass:" label3D",alwaysVisible:!1,topMargin:-.5},tooltip:{text:"",cssClass:"toolTip text-xs",mapboxStyle:!1,topMargin:0},sphere:{position:[0,0,0],radius:1,sides:20,units:"scene",material:"MeshBasicMaterial",anchor:"bottom-left",bbox:!0,tooltip:!0,raycasted:!0},tube:{geometry:null,radius:1,sides:6,units:"scene",material:"MeshBasicMaterial",anchor:"center",bbox:!0,tooltip:!0,raycasted:!0},loadObj:{type:null,obj:null,units:"scene",scale:1,rotation:0,defaultAnimation:0,anchor:"bottom-left",bbox:!0,tooltip:!0,raycasted:!0},Object3D:{obj:null,units:"scene",anchor:"bottom-left",bbox:!0,tooltip:!0,raycasted:!0},extrusion:{coordinates:[[[]]],geometryOptions:{},height:100,materials:null,scale:1,rotation:0,units:"scene",anchor:"center",bbox:!0,tooltip:!0,raycasted:!0}},geometries:{line:["LineString"],tube:["LineString"],sphere:["Point"]}},_=_=S;var T={};T=T=function(e){let t=(e=u._validate(e,_.prototype._defaults.Object3D)).obj;const n=u.types.rotation(e.rotation,[0,0,0]),i=u.types.scale(e.scale,[1,1,1]);t.rotation.set(n[0],n[1],n[2]),t.scale.set(i[0],i[1],i[2]),t.name="model";let r=_.prototype._makeGroup(t,e);return e.obj.name="model",_.prototype._addMethods(r),r.setAnchor(e.anchor),r.setCenter(e.adjustment),r.raycasted=e.raycasted,r.visibility=!0,r};var E={};E=E=function(e){e=u._validate(e,_.prototype._defaults.sphere);let t=new THREE.SphereBufferGeometry(e.radius,e.sides,e.sides),n=g(e),i=new THREE.Mesh(t,n);return new T({obj:i,units:e.units,anchor:e.anchor,adjustment:e.adjustment,bbox:e.bbox,tooltip:e.tooltip,raycasted:e.raycasted})};var A={};function L(e){e=u._validate(e,_.prototype._defaults.extrusion);let t=L.prototype.buildShape(e.coordinates),n=L.prototype.buildGeometry(t,e.geometryOptions),r=new i.Mesh(n,e.materials);return e.obj=r,new T(e)}L.prototype={buildShape:function(e){if(e[0]instanceof(i.Vector2||i.Vector3))return new i.Shape(e);let t=new i.Shape;for(let n=0;n<e.length;n++)0===n?t=new i.Shape(this.buildPoints(e[0],e[0])):t.holes.push(new i.Path(this.buildPoints(e[n],e[0])));return t},buildPoints:function(e,t){const n=[];let r=u.projectToWorld([t[0][0],t[0][1],0]);for(let a=0;a<e.length;a++){let t=u.projectToWorld([e[a][0],e[a][1],0]);n.push(new i.Vector2(u.toDecimal(t.x-r.x,9),u.toDecimal(t.y-r.y,9)))}return n},buildGeometry:function(e,t){let n=new i.ExtrudeBufferGeometry(e,t);return n.computeBoundingBox(),n}},A=A=L;var R={};R=R=function(e){e=u._validate(e,_.prototype._defaults.label);let t=_.prototype.drawLabelHTML(e.htmlElement,e.cssClass),n=new w.CSS2DObject(t);n.name="label",n.visible=e.alwaysVisible,n.alwaysVisible=e.alwaysVisible;var i=_.prototype._makeGroup(n,e);return _.prototype._addMethods(i),i.visibility=e.alwaysVisible,i};var C={};C=C=function(e){if((e=u._validate(e,_.prototype._defaults.tooltip)).text){let n=_.prototype.drawTooltip(e.text,e.mapboxStyle),i=new w.CSS2DObject(n);i.visible=!1,i.name="tooltip";var t=_.prototype._makeGroup(i,e);return _.prototype._addMethods(t),t}};var P={};i.OBJLoader=function(){var e=/^[og]\s*(.+)?/,n=/^mtllib /,r=/^usemtl /,a=/^usemap /,o=new i.Vector3,s=new i.Vector3,l=new i.Vector3,c=new i.Vector3,u=new i.Vector3;function h(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);var i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(var n=this.materials.length-1;n>=0;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){var i=n.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){var n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){var n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){var i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){var i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){var i=this.vertices,r=this.object.geometry.normals;o.fromArray(i,e),s.fromArray(i,t),l.fromArray(i,n),u.subVectors(l,s),c.subVectors(o,s),u.cross(c),u.normalize(),r.push(u.x,u.y,u.z),r.push(u.x,u.y,u.z),r.push(u.x,u.y,u.z)},addColor:function(e,t,n){var i=this.colors,r=this.object.geometry.colors;void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){var i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,r,a,o,s,l){var c=this.vertices.length,u=this.parseVertexIndex(e,c),h=this.parseVertexIndex(t,c),d=this.parseVertexIndex(n,c);if(this.addVertex(u,h,d),this.addColor(u,h,d),void 0!==o&&""!==o){var p=this.normals.length;u=this.parseNormalIndex(o,p),h=this.parseNormalIndex(s,p),d=this.parseNormalIndex(l,p),this.addNormal(u,h,d)}else this.addFaceNormal(u,h,d);if(void 0!==i&&""!==i){var f=this.uvs.length;u=this.parseUVIndex(i,f),h=this.parseUVIndex(r,f),d=this.parseUVIndex(a,f),this.addUV(u,h,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,n=0,i=e.length;n<i;n++){var r=this.parseVertexIndex(e[n],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var n=this.vertices.length,i=this.uvs.length,r=0,a=e.length;r<a;r++)this.addVertexLine(this.parseVertexIndex(e[r],n));var o=0;for(a=t.length;o<a;o++)this.addUVLine(this.parseUVIndex(t[o],i))}};return e.startObject("",!1),e}function d(e){i.Loader.call(this,e),this.materials=null}return d.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:d,load:function(e,n,r,a){var o=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(i){try{n(o.parse(i))}catch(t){a?a(t):console.error(t),o.manager.itemError(e)}}),r,a)},setMaterials:function(e){return this.materials=e,this},parse:function(t){var o=new h;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));for(var s=t.split("\n"),l="",c="",u=[],d="function"==typeof"".trimLeft,p=0,f=s.length;p<f;p++)if(l=s[p],0!==(l=d?l.trimLeft():l.trim()).length&&"#"!==(c=l.charAt(0)))if("v"===c){var m=l.split(/\s+/);switch(m[0]){case"v":o.vertices.push(parseFloat(m[1]),parseFloat(m[2]),parseFloat(m[3])),m.length>=7?o.colors.push(parseFloat(m[4]),parseFloat(m[5]),parseFloat(m[6])):o.colors.push(void 0,void 0,void 0);break;case"vn":o.normals.push(parseFloat(m[1]),parseFloat(m[2]),parseFloat(m[3]));break;case"vt":o.uvs.push(parseFloat(m[1]),parseFloat(m[2]))}}else if("f"===c){for(var g=l.substr(1).trim().split(/\s+/),v=[],y=0,x=g.length;y<x;y++){var b=g[y];if(b.length>0){var w=b.split("/");v.push(w)}}var _=v[0];for(y=1,x=v.length-1;y<x;y++){var M=v[y],S=v[y+1];o.addFace(_[0],M[0],S[0],_[1],M[1],S[1],_[2],M[2],S[2])}}else if("l"===c){var T=l.substring(1).trim().split(" "),E=[],A=[];if(-1===l.indexOf("/"))E=T;else for(var L=0,R=T.length;L<R;L++){var C=T[L].split("/");""!==C[0]&&E.push(C[0]),""!==C[1]&&A.push(C[1])}o.addLineGeometry(E,A)}else if("p"===c){var P=l.substr(1).trim().split(" ");o.addPointGeometry(P)}else if(null!==(u=e.exec(l))){var I=(" "+u[0].substr(1).trim()).substr(1);o.startObject(I)}else if(r.test(l))o.object.startMaterial(l.substring(7).trim(),o.materialLibraries);else if(n.test(l))o.materialLibraries.push(l.substring(7).trim());else if(a.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===c){if((u=l.split(" ")).length>1){var D=u[1].trim().toLowerCase();o.object.smooth="0"!==D&&"off"!==D}else o.object.smooth=!0;(q=o.object.currentMaterial())&&(q.smooth=o.object.smooth)}else{if("\0"===l)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}o.finalize();var O=new i.Group;if(O.materialLibraries=[].concat(o.materialLibraries),!0==!(1===o.objects.length&&0===o.objects[0].geometry.vertices.length))for(p=0,f=o.objects.length;p<f;p++){var N=o.objects[p],F=N.geometry,B=N.materials,z="Line"===F.type,k="Points"===F.type,H=!1;if(0!==F.vertices.length){(J=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute(F.vertices,3)),F.normals.length>0&&J.setAttribute("normal",new i.Float32BufferAttribute(F.normals,3)),F.colors.length>0&&(H=!0,J.setAttribute("color",new i.Float32BufferAttribute(F.colors,3))),!0===F.hasUVIndices&&J.setAttribute("uv",new i.Float32BufferAttribute(F.uvs,2));for(var U,G=[],j=0,V=B.length;j<V;j++){var W=(Y=B[j]).name+"_"+Y.smooth+"_"+H,q=o.materials[W];if(null!==this.materials)if(q=this.materials.create(Y.name),!z||!q||q instanceof i.LineBasicMaterial){if(k&&q&&!(q instanceof i.PointsMaterial)){var X=new i.PointsMaterial({size:10,sizeAttenuation:!1});i.Material.prototype.copy.call(X,q),X.color.copy(q.color),X.map=q.map,q=X}}else{var Z=new i.LineBasicMaterial;i.Material.prototype.copy.call(Z,q),Z.color.copy(q.color),q=Z}void 0===q&&((q=z?new i.LineBasicMaterial:k?new i.PointsMaterial({size:1,sizeAttenuation:!1}):new i.MeshPhongMaterial).name=Y.name,q.flatShading=!Y.smooth,q.vertexColors=H,o.materials[W]=q),G.push(q)}if(G.length>1){for(j=0,V=B.length;j<V;j++){var Y=B[j];J.addGroup(Y.groupStart,Y.groupCount,j)}U=z?new i.LineSegments(J,G):k?new i.Points(J,G):new i.Mesh(J,G)}else U=z?new i.LineSegments(J,G[0]):k?new i.Points(J,G[0]):new i.Mesh(J,G[0]);U.name=N.name,O.add(U)}}else if(o.vertices.length>0){var J;q=new i.PointsMaterial({size:1,sizeAttenuation:!1}),(J=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute(o.vertices,3)),o.colors.length>0&&void 0!==o.colors[0]&&(J.setAttribute("color",new i.Float32BufferAttribute(o.colors,3)),q.vertexColors=!0);var K=new i.Points(J,q);O.add(K)}return O}}),d}(),P=P=i.OBJLoader;var I={};i.MTLLoader=function(e){i.Loader.call(this,e)},i.MTLLoader.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:i.MTLLoader,load:function(e,n,r,a){var o=this,s=""===this.path?i.LoaderUtils.extractUrlBase(e||""):this.path,l=new i.FileLoader(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(i){try{n(o.parse(i,s))}catch(t){a?a(t):console.error(t),o.manager.itemError(e)}}),r,a)},setMaterialOptions:function(e){return this.materialOptions=e,this},parse:function(e,t){for(var n=e.split("\n"),r={},a=/\s+/,o={},s=0;s<n.length;s++){var l=n[s];if(0!==(l=l.trim()).length&&"#"!==l.charAt(0)){var c=l.indexOf(" "),u=c>=0?l.substring(0,c):l;u=u.toLowerCase();var h=c>=0?l.substring(c+1):"";if(h=h.trim(),"newmtl"===u)r={name:h},o[h]=r;else if("ka"===u||"kd"===u||"ks"===u||"ke"===u){var d=h.split(a,3);r[u]=[parseFloat(d[0]),parseFloat(d[1]),parseFloat(d[2])]}else r[u]=h}}var p=new i.MTLLoader.MaterialCreator(this.resourcePath||t,this.materialOptions);return p.setCrossOrigin(this.crossOrigin),p.setManager(this.manager),p.setMaterials(o),p}}),i.MTLLoader.MaterialCreator=function(e,t){this.baseUrl=e||"",this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:i.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:i.RepeatWrapping},i.MTLLoader.MaterialCreator.prototype={constructor:i.MTLLoader.MaterialCreator,crossOrigin:"anonymous",setCrossOrigin:function(e){return this.crossOrigin=e,this},setManager:function(e){this.manager=e},setMaterials:function(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(e){if(!this.options)return e;var t={};for(var n in e){var i=e[n],r={};for(var a in t[n]=r,i){var o=!0,s=i[a],l=a.toLowerCase();switch(l){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(s=[s[0]/255,s[1]/255,s[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===s[0]&&0===s[1]&&0===s[2]&&(o=!1)}o&&(r[l]=s)}}return t},preload:function(){for(var e in this.materialsInfo)this.create(e)},getIndex:function(e){return this.nameLookup[e]},getAsArray:function(){var e=0;for(var t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray},create:function(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]},createMaterial_:function(e){var t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function a(e,n){if(!r[e]){var i,a,o=t.getTextureParams(n,r),s=t.loadTexture((i=t.baseUrl,"string"!=typeof(a=o.url)||""===a?"":/^https?:\/\//i.test(a)?a:i+a));s.repeat.copy(o.scale),s.offset.copy(o.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,r[e]=s}}for(var o in n){var s,l=n[o];if(""!==l)switch(o.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(l);break;case"ks":r.specular=(new i.Color).fromArray(l);break;case"ke":r.emissive=(new i.Color).fromArray(l);break;case"map_kd":a("map",l);break;case"map_ks":a("specularMap",l);break;case"map_ke":a("emissiveMap",l);break;case"norm":a("normalMap",l);break;case"map_bump":case"bump":a("bumpMap",l);break;case"map_d":a("alphaMap",l),r.transparent=!0;break;case"ns":r.shininess=parseFloat(l);break;case"d":(s=parseFloat(l))<1&&(r.opacity=s,r.transparent=!0);break;case"tr":s=parseFloat(l),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(r.opacity=1-s,r.transparent=!0)}}return this.materials[e]=new i.MeshPhongMaterial(r),this.materials[e]},getTextureParams:function(e,t){var n,r={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},a=e.split(/\s+/);return(n=a.indexOf("-bm"))>=0&&(t.bumpScale=parseFloat(a[n+1]),a.splice(n,2)),(n=a.indexOf("-s"))>=0&&(r.scale.set(parseFloat(a[n+1]),parseFloat(a[n+2])),a.splice(n,4)),(n=a.indexOf("-o"))>=0&&(r.offset.set(parseFloat(a[n+1]),parseFloat(a[n+2])),a.splice(n,4)),r.url=a.join(" ").trim(),r},loadTexture:function(e,t,n,r,a){var o,s=void 0!==this.manager?this.manager:i.DefaultLoadingManager,l=s.getHandler(e);return null===l&&(l=new i.TextureLoader(s)),l.setCrossOrigin&&l.setCrossOrigin(this.crossOrigin),o=l.load(e,n,r,a),void 0!==t&&(o.mapping=t),o}},I=I=i.MTLLoader;var D,O,N={},F=N={};function B(){throw new Error("setTimeout has not been defined")}function z(){throw new Error("clearTimeout has not been defined")}function k(e){if(D===setTimeout)return setTimeout(e,0);if((D===B||!D)&&setTimeout)return D=setTimeout,setTimeout(e,0);try{return D(e,0)}catch(t){try{return D.call(null,e,0)}catch(t){return D.call(this,e,0)}}}!function(){try{D="function"==typeof setTimeout?setTimeout:B}catch(t){D=B}try{O="function"==typeof clearTimeout?clearTimeout:z}catch(t){O=z}}();var H,U=[],G=!1,j=-1;function V(){G&&H&&(G=!1,H.length?U=H.concat(U):j=-1,U.length&&W())}function W(){if(!G){var e=k(V);G=!0;for(var n=U.length;n;){for(H=U,U=[];++j<n;)H&&H[j].run();j=-1,n=U.length}H=null,G=!1,function(e){if(O===clearTimeout)return clearTimeout(e);if((O===z||!O)&&clearTimeout)return O=clearTimeout,clearTimeout(e);try{O(e)}catch(t){try{return O.call(null,e)}catch(t){return O.call(this,e)}}}(e)}}function q(e,t){this.fun=e,this.array=t}function X(){}F.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];U.push(new q(e,t)),1!==U.length||G||k(W)},q.prototype.run=function(){this.fun.apply(null,this.array)},F.title="browser",F.browser=!0,F.env={},F.argv=[],F.version="",F.versions={},F.on=X,F.addListener=X,F.once=X,F.off=X,F.removeListener=X,F.removeAllListeners=X,F.emit=X,F.prependListener=X,F.prependOnceListener=X,F.listeners=function(e){return[]},F.binding=function(e){throw new Error("process.binding is not supported")},F.cwd=function(){return"/"},F.chdir=function(e){throw new Error("process.chdir is not supported")},F.umask=function(){return 0};var Z={exports:{}};(function(e){(function(){!function(e){"object"==typeof Z.exports?Z.exports=e():"undefined"!=typeof define&&define.amd?define(["fflate",e]):("undefined"!=typeof self?self:this).fflate=e()}((function(){var t={__esModule:!0},n=("object"==typeof Z.exports?function(t){"use strict";try{(void 0)("require('worker_threads')").Worker}catch(a){}return Z.exports.default=function(t,n,i,r,a){e((function(){return a(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var o=function(){};return{terminate:o,postMessage:o}},t}:function(e){"use strict";var t=eval;return e.default=function(e,n,i,r,a){var o=t[n]||(t[n]=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))),s=new Worker(o);return s.onerror=function(e){return a(e.error,null)},s.onmessage=function(e){return a(null,e.data)},s.postMessage(i,r),s},e})({}),i=Uint8Array,r=Uint16Array,a=Uint32Array,o=new i([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new i([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new i([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=function(e,t){for(var n=new r(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new a(n[30]);for(i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)o[s]=s-n[i]<<5|i;return[n,o]},u=c(o,2),h=u[0],d=u[1];h[28]=258,d[258]=28;for(var p=c(s,0),f=p[0],m=p[1],g=new r(32768),v=0;v<32768;++v){var y=(43690&v)>>>1|(21845&v)<<1;g[v]=((65280&(y=(61680&(y=(52428&y)>>>2|(13107&y)<<2))>>>4|(3855&y)<<4))>>>8|(255&y)<<8)>>>1}var x=function(e,t,n){for(var i=e.length,a=0,o=new r(t);a<i;++a)++o[e[a]-1];var s,l=new r(t);for(a=0;a<t;++a)l[a]=l[a-1]+o[a-1]<<1;if(n){s=new r(1<<t);var c=15-t;for(a=0;a<i;++a)if(e[a])for(var u=a<<4|e[a],h=t-e[a],d=l[e[a]-1]++<<h,p=d|(1<<h)-1;d<=p;++d)s[g[d]>>>c]=u}else for(s=new r(i),a=0;a<i;++a)e[a]&&(s[a]=g[l[e[a]-1]++]>>>15-e[a]);return s},b=new i(288);for(v=0;v<144;++v)b[v]=8;for(v=144;v<256;++v)b[v]=9;for(v=256;v<280;++v)b[v]=7;for(v=280;v<288;++v)b[v]=8;var w=new i(32);for(v=0;v<32;++v)w[v]=5;var _=x(b,9,0),M=x(b,9,1),S=x(w,5,0),T=x(w,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},A=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},L=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},R=function(e){return(e/8|0)+(7&e&&1)},C=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var o=new(e instanceof r?r:e instanceof a?a:i)(n-t);return o.set(e.subarray(t,n)),o},P=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new i(0);var a=!t||n,c=!n||n.i;n||(n={}),t||(t=new i(3*r));var u=function(e){var n=t.length;if(e>n){var r=new i(Math.max(2*n,e));r.set(t),t=r}},d=n.f||0,p=n.p||0,m=n.b||0,g=n.l,v=n.d,y=n.m,b=n.n,w=8*r;do{if(!g){n.f=d=A(e,p,1);var _=A(e,p+1,3);if(p+=3,!_){var S=e[(U=R(p)+4)-4]|e[U-3]<<8,P=U+S;if(P>r){if(c)throw"unexpected EOF";break}a&&u(m+S),t.set(e.subarray(U,P),m),n.b=m+=S,n.p=p=8*P;continue}if(1==_)g=M,v=T,y=9,b=5;else{if(2!=_)throw"invalid block type";var I=A(e,p,31)+257,D=A(e,p+10,15)+4,O=I+A(e,p+5,31)+1;p+=14;for(var N=new i(O),F=new i(19),B=0;B<D;++B)F[l[B]]=A(e,p+3*B,7);p+=3*D;var z=E(F),k=(1<<z)-1;if(!c&&p+O*(z+7)>w)break;var H=x(F,z,1);for(B=0;B<O;){var U,G=H[A(e,p,k)];if(p+=15&G,(U=G>>>4)<16)N[B++]=U;else{var j=0,V=0;for(16==U?(V=3+A(e,p,3),p+=2,j=N[B-1]):17==U?(V=3+A(e,p,7),p+=3):18==U&&(V=11+A(e,p,127),p+=7);V--;)N[B++]=j}}var W=N.subarray(0,I),q=N.subarray(I);y=E(W),b=E(q),g=x(W,y,1),v=x(q,b,1)}if(p>w)throw"unexpected EOF"}a&&u(m+131072);for(var X=(1<<y)-1,Z=(1<<b)-1,Y=y+b+18;c||p+Y<w;){var J=(j=g[L(e,p)&X])>>>4;if((p+=15&j)>w)throw"unexpected EOF";if(!j)throw"invalid length/literal";if(J<256)t[m++]=J;else{if(256==J){g=null;break}var K=J-254;J>264&&(K=A(e,p,(1<<(ee=o[B=J-257]))-1)+h[B],p+=ee);var Q=v[L(e,p)&Z],$=Q>>>4;if(!Q)throw"invalid distance";if(p+=15&Q,q=f[$],$>3){var ee=s[$];q+=L(e,p)&(1<<ee)-1,p+=ee}if(p>w)throw"unexpected EOF";a&&u(m+131072);for(var te=m+K;m<te;m+=4)t[m]=t[m-q],t[m+1]=t[m+1-q],t[m+2]=t[m+2-q],t[m+3]=t[m+3-q];m=te}}n.l=g,n.p=p,n.b=m,g&&(d=1,n.m=y,n.d=v,n.n=b)}while(!d);return m==t.length?t:C(t,0,m)},I=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},D=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},O=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return[U,0];if(1==o){var l=new i(n[0].s+1);return l[n[0].s]=1,[l,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var c=n[0],u=n[1],h=0,d=1,p=2;for(n[0]={s:-1,f:c.f+u.f,l:c,r:u};d!=o-1;)c=n[n[h].f<n[p].f?h++:p++],u=n[h!=d&&n[h].f<n[p].f?h++:p++],n[d++]={s:-1,f:c.f+u.f,l:c,r:u};var f=s[0].s;for(a=1;a<o;++a)s[a].s>f&&(f=s[a].s);var m=new r(f+1),g=N(n[d-1],m,0);if(g>t){a=0;var v=0,y=g-t,x=1<<y;for(s.sort((function(e,t){return m[t.s]-m[e.s]||e.f-t.f}));a<o;++a){var b=s[a].s;if(!(m[b]>t))break;v+=x-(1<<g-m[b]),m[b]=t}for(v>>>=y;v>0;){var w=s[a].s;m[w]<t?v-=1<<t-m[w]++-1:++a}for(;a>=0&&v;--a){var _=s[a].s;m[_]==t&&(--m[_],++v)}g=t}return[new i(m),g]},N=function(e,t,n){return-1==e.s?Math.max(N(e.l,t,n+1),N(e.r,t,n+1)):t[e.s]=n},F=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new r(++t),i=0,a=e[0],o=1,s=function(e){n[i++]=e},l=1;l<=t;++l)if(e[l]==a&&l!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[l]}return[n.subarray(0,i),t]},B=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},z=function(e,t,n){var i=n.length,r=R(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var a=0;a<i;++a)e[r+a+4]=n[a];return 8*(r+4+i)},k=function(e,t,n,i,a,c,u,h,d,p,f){I(t,f++,n),++a[256];for(var m=O(a,15),g=m[0],v=m[1],y=O(c,15),M=y[0],T=y[1],E=F(g),A=E[0],L=E[1],R=F(M),C=R[0],P=R[1],N=new r(19),k=0;k<A.length;++k)N[31&A[k]]++;for(k=0;k<C.length;++k)N[31&C[k]]++;for(var H=O(N,7),U=H[0],G=H[1],j=19;j>4&&!U[l[j-1]];--j);var V,W,q,X,Z=p+5<<3,Y=B(a,b)+B(c,w)+u,J=B(a,g)+B(c,M)+u+14+3*j+B(N,U)+(2*N[16]+3*N[17]+7*N[18]);if(Z<=Y&&Z<=J)return z(t,f,e.subarray(d,d+p));if(I(t,f,1+(J<Y)),f+=2,J<Y){V=x(g,v,0),W=g,q=x(M,T,0),X=M;var K=x(U,G,0);for(I(t,f,L-257),I(t,f+5,P-1),I(t,f+10,j-4),f+=14,k=0;k<j;++k)I(t,f+3*k,U[l[k]]);f+=3*j;for(var Q=[A,C],$=0;$<2;++$){var ee=Q[$];for(k=0;k<ee.length;++k)I(t,f,K[te=31&ee[k]]),f+=U[te],te>15&&(I(t,f,ee[k]>>>5&127),f+=ee[k]>>>12)}}else V=_,W=b,q=S,X=w;for(k=0;k<h;++k)if(i[k]>255){var te;D(t,f,V[257+(te=i[k]>>>18&31)]),f+=W[te+257],te>7&&(I(t,f,i[k]>>>23&31),f+=o[te]);var ne=31&i[k];D(t,f,q[ne]),f+=X[ne],ne>3&&(D(t,f,i[k]>>>5&8191),f+=s[ne])}else D(t,f,V[i[k]]),f+=W[i[k]];return D(t,f,V[256]),f+W[256]},H=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),U=new i(0),G=function(e,t,n,l,c,u){var h=e.length,p=new i(l+h+5*(1+Math.ceil(h/7e3))+c),f=p.subarray(l,p.length-c),g=0;if(!t||h<8)for(var v=0;v<=h;v+=65535){var y=v+65535;y<h?g=z(f,g,e.subarray(v,y)):(f[v]=u,g=z(f,g,e.subarray(v,h)))}else{for(var x=H[t-1],b=x>>>13,w=8191&x,_=(1<<n)-1,M=new r(32768),S=new r(_+1),T=Math.ceil(n/3),E=2*T,A=function(t){return(e[t]^e[t+1]<<T^e[t+2]<<E)&_},L=new a(25e3),P=new r(288),I=new r(32),D=0,O=0,N=(v=0,0),F=0,B=0;v<h;++v){var G=A(v),j=32767&v,V=S[G];if(M[j]=V,S[G]=j,F<=v){var W=h-v;if((D>7e3||N>24576)&&W>423){g=k(e,f,0,L,P,I,O,N,B,v-B,g),N=D=O=0,B=v;for(var q=0;q<286;++q)P[q]=0;for(q=0;q<30;++q)I[q]=0}var X=2,Z=0,Y=w,J=j-V&32767;if(W>2&&G==A(v-J))for(var K=Math.min(b,W)-1,Q=Math.min(32767,v),$=Math.min(258,W);J<=Q&&--Y&&j!=V;){if(e[v+X]==e[v+X-J]){for(var ee=0;ee<$&&e[v+ee]==e[v+ee-J];++ee);if(ee>X){if(X=ee,Z=J,ee>K)break;var te=Math.min(J,ee-2),ne=0;for(q=0;q<te;++q){var ie=v-J+q+32768&32767,re=ie-M[ie]+32768&32767;re>ne&&(ne=re,V=ie)}}}J+=(j=V)-(V=M[j])+32768&32767}if(Z){L[N++]=268435456|d[X]<<18|m[Z];var ae=31&d[X],oe=31&m[Z];O+=o[ae]+s[oe],++P[257+ae],++I[oe],F=v+X,++D}else L[N++]=e[v],++P[e[v]]}}g=k(e,f,u,L,P,I,O,N,B,v-B,g),!u&&7&g&&(g=z(f,g+1,U))}return C(p,0,l+R(g)+c)},j=function(){for(var e=new a(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),V=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=j[255&n^t[i]]^n>>>8;e=n},d:function(){return~e}}},W=function(){var e=1,t=0;return{p:function(n){for(var i=e,r=t,a=n.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)r+=i+=n[o];i=(65535&i)+15*(i>>16),r=(65535&r)+15*(r>>16)}e=i,t=r},d:function(){return((e%=65521)>>>8<<16|(255&(t%=65521))<<8|t>>>8)+2*((255&e)<<23)}}},q=function(e,t,n,i,r){return G(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)},X=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n},Y=function(e,t,n){for(var i=e(),r=""+e,a=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<i.length;++o){var s=i[o],l=a[o];if("function"==typeof s){t+=";"+l+"=";var c=""+s;if(s.prototype)if(-1!=c.indexOf("[native code]")){var u=c.indexOf(" ",8)+1;t+=c.slice(u,c.indexOf("(",u))}else for(var h in t+=c,s.prototype)t+=";"+l+".prototype."+h+"="+s.prototype[h];else t+=c}else n[l]=s}return[t,n]},J=[],K=function(e){var t=[];for(var n in e)(e[n]instanceof i||e[n]instanceof r||e[n]instanceof a)&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},Q=function(e,t,i,r){var a;if(!J[i]){for(var o="",s={},l=e.length-1,c=0;c<l;++c)o=(a=Y(e[c],o,s))[0],s=a[1];J[i]=Y(e[l],o,s)}var u=X({},J[i][1]);return n.default(J[i][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t+"}",i,u,K(u),r)},$=function(){return[i,r,a,o,s,l,h,f,M,T,g,x,E,A,L,R,C,P,Le,ae,oe]},ee=function(){return[i,r,a,o,s,l,d,m,_,b,S,w,g,H,U,x,I,D,O,N,F,B,z,k,R,C,G,q,Se,ae]},te=function(){return[fe,ve,pe,V,j]},ne=function(){return[me,ge]},ie=function(){return[ye,pe,W]},re=function(){return[xe]},ae=function(e){return postMessage(e,[e.buffer])},oe=function(e){return e&&e.size&&new i(e.size)},se=function(e,t,n,i,r,a){var o=Q(n,i,r,(function(e,t){o.terminate(),a(e,t)}));return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},le=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}},ce=function(e,t,n,i,r){var a,o=Q(e,i,r,(function(e,n){e?(o.terminate(),t.ondata.call(t,e)):(n[1]&&o.terminate(),t.ondata.call(t,e,n[0],n[1]))}));o.postMessage(n),t.push=function(e,n){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";o.postMessage([e,a=n],[e.buffer])},t.terminate=function(){o.terminate()}},ue=function(e,t){return e[t]|e[t+1]<<8},he=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+2*(e[t+3]<<23)},de=function(e,t){return he(e,t)|4294967296*he(e,t)},pe=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},fe=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&pe(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}},me=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var i=(t>>3&1)+(t>>4&1);i>0;i-=!e[n++]);return n+(2&t)},ge=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16)+2*(e[t-1]<<23)},ve=function(e){return 10+(e.filename&&e.filename.length+1||0)},ye=function(e,t){var n=t.level,i=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=i<<6|(i?32-2*i:1)},xe=function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function be(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var we=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(q(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}();t.Deflate=we;var _e=function(e,t){ce([ee,function(){return[le,we]}],this,be.call(this,e,t),(function(e){var t=new we(e.data);onmessage=le(t)}),6)};function Me(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return se(e,t,[ee],(function(e){return ae(Se(e.data[0],e.data[1]))}),0,n)}function Se(e,t){return q(e,t||{},0,0)}t.AsyncDeflate=_e,t.deflate=Me,t.deflateSync=Se;var Te=function(){function e(e){this.s={},this.p=new i(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,n=new i(t+e.length);n.set(this.p),n.set(e,t),this.p=n},e.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,n=P(this.p,this.o,this.s);this.ondata(C(n,t,this.s.b),this.d),this.o=C(n,this.s.b-32768),this.s.b=this.o.length,this.p=C(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();t.Inflate=Te;var Ee=function(e){this.ondata=e,ce([$,function(){return[le,Te]}],this,0,(function(){var e=new Te;onmessage=le(e)}),7)};function Ae(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return se(e,t,[$],(function(e){return ae(Le(e.data[0],oe(e.data[1])))}),1,n)}function Le(e,t){return P(e,t)}t.AsyncInflate=Ee,t.inflate=Ae,t.inflateSync=Le;var Re=function(){function e(e,t){this.c=V(),this.l=0,this.v=1,we.call(this,e,t)}return e.prototype.push=function(e,t){we.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var n=q(e,this.o,this.v&&ve(this.o),t&&8,!t);this.v&&(fe(n,this.o),this.v=0),t&&(pe(n,n.length-8,this.c.d()),pe(n,n.length-4,this.l)),this.ondata(n,t)},e}();t.Gzip=Re,t.Compress=Re;var Ce=function(e,t){ce([ee,te,function(){return[le,we,Re]}],this,be.call(this,e,t),(function(e){var t=new Re(e.data);onmessage=le(t)}),8)};function Pe(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return se(e,t,[ee,te,function(){return[Ie]}],(function(e){return ae(Ie(e.data[0],e.data[1]))}),2,n)}function Ie(e,t){t||(t={});var n=V(),i=e.length;n.p(e);var r=q(e,t,ve(t),8),a=r.length;return fe(r,t),pe(r,a-8,n.d()),pe(r,a-4,i),r}t.AsyncGzip=Ce,t.AsyncCompress=Ce,t.gzip=Pe,t.compress=Pe,t.gzipSync=Ie,t.compressSync=Ie;var De=function(){function e(e){this.v=1,Te.call(this,e)}return e.prototype.push=function(e,t){if(Te.prototype.e.call(this,e),this.v){var n=this.p.length>3?me(this.p):4;if(n>=this.p.length&&!t)return;this.p=this.p.subarray(n),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Te.prototype.c.call(this,t)},e}();t.Gunzip=De;var Oe=function(e){this.ondata=e,ce([$,ne,function(){return[le,Te,De]}],this,0,(function(){var e=new De;onmessage=le(e)}),9)};function Ne(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return se(e,t,[$,ne,function(){return[Fe]}],(function(e){return ae(Fe(e.data[0]))}),3,n)}function Fe(e,t){return P(e.subarray(me(e),-8),t||new i(ge(e)))}t.AsyncGunzip=Oe,t.gunzip=Ne,t.gunzipSync=Fe;var Be=function(){function e(e,t){this.c=W(),this.v=1,we.call(this,e,t)}return e.prototype.push=function(e,t){we.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e);var n=q(e,this.o,this.v&&2,t&&4,!t);this.v&&(ye(n,this.o),this.v=0),t&&pe(n,n.length-4,this.c.d()),this.ondata(n,t)},e}();t.Zlib=Be;function ze(e,t){t||(t={});var n=W();n.p(e);var i=q(e,t,2,4);return ye(i,t),pe(i,i.length-4,n.d()),i}t.AsyncZlib=function(e,t){ce([ee,ie,function(){return[le,we,Be]}],this,be.call(this,e,t),(function(e){var t=new Be(e.data);onmessage=le(t)}),10)},t.zlib=function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return se(e,t,[ee,ie,function(){return[ze]}],(function(e){return ae(ze(e.data[0],e.data[1]))}),4,n)},t.zlibSync=ze;var ke=function(){function e(e){this.v=1,Te.call(this,e)}return e.prototype.push=function(e,t){if(Te.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Te.prototype.c.call(this,t)},e}();t.Unzlib=ke;var He=function(e){this.ondata=e,ce([$,re,function(){return[le,Te,ke]}],this,0,(function(){var e=new ke;onmessage=le(e)}),11)};function Ue(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return se(e,t,[$,re,function(){return[Ge]}],(function(e){return ae(Ge(e.data[0],oe(e.data[1])))}),5,n)}function Ge(e,t){return P((xe(e),e.subarray(2,-4)),t)}t.AsyncUnzlib=He,t.unzlib=Ue,t.unzlibSync=Ge;var je=function(){function e(e){this.G=De,this.I=Te,this.Z=ke,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new i(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var r=this,a=function(){r.ondata.apply(r,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(a):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(a):new this.Z(a),this.s.push(this.p,t),this.p=null}}},e}();t.Decompress=je;var Ve=function(){function e(e){this.G=Oe,this.I=Ee,this.Z=He,this.ondata=e}return e.prototype.push=function(e,t){je.prototype.push.call(this,e,t)},e}();t.AsyncDecompress=Ve,t.decompress=function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return 31==e[0]&&139==e[1]&&8==e[2]?Ne(e,t,n):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?Ae(e,t,n):Ue(e,t,n)},t.decompressSync=function(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?Fe(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?Le(e,t):Ge(e,t)};var We=function(e,t,n,r){for(var a in e){var o=e[a],s=t+a;o instanceof i?n[s]=[o,r]:Array.isArray(o)?n[s]=[o[0],X(r,o[1])]:We(o,s+"/",n,r)}},qe="undefined"!=typeof TextEncoder&&new TextEncoder,Xe="undefined"!=typeof TextDecoder&&new TextDecoder,Ze=0;try{Xe.decode(U,{stream:!0}),Ze=1}catch(n){}var Ye=function(e){for(var t="",n=0;;){var i=e[n++],r=(i>127)+(i>223)+(i>239);if(n+r>e.length)return[t,C(e,n-1)];r?3==r?(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|i>>10,56320|1023&i)):t+=String.fromCharCode(1&r?(31&i)<<6|63&e[n++]:(15&i)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(i)}},Je=function(){function e(e){this.ondata=e,Ze?this.t=new TextDecoder:this.p=U}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t||(t=!1),this.t)return this.ondata(this.t.decode(e,{stream:!t}),t);var n=new i(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var r=Ye(n),a=r[0],o=r[1];if(t&&o.length)throw"invalid utf-8 data";this.p=o,this.ondata(a,t)},e}();t.DecodeUTF8=Je;var Ke=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";this.ondata(Qe(e),t||!1)},e}();function Qe(e,t){if(t){for(var n=new i(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(qe)return qe.encode(e);var a=e.length,o=new i(e.length+(e.length>>1)),s=0,l=function(e){o[s++]=e};for(r=0;r<a;++r){if(s+5>o.length){var c=new i(s+8+(a-r<<1));c.set(o),o=c}var u=e.charCodeAt(r);u<128||t?l(u):u<2048?(l(192|u>>>6),l(128|63&u)):u>55295&&u<57344?(l(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>>18),l(128|u>>>12&63),l(128|u>>>6&63),l(128|63&u)):(l(224|u>>>12),l(128|u>>>6&63),l(128|63&u))}return C(o,0,s)}function $e(e,t){if(t){for(var n="",i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}if(Xe)return Xe.decode(e);var r=Ye(e);if(r[1].length)throw"invalid utf-8 data";return r[0]}t.EncodeUTF8=Ke,t.strToU8=Qe,t.strFromU8=$e;var et=function(e){return 1==e?3:e<6?2:9==e?1:0},tt=function(e,t){return t+30+ue(e,t+26)+ue(e,t+28)},nt=function(e,t,n){var i=ue(e,t+28),r=$e(e.subarray(t+46,t+46+i),!(2048&ue(e,t+8))),a=t+46+i,o=he(e,t+20),s=n&&4294967295==o?it(e,a):[o,he(e,t+24),he(e,t+42)],l=s[0],c=s[1],u=s[2];return[ue(e,t+10),l,c,r,a+ue(e,t+30)+ue(e,t+32),u]},it=function(e,t){for(;1!=ue(e,t);t+=4+ue(e,t+2));return[de(e,t+12),de(e,t+4),de(e,t+20)]},rt=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;if(i>65535)throw"extra field too long";t+=i+4}return t},at=function(e,t,n,i,r,a,o,s){var l=i.length,c=n.extra,u=s&&s.length,h=rt(c);pe(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(null==a&&8),e[t++]=r&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),p=d.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(pe(e,t,2*(p<<24)|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),t+=4,null!=a&&(pe(e,t,n.crc),pe(e,t+4,a),pe(e,t+8,n.size)),pe(e,t+12,l),pe(e,t+14,h),t+=16,null!=o&&(pe(e,t,u),pe(e,t+6,n.attrs),pe(e,t+10,o),t+=14),e.set(i,t),t+=l,h)for(var f in c){var m=c[f],g=m.length;pe(e,t,+f),pe(e,t+2,g),e.set(m,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},ot=function(e,t,n,i,r){pe(e,t,101010256),pe(e,t+8,n),pe(e,t+10,n),pe(e,t+12,i),pe(e,t+16,r)},st=function(){function e(e){this.filename=e,this.c=V(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();t.ZipPassThrough=st;var lt=function(){function e(e,t){var n=this;t||(t={}),st.call(this,e),this.d=new we(t,(function(e,t){n.ondata(null,e,t)})),this.compression=8,this.flag=et(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){st.prototype.push.call(this,e,t)},e}();t.ZipDeflate=lt;var ct=function(){function e(e,t){var n=this;t||(t={}),st.call(this,e),this.d=new _e(t,(function(e,t,i){n.ondata(e,t,i)})),this.compression=8,this.flag=et(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){st.prototype.push.call(this,e,t)},e}();t.AsyncZipDeflate=ct;var ut=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var n=Qe(e.filename),r=n.length,a=e.comment,o=a&&Qe(a),s=r!=e.filename.length||o&&a.length!=o.length,l=r+rt(e.extra)+30;if(r>65535)throw"filename too long";var c=new i(l);at(c,0,e,n,s);var u=[c],h=function(){for(var e=0,n=u;e<n.length;e++)t.ondata(null,n[e],!1);u=[]},d=this.d;this.d=0;var p=this.u.length,f=X(e,{f:n,u:s,o:o,t:function(){e.terminate&&e.terminate()},r:function(){if(h(),d){var e=t.u[p+1];e?e.r():t.d=1}d=1}}),m=0;e.ondata=function(n,r,a){if(n)t.ondata(n,r,a),t.terminate();else if(m+=r.length,u.push(r),a){var o=new i(16);pe(o,0,134695760),pe(o,4,e.crc),pe(o,8,m),pe(o,12,e.size),u.push(o),f.c=m,f.b=l+m+16,f.crc=e.crc,f.size=e.size,d&&f.r(),d=1}else d&&h()},this.u.push(f)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,r=0,a=this.u;r<a.length;r++)n+=46+(c=a[r]).f.length+rt(c.extra)+(c.o?c.o.length:0);for(var o=new i(n+22),s=0,l=this.u;s<l.length;s++){var c;at(o,e,c=l[s],c.f,c.u,c.c,t,c.o),e+=46+c.f.length+rt(c.extra)+(c.o?c.o.length:0),t+=c.b}ot(o,e,this.u.length,n,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();t.Zip=ut,t.zip=function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";var r={};We(e,"",r,t);var a=Object.keys(r),o=a.length,s=0,l=0,c=o,u=Array(o),h=[],d=function(){for(var e=0;e<h.length;++e)h[e]()},p=function(){var e=new i(l+22),t=s,r=l-s;l=0;for(var a=0;a<c;++a){var o=u[a];try{var h=o.c.length;at(e,l,o,o.f,o.u,h);var d=30+o.f.length+rt(o.extra),p=l+d;e.set(o.c,p),at(e,s,o,o.f,o.u,h,l,o.m),s+=16+d+(o.m?o.m.length:0),l=p+h}catch(e){return n(e,null)}}ot(e,s,u.length,r,t),n(null,e)};o||p();for(var f=function(e){var t=a[e],i=r[t],c=i[0],f=i[1],m=V(),g=c.length;m.p(c);var v=Qe(t),y=v.length,x=f.comment,b=x&&Qe(x),w=b&&b.length,_=rt(f.extra),M=0==f.level?0:8,S=function(i,r){if(i)d(),n(i,null);else{var a=r.length;u[e]=X(f,{size:g,crc:m.d(),c:r,f:v,m:b,u:y!=t.length||b&&x.length!=w,compression:M}),s+=30+y+_+a,l+=76+2*(y+_)+(w||0)+a,--o||p()}};if(y>65535&&S("filename too long",null),M)if(g<16e4)try{S(null,Se(c,f))}catch(e){S(e,null)}else h.push(Me(c,f,S));else S(null,c)},m=0;m<c;++m)f(m);return d},t.zipSync=function(e,t){t||(t={});var n={},r=[];We(e,"",n,t);var a=0,o=0;for(var s in n){var l=n[s],c=l[0],u=l[1],h=0==u.level?0:8,d=(S=Qe(s)).length,p=u.comment,f=p&&Qe(p),m=f&&f.length,g=rt(u.extra);if(d>65535)throw"filename too long";var v=h?Se(c,u):c,y=v.length,x=V();x.p(c),r.push(X(u,{size:c.length,crc:x.d(),c:v,f:S,m:f,u:d!=s.length||f&&p.length!=m,o:a,compression:h})),a+=30+d+g+y,o+=76+2*(d+g)+(m||0)+y}for(var b=new i(o+22),w=a,_=o-a,M=0;M<r.length;++M){var S;at(b,(S=r[M]).o,S,S.f,S.u,S.c.length);var T=30+S.f.length+rt(S.extra);b.set(S.c,S.o+T),at(b,a,S,S.f,S.u,S.c.length,S.o,S.m),a+=16+T+(S.m?S.m.length:0)}return ot(b,a,r.length,_,w),b};var ht=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();t.UnzipPassThrough=ht;var dt=function(){function e(){var e=this;this.i=new Te((function(t,n){e.ondata(null,t,n)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e.compression=8,e}();t.UnzipInflate=dt;var pt=function(){function e(e,t){var n=this;t<32e4?this.i=new Te((function(e,t){n.ondata(null,e,t)})):(this.i=new Ee((function(e,t,i){n.ondata(e,t,i)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=C(e,0)),this.i.push(e,t)},e.compression=8,e}();t.AsyncUnzipInflate=pt;var ft=function(){function e(e){this.onfile=e,this.k=[],this.o={0:ht},this.p=U}return e.prototype.push=function(e,t){var n=this;if(!this.onfile)throw"no callback";if(this.c>0){var r=Math.min(this.c,e.length),a=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(a,!this.c):this.k[0].push(a),(e=e.subarray(r)).length)return this.push(e,t)}else{var o=0,s=0,l=void 0,c=void 0;this.p.length?e.length?((c=new i(this.p.length+e.length)).set(this.p),c.set(e,this.p.length)):c=this.p:c=e;for(var u=c.length,h=this.c,d=h&&this.d,p=function(){var e,t=he(c,s);if(67324752==t){o=1,l=s,f.d=null,f.c=0;var i=ue(c,s+6),r=ue(c,s+8),a=2048&i,d=8&i,p=ue(c,s+26),m=ue(c,s+28);if(u>s+30+p+m){var g=[];f.k.unshift(g),o=2;var v=he(c,s+18),y=he(c,s+22),x=$e(c.subarray(s+30,s+=30+p),!a);4294967295==v?(e=d?[-2]:it(c,s),v=e[0],y=e[1]):d&&(v=-1),s+=m,f.c=v;var b={name:x,compression:r,start:function(){if(!b.ondata)throw"no callback";if(v){var e=n.o[r];if(!e)throw"unknown compression type "+r;var t=v<0?new e(x):new e(x,v,y);t.ondata=function(e,t,n){b.ondata(e,t,n)};for(var i=0,a=g;i<a.length;i++)t.push(a[i],!1);n.k[0]==g?n.d=t:t.push(U,!0)}else b.ondata(null,U,!0)},terminate:function(){n.k[0]==g&&n.d.terminate&&n.d.terminate()}};v>=0&&(b.size=v,b.originalSize=y),f.onfile(b)}return"break"}if(h){if(134695760==t)return l=s+=12+(-2==h&&8),o=2,f.c=0,"break";if(33639248==t)return l=s-=4,o=2,f.c=0,"break"}},f=this;s<u-4&&"break"!==p();++s);if(this.p=U,h<0){var m=c.subarray(0,o?l-12-(-2==h&&8)-(134695760==he(c,l-16)&&4):s);d?d.push(m,!!o):this.k[+(2==o)].push(m)}if(2&o)return this.push(c.subarray(s),t);this.p=c.subarray(s)}if(t&&this.c)throw"invalid zip file"},e.prototype.register=function(e){this.o[e.compression]=e},e}();return t.Unzip=ft,t.unzip=function(e,t){if("function"!=typeof t)throw"no callback";for(var n=[],r=function(){for(var e=0;e<n.length;++e)n[e]()},a={},o=e.length-22;101010256!=he(e,o);--o)if(!o||e.length-o>65558)return void t("invalid zip file",null);var s=ue(e,o+8);s||t(null,{});var l=s,c=he(e,o+16),u=4294967295==c;if(u){if(o=he(e,o-12),101075792!=he(e,o))return void t("invalid zip file",null);l=s=he(e,o+32),c=he(e,o+48)}for(var h=function(o){var l=nt(e,c,u),h=l[0],d=l[1],p=l[2],f=l[3],m=l[4],g=tt(e,l[5]);c=m;var v=function(e,n){e?(r(),t(e,null)):(a[f]=n,--s||t(null,a))};if(h)if(8==h){var y=e.subarray(g,g+d);if(d<32e4)try{v(null,Le(y,new i(p)))}catch(e){v(e,null)}else n.push(Ae(y,{size:p},v))}else v("unknown compression type "+h,null);else v(null,C(e,g,g+d))},d=0;d<l;++d)h();return r},t.unzipSync=function(e){for(var t={},n=e.length-22;101010256!=he(e,n);--n)if(!n||e.length-n>65558)throw"invalid zip file";var r=ue(e,n+8);if(!r)return{};var a=he(e,n+16),o=4294967295==a;if(o){if(n=he(e,n-12),101075792!=he(e,n))throw"invalid zip file";r=he(e,n+32),a=he(e,n+48)}for(var s=0;s<r;++s){var l=nt(e,a,o),c=l[0],u=l[1],h=l[2],d=l[3],p=l[4],f=tt(e,l[5]);if(a=p,c){if(8!=c)throw"unknown compression type "+c;t[d]=Le(e.subarray(f,f+u),new i(h))}else t[d]=C(e,f,f+u)}return t},t}))}).call(this)}).call(this,n({}).setImmediate),Z=Z.exports;var Y={};i.FBXLoader=function(){var e,n,r;function a(e){i.Loader.call(this,e)}function o(e,t){this.textureLoader=e,this.manager=t}function s(){}function l(){}function c(){}function u(){}function h(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function d(){}function p(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 f(e){return e/46186158e3}a.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:a,load:function(e,n,r,a){var o=this,s=""===o.path?i.LoaderUtils.extractUrlBase(e):o.path,l=new i.FileLoader(this.manager);l.setPath(o.path),l.setResponseType("arraybuffer"),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,(function(i){try{n(o.parse(i,s))}catch(t){a?a(t):console.error(t),o.manager.itemError(e)}}),r,a)},parse:function(t,n){if(s="Kaydara FBX Binary  \0",(a=t).byteLength>=s.length&&s===_(a,0,s.length))e=(new u).parse(t);else{var r=_(t);if(!function(e){var t,n,i=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;for(var a=0;a<i.length;++a){if((n=void 0,n=e[(t=1)-1],e=e.slice(r+t),r++,n)===i[a])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(p(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+p(r));e=(new c).parse(r)}var a,s;return new o(new i.TextureLoader(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),this.manager).parse(e)}}),o.prototype={constructor:o,parse:function(){n=this.parseConnections();var e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),a=this.parseDeformers(),o=(new s).parse(a);return this.parseScene(a,o,i),r},parseConnections:function(){var t=new Map;return"Connections"in e&&e.Connections.connections.forEach((function(e){var n=e[0],i=e[1],r=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var a={ID:i,relationship:r};t.get(n).parents.push(a),t.has(i)||t.set(i,{parents:[],children:[]});var o={ID:n,relationship:r};t.get(i).children.push(o)})),t},parseImages:function(){var t={},n={};if("Video"in e.Objects){var i=e.Objects.Video;for(var r in i){var a=i[r];if(t[c=parseInt(r)]=a.RelativeFilename||a.Filename,"Content"in a){var o=a.Content instanceof ArrayBuffer&&a.Content.byteLength>0,s="string"==typeof a.Content&&""!==a.Content;if(o||s){var l=this.parseImage(i[r]);n[a.RelativeFilename||a.Filename]=l}}}}for(var c in t){var u=t[c];void 0!==n[u]?t[c]=n[u]:t[c]=t[c].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,i=e.RelativeFilename||e.Filename,r=i.slice(i.lastIndexOf(".")+1).toLowerCase();switch(r){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 ",i),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+r+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var a=new Uint8Array(n);return window.URL.createObjectURL(new Blob([a],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var i=e.Objects.Texture;for(var r in i){var a=this.parseTexture(i[r],t);n.set(parseInt(r),a)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,a=e.WrapModeV,o=void 0!==r?r.value:0,s=void 0!==a?a.value:0;if(n.wrapS=0===o?i.RepeatWrapping:i.ClampToEdgeWrapping,n.wrapT=0===s?i.RepeatWrapping:i.ClampToEdgeWrapping,"Scaling"in e){var l=e.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}return n},loadTexture:function(e,t){var r,a,o=this.textureLoader.path,s=n.get(e.id).children;void 0!==s&&s.length>0&&void 0!==t[s[0].ID]&&(0!==(r=t[s[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var l=e.FileName.slice(-3).toLowerCase();if("tga"===l){var c=this.manager.getHandler(".tga");null===c?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),a=new i.Texture):a=c.load(r)}else"psd"===l?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),a=new i.Texture):a=this.textureLoader.load(r);return this.textureLoader.setPath(o),a},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var i=e.Objects.Material;for(var r in i){var a=this.parseMaterial(i[r],t);null!==a&&n.set(parseInt(r),a)}}return n},parseMaterial:function(e,t){var r=e.id,a=e.attrName,o=e.ShadingModel;if("object"==typeof o&&(o=o.value),!n.has(r))return null;var s,l=this.parseParameters(e,t,r);switch(o.toLowerCase()){case"phong":s=new i.MeshPhongMaterial;break;case"lambert":s=new i.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new i.MeshPhongMaterial}return s.setValues(l),s.name=a,s},parseParameters:function(e,t,r){var a={};e.BumpFactor&&(a.bumpScale=e.BumpFactor.value),e.Diffuse?a.color=(new i.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(a.color=(new i.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(a.displacementScale=e.DisplacementFactor.value),e.Emissive?a.emissive=(new i.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(a.emissive=(new i.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(a.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(a.opacity=parseFloat(e.Opacity.value)),a.opacity<1&&(a.transparent=!0),e.ReflectionFactor&&(a.reflectivity=e.ReflectionFactor.value),e.Shininess&&(a.shininess=e.Shininess.value),e.Specular?a.specular=(new i.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(a.specular=(new i.Color).fromArray(e.SpecularColor.value));var o=this;return n.get(r).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":a.bumpMap=o.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":a.aoMap=o.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":a.map=o.getTexture(t,e.ID),a.map.encoding=i.sRGBEncoding;break;case"DisplacementColor":a.displacementMap=o.getTexture(t,e.ID);break;case"EmissiveColor":a.emissiveMap=o.getTexture(t,e.ID),a.emissiveMap.encoding=i.sRGBEncoding;break;case"NormalMap":case"Maya|TEX_normal_map":a.normalMap=o.getTexture(t,e.ID);break;case"ReflectionColor":a.envMap=o.getTexture(t,e.ID),a.envMap.mapping=i.EquirectangularReflectionMapping,a.envMap.encoding=i.sRGBEncoding;break;case"SpecularColor":a.specularMap=o.getTexture(t,e.ID),a.specularMap.encoding=i.sRGBEncoding;break;case"TransparentColor":case"TransparencyFactor":a.alphaMap=o.getTexture(t,e.ID),a.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.",n)}})),a},getTexture:function(t,i){return"LayeredTexture"in e.Objects&&i in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),i=n.get(i).children[0].ID),t.get(i)},parseDeformers:function(){var t={},i={};if("Deformer"in e.Objects){var r=e.Objects.Deformer;for(var a in r){var o=r[a],s=n.get(parseInt(a));if("Skin"===o.attrType){var l=this.parseSkeleton(s,r);l.ID=a,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=s.parents[0].ID,t[a]=l}else if("BlendShape"===o.attrType){var c={id:a};c.rawTargets=this.parseMorphTargets(s,r),c.id=a,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),i[a]=c}}}return{skeletons:t,morphTargets:i}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var a={ID:e.ID,indices:[],weights:[],transformLink:(new i.Matrix4).fromArray(r.TransformLink.a)};"Indexes"in r&&(a.indices=r.Indexes.a,a.weights=r.Weights.a),n.push(a)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,t){for(var i=[],r=0;r<e.children.length;r++){var a=e.children[r],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;s.geoID=n.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,i.push(s)}return i},parseScene:function(t,a,o){r=new i.Group;var s=this.parseModels(t.skeletons,a,o),c=e.Objects.Model,u=this;s.forEach((function(e){var t=c[e.ID];u.setLookAtProperties(e,t),n.get(e.ID).parents.forEach((function(t){var n=s.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&r.add(e)})),this.bindSkeleton(t.skeletons,a,s),this.createAmbientLight(),this.setupMorphMaterials(),r.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);var t=x(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));var h=(new l).parse();1===r.children.length&&r.children[0].isGroup&&(r.children[0].animations=h,r=r.children[0]),r.animations=h},parseModels:function(t,r,a){var o=new Map,s=e.Objects.Model;for(var l in s){var c=parseInt(l),u=s[l],h=n.get(c),d=this.buildSkeleton(h,t,c,u.attrName);if(!d){switch(u.attrType){case"Camera":d=this.createCamera(h);break;case"Light":d=this.createLight(h);break;case"Mesh":d=this.createMesh(h,r,a);break;case"NurbsCurve":d=this.createCurve(h,r);break;case"LimbNode":case"Root":d=new i.Bone;break;case"Null":default:d=new i.Group}d.name=u.attrName?i.PropertyBinding.sanitizeNodeName(u.attrName):"",d.ID=c}this.getTransformData(d,u),o.set(c,d)}return o},buildSkeleton:function(e,t,n,r){var a=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 l=a;(a=new i.Bone).matrixWorld.copy(t.transformLink),a.name=r?i.PropertyBinding.sanitizeNodeName(r):"",a.ID=n,s.bones[o]=a,null!==l&&a.add(l)}}))}})),a},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 i.Object3D;else{var a=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(a=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 l=window.innerWidth,c=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(l=r.AspectWidth.value,c=r.AspectHeight.value);var u=l/c,h=45;void 0!==r.FieldOfView&&(h=r.FieldOfView.value);var d=r.FocalLength?r.FocalLength.value:null;switch(a){case 0:n=new i.PerspectiveCamera(h,u,o,s),null!==d&&n.setFocalLength(d);break;case 1:n=new i.OrthographicCamera(-l/2,l/2,c/2,-c/2,o,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+a+"."),n=new i.Object3D}}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 i.Object3D;else{var a;a=void 0===r.LightType?0:r.LightType.value;var o=16777215;void 0!==r.Color&&(o=(new i.Color).fromArray(r.Color.value));var s=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(s=0);var l=0;switch(void 0!==r.FarAttenuationEnd&&(l=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),a){case 0:n=new i.PointLight(o,s,l,1);break;case 1:n=new i.DirectionalLight(o,s);break;case 2:var c=Math.PI/3;void 0!==r.InnerAngle&&(c=i.MathUtils.degToRad(r.InnerAngle.value));var u=0;void 0!==r.OuterAngle&&(u=i.MathUtils.degToRad(r.OuterAngle.value),u=Math.max(u,1)),n=new i.SpotLight(o,s,l,c,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a THREE.PointLight."),n=new i.PointLight(o,s)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(n.castShadow=!0)}return n},createMesh:function(e,t,n){var r,a=null,o=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=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 i.MeshPhongMaterial({color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(s.forEach((function(e){e.skinning=!0})),(r=new i.SkinnedMesh(a,o)).normalizeSkinWeights()):r=new i.Mesh(a,o),r},createCurve:function(e,t){var n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),r=new i.LineBasicMaterial({color:3342591,linewidth:1});return new i.Line(n,r)},getTransformData:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?b(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(t,a){"LookAtProperty"in a&&n.get(t.ID).children.forEach((function(n){if("LookAtProperty"===n.relationship){var a=e.Objects.Model[n.ID];if("Lcl_Translation"in a){var o=a.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(o),r.add(t.target)):t.lookAt((new i.Vector3).fromArray(o))}}}))},bindSkeleton:function(e,t,r){var a=this.parsePoseNodes();for(var o in e){var s=e[o];n.get(parseInt(s.ID)).parents.forEach((function(e){if(t.has(e.ID)){var o=e.ID;n.get(o).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new i.Skeleton(s.bones),a[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 a=n[r].PoseNode;Array.isArray(a)?a.forEach((function(e){t[e.Node]=(new i.Matrix4).fromArray(e.Matrix.a)})):t[a.Node]=(new i.Matrix4).fromArray(a.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,n=t[0],a=t[1],o=t[2];if(0!==n||0!==a||0!==o){var s=new i.Color(n,a,o);r.add(new i.AmbientLight(s,1))}}},setupMorphMaterials:function(){var e=this;r.traverse((function(t){t.isMesh&&t.geometry.morphAttributes.position&&t.geometry.morphAttributes.position.length&&(Array.isArray(t.material)?t.material.forEach((function(n,i){e.setupMorphMaterial(t,n,i)})):e.setupMorphMaterial(t,t.material))}))},setupMorphMaterial:function(e,t,n){var i=e.uuid,a=t.uuid,o=!1;if(r.traverse((function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach((function(t){t.uuid===a&&e.uuid!==i&&(o=!0)})):e.material.uuid===a&&e.uuid!==i&&(o=!0))})),!0===o){var s=t.clone();s.morphTargets=!0,void 0===n?e.material=s:e.material[n]=s}else t.morphTargets=!0}},s.prototype={constructor:s,parse:function(t){var i=new Map;if("Geometry"in e.Objects){var r=e.Objects.Geometry;for(var a in r){var o=n.get(parseInt(a)),s=this.parseGeometry(o,r[a],t);i.set(parseInt(a),s)}}return i},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,i){var r=i.skeletons,a=[],o=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e}),null);t.children.forEach((function(e){void 0!==i.morphTargets[e.ID]&&a.push(i.morphTargets[e.ID])}));var l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=b(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 u=x(c);return this.genGeometry(n,s,a,u)}},genGeometry:function(e,t,n,r){var a=new i.BufferGeometry;e.attrName&&(a.name=e.attrName);var o=this.parseGeoNode(e,t),s=this.genBuffers(o),l=new i.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(r),a.setAttribute("position",l),s.colors.length>0&&a.setAttribute("color",new i.Float32BufferAttribute(s.colors,3)),t&&(a.setAttribute("skinIndex",new i.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute("skinWeight",new i.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=t),s.normal.length>0){var c=(new i.Matrix3).getNormalMatrix(r),u=new i.Float32BufferAttribute(s.normal,3);u.applyNormalMatrix(c),a.setAttribute("normal",u)}if(s.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),a.setAttribute(n,new i.Float32BufferAttribute(s.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){var h=s.materialIndex[0],d=0;if(s.materialIndex.forEach((function(e,t){e!==h&&(a.addGroup(d,t-d,h),h=e,d=t)})),a.groups.length>0){var p=a.groups[a.groups.length-1],f=p.start+p.count;f!==s.materialIndex.length&&a.addGroup(f,s.materialIndex.length-f,h)}0===a.groups.length&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(a,e,n,r),a},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 i=0;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:t,weight:e.weights[r]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,i=0,r=!1,a=[],o=[],s=[],l=[],c=[],u=[],h=this;return e.vertexIndices.forEach((function(d,p){var f=!1;d<0&&(d^=-1,f=!0);var m=[],v=[];if(a.push(3*d,3*d+1,3*d+2),e.color){var y=g(p,n,d,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){v.push(e.weight),m.push(e.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);var x=[0,0,0,0],b=[0,0,0,0];v.forEach((function(e,t){var n=e,i=m[t];b.forEach((function(e,t,r){if(n>e){r[t]=n,n=e;var a=x[t];x[t]=i,i=a}}))})),m=x,v=b}for(;v.length<4;)v.push(0),m.push(0);for(var w=0;w<4;++w)c.push(v[w]),u.push(m[w])}if(e.normal&&(y=g(p,n,d,e.normal),o.push(y[0],y[1],y[2])),e.material&&"AllSame"!==e.material.mappingType)var _=g(p,n,d,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var i=g(p,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])})),i++,f&&(h.genFace(t,e,a,_,o,s,l,c,u,i),n++,i=0,a=[],o=[],s=[],l=[],c=[],u=[])})),t},genFace:function(e,t,n,i,r,a,o,s,l,c){for(var u=2;u<c;u++)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*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(u-1)]),e.vertexWeights.push(s[4*(u-1)+1]),e.vertexWeights.push(s[4*(u-1)+2]),e.vertexWeights.push(s[4*(u-1)+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[4*u+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*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(u-1)]),e.colors.push(a[3*(u-1)+1]),e.colors.push(a[3*(u-1)+2]),e.colors.push(a[3*u]),e.colors.push(a[3*u+1]),e.colors.push(a[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[3*(u-1)]),e.normal.push(r[3*(u-1)+1]),e.normal.push(r[3*(u-1)+2]),e.normal.push(r[3*u]),e.normal.push(r[3*u+1]),e.normal.push(r[3*u+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(u-1)]),e.uvs[n].push(o[n][2*(u-1)+1]),e.uvs[n].push(o[n][2*u]),e.uvs[n].push(o[n][2*u+1])}))},addMorphTargets:function(t,n,i,r){if(0!==i.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var a=this;i.forEach((function(i){i.rawTargets.forEach((function(i){var o=e.Objects.Geometry[i.geoID];void 0!==o&&a.genMorphGeometry(t,n,o,r,i.name)}))}))}},genMorphGeometry:function(e,t,n,r,a){for(var o=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],s=void 0!==n.Vertices?n.Vertices.a:[],l=void 0!==n.Indexes?n.Indexes.a:[],c=3*e.attributes.position.count,u=new Float32Array(c),h=0;h<l.length;h++){var d=3*l[h];u[d]=s[3*h],u[d+1]=s[3*h+1],u[d+2]=s[3*h+2]}var p={vertexIndices:o,vertexPositions:u},f=this.genBuffers(p),m=new i.Float32BufferAttribute(f.vertex,3);m.name=a||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)},parseNormals:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a,r=[];return"IndexToDirect"===n&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:r,mappingType:t,referenceType:n}},parseUVs:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a,r=[];return"IndexToDirect"===n&&(r=e.UVIndex.a),{dataSize:2,buffer:i,indices:r,mappingType:t,referenceType:n}},parseVertexColors:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a,r=[];return"IndexToDirect"===n&&(r=e.ColorIndex.a),{dataSize:4,buffer:i,indices:r,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 i=e.Materials.a,r=[],a=0;a<i.length;++a)r.push(a);return{dataSize:1,buffer:i,indices:r,mappingType:t,referenceType:n}},parseNurbsGeometry:function(e){if(void 0===i.NURBSCurve)return console.error("THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new i.BufferGeometry;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 i.BufferGeometry;for(var n,r,a=t-1,o=e.KnotVector.a,s=[],l=e.Points.a,c=0,u=l.length;c<u;c+=4)s.push((new i.Vector4).fromArray(l,c));if("Closed"===e.Form)s.push(s[0]);else if("Periodic"===e.Form)for(n=a,r=o.length-1-n,c=0;c<a;++c)s.push(s[c]);var h=new i.NURBSCurve(a,o,s,n,r).getPoints(7*s.length),d=new Float32Array(3*h.length);h.forEach((function(e,t){e.toArray(d,3*t)}));var p=new i.BufferGeometry;return p.setAttribute("position",new i.BufferAttribute(d,3)),p}},l.prototype={constructor:l,parse:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var i=t[n],r=this.addClip(i);e.push(r)}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 i in t){var r=t[i];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){var a={id:r.id,attr:r.attrName,curves:{}};n.set(a.id,a)}}return n},parseAnimationCurves:function(t){var i=e.Objects.AnimationCurve;for(var r in i){var a={id:i[r].id,times:i[r].KeyTime.a.map(f),values:i[r].KeyValueFloat.a},o=n.get(a.id);if(void 0!==o){var s=o.parents[0].ID,l=o.parents[0].relationship;l.match(/X/)?t.get(s).curves.x=a:l.match(/Y/)?t.get(s).curves.y=a:l.match(/Z/)?t.get(s).curves.z=a:l.match(/d|DeformPercent/)&&t.has(s)&&(t.get(s).curves.morph=a)}}},parseAnimationLayers:function(t){var a=e.Objects.AnimationLayer,o=new Map;for(var s in a){var l=[],c=n.get(parseInt(s));void 0!==c&&(c.children.forEach((function(a,o){if(t.has(a.ID)){var s=t.get(a.ID);if(void 0!==s.curves.x||void 0!==s.curves.y||void 0!==s.curves.z){if(void 0===l[o]&&void 0!==(f=n.get(a.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID)){if(void 0===(u=e.Objects.Model[f.toString()]))return void console.warn("THREE.FBXLoader: Encountered a unused curve.",a);var c={modelName:u.attrName?i.PropertyBinding.sanitizeNodeName(u.attrName):"",ID:u.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};r.traverse((function(e){e.ID===u.id&&(c.transform=e.matrix,e.userData.transformData&&(c.eulerOrder=e.userData.transformData.eulerOrder))})),c.transform||(c.transform=new i.Matrix4),"PreRotation"in u&&(c.preRotation=u.PreRotation.value),"PostRotation"in u&&(c.postRotation=u.PostRotation.value),l[o]=c}l[o]&&(l[o][s.attr]=s)}else if(void 0!==s.curves.morph){if(void 0===l[o]){var u,h=n.get(a.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,d=n.get(h).parents[0].ID,p=n.get(d).parents[0].ID,f=n.get(p).parents[0].ID;c={modelName:(u=e.Objects.Model[f]).attrName?i.PropertyBinding.sanitizeNodeName(u.attrName):"",morphName:e.Objects.Deformer[h].attrName},l[o]=c}l[o][s.attr]=s}}})),o.set(parseInt(s),l))}return o},parseAnimStacks:function(t){var i=e.Objects.AnimationStack,r={};for(var a in i){var o=n.get(parseInt(a)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=t.get(o[0].ID);r[a]={name:i[a].attrName,layer:s}}return r},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new i.AnimationClip(e.name,-1,t)},generateTracks:function(e){var t=[],n=new i.Vector3,r=new i.Quaternion,a=new i.Vector3;if(e.transform&&e.transform.decompose(n,r,a),n=n.toArray(),r=(new i.Euler).setFromQuaternion(r,e.eulerOrder).toArray(),a=a.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 l=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale");void 0!==l&&t.push(l)}if(void 0!==e.DeformPercent){var c=this.generateMorphTrack(e);void 0!==c&&t.push(c)}return t},generateVectorTrack:function(e,t,n,r){var a=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(a,t,n);return new i.VectorKeyframeTrack(e+"."+r,a,o)},generateRotationTrack:function(e,t,n,r,a,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(i.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(i.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(i.MathUtils.degToRad));var s=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(s,t,n);void 0!==r&&((r=r.map(i.MathUtils.degToRad)).push(o),r=(new i.Euler).fromArray(r),r=(new i.Quaternion).setFromEuler(r)),void 0!==a&&((a=a.map(i.MathUtils.degToRad)).push(o),a=(new i.Euler).fromArray(a),a=(new i.Quaternion).setFromEuler(a).invert());for(var c=new i.Quaternion,u=new i.Euler,h=[],d=0;d<l.length;d+=3)u.set(l[d],l[d+1],l[d+2],o),c.setFromEuler(u),void 0!==r&&c.premultiply(r),void 0!==a&&c.multiply(a),c.toArray(h,d/3*4);return new i.QuaternionKeyframeTrack(e+".quaternion",s,h)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),a=r.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new i.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+a+"]",t.times,n)},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,i=t[0],r=1;r<t.length;r++){var a=t[r];a!==i&&(t[n]=a,i=a,n++)}t=t.slice(0,n)}return t},getKeyframeTrackValues:function(e,t,n){var i=n,r=[],a=-1,o=-1,s=-1;return e.forEach((function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==a){var n=t.x.values[a];r.push(n),i[0]=n}else r.push(i[0]);if(-1!==o){var l=t.y.values[o];r.push(l),i[1]=l}else r.push(i[1]);if(-1!==s){var c=t.z.values[s];r.push(c),i[2]=c}else r.push(i[2])})),r},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],i=e.values[t]-n,r=Math.abs(i);if(r>=180){for(var a=r/180,o=i/a,s=n+o,l=e.times[t-1],c=(e.times[t]-l)/a,u=l+c,h=[],d=[];u<e.times[t];)h.push(u),u+=c,d.push(s),s+=o;e.times=M(e.times,t,h),e.values=M(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 d,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,i){var r=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(!r&&!a){var o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes},parseNodeBegin:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),r={name:n},a=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,r):n in o?("PoseNode"===n?o.PoseNode.push(r):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==a.id&&(o[n][a.id]=r)):"number"==typeof a.id?(o[n]={},o[n][a.id]=r):"Properties70"!==n&&(o[n]="PoseNode"===n?[r]:r),"number"==typeof a.id&&(r.id=a.id),""!==a.name&&(r.attrName=a.name),""!==a.type&&(r.attrType=a.type),this.pushStack(r)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}},parseNodeProperty:function(e,t,n){var i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());var a=this.getCurrentNode();if("Properties70"!==a.name){if("C"===i){var o=r.split(",").slice(1),s=parseInt(o[0]),l=parseInt(o[1]),c=r.split(",").slice(3);i="connections",function(e,t){for(var n=0,i=e.length,r=t.length;n<r;n++,i++)e[i]=t[n]}(r=[s,l],c=c.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===a[i]&&(a[i]=[])}"Node"===i&&(a.id=r),i in a&&Array.isArray(a[i])?a[i].push(r):"a"!==i?a[i]=r:a.a=r,this.setCurrentProp(a,i),"a"===i&&","!==r.slice(-1)&&(a.a=w(r))}else this.parseNodeSpecialProperty(e,i,r)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=w(t.a))},parseNodeSpecialProperty:function(e,t,n){var i=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),r=i[0],a=i[1],o=i[2],s=i[3],l=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=w(l)}this.getPrevNode()[r]={type:a,type2:o,flag:s,value:l},this.setCurrentProp(this.getPrevNode(),r)}},u.prototype={constructor:u,parse:function(e){var t=new h(e);t.skip(23);var n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var i=new d;!this.endOfContent(t);){var r=this.parseNode(t,n);null!==r&&i.add(r.name,r)}return i},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={},i=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var a=e.getUint8(),o=e.getString(a);if(0===i)return null;for(var s=[],l=0;l<r;l++)s.push(this.parseProperty(e));var c=s.length>0?s[0]:"",u=s.length>1?s[1]:"",h=s.length>2?s[2]:"";for(n.singleProperty=1===r&&e.getOffset()===i;i>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(o,n,d)}return n.propertyList=s,"number"==typeof c&&(n.id=c),""!==u&&(n.attrName=u),""!==h&&(n.attrType=h),""!==o&&(n.name=o),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if("Connections"===e&&"C"===n.name){var r=[];n.propertyList.forEach((function(e,t){0!==t&&r.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(r)}else if("Properties70"===n.name)Object.keys(n).forEach((function(e){t[e]=n[e]}));else if("Properties70"===e&&"P"===n.name){var a,o=n.propertyList[0],s=n.propertyList[1],l=n.propertyList[2],c=n.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),a="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[o]={type:s,type2:l,flag:c,value:a}}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":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var i=e.getUint32(),r=e.getUint32(),a=e.getUint32();if(0===r)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}void 0===Z&&console.error("THREE.FBXLoader: External library fflate.min.js required.");var o=new h(Z.unzlibSync(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case"b":case"c":return o.getBooleanArray(i);case"d":return o.getFloat64Array(i);case"f":return o.getFloat32Array(i);case"i":return o.getInt32Array(i);case"l":return o.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},h.prototype={constructor:h,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)),i.LoaderUtils.decodeText(new Uint8Array(t))}},d.prototype={constructor:d,add:function(e,t){this[e]=t}};var m=[];function g(e,t,n,i){var r;switch(i.mappingType){case"ByPolygonVertex":r=e;break;case"ByPolygon":r=t;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);var a=r*i.dataSize,o=a+i.dataSize;return function(e,t,n,i){for(var r=n,a=0;r<i;r++,a++)e[a]=t[r];return e}(m,i.buffer,a,o)}var v=new i.Euler,y=new i.Vector3;function x(e){var t,n=new i.Matrix4,r=new i.Matrix4,a=new i.Matrix4,o=new i.Matrix4,s=new i.Matrix4,l=new i.Matrix4,c=new i.Matrix4,u=new i.Matrix4,h=new i.Matrix4,d=new i.Matrix4,p=new i.Matrix4,f=new i.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&n.setPosition(y.fromArray(e.translation)),e.preRotation&&((t=e.preRotation.map(i.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(v.fromArray(t))),e.rotation&&((t=e.rotation.map(i.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(v.fromArray(t))),e.postRotation&&((t=e.postRotation.map(i.MathUtils.degToRad)).push(e.eulerOrder),o.makeRotationFromEuler(v.fromArray(t)),o.invert()),e.scale&&s.scale(y.fromArray(e.scale)),e.scalingOffset&&c.setPosition(y.fromArray(e.scalingOffset)),e.scalingPivot&&l.setPosition(y.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(y.fromArray(e.rotationOffset)),e.rotationPivot&&h.setPosition(y.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));var g=(new i.Matrix4).copy(r).multiply(a).multiply(o),x=new i.Matrix4;x.extractRotation(d);var b=new i.Matrix4;b.copyPosition(d);var w=new i.Matrix4,_=(new i.Matrix4).copy(b).invert().multiply(d);w.copy(x).invert().multiply(_);var M=s,S=new i.Matrix4;if(0===m)S.copy(x).multiply(g).multiply(w).multiply(M);else if(1===m)S.copy(x).multiply(w).multiply(g).multiply(M);else{var T=(new i.Matrix4).scale((new i.Vector3).setFromMatrixScale(p)),E=(new i.Matrix4).copy(T).invert(),A=(new i.Matrix4).copy(w).multiply(E);S.copy(x).multiply(g).multiply(A).multiply(M)}var L=new i.Matrix4;L.copy(h).invert();var R=new i.Matrix4;R.copy(l).invert();var C=new i.Matrix4;C.copy(n).multiply(u).multiply(h).multiply(r).multiply(a).multiply(o).multiply(L).multiply(c).multiply(l).multiply(s).multiply(R);var P=(new i.Matrix4).copyPosition(C),I=(new i.Matrix4).copy(d).multiply(P);return f.copyPosition(I),(C=(new i.Matrix4).copy(f).multiply(S)).premultiply(d.invert()),C}function b(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 w(e){return e.split(",").map((function(e){return parseFloat(e)}))}function _(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),i.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function M(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}return a}(),Y=Y=i.FBXLoader;var J={};i.GLTFLoader=function(){function e(e){i.Loader.call(this,e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new s(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new l(e)})),this.register((function(e){return new a(e)})),this.register((function(e){return new h(e)}))}function n(){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(i.Loader.prototype),{constructor:e,load:function(e,n,r,a){var o,s=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:i.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);var l=function(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)},c=new i.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,(function(i){try{s.parse(i,o,(function(t){n(t),s.manager.itemEnd(e)}),l)}catch(t){l(t)}}),r,l)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')},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,n,a){var s,l={},c={};if("string"==typeof e)s=e;else if(i.LoaderUtils.decodeText(new Uint8Array(e,0,4))===d){try{l[r.KHR_BINARY_GLTF]=new m(e)}catch(_){return void(a&&a(_))}s=l[r.KHR_BINARY_GLTF].content}else s=i.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(s);if(void 0===u.asset||u.asset.version[0]<2)a&&a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var h=new O(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(var p=0;p<this.pluginCallbacks.length;p++){var f=this.pluginCallbacks[p](h);c[f.name]=f,l[f.name]=!0}if(u.extensionsUsed)for(p=0;p<u.extensionsUsed.length;++p){var y=u.extensionsUsed[p],w=u.extensionsRequired||[];switch(y){case r.KHR_MATERIALS_UNLIT:l[y]=new o;break;case r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:l[y]=new x;break;case r.KHR_DRACO_MESH_COMPRESSION:l[y]=new g(u,this.dracoLoader);break;case r.KHR_TEXTURE_TRANSFORM:l[y]=new v;break;case r.KHR_MESH_QUANTIZATION:l[y]=new b;break;default:w.indexOf(y)>=0&&void 0===c[y]&&console.warn('THREE.GLTFLoader: Unknown extension "'+y+'".')}}h.setExtensions(l),h.setPlugins(c),h.parse(n,a)}}});var r={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"};function a(e){this.parser=e,this.name=r.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function o(){this.name=r.KHR_MATERIALS_UNLIT}function s(e){this.parser=e,this.name=r.KHR_MATERIALS_CLEARCOAT}function l(e){this.parser=e,this.name=r.KHR_MATERIALS_TRANSMISSION}function c(e){this.parser=e,this.name=r.KHR_TEXTURE_BASISU}function u(e){this.parser=e,this.name=r.EXT_TEXTURE_WEBP,this.isSupported=null}function h(e){this.name=r.EXT_MESHOPT_COMPRESSION,this.parser=e}a.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,i=t.length;n<i;n++){var r=t[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}},a.prototype._loadLight=function(e){var t=this.parser,n="light:"+e,r=t.cache.get(n);if(r)return r;var a,o=t.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],l=new i.Color(16777215);void 0!==s.color&&l.fromArray(s.color);var c=void 0!==s.range?s.range:0;switch(s.type){case"directional":(a=new i.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new i.PointLight(l)).distance=c;break;case"spot":(a=new i.SpotLight(l)).distance=c,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,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return a.position.set(0,0,0),a.decay=2,void 0!==s.intensity&&(a.intensity=s.intensity),a.name=t.createUniqueName(s.name||"light_"+e),r=Promise.resolve(a),t.cache.add(n,r),r},a.prototype.createNodeAttachment=function(e){var t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))},o.prototype.getMaterialType=function(){return i.MeshBasicMaterial},o.prototype.extendParams=function(e,t,n){var r=[];e.color=new i.Color(1,1,1),e.opacity=1;var a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==a.baseColorTexture&&r.push(n.assignTexture(e,"map",a.baseColorTexture))}return Promise.all(r)},s.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?i.MeshPhysicalMaterial:null},s.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 a=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&a.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&a.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(a.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new i.Vector2(s,-s)}return Promise.all(a)},l.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?i.MeshPhysicalMaterial:null},l.prototype.extendMaterialParams=function(e,t){var n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)},c.prototype.loadTexture=function(e){var t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;var r=i.extensions[this.name],a=n.images[r.source],o=t.options.ktx2Loader;if(!o){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,a,o)},u.prototype.loadTexture=function(e){var t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;var a=r.extensions[t],o=i.images[a.source],s=n.textureLoader;if(o.uri){var l=n.options.manager.getHandler(o.uri);null!==l&&(s=l)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,o,s);if(i.extensionsRequired&&i.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},h.prototype.loadBufferView=function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,a.ready]).then((function(e){var t=i.byteOffset||0,n=i.byteLength||0,r=i.count,o=i.byteStride,s=new ArrayBuffer(r*o),l=new Uint8Array(e[0],t,n);return a.decodeGltfBuffer(new Uint8Array(s),r,o,l,i.mode,i.filter),s}))}return null};var d="glTF",p=1313821514,f=5130562;function m(e){this.name=r.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==d)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-12,a=new DataView(e,12),o=0;o<n;){var s=a.getUint32(o,!0);o+=4;var l=a.getUint32(o,!0);if(o+=4,l===p){var c=new Uint8Array(e,12+o,s);this.content=i.LoaderUtils.decodeText(c)}else if(l===f){var u=12+o;this.body=e.slice(u,u+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function g(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=r.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function v(){this.name=r.KHR_TEXTURE_TRANSFORM}function y(e){i.MeshStandardMaterial.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"),a=["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 i.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var i in s)e.uniforms[i]=s[i];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>",a).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 x(){return{name:r.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 y},extendParams:function(e,t,n){var r=t.extensions[this.name];e.color=new i.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(r.diffuseFactor)){var o=r.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==r.diffuseTexture&&a.push(n.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new i.Color(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new i.Color(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;a.push(n.assignTexture(e,"glossinessMap",s)),a.push(n.assignTexture(e,"specularMap",s))}return Promise.all(a)},createMaterial:function(e){var t=new y(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=i.TangentSpaceNormalMap,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 b(){this.name=r.KHR_MESH_QUANTIZATION}function w(e,t,n,r){i.Interpolant.call(this,e,t,n,r)}g.prototype.decodePrimitive=function(e,t){var n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(var c in a){var u=E[c]||c.toLowerCase();o[u]=a[c]}for(c in e.attributes)if(u=E[c]||c.toLowerCase(),void 0!==a[c]){var h=n.accessors[e.attributes[c]],d=_[h.componentType];l[u]=d,s[u]=!0===h.normalized}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var n in e.attributes){var i=e.attributes[n],r=s[n];void 0!==r&&(i.normalized=r)}t(e)}),o,l)}))}))},v.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},y.prototype=Object.create(i.MeshStandardMaterial.prototype),y.prototype.constructor=y,y.prototype.copy=function(e){return i.MeshStandardMaterial.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},w.prototype=Object.create(i.Interpolant.prototype),w.prototype.constructor=w,w.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t},w.prototype.beforeStart_=w.prototype.copySampleValue_,w.prototype.afterEnd_=w.prototype.copySampleValue_,w.prototype.interpolate_=function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,u=(n-t)/c,h=u*u,d=h*u,p=e*l,f=p-l,m=-2*d+3*h,g=d-h,v=1-m,y=g-h+u,x=0;x!==o;x++){var b=a[f+x+o],w=a[f+x+s]*c,_=a[p+x+o],M=a[p+x]*c;r[x]=v*b+y*w+m*_+g*M}return r};var _={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},S={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},A={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},L={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete};function R(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 C(e,t,n){for(var i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function P(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 I(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length)for(e.morphTargetDictionary={},n=0,i=r.length;n<i;n++)e.morphTargetDictionary[r[n]]=n;else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function D(e){for(var t="",n=Object.keys(e).sort(),i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function O(e,t){this.json=e||{},this.extensions={},this.plugins={},this.options=t||{},this.cache=new n,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 i.ImageBitmapLoader(this.options.manager):this.textureLoader=new i.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new i.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function N(e,t,n){var r=t.attributes,a=[];function o(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(var s in r){var l=E[s]||s.toLowerCase();l in e.attributes||a.push(o(r[s],l))}if(void 0!==t.indices&&!e.index){var c=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));a.push(c)}return P(e,t),function(e,t,n){var r=t.attributes,a=new i.Box3;if(void 0!==r.POSITION){var o=(p=n.json.accessors[r.POSITION]).min,s=p.max;if(void 0!==o&&void 0!==s){a.set(new i.Vector3(o[0],o[1],o[2]),new i.Vector3(s[0],s[1],s[2]));var l=t.targets;if(void 0!==l){for(var c=new i.Vector3,u=new i.Vector3,h=0,d=l.length;h<d;h++){var p,f=l[h];void 0!==f.POSITION&&(o=(p=n.json.accessors[f.POSITION]).min,s=p.max,void 0!==o&&void 0!==s?(u.setX(Math.max(Math.abs(o[0]),Math.abs(s[0]))),u.setY(Math.max(Math.abs(o[1]),Math.abs(s[1]))),u.setZ(Math.max(Math.abs(o[2]),Math.abs(s[2]))),c.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}a.expandByVector(c)}e.boundingBox=a;var m=new i.Sphere;a.getCenter(m.center),m.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(a).then((function(){return void 0!==t.targets?function(e,t,n){for(var i=!1,r=!1,a=0,o=t.length;a<o&&(void 0!==(c=t[a]).POSITION&&(i=!0),void 0!==c.NORMAL&&(r=!0),!i||!r);a++);if(!i&&!r)return Promise.resolve(e);var s=[],l=[];for(a=0,o=t.length;a<o;a++){var c=t[a];if(i){var u=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;s.push(u)}r&&(u=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal,l.push(u))}return Promise.all([Promise.all(s),Promise.all(l)]).then((function(t){var n=t[0],a=t[1];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function F(e,t){var n=e.getIndex();if(null===n){var r=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<a.count;o++)r.push(o);e.setIndex(r),n=e.getIndex()}var s=n.count-2,l=[];if(t===i.TriangleFanDrawMode)for(o=1;o<=s;o++)l.push(n.getX(0)),l.push(n.getX(o)),l.push(n.getX(o+1));else for(o=0;o<s;o++)o%2==0?(l.push(n.getX(o)),l.push(n.getX(o+1)),l.push(n.getX(o+2))):(l.push(n.getX(o+2)),l.push(n.getX(o+1)),l.push(n.getX(o)));l.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(l),c}return O.prototype.setExtensions=function(e){this.extensions=e},O.prototype.setPlugins=function(e){this.plugins=e},O.prototype.parse=function(e,t){var n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};C(r,a,i),P(a,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)},O.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],i=0,r=t.length;i<r;i++)for(var a=t[i].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(n[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}},O.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},O.prototype._getNodeRef=function(e,t,n){if(e.refs[t]<=1)return n;var i=n.clone();return i.name+="_instance_"+e.uses[t]++,i},O.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var i=e(t[n]);if(i)return i}},O.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],i=0;i<t.length;i++){var r=e(t[i]);r&&n.push(r)}return n},O.prototype.getDependency=function(e,t){var n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i},O.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t},O.prototype.loadBuffer=function(e){var t=this.json.buffers[e],n=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[r.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,r){n.load(R(t.uri,i.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},O.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))},O.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 a=[];return void 0!==r.bufferView?a.push(this.getDependency("bufferView",r.bufferView)):a.push(null),void 0!==r.sparse&&(a.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(a).then((function(e){var a,o,s=e[0],l=T[r.type],c=_[r.componentType],u=c.BYTES_PER_ELEMENT,h=u*l,d=r.byteOffset||0,p=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,f=!0===r.normalized;if(p&&p!==h){var m=Math.floor(d/p),g="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+m+":"+r.count,v=t.cache.get(g);v||(a=new c(s,m*p,r.count*p/u),v=new i.InterleavedBuffer(a,p/u),t.cache.add(g,v)),o=new i.InterleavedBufferAttribute(v,l,d%p/u,f)}else a=null===s?new c(r.count*l):new c(s,d,r.count*l),o=new i.BufferAttribute(a,l,f);if(void 0!==r.sparse){var y=T.SCALAR,x=_[r.sparse.indices.componentType],b=r.sparse.indices.byteOffset||0,w=r.sparse.values.byteOffset||0,M=new x(e[1],b,r.sparse.count*y),S=new c(e[2],w,r.sparse.count*l);null!==s&&(o=new i.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var E=0,A=M.length;E<A;E++){var L=M[E];if(o.setX(L,S[E*l]),l>=2&&o.setY(L,S[E*l+1]),l>=3&&o.setZ(L,S[E*l+2]),l>=4&&o.setW(L,S[E*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},O.prototype.loadTexture=function(e){var t=this.json,n=this.options,i=t.textures[e],r=t.images[i.source],a=this.textureLoader;if(r.uri){var o=n.manager.getHandler(r.uri);null!==o&&(a=o)}return this.loadTextureImage(e,r,a)},O.prototype.loadTextureImage=function(e,t,n){var r=this,a=this.json,o=this.options,s=a.textures[e],l=self.URL||self.webkitURL,c=t.uri,u=!1,h=!0;if("image/jpeg"===t.mimeType&&(h=!1),void 0!==t.bufferView)c=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}u=!0;var i=new Blob([e],{type:t.mimeType});return c=l.createObjectURL(i)}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return Promise.resolve(c).then((function(e){return new Promise((function(t,r){var a=t;!0===n.isImageBitmapLoader&&(a=function(e){t(new i.CanvasTexture(e))}),n.load(R(e,o.path),a,void 0,r)}))})).then((function(t){!0===u&&l.revokeObjectURL(c),t.flipY=!1,s.name&&(t.name=s.name),h||(t.format=i.RGBFormat);var n=(a.samplers||{})[s.sampler]||{};return t.magFilter=M[n.magFilter]||i.LinearFilter,t.minFilter=M[n.minFilter]||i.LinearMipmapLinearFilter,t.wrapS=S[n.wrapS]||i.RepeatWrapping,t.wrapT=S[n.wrapT]||i.RepeatWrapping,r.associations.set(t,{type:"textures",index:e}),t}))},O.prototype.assignTexture=function(e,t,n){var i=this;return this.getDependency("texture",n.index).then((function(a){if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[r.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[r.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=i.associations.get(a);a=i.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),i.associations.set(a,s)}}e[t]=a}))},O.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,r=void 0!==t.attributes.tangent,a=void 0!==t.attributes.color,o=void 0===t.attributes.normal,s=!0===e.isSkinnedMesh,l=Object.keys(t.morphAttributes).length>0,c=l&&void 0!==t.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+n.uuid,h=this.cache.get(u);h||(h=new i.PointsMaterial,i.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(u,h)),n=h}else if(e.isLine){u="LineBasicMaterial:"+n.uuid;var d=this.cache.get(u);d||(d=new i.LineBasicMaterial,i.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(u,d)),n=d}if(r||a||o||s||l){u="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),s&&(u+="skinning:"),r&&(u+="vertex-tangents:"),a&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),l&&(u+="morph-targets:"),c&&(u+="morph-normals:");var p=this.cache.get(u);p||(p=n.clone(),s&&(p.skinning=!0),a&&(p.vertexColors=!0),o&&(p.flatShading=!0),l&&(p.morphTargets=!0),c&&(p.morphNormals=!0),r&&(p.vertexTangents=!0,p.normalScale&&(p.normalScale.y*=-1),p.clearcoatNormalScale&&(p.clearcoatNormalScale.y*=-1)),this.cache.add(u,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n},O.prototype.getMaterialType=function(){return i.MeshStandardMaterial},O.prototype.loadMaterial=function(e){var t,n=this,a=this.json,o=this.extensions,s=a.materials[e],l={},c=s.extensions||{},u=[];if(c[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=o[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=h.getMaterialType(),u.push(h.extendParams(l,s,n))}else if(c[r.KHR_MATERIALS_UNLIT]){var d=o[r.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),u.push(d.extendParams(l,s,n))}else{var p=s.pbrMetallicRoughness||{};if(l.color=new i.Color(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&&u.push(n.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&&(u.push(n.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),u.push(n.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),u.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))}!0===s.doubleSided&&(l.side=i.DoubleSide);var m=s.alphaMode||"OPAQUE";return"BLEND"===m?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===m&&(l.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&t!==i.MeshBasicMaterial&&(u.push(n.assignTexture(l,"normalMap",s.normalTexture)),l.normalScale=new i.Vector2(1,-1),void 0!==s.normalTexture.scale&&l.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),void 0!==s.occlusionTexture&&t!==i.MeshBasicMaterial&&(u.push(n.assignTexture(l,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(l.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&t!==i.MeshBasicMaterial&&(l.emissive=(new i.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&t!==i.MeshBasicMaterial&&u.push(n.assignTexture(l,"emissiveMap",s.emissiveTexture)),Promise.all(u).then((function(){var a;return a=t===y?o[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new t(l),s.name&&(a.name=s.name),a.map&&(a.map.encoding=i.sRGBEncoding),a.emissiveMap&&(a.emissiveMap.encoding=i.sRGBEncoding),P(a,s),n.associations.set(a,{type:"materials",index:e}),s.extensions&&C(o,a,s),a}))},O.prototype.createUniqueName=function(e){for(var t=i.PropertyBinding.sanitizeNodeName(e||""),n=t,r=1;this.nodeNamesUsed[n];++r)n=t+"_"+r;return this.nodeNamesUsed[n]=!0,n},O.prototype.loadGeometries=function(e){var t=this,n=this.extensions,a=this.primitiveCache;function o(e){return n[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return N(n,e,t)}))}for(var s,l,c=[],u=0,h=e.length;u<h;u++){var d,p=e[u],f=(void 0,(l=(s=p).extensions&&s.extensions[r.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+D(l.attributes):s.indices+":"+D(s.attributes)+":"+s.mode),m=a[f];m?c.push(m.promise):(d=p.extensions&&p.extensions[r.KHR_DRACO_MESH_COMPRESSION]?o(p):N(new i.BufferGeometry,p,t),a[f]={primitive:p,promise:d},c.push(d))}return Promise.all(c)},O.prototype.loadMesh=function(e){for(var t,n=this,r=this.json,a=this.extensions,o=r.meshes[e],s=o.primitives,l=[],c=0,u=s.length;c<u;c++){var h=void 0===s[c].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new i.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:i.FrontSide})),t.DefaultMaterial):this.getDependency("material",s[c].material);l.push(h)}return l.push(n.loadGeometries(s)),Promise.all(l).then((function(t){for(var r=t.slice(0,t.length-1),l=t[t.length-1],c=[],u=0,h=l.length;u<h;u++){var d,p=l[u],f=s[u],m=r[u];if(4===f.mode||5===f.mode||6===f.mode||void 0===f.mode)!0!==(d=!0===o.isSkinnedMesh?new i.SkinnedMesh(p,m):new i.Mesh(p,m)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),5===f.mode?d.geometry=F(d.geometry,i.TriangleStripDrawMode):6===f.mode&&(d.geometry=F(d.geometry,i.TriangleFanDrawMode));else if(1===f.mode)d=new i.LineSegments(p,m);else if(3===f.mode)d=new i.Line(p,m);else if(2===f.mode)d=new i.LineLoop(p,m);else{if(0!==f.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);d=new i.Points(p,m)}Object.keys(d.geometry.morphAttributes).length>0&&I(d,o),d.name=n.createUniqueName(o.name||"mesh_"+e),P(d,o),f.extensions&&C(a,d,f),n.assignFinalMaterial(d),c.push(d)}if(1===c.length)return c[0];var g=new i.Group;for(u=0,h=c.length;u<h;u++)g.add(c[u]);return g}))},O.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new i.PerspectiveCamera(i.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new i.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),P(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},O.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}))},O.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],r=[],a=[],o=[],s=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],h=t.samplers[u.sampler],d=u.target,p=void 0!==d.node?d.node:d.id,f=void 0!==t.parameters?t.parameters[h.input]:h.input,m=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",m)),o.push(h),s.push(d)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(s)]).then((function(n){for(var r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=[],u=0,h=r.length;u<h;u++){var d=r[u],p=a[u],f=o[u],m=s[u],g=l[u];if(void 0!==d){var v;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,A[g.path]){case A.weights:v=i.NumberKeyframeTrack;break;case A.rotation:v=i.QuaternionKeyframeTrack;break;case A.position:case A.scale:default:v=i.VectorKeyframeTrack}var y=d.name?d.name:d.uuid,x=void 0!==m.interpolation?L[m.interpolation]:i.InterpolateLinear,b=[];A[g.path]===A.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&b.push(e.name?e.name:e.uuid)})):b.push(y);var _=f.array;if(f.normalized){var M;if(_.constructor===Int8Array)M=1/127;else if(_.constructor===Uint8Array)M=1/255;else if(_.constructor==Int16Array)M=1/32767;else{if(_.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");M=1/65535}for(var S=new Float32Array(_.length),T=0,E=_.length;T<E;T++)S[T]=_[T]*M;_=S}for(T=0,E=b.length;T<E;T++){var R=new v(b[T]+"."+A[g.path],p.array,_,x);"CUBICSPLINE"===m.interpolation&&(R.createInterpolant=function(e){return new w(this.times,this.values,this.getValueSize()/3,e)},R.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(R)}}}var C=t.name?t.name:"animation_"+e;return new i.AnimationClip(C,void 0,c)}))},O.prototype.loadNode=function(e){var t,n=this.json,r=this.extensions,a=this,o=n.nodes[e],s=o.name?a.createUniqueName(o.name):"";return(t=[],void 0!==o.mesh&&t.push(a.getDependency("mesh",o.mesh).then((function(e){var t=a._getNodeRef(a.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(a.getDependency("camera",o.camera).then((function(e){return a._getNodeRef(a.cameraCache,o.camera,e)}))),a._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 i.Bone:t.length>1?new i.Group:1===t.length?t[0]:new i.Object3D)!==t[0])for(var l=0,c=t.length;l<c;l++)n.add(t[l]);if(o.name&&(n.userData.name=o.name,n.name=s),P(n,o),o.extensions&&C(r,n,o),void 0!==o.matrix){var u=new i.Matrix4;u.fromArray(o.matrix),n.applyMatrix4(u)}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 a.associations.set(n,{type:"nodes",index:e}),n}))},O.prototype.loadScene=function(){function e(t,n,r,a){var o=r.nodes[t];return a.getDependency("node",t).then((function(e){return void 0===o.skin?e:a.getDependency("skin",o.skin).then((function(e){for(var n=[],i=0,r=(t=e).joints.length;i<r;i++)n.push(a.getDependency("node",t.joints[i]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var r=[],a=[],o=0,s=n.length;o<s;o++){var l=n[o];if(l){r.push(l);var c=new i.Matrix4;void 0!==t.inverseBindMatrices&&c.fromArray(t.inverseBindMatrices.array,16*o),a.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new i.Skeleton(r,a),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var i=[];if(o.children)for(var s=o.children,l=0,c=s.length;l<c;l++){var u=s[l];i.push(e(u,t,r,a))}return Promise.all(i)}))}return function(t){var n=this.json,r=this.extensions,a=this.json.scenes[t],o=new i.Group;a.name&&(o.name=this.createUniqueName(a.name)),P(o,a),a.extensions&&C(r,o,a);for(var s=a.nodes||[],l=[],c=0,u=s.length;c<u;c++)l.push(e(s[c],o,n,this));return Promise.all(l).then((function(){return o}))}}(),e}(),J=J=i.GLTFLoader;var K={};i.ColladaLoader=function(e){i.Loader.call(this,e)},i.ColladaLoader.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:i.ColladaLoader,load:function(e,n,r,a){var o=this,s=""===o.path?i.LoaderUtils.extractUrlBase(e):o.path,l=new i.FileLoader(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,(function(i){try{n(o.parse(i,s))}catch(t){a?a(t):console.error(t),o.manager.itemError(e)}}),r,a)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},parse:function(e,t){function n(e,t){for(var n=[],i=e.childNodes,r=0,a=i.length;r<a;r++){var o=i[r];o.nodeName===t&&n.push(o)}return n}function r(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=t[i];return n}function a(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseFloat(t[i]);return n}function o(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseInt(t[i]);return n}function s(e){return e.substring(1)}function l(e){return 0===Object.keys(e).length}function c(e){return void 0!==e&&!0===e.hasAttribute("meter")?parseFloat(e.getAttribute("meter")):1}function u(e){return void 0!==e?e.textContent:"Y_UP"}function h(e,t,i,r){var a=n(e,t)[0];if(void 0!==a)for(var o=n(a,i),s=0;s<o.length;s++)r(o[s])}function d(e,t){for(var n in e)e[n].build=t(e[n])}function p(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function f(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=s(r.getAttribute("source")),o=r.getAttribute("semantic");t.inputs[o]=a}}return t}function m(e){var t={},n=e.getAttribute("target").split("/"),i=n.shift(),r=n.shift(),a=-1!==r.indexOf("("),o=-1!==r.indexOf(".");if(o)n=r.split("."),r=n.shift(),t.member=n.shift();else if(a){var l=r.split("(");r=l.shift();for(var c=0;c<l.length;c++)l[c]=parseInt(l[c].replace(/\)/,""));t.indices=l}return t.id=i,t.sid=r,t.arraySyntax=a,t.memberSyntax=o,t.sampler=s(e.getAttribute("source")),t}function g(e){var t=[],n=e.channels,i=e.samplers,r=e.sources;for(var a in n)if(n.hasOwnProperty(a)){var o=n[a],s=i[o.sampler],l=s.inputs.INPUT,c=s.inputs.OUTPUT;_(y(o,r[l],r[c]),t)}return t}function v(e){return p(Ke.animations[e],g)}function y(e,t,n){var i,r,a,o,s,l,c=Ke.nodes[e.id],u=Fe(c.id),h=c.transforms[e.sid],d=c.matrix.clone().transpose(),p={};switch(h){case"matrix":for(a=0,o=t.array.length;a<o;a++)if(i=t.array[a],r=a*n.stride,void 0===p[i]&&(p[i]={}),!0===e.arraySyntax){var f=n.array[r],m=e.indices[0]+4*e.indices[1];p[i][m]=f}else for(s=0,l=n.stride;s<l;s++)p[i][s]=n.array[r+s];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',h)}var g=function(e,t){var n=[];for(var i in e)n.push({time:parseFloat(i),value:e[i]});n.sort((function(e,t){return e.time-t.time}));for(var r=0;r<16;r++)M(n,r,t.elements[r]);return n}(p,d);return{name:u.uuid,keyframes:g}}var x=new i.Vector3,b=new i.Vector3,w=new i.Quaternion;function _(e,t){for(var n=e.keyframes,r=e.name,a=[],o=[],s=[],l=[],c=0,u=n.length;c<u;c++){var h=n[c],d=h.time,p=h.value;Te.fromArray(p).transpose(),Te.decompose(x,w,b),a.push(d),o.push(x.x,x.y,x.z),s.push(w.x,w.y,w.z,w.w),l.push(b.x,b.y,b.z)}return o.length>0&&t.push(new i.VectorKeyframeTrack(r+".position",a,o)),s.length>0&&t.push(new i.QuaternionKeyframeTrack(r+".quaternion",a,s)),l.length>0&&t.push(new i.VectorKeyframeTrack(r+".scale",a,l)),t}function M(e,t,n){var i,r,a,o=!0;for(r=0,a=e.length;r<a;r++)void 0===(i=e[r]).value[t]?i.value[t]=null:o=!1;if(!0===o)for(r=0,a=e.length;r<a;r++)(i=e[r]).value[t]=n;else!function(e,t){for(var n,i,r=0,a=e.length;r<a;r++){var o=e[r];if(null===o.value[t]){if(n=S(e,r,t),i=T(e,r,t),null===n){o.value[t]=i.value[t];continue}if(null===i){o.value[t]=n.value[t];continue}E(o,n,i,t)}}}(e,t)}function S(e,t,n){for(;t>=0;){var i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t<e.length;){var i=e[t];if(null!==i.value[n])return i;t++}return null}function E(e,t,n,i){n.time-t.time!=0?e.value[i]=(e.time-t.time)*(n.value[i]-t.value[i])/(n.time-t.time)+t.value[i]:e.value[i]=t.value[i]}function A(e){for(var t=[],n=e.name,r=e.end-e.start||-1,a=e.animations,o=0,s=a.length;o<s;o++)for(var l=v(a[o]),c=0,u=l.length;c<u;c++)t.push(l[c]);return new i.AnimationClip(n,r,t)}function L(e){return p(Ke.clips[e],A)}function R(e){for(var t={sources:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=a(r.textContent);break;case"source":var o=r.getAttribute("id");t.sources[o]=ae(r);break;case"joints":t.joints=C(r);break;case"vertex_weights":t.vertexWeights=P(r)}}return t}function C(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=r.getAttribute("semantic"),o=s(r.getAttribute("source"));t.inputs[a]=o}}return t}function P(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=r.getAttribute("semantic"),l=s(r.getAttribute("source")),c=parseInt(r.getAttribute("offset"));t.inputs[a]={id:l,offset:c};break;case"vcount":t.vcount=o(r.textContent);break;case"v":t.v=o(r.textContent)}}return t}function I(e){var t={id:e.id},n=Ke.geometries[t.id];return void 0!==e.skin&&(t.skin=function(e){var t,n,r,a={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},o=e.sources,s=e.vertexWeights,l=s.vcount,c=s.v,u=s.inputs.JOINT.offset,h=s.inputs.WEIGHT.offset,d=e.sources[e.joints.inputs.JOINT],p=e.sources[e.joints.inputs.INV_BIND_MATRIX],f=o[s.inputs.WEIGHT.id].array,m=0;for(t=0,r=l.length;t<r;t++){var g=l[t],v=[];for(n=0;n<g;n++){var y=c[m+u],x=f[c[m+h]];v.push({index:y,weight:x}),m+=2}for(v.sort(M),n=0;n<4;n++){var b=v[n];void 0!==b?(a.indices.array.push(b.index),a.weights.array.push(b.weight)):(a.indices.array.push(0),a.weights.array.push(0))}}for(e.bindShapeMatrix?a.bindMatrix=(new i.Matrix4).fromArray(e.bindShapeMatrix).transpose():a.bindMatrix=(new i.Matrix4).identity(),t=0,r=d.array.length;t<r;t++){var w=d.array[t],_=(new i.Matrix4).fromArray(p.array,t*p.stride).transpose();a.joints.push({name:w,boneInverse:_})}return a;function M(e,t){return t.weight-e.weight}}(e.skin),n.sources.skinIndices=t.skin.indices,n.sources.skinWeights=t.skin.weights),t}function D(e){return void 0!==e.build?e.build:e.init_from}function O(e){var t=Ke.images[e];return void 0!==t?p(t,D):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",e),null)}function N(e){for(var t={surfaces:{},samplers:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":F(r,t);break;case"technique":t.technique=k(r);break;case"extra":t.extra=W(r)}}return t}function F(e,t){for(var n=e.getAttribute("sid"),i=0,r=e.childNodes.length;i<r;i++){var a=e.childNodes[i];if(1===a.nodeType)switch(a.nodeName){case"surface":t.surfaces[n]=B(a);break;case"sampler2D":t.samplers[n]=z(a)}}}function B(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"init_from":t.init_from=r.textContent}}return t}function z(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"source":t.source=r.textContent}}return t}function k(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=r.nodeName,t.parameters=H(r)}}return t}function H(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":t[r.nodeName]=U(r);break;case"transparent":t[r.nodeName]={opaque:r.getAttribute("opaque"),data:U(r)}}}return t}function U(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":t[r.nodeName]=a(r.textContent);break;case"float":t[r.nodeName]=parseFloat(r.textContent);break;case"texture":t[r.nodeName]={id:r.getAttribute("texture"),extra:G(r)}}}return t}function G(e){for(var t={technique:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"extra":j(r,t)}}return t}function j(e,t){for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique":V(r,t)}}}function V(e,t){for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=0:t.technique[r.nodeName]=parseInt(r.textContent)}}}function W(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique":t.technique=q(r)}}return t}function q(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"double_sided":t[r.nodeName]=parseInt(r.textContent)}}return t}function X(e){return e}function Z(e){var t,n,r=(t=e.url,p(Ke.effects[t],X)),a=r.profile.technique,o=r.profile.extra;switch(a.type){case"phong":case"blinn":n=new i.MeshPhongMaterial;break;case"lambert":n=new i.MeshLambertMaterial;break;default:n=new i.MeshBasicMaterial}function s(e){var t=r.profile.samplers[e.id],n=null;if(void 0!==t?n=O(r.profile.surfaces[t.source].init_from):(console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),n=O(e.id)),null!==n){var a=function(e){var t,n=e.slice(2+(e.lastIndexOf(".")-1>>>0));switch(n=n.toLowerCase()){case"tga":t=We;break;default:t=Xe}return t}(n);if(void 0!==a){var o=a.load(n),s=e.extra;if(void 0!==s&&void 0!==s.technique&&!1===l(s.technique)){var c=s.technique;o.wrapS=c.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,o.wrapT=c.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,o.offset.set(c.offsetU||0,c.offsetV||0),o.repeat.set(c.repeatU||1,c.repeatV||1)}else o.wrapS=i.RepeatWrapping,o.wrapT=i.RepeatWrapping;return o}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",n),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}n.name=e.name||"";var c=a.parameters;for(var u in c){var h=c[u];switch(u){case"diffuse":h.color&&n.color.fromArray(h.color),h.texture&&(n.map=s(h.texture));break;case"specular":h.color&&n.specular&&n.specular.fromArray(h.color),h.texture&&(n.specularMap=s(h.texture));break;case"bump":h.texture&&(n.normalMap=s(h.texture));break;case"ambient":h.texture&&(n.lightMap=s(h.texture));break;case"shininess":h.float&&n.shininess&&(n.shininess=h.float);break;case"emission":h.color&&n.emissive&&n.emissive.fromArray(h.color),h.texture&&(n.emissiveMap=s(h.texture))}}var d=c.transparent,f=c.transparency;if(void 0===f&&d&&(f={float:1}),void 0===d&&f&&(d={opaque:"A_ONE",data:{color:[1,1,1,1]}}),d&&f)if(d.data.texture)n.transparent=!0;else{var m=d.data.color;switch(d.opaque){case"A_ONE":n.opacity=m[3]*f.float;break;case"RGB_ZERO":n.opacity=1-m[0]*f.float;break;case"A_ZERO":n.opacity=1-m[3]*f.float;break;case"RGB_ONE":n.opacity=m[0]*f.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',d.opaque)}n.opacity<1&&(n.transparent=!0)}return void 0!==o&&void 0!==o.technique&&1===o.technique.double_sided&&(n.side=i.DoubleSide),n}function Y(e){return p(Ke.materials[e],Z)}function J(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"technique_common":return K(n)}}return{}}function K(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"perspective":case"orthographic":t.technique=i.nodeName,t.parameters=Q(i)}}return t}function Q(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[i.nodeName]=parseFloat(i.textContent)}}return t}function $(e){var t;switch(e.optics.technique){case"perspective":t=new i.PerspectiveCamera(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":var n=e.optics.parameters.ymag,r=e.optics.parameters.xmag,a=e.optics.parameters.aspect_ratio;r=void 0===r?n*a:r,n=void 0===n?r/a:n,r*=.5,n*=.5,t=new i.OrthographicCamera(-r,r,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new i.PerspectiveCamera}return t.name=e.name||"",t}function ee(e){var t=Ke.cameras[e];return void 0!==t?p(t,$):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",e),null)}function te(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=r.nodeName,t.parameters=ne(r)}}return t}function ne(e){for(var t={},n=0,r=e.childNodes.length;n<r;n++){var o=e.childNodes[n];if(1===o.nodeType)switch(o.nodeName){case"color":var s=a(o.textContent);t.color=(new i.Color).fromArray(s);break;case"falloff_angle":t.falloffAngle=parseFloat(o.textContent);break;case"quadratic_attenuation":var l=parseFloat(o.textContent);t.distance=l?Math.sqrt(1/l):0}}return t}function ie(e){var t;switch(e.technique){case"directional":t=new i.DirectionalLight;break;case"point":t=new i.PointLight;break;case"spot":t=new i.SpotLight;break;case"ambient":t=new i.AmbientLight}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function re(e){var t=Ke.lights[e];return void 0!==t?p(t,ie):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",e),null)}function ae(e){for(var t={array:[],stride:3},i=0;i<e.childNodes.length;i++){var o=e.childNodes[i];if(1===o.nodeType)switch(o.nodeName){case"float_array":t.array=a(o.textContent);break;case"Name_array":t.array=r(o.textContent);break;case"technique_common":var s=n(o,"accessor")[0];void 0!==s&&(t.stride=parseInt(s.getAttribute("stride")))}}return t}function oe(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&(t[i.getAttribute("semantic")]=s(i.getAttribute("source")))}return t}function se(e){for(var t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0,hasUV:!1},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=s(r.getAttribute("source")),l=r.getAttribute("semantic"),c=parseInt(r.getAttribute("offset")),u=parseInt(r.getAttribute("set")),h=u>0?l+u:l;t.inputs[h]={id:a,offset:c},t.stride=Math.max(t.stride,c+1),"TEXCOORD"===l&&(t.hasUV=!0);break;case"vcount":t.vcount=o(r.textContent);break;case"p":t.p=o(r.textContent)}}return t}function le(e){for(var t=0,n=0,i=e.length;n<i;n++)!0===e[n].hasUV&&t++;t>0&&t<e.length&&(e.uvsNeedsFix=!0)}function ce(e){var t={},n=e.sources,i=e.vertices,r=e.primitives;if(0===r.length)return{};var a=function(e){for(var t={},n=0;n<e.length;n++){var i=e[n];void 0===t[i.type]&&(t[i.type]=[]),t[i.type].push(i)}return t}(r);for(var o in a){var s=a[o];le(s),t[o]=ue(s,n,i)}return t}function ue(e,t,n){for(var r={},a={array:[],stride:0},o={array:[],stride:0},s={array:[],stride:0},l={array:[],stride:0},c={array:[],stride:0},u=[],h=[],d=new i.BufferGeometry,p=[],f=0,m=0;m<e.length;m++){var g=e[m],v=g.inputs,y=0;switch(g.type){case"lines":case"linestrips":y=2*g.count;break;case"triangles":y=3*g.count;break;case"polylist":for(var x=0;x<g.count;x++){var b=g.vcount[x];switch(b){case 3:y+=3;break;case 4:y+=6;break;default:y+=3*(b-2)}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",g.type)}for(var w in d.addGroup(f,y,m),f+=y,g.material&&p.push(g.material),v){var _=v[w];switch(w){case"VERTEX":for(var M in n){var S=n[M];switch(M){case"POSITION":var T=a.array.length;if(he(g,t[S],_.offset,a.array),a.stride=t[S].stride,t.skinWeights&&t.skinIndices&&(he(g,t.skinIndices,_.offset,u),he(g,t.skinWeights,_.offset,h)),!1===g.hasUV&&!0===e.uvsNeedsFix){y=(a.array.length-T)/a.stride;for(var E=0;E<y;E++)s.array.push(0,0)}break;case"NORMAL":he(g,t[S],_.offset,o.array),o.stride=t[S].stride;break;case"COLOR":he(g,t[S],_.offset,c.array),c.stride=t[S].stride;break;case"TEXCOORD":he(g,t[S],_.offset,s.array),s.stride=t[S].stride;break;case"TEXCOORD1":he(g,t[S],_.offset,l.array),s.stride=t[S].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',M)}}break;case"NORMAL":he(g,t[_.id],_.offset,o.array),o.stride=t[_.id].stride;break;case"COLOR":he(g,t[_.id],_.offset,c.array),c.stride=t[_.id].stride;break;case"TEXCOORD":he(g,t[_.id],_.offset,s.array),s.stride=t[_.id].stride;break;case"TEXCOORD1":he(g,t[_.id],_.offset,l.array),l.stride=t[_.id].stride}}}return a.array.length>0&&d.setAttribute("position",new i.Float32BufferAttribute(a.array,a.stride)),o.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(o.array,o.stride)),c.array.length>0&&d.setAttribute("color",new i.Float32BufferAttribute(c.array,c.stride)),s.array.length>0&&d.setAttribute("uv",new i.Float32BufferAttribute(s.array,s.stride)),l.array.length>0&&d.setAttribute("uv2",new i.Float32BufferAttribute(l.array,l.stride)),u.length>0&&d.setAttribute("skinIndex",new i.Float32BufferAttribute(u,4)),h.length>0&&d.setAttribute("skinWeight",new i.Float32BufferAttribute(h,4)),r.data=d,r.type=e[0].type,r.materialKeys=p,r}function he(e,t,n,i){var r=e.p,a=e.stride,o=e.vcount;function s(e){for(var t=r[e+n]*c,a=t+c;t<a;t++)i.push(l[t])}var l=t.array,c=t.stride;if(void 0!==e.vcount)for(var u=0,h=0,d=o.length;h<d;h++){var p=o[h];if(4===p){var f=u+1*a,m=u+2*a,g=u+3*a;s(u+0*a),s(f),s(g),s(f),s(m),s(g)}else if(3===p)f=u+1*a,m=u+2*a,s(u+0*a),s(f),s(m);else if(p>4)for(var v=1,y=p-2;v<=y;v++)f=u+a*v,m=u+a*(v+1),s(u+0*a),s(f),s(m);u+=a*p}else for(h=0,d=r.length;h<d;h+=a)s(h)}function de(e){return p(Ke.geometries[e],ce)}function pe(e){return void 0!==e.build?e.build:e}function fe(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"joint":t.joints[i.getAttribute("sid")]=me(i);break;case"link":t.links.push(ve(i))}}}function me(e){for(var t,n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"prismatic":case"revolute":t=ge(i)}}return t}function ge(e,t){t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",axis:new i.Vector3,limits:{min:0,max:0},type:e.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"axis":var o=a(r.textContent);t.axis.fromArray(o);break;case"limits":var s=r.getElementsByTagName("max")[0],l=r.getElementsByTagName("min")[0];t.limits.max=parseFloat(s.textContent),t.limits.min=parseFloat(l.textContent)}}return t.limits.min>=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ve(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"attachment_full":t.attachments.push(ye(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(xe(i))}}return t}function ye(e){for(var t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"link":t.links.push(ve(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(xe(i))}}return t}function xe(e){var t={type:e.nodeName},n=a(e.textContent);switch(t.type){case"matrix":t.obj=new i.Matrix4,t.obj.fromArray(n).transpose();break;case"translate":t.obj=new i.Vector3,t.obj.fromArray(n);break;case"rotate":t.obj=new i.Vector3,t.obj.fromArray(n),t.angle=i.MathUtils.degToRad(n[3])}return t}function be(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"technique_common":we(i,t)}}}function we(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"inertia":t.inertia=a(i.textContent);break;case"mass":t.mass=a(i.textContent)[0]}}}function _e(e){for(var t={target:e.getAttribute("target").split("/").pop()},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"axis":var r=i.getElementsByTagName("param")[0];t.axis=r.textContent;var a=t.axis.split("inst_").pop().split("axis")[0];t.jointIndex=a.substr(0,a.length-1)}}return t}function Me(e){return void 0!==e.build?e.build:e}function Se(e){for(var t=[],n=He.querySelector('[id="'+e.id+'"]'),r=0;r<n.childNodes.length;r++){var o=n.childNodes[r];if(1===o.nodeType)switch(o.nodeName){case"matrix":var s=a(o.textContent),l=(new i.Matrix4).fromArray(s).transpose();t.push({sid:o.getAttribute("sid"),type:o.nodeName,obj:l});break;case"translate":case"scale":s=a(o.textContent);var c=(new i.Vector3).fromArray(s);t.push({sid:o.getAttribute("sid"),type:o.nodeName,obj:c});break;case"rotate":s=a(o.textContent),c=(new i.Vector3).fromArray(s);var u=i.MathUtils.degToRad(s[3]);t.push({sid:o.getAttribute("sid"),type:o.nodeName,obj:c,angle:u})}}return t}var Te=new i.Matrix4,Ee=new i.Vector3;function Ae(e){for(var t={name:e.getAttribute("name")||"",type:e.getAttribute("type"),id:e.getAttribute("id"),sid:e.getAttribute("sid"),matrix:new i.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}},n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"node":t.nodes.push(r.getAttribute("id")),Ae(r);break;case"instance_camera":t.instanceCameras.push(s(r.getAttribute("url")));break;case"instance_controller":t.instanceControllers.push(Le(r));break;case"instance_light":t.instanceLights.push(s(r.getAttribute("url")));break;case"instance_geometry":t.instanceGeometries.push(Le(r));break;case"instance_node":t.instanceNodes.push(s(r.getAttribute("url")));break;case"matrix":var o=a(r.textContent);t.matrix.multiply(Te.fromArray(o).transpose()),t.transforms[r.getAttribute("sid")]=r.nodeName;break;case"translate":o=a(r.textContent),Ee.fromArray(o),t.matrix.multiply(Te.makeTranslation(Ee.x,Ee.y,Ee.z)),t.transforms[r.getAttribute("sid")]=r.nodeName;break;case"rotate":o=a(r.textContent);var l=i.MathUtils.degToRad(o[3]);t.matrix.multiply(Te.makeRotationAxis(Ee.fromArray(o),l)),t.transforms[r.getAttribute("sid")]=r.nodeName;break;case"scale":o=a(r.textContent),t.matrix.scale(Ee.fromArray(o)),t.transforms[r.getAttribute("sid")]=r.nodeName;break;case"extra":break;default:console.log(r)}}return Ne(t.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",t.id):Ke.nodes[t.id]=t,t}function Le(e){for(var t={id:s(e.getAttribute("url")),materials:{},skeletons:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"bind_material":for(var r=i.getElementsByTagName("instance_material"),a=0;a<r.length;a++){var o=r[a],l=o.getAttribute("symbol"),c=o.getAttribute("target");t.materials[l]=s(c)}break;case"skeleton":t.skeletons.push(s(i.textContent))}}return t}function Re(e,t){var n,r,a,o=[],s=[];for(n=0;n<e.length;n++){var l=e[n];if(Ne(l))Ce(Fe(l),t,o);else if(a=l,void 0!==Ke.visualScenes[a])for(var c=Ke.visualScenes[l].children,u=0;u<c.length;u++){var h=c[u];"JOINT"===h.type&&Ce(Fe(h.id),t,o)}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",l)}for(n=0;n<t.length;n++)for(u=0;u<o.length;u++)if((r=o[u]).bone.name===t[n].name){s[n]=r,r.processed=!0;break}for(n=0;n<o.length;n++)!1===(r=o[n]).processed&&(s.push(r),r.processed=!0);var d=[],p=[];for(n=0;n<s.length;n++)r=s[n],d.push(r.bone),p.push(r.boneInverse);return new i.Skeleton(d,p)}function Ce(e,t,n){e.traverse((function(e){if(!0===e.isBone){for(var r,a=0;a<t.length;a++){var o=t[a];if(o.name===e.name){r=o.boneInverse;break}}void 0===r&&(r=new i.Matrix4),n.push({bone:e,boneInverse:r,processed:!1})}}))}function Pe(e){for(var t,n=[],r=e.matrix,a=e.nodes,o=e.type,s=e.instanceCameras,l=e.instanceControllers,c=e.instanceLights,u=e.instanceGeometries,h=e.instanceNodes,d=0,f=a.length;d<f;d++)n.push(Fe(a[d]));for(d=0,f=s.length;d<f;d++){var m=ee(s[d]);null!==m&&n.push(m.clone())}for(d=0,f=l.length;d<f;d++)for(var g=l[d],v=(t=g.id,p(Ke.controllers[t],I)),y=Oe(de(v.id),g.materials),x=Re(g.skeletons,v.skin.joints),b=0,w=y.length;b<w;b++){var _;(_=y[b]).isSkinnedMesh&&(_.bind(x,v.skin.bindMatrix),_.normalizeSkinWeights()),n.push(_)}for(d=0,f=c.length;d<f;d++){var M=re(c[d]);null!==M&&n.push(M.clone())}for(d=0,f=u.length;d<f;d++)for(b=0,w=(y=Oe(de((g=u[d]).id),g.materials)).length;b<w;b++)n.push(y[b]);for(d=0,f=h.length;d<f;d++)n.push(Fe(h[d]).clone());if(0===a.length&&1===n.length)_=n[0];else for(_="JOINT"===o?new i.Bone:new i.Group,d=0;d<n.length;d++)_.add(n[d]);return _.name="JOINT"===o?e.sid:e.name,_.matrix.copy(r),_.matrix.decompose(_.position,_.quaternion,_.scale),_}var Ie=new i.MeshBasicMaterial({color:16711935});function De(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var a=t[e[i]];void 0===a?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",e[i]),n.push(Ie)):n.push(Y(a))}return n}function Oe(e,t){var n=[];for(var r in e){var a=e[r],o=De(a.materialKeys,t);0===o.length&&("lines"===r||"linestrips"===r?o.push(new i.LineBasicMaterial):o.push(new i.MeshPhongMaterial));var s=void 0!==a.data.attributes.skinIndex;if(s)for(var l=0,c=o.length;l<c;l++)o[l].skinning=!0;var u,h=1===o.length?o[0]:o;switch(r){case"lines":u=new i.LineSegments(a.data,h);break;case"linestrips":u=new i.Line(a.data,h);break;case"triangles":case"polylist":u=s?new i.SkinnedMesh(a.data,h):new i.Mesh(a.data,h)}n.push(u)}return n}function Ne(e){return void 0!==Ke.nodes[e]}function Fe(e){return p(Ke.nodes[e],Pe)}function Be(e){var t=new i.Group;t.name=e.name;for(var n=e.children,r=0;r<n.length;r++){var a=n[r];t.add(Fe(a.id))}return t}function ze(e){return p(Ke.visualScenes[e],Be)}if(0===e.length)return{scene:new i.Scene};var ke=(new DOMParser).parseFromString(e,"application/xml"),He=n(ke,"COLLADA")[0],Ue=ke.getElementsByTagName("parsererror")[0];if(void 0!==Ue){var Ge,je=n(Ue,"div")[0];return Ge=je?je.textContent:function(e){for(var t="",n=[e];n.length;){var i=n.shift();i.nodeType===Node.TEXT_NODE?t+=i.textContent:(t+="\n",n.push.apply(n,i.childNodes))}return t.trim()}(Ue),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",Ge),null}var Ve=He.getAttribute("version");console.log("THREE.ColladaLoader: File version",Ve);var We,qe=function(e){return{unit:c(n(e,"unit")[0]),upAxis:u(n(e,"up_axis")[0])}}(n(He,"asset")[0]),Xe=new i.TextureLoader(this.manager);Xe.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),i.TGALoader&&(We=new i.TGALoader(this.manager)).setPath(this.resourcePath||t);var Ze=[],Ye={},Je=0,Ke={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};h(He,"library_animations","animation",(function e(t){for(var n={sources:{},samplers:{},channels:{}},r=!1,a=0,o=t.childNodes.length;a<o;a++){var s,l=t.childNodes[a];if(1===l.nodeType)switch(l.nodeName){case"source":s=l.getAttribute("id"),n.sources[s]=ae(l);break;case"sampler":s=l.getAttribute("id"),n.samplers[s]=f(l);break;case"channel":s=l.getAttribute("target"),n.channels[s]=m(l);break;case"animation":e(l),r=!0;break;default:console.log(l)}}!1===r&&(Ke.animations[t.getAttribute("id")||i.MathUtils.generateUUID()]=n)})),h(He,"library_animation_clips","animation_clip",(function(e){for(var t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"instance_animation":t.animations.push(s(r.getAttribute("url")))}}Ke.clips[e.getAttribute("id")]=t})),h(He,"library_controllers","controller",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":t.id=s(r.getAttribute("source")),t.skin=R(r);break;case"morph":t.id=s(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}Ke.controllers[e.getAttribute("id")]=t})),h(He,"library_images","image",(function(e){var t={init_from:n(e,"init_from")[0].textContent};Ke.images[e.getAttribute("id")]=t})),h(He,"library_effects","effect",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"profile_COMMON":t.profile=N(r)}}Ke.effects[e.getAttribute("id")]=t})),h(He,"library_materials","material",(function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"instance_effect":t.url=s(r.getAttribute("url"))}}Ke.materials[e.getAttribute("id")]=t})),h(He,"library_cameras","camera",(function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"optics":t.optics=J(r)}}Ke.cameras[e.getAttribute("id")]=t})),h(He,"library_lights","light",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique_common":t=te(r)}}Ke.lights[e.getAttribute("id")]=t})),h(He,"library_geometries","geometry",(function(e){var t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},i=n(e,"mesh")[0];if(void 0!==i){for(var r=0;r<i.childNodes.length;r++){var a=i.childNodes[r];if(1===a.nodeType){var o=a.getAttribute("id");switch(a.nodeName){case"source":t.sources[o]=ae(a);break;case"vertices":t.vertices=oe(a);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",a.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push(se(a));break;default:console.log(a)}}}Ke.geometries[e.getAttribute("id")]=t}})),h(He,"library_nodes","node",Ae),h(He,"library_visual_scenes","visual_scene",(function(e){var t={name:e.getAttribute("name"),children:[]};!function(e){for(var t=e.getElementsByTagName("node"),n=0;n<t.length;n++){var i=t[n];!1===i.hasAttribute("id")&&i.setAttribute("id","three_default_"+Je++)}}(e);for(var i=n(e,"node"),r=0;r<i.length;r++)t.children.push(Ae(i[r]));Ke.visualScenes[e.getAttribute("id")]=t})),h(He,"library_kinematics_models","kinematics_model",(function(e){for(var t={name:e.getAttribute("name")||"",joints:{},links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"technique_common":fe(i,t)}}Ke.kinematicsModels[e.getAttribute("id")]=t})),h(He,"library_physics_models","physics_model",(function(e){for(var t={name:e.getAttribute("name")||"",rigidBodies:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"rigid_body":t.rigidBodies[i.getAttribute("name")]={},be(i,t.rigidBodies[i.getAttribute("name")])}}Ke.physicsModels[e.getAttribute("id")]=t})),h(He,"scene","instance_kinematics_scene",(function(e){for(var t={bindJointAxis:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"bind_joint_axis":t.bindJointAxis.push(_e(i))}}Ke.kinematicsScenes[s(e.getAttribute("url"))]=t})),d(Ke.animations,g),d(Ke.clips,A),d(Ke.controllers,I),d(Ke.images,D),d(Ke.effects,X),d(Ke.materials,Z),d(Ke.cameras,$),d(Ke.lights,ie),d(Ke.geometries,ce),d(Ke.visualScenes,Be),function(){var e=Ke.clips;if(!0===l(e)){if(!1===l(Ke.animations)){var t=[];for(var n in Ke.animations)for(var r=v(n),a=0,o=r.length;a<o;a++)t.push(r[a]);Ze.push(new i.AnimationClip("default",-1,t))}}else for(var n in e)Ze.push(L(n))}(),function(){var e=Object.keys(Ke.kinematicsModels)[0],t=Object.keys(Ke.kinematicsScenes)[0],n=Object.keys(Ke.visualScenes)[0];if(void 0!==e&&void 0!==t){for(var r,a=(r=e,p(Ke.kinematicsModels[r],pe)),o=function(e){return p(Ke.kinematicsScenes[e],Me)}(t),s=ze(n),l=o.bindJointAxis,c={},u=0,h=l.length;u<h;u++){var d=l[u],f=He.querySelector('[sid="'+d.target+'"]');if(f){var m=f.parentElement;v(d.jointIndex,m)}}var g=new i.Matrix4;Ye={joints:a&&a.joints,getJointValue:function(e){var t=c[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(e,t){var n=c[e];if(n){var r=n.joint;if(t>r.limits.max||t<r.limits.min)console.warn("THREE.ColladaLoader: Joint "+e+" value "+t+" outside of limits (min: "+r.limits.min+", max: "+r.limits.max+").");else if(r.static)console.warn("THREE.ColladaLoader: Joint "+e+" is static.");else{var a=n.object,o=r.axis,s=n.transforms;Te.identity();for(var l=0;l<s.length;l++){var u=s[l];if(u.sid&&-1!==u.sid.indexOf(e))switch(r.type){case"revolute":Te.multiply(g.makeRotationAxis(o,i.MathUtils.degToRad(t)));break;case"prismatic":Te.multiply(g.makeTranslation(o.x*t,o.y*t,o.z*t));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+r.type)}else switch(u.type){case"matrix":Te.multiply(u.obj);break;case"translate":Te.multiply(g.makeTranslation(u.obj.x,u.obj.y,u.obj.z));break;case"scale":Te.scale(u.obj);break;case"rotate":Te.multiply(g.makeRotationAxis(u.obj,u.angle))}}a.matrix.copy(Te),a.matrix.decompose(a.position,a.quaternion,a.scale),c[e].position=t}}else console.log("THREE.ColladaLoader: "+e+" does not exist.")}}}function v(e,t){var n=t.getAttribute("name"),i=a.joints[e];s.traverse((function(r){r.name===n&&(c[e]={object:r,transforms:Se(t),joint:i,position:i.zeroPosition})}))}}();var Qe=function(e){return ze(s(n(e,"instance_visual_scene")[0].getAttribute("url")))}(n(He,"scene")[0]);return Qe.animations=Ze,"Z_UP"===qe.upAxis&&Qe.quaternion.setFromEuler(new i.Euler(-Math.PI/2,0,0)),Qe.scale.multiplyScalar(qe.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Ze},kinematics:Ye,library:Ke,scene:Qe}}}),K=K=i.ColladaLoader;var Q={};const $=new P,ee=new I,te=new J,ne=new Y,ie=new K;Q=Q=function(e,t,n){if(void 0===e)return console.error("Invalid options provided to loadObj()");let i;switch((e=u._validate(e,_.prototype._defaults.loadObj)).type||(e.type="mtl"),e.type){case"mtl":i=$;break;case"gltf":case"glb":i=te;break;case"fbx":i=ne;break;case"dae":i=ie}ee.load(e.mtl,(function(r){r&&"mtl"==e.type&&(r.preload(),i.setMaterials(r)),i.load(e.obj,i=>{let r=[];switch(e.type){case"mtl":i=i.children[0];break;case"gltf":case"glb":case"dae":r=i.animations,i=i.scene;break;case"fbx":r=i.animations}i.animations=r;const a=u.types.rotation(e.rotation,[0,0,0]),o=u.types.scale(e.scale,[1,1,1]);i.rotation.set(a[0],a[1],a[2]),i.scale.set(o[0],o[1],o[2]),e.normalize&&i.traverse((function(e){if(e.isMesh){let t;"MeshStandardMaterial"==e.material.type?(e.material.metalness&&(e.material.metalness*=.1),e.material.glossiness&&(e.material.glossiness*=.25),t=new THREE.Color(12,12,12)):"MeshPhongMaterial"==e.material.type&&(e.material.shininess=.1,t=new THREE.Color(20,20,20)),e.material.specular&&e.material.specular.isColor&&(e.material.specular=t)}})),i.name="model";let s=_.prototype._makeGroup(i,e);_.prototype._addMethods(s),s.setAnchor(e.anchor),s.setCenter(e.adjustment),s.raycasted=e.raycasted,n(s),t(s),s.setFixedZoom(e.mapScale),s.idle()},()=>null,t=>{console.error("Could not load model file: "+e.obj+" \n "+t.stack),n("Error loading the model")})}),()=>null,e=>{console.warn("No material file found for SymbolLayer3D model "+m)})};var re,ae,oe,se,le={};function ce(e){e=u._validate(e,_.prototype._defaults.line);var t=u.lnglatsToWorld(e.geometry),n=u.normalizeVertices(t),r=u.flattenVectors(n.vertices),a=new i.LineGeometry;a.setPositions(r);let o=new i.LineMaterial({color:e.color,linewidth:e.width,dashed:!1,opacity:e.opacity});return o.resolution.set(window.innerWidth,window.innerHeight),o.isMaterial=!0,o.transparent=!0,o.depthWrite=!1,(ce=new i.Line2(a,o)).position.copy(n.position),ce.computeLineDistances(),ce}le=le=ce,i.LineSegmentsGeometry=function(){i.InstancedBufferGeometry.call(this),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new i.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new i.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))},i.LineSegmentsGeometry.prototype=Object.assign(Object.create(i.InstancedBufferGeometry.prototype),{constructor:i.LineSegmentsGeometry,isLineSegmentsGeometry:!0,applyMatrix4:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},setPositions:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new i.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new i.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},setColors:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new i.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new i.InterleavedBufferAttribute(n,3,3)),this},fromWireframeGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromEdgesGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromMesh:function(e){return this.fromWireframeGeometry(new i.WireframeGeometry(e.geometry)),this},fromLineSegments:function(e){var t=e.geometry;if(!t.isGeometry)return t.isBufferGeometry&&this.setPositions(t.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},computeBoundingBox:(ae=new i.Box3,function(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),ae.setFromBufferAttribute(t),this.boundingBox.union(ae))}),computeBoundingSphere:(re=new i.Vector3,function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var r=0,a=0,o=e.count;a<o;a++)re.fromBufferAttribute(e,a),r=Math.max(r,n.distanceToSquared(re)),re.fromBufferAttribute(t,a),r=Math.max(r,n.distanceToSquared(re));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}),toJSON:function(){},applyMatrix:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}),i.LineGeometry=function(){i.LineSegmentsGeometry.call(this),this.type="LineGeometry"},i.LineGeometry.prototype=Object.assign(Object.create(i.LineSegmentsGeometry.prototype),{constructor:i.LineGeometry,isLineGeometry:!0,setPositions:function(e){for(var t=e.length-3,n=new Float32Array(2*t),r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return i.LineSegmentsGeometry.prototype.setPositions.call(this,n),this},setColors:function(e){for(var t=e.length-3,n=new Float32Array(2*t),r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return i.LineSegmentsGeometry.prototype.setColors.call(this,n),this},fromLine:function(e){var t=e.geometry;if(!t.isGeometry)return t.isBufferGeometry&&this.setPositions(t.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},copy:function(){return this}}),i.WireframeGeometry2=function(e){i.LineSegmentsGeometry.call(this),this.type="WireframeGeometry2",this.fromWireframeGeometry(new i.WireframeGeometry(e))},i.WireframeGeometry2.prototype=Object.assign(Object.create(i.LineSegmentsGeometry.prototype),{constructor:i.WireframeGeometry2,isWireframeGeometry2:!0}),i.UniformsLib.line={linewidth:{value:1},resolution:{value:new i.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},i.ShaderLib.line={uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,i.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},i.LineMaterial=function(e){i.ShaderMaterial.call(this,{type:"LineMaterial",uniforms:i.UniformsUtils.clone(i.ShaderLib.line.uniforms),vertexShader:i.ShaderLib.line.vertexShader,fragmentShader:i.ShaderLib.line.fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)},i.LineMaterial.prototype=Object.create(i.ShaderMaterial.prototype),i.LineMaterial.prototype.constructor=i.LineMaterial,i.LineMaterial.prototype.isLineMaterial=!0,i.LineSegments2=function(e,t){void 0===e&&(e=new i.LineSegmentsGeometry),void 0===t&&(t=new i.LineMaterial({color:16777215*Math.random()})),i.Mesh.call(this,e,t),this.type="LineSegments2"},i.LineSegments2.prototype=Object.assign(Object.create(i.Mesh.prototype),{constructor:i.LineSegments2,isLineSegments2:!0,computeLineDistances:(oe=new i.Vector3,se=new i.Vector3,function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.data.count),a=0,o=0,s=t.data.count;a<s;a++,o+=2)oe.fromBufferAttribute(t,a),se.fromBufferAttribute(n,a),r[o]=0===o?0:r[o-1],r[o+1]=r[o]+oe.distanceTo(se);var l=new i.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(l,1,1)),this}),raycast:function(){var e=new i.Vector4,t=new i.Vector4,n=new i.Vector4,r=new i.Vector3,a=new i.Matrix4,o=new i.Line3,s=new i.Vector3;return function(l,c){null===l.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var u=void 0!==l.params.Line2&&l.params.Line2.threshold||0,h=l.ray,d=l.camera,p=d.projectionMatrix,f=this.geometry,m=this.material,g=m.resolution,v=m.linewidth+u,y=f.attributes.instanceStart,x=f.attributes.instanceEnd,b=-d.near;h.at(1,n),n.w=1,n.applyMatrix4(d.matrixWorldInverse),n.applyMatrix4(p),n.multiplyScalar(1/n.w),n.x*=g.x/2,n.y*=g.y/2,n.z=0,r.copy(n);var w=this.matrixWorld;a.multiplyMatrices(d.matrixWorldInverse,w);for(var _=0,M=y.count;_<M;_++)if(e.fromBufferAttribute(y,_),t.fromBufferAttribute(x,_),e.w=1,t.w=1,e.applyMatrix4(a),t.applyMatrix4(a),!(e.z>b&&t.z>b)){if(e.z>b){const n=e.z-t.z,i=(e.z-b)/n;e.lerp(t,i)}else if(t.z>b){const n=t.z-e.z,i=(t.z-b)/n;t.lerp(e,i)}e.applyMatrix4(p),t.applyMatrix4(p),e.multiplyScalar(1/e.w),t.multiplyScalar(1/t.w),e.x*=g.x/2,e.y*=g.y/2,t.x*=g.x/2,t.y*=g.y/2,o.start.copy(e),o.start.z=0,o.end.copy(t),o.end.z=0;var S=o.closestPointToPointParameter(r,!0);o.at(S,s);var T=i.MathUtils.lerp(e.z,t.z,S),E=T>=-1&&T<=1,A=r.distanceTo(s)<.5*v;if(E&&A){o.start.fromBufferAttribute(y,_),o.end.fromBufferAttribute(x,_),o.start.applyMatrix4(w),o.end.applyMatrix4(w);var L=new i.Vector3,R=new i.Vector3;h.distanceSqToSegment(o.start,o.end,R,L),c.push({point:R,pointOnLine:L,distance:h.origin.distanceTo(R),object:this,face:null,faceIndex:_,uv:null,uv2:null})}}}}()}),i.Line2=function(e,t){void 0===e&&(e=new i.LineGeometry),void 0===t&&(t=new i.LineMaterial({color:16777215*Math.random()})),i.LineSegments2.call(this,e,t),this.type="Line2"},i.Line2.prototype=Object.assign(Object.create(i.LineSegments2.prototype),{constructor:i.Line2,isLine2:!0}),i.Wireframe=function(e,t){i.Mesh.call(this),this.type="Wireframe",this.geometry=void 0!==e?e:new i.LineSegmentsGeometry,this.material=void 0!==t?t:new i.LineMaterial({color:16777215*Math.random()})},i.Wireframe.prototype=Object.assign(Object.create(i.Mesh.prototype),{constructor:i.Wireframe,isWireframe:!0,computeLineDistances:function(){var e=new i.Vector3,t=new i.Vector3;return function(){for(var n=this.geometry,r=n.attributes.instanceStart,a=n.attributes.instanceEnd,o=new Float32Array(2*r.data.count),s=0,l=0,c=r.data.count;s<c;s++,l+=2)e.fromBufferAttribute(r,s),t.fromBufferAttribute(a,s),o[l]=0===l?0:o[l-1],o[l+1]=o[l]+e.distanceTo(t);var u=new i.InstancedInterleavedBuffer(o,2,1);return n.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(u,1,0)),n.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(u,1,1)),this}}()});var ue={};ue=ue=function(e,t){e=u._validate(e,_.prototype._defaults.tube);let n=[];e.geometry.forEach(e=>{n.push(new i.Vector3(e[0],e[1],e[2]))});const r=new i.CatmullRomCurve3(n);let a=new i.TubeGeometry(r,n.length,e.radius,e.sides,!1),o=g(e),s=new i.Mesh(a,o);return new T({obj:s,units:e.units,anchor:e.anchor,adjustment:e.adjustment,bbox:e.bbox,tooltip:e.tooltip,raycasted:e.raycasted})};var he={};he=he=function(e){this.map=e,this.renderer=new w.CSS2DRenderer,this.renderer.setSize(this.map.getCanvas().clientWidth,this.map.getCanvas().clientHeight),this.renderer.domElement.style.position="absolute",this.renderer.domElement.id="labelCanvas",this.renderer.domElement.style.top=0,this.renderer.domElement.style.zIndex="0",this.map.getCanvasContainer().appendChild(this.renderer.domElement),this.scene,this.camera,this.dispose=function(){this.map.getCanvasContainer().removeChild(this.renderer.domElement),this.renderer.domElement.remove(),this.renderer={}},this.setSize=function(e,t){this.renderer.setSize(e,t)},this.map.on("resize",function(){this.renderer.setSize(this.map.getCanvas().clientWidth,this.map.getCanvas().clientHeight)}.bind(this)),this.state={reset:function(){}},this.render=async function(e,t){return this.scene=e,this.camera=t,new Promise(n=>{n(this.renderer.render(e,t))})},this.toggleLabels=async function(e,t){return new Promise(n=>{n(this.setVisibility(e,t,this.scene,this.camera,this.renderer))})},this.setVisibility=function(e,t,n,i,r){this.renderer.cacheList.forEach((function(a){a.visible!=t&&a.layer===e&&(t&&a.alwaysVisible||!t)&&(a.visible=t,r.renderObject(a,n,i))}))}};var de={};de=de=class{constructor(e,t){this.id=e.layerId,this.type="custom",this.renderingMode="3d",this.opacity=.5,this.buildingsLayerId=e.buildingsLayerId,this.minAltitude=e.minAltitude||.1,this.tb=t}onAdd(e,t){this.map=e;const n=t.createShader(t.VERTEX_SHADER);t.shaderSource(n,"\n\t\t\tuniform mat4 u_matrix;\n\t\t\tuniform float u_height_factor;\n\t\t\tuniform float u_altitude;\n\t\t\tuniform float u_azimuth;\n\t\t\tattribute vec2 a_pos;\n\t\t\tattribute vec4 a_normal_ed;\n\t\t\tattribute lowp vec2 a_base;\n\t\t\tattribute lowp vec2 a_height;\n\t\t\tvoid main() {\n\t\t\t\tfloat base = max(0.0, a_base.x);\n\t\t\t\tfloat height = max(0.0, a_height.x);\n\t\t\t\tfloat t = mod(a_normal_ed.x, 2.0);\n\t\t\t\tvec4 pos = vec4(a_pos, t > 0.0 ? height : base, 1);\n\t\t\t\tfloat len = pos.z * u_height_factor / tan(u_altitude);\n\t\t\t\tpos.x += cos(u_azimuth) * len;\n\t\t\t\tpos.y += sin(u_azimuth) * len;\n\t\t\t\tpos.z = 0.0;\n\t\t\t\tgl_Position = u_matrix * pos;\n\t\t\t}\n\t\t\t"),t.compileShader(n);const i=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(i,"\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = vec4(0.0, 0.0, 0.0, 0.7);\n\t\t\t}\n\t\t\t"),t.compileShader(i),this.program=t.createProgram(),t.attachShader(this.program,n),t.attachShader(this.program,i),t.linkProgram(this.program),t.validateProgram(this.program),this.uMatrix=t.getUniformLocation(this.program,"u_matrix"),this.uHeightFactor=t.getUniformLocation(this.program,"u_height_factor"),this.uAltitude=t.getUniformLocation(this.program,"u_altitude"),this.uAzimuth=t.getUniformLocation(this.program,"u_azimuth"),this.aPos=t.getAttribLocation(this.program,"a_pos"),this.aNormal=t.getAttribLocation(this.program,"a_normal_ed"),this.aBase=t.getAttribLocation(this.program,"a_base"),this.aHeight=t.getAttribLocation(this.program,"a_height")}render(e,t){e.useProgram(this.program);const n=this.map.style.sourceCaches.composite,i=n.getVisibleCoordinates().reverse(),r=this.map.getLayer(this.buildingsLayerId),a=this.map.painter.context,{lng:o,lat:s}=this.map.getCenter(),l=this.tb.getSunPosition(this.tb.lightDateTime,[o,s]);e.uniform1f(this.uAltitude,l.altitude>this.minAltitude?l.altitude:0),e.uniform1f(this.uAzimuth,l.azimuth+3*Math.PI/2),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.getExtension("EXT_blend_minmax"),e.disable(e.DEPTH_TEST);for(const c of i){const t=n.getTile(c),i=t.getBucket(r);if(!i)continue;const[o,s]=i.programConfigurations.programConfigurations[this.buildingsLayerId]._buffers;e.uniformMatrix4fv(this.uMatrix,!1,c.posMatrix),e.uniform1f(this.uHeightFactor,Math.pow(2,c.overscaledZ)/t.tileSize/8);for(const n of i.segments.get()){const t=a.currentNumAttributes||0,r=2;for(let n=r;n<t;n++)e.disableVertexAttribArray(n);const l=n.vertexOffset||0;e.enableVertexAttribArray(this.aPos),e.enableVertexAttribArray(this.aNormal),e.enableVertexAttribArray(this.aHeight),e.enableVertexAttribArray(this.aBase),i.layoutVertexBuffer.bind(),e.vertexAttribPointer(this.aPos,2,e.SHORT,!1,12,12*l),e.vertexAttribPointer(this.aNormal,4,e.SHORT,!1,12,4+12*l),o.bind(),e.vertexAttribPointer(this.aHeight,1,e.FLOAT,!1,4,4*l),s.bind(),e.vertexAttribPointer(this.aBase,1,e.FLOAT,!1,4,4*l),i.indexBuffer.bind(),a.currentNumAttributes=r,e.drawElements(e.TRIANGLES,3*n.primitiveLength,e.UNSIGNED_SHORT,3*n.primitiveOffset*2)}}}};var pe={};function fe(e,t,n){this.init(e,t,n)}fe.prototype={repaint:function(){this.map.repaint=!0},init:function(e,t,n){this.options=u._validate(n||{},me),this.map=e,this.map.tb=this,this.objects=new _,this.renderer=new i.WebGLRenderer({alpha:!0,antialias:!0,preserveDrawingBuffer:n.preserveDrawingBuffer,canvas:e.getCanvas(),context:t}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.map.getCanvas().clientWidth,this.map.getCanvas().clientHeight),this.renderer.outputEncoding=i.sRGBEncoding,this.renderer.autoClear=!1,this.labelRenderer=new he(this.map),this.scene=new i.Scene,this.world=new i.Group,this.world.name="world",this.scene.add(this.world),this.objectsCache=new Map,this.zoomLayers=[],this.fov=this.options.fov,this.orthographic=this.options.orthographic||!1,this.raycaster=new i.Raycaster,this.raycaster.layers.set(0),this.mapCenter=this.map.getCenter(),this.mapCenterUnits=u.projectToWorld([this.mapCenter.lng,this.mapCenter.lat]),this.lightDateTime=new Date,this.lightLng=this.mapCenter.lng,this.lightLat=this.mapCenter.lat,this.sunPosition,this.rotationStep=5,this.gridStep=6,this.altitudeStep=.1,this.lights=this.initLights,this.options.defaultLights&&this.defaultLights(),this.options.realSunlight&&this.realSunlight(this.options.realSunlightHelper),this.skyLayerName="sky-layer",this.sky=this.options.sky,this.enableSelectingFeatures=this.options.enableSelectingFeatures||!1,this.enableSelectingObjects=this.options.enableSelectingObjects||!1,this.enableDraggingObjects=this.options.enableDraggingObjects||!1,this.enableRotatingObjects=this.options.enableRotatingObjects||!1,this.enableTooltips=this.options.enableTooltips||!1,this.multiLayer=this.options.multiLayer||!1,this.map.on("style.load",(function(){this.tb.zoomLayers=[],this.tb.options.multiLayer&&this.addLayer({id:"threebox_layer",type:"custom",renderingMode:"3d",map:this,onAdd:function(e,t){},render:function(e,t){this.map.tb.update()}}),this.tb.sky&&this.tb.createSkyLayer()})),this.map.on("load",(function(){let t;this.selectedObject,this.selectedFeature,this.draggedObject,this.overedObject,this.overedFeature;let n,i=this.getCanvasContainer();this.getCanvasContainer().style.cursor="default";let r,a,o,s,l=[];function c(e){var t=i.getBoundingClientRect();return{x:e.originalEvent.clientX-t.left-i.clientLeft,y:e.originalEvent.clientY-t.top-i.clientTop}}this.unselectObject=function(){this.selectedObject.selected=!1,this.selectedObject=null},this.outObject=function(){this.overedObject.over=!1,this.overedObject=null},this.unselectFeature=function(e){void 0!==e.id&&(this.setFeatureState({source:e.source,sourceLayer:e.sourceLayer,id:e.id},{select:!1}),this.removeTooltip(e),(e=this.queryRenderedFeatures({layers:[e.layer.id],filter:["==",["id"],e.id]})[0])&&this.fire("SelectedFeatureChange",{detail:e}),this.selectedFeature=null)},this.selectFeature=function(e){this.selectedFeature=e,this.setFeatureState({source:this.selectedFeature.source,sourceLayer:this.selectedFeature.sourceLayer,id:this.selectedFeature.id},{select:!0}),this.selectedFeature=this.queryRenderedFeatures({layers:[this.selectedFeature.layer.id],filter:["==",["id"],this.selectedFeature.id]})[0],this.addTooltip(this.selectedFeature),this.fire("SelectedFeatureChange",{detail:this.selectedFeature})},this.outFeature=function(t){this.overedFeature&&void 0!==this.overedFeature&&this.overedFeature.id!=t&&(e.setFeatureState({source:this.overedFeature.source,sourceLayer:this.overedFeature.sourceLayer,id:this.overedFeature.id},{hover:!1}),this.removeTooltip(this.overedFeature),this.overedFeature=null)},this.addTooltip=function(e){if(!this.tb.enableTooltips)return;let t=this.tb.getFeatureCenter(e),n=this.tb.tooltip({text:e.properties.name||e.id||e.type,mapboxStyle:!0,feature:e});n.setCoords(t),this.tb.add(n,e.layer.id),e.tooltip=n,e.tooltip.tooltip.visible=!0},this.removeTooltip=function(e){e.tooltip&&(e.tooltip.visibility=!1,this.tb.remove(e.tooltip),e.tooltip=null)},e.onContextMenu=function(e){alert("contextMenu")},this.onClick=function(t){let n,i=[];if(e.tb.enableSelectingObjects&&(i=this.tb.queryRenderedFeatures(t.point)),n="object"==typeof i[0]){let e=fe.prototype.findParent3DObject(i[0]);if(e){if(this.selectedFeature&&this.unselectFeature(this.selectedFeature),this.selectedObject){if(this.selectedObject.uuid!=e.uuid)this.selectedObject.selected=!1,e.selected=!0,this.selectedObject=e;else if(this.selectedObject.uuid==e.uuid)return void this.unselectObject()}else this.selectedObject=e,this.selectedObject.selected=!0;this.selectedObject.dispatchEvent({type:"Wireframed",detail:this.selectedObject}),this.selectedObject.dispatchEvent({type:"IsPlayingChanged",detail:this.selectedObject}),this.repaint=!0,t.preventDefault()}}else{let n=[];if(e.tb.enableSelectingFeatures&&(n=this.queryRenderedFeatures(t.point)),n.length>0&&"fill-extrusion"==n[0].layer.type&&void 0!==n[0].id)if(this.selectedObject&&this.unselectObject(),this.selectedFeature){if(this.selectedFeature.id!=n[0].id)this.unselectFeature(this.selectedFeature),this.selectFeature(n[0]);else if(this.selectedFeature.id==n[0].id)return void this.unselectFeature(this.selectedFeature)}else this.selectFeature(n[0])}},this.onMouseMove=function(i){let l,u=c(i);if(this.getCanvasContainer().style.cursor="default",i.originalEvent.altKey&&this.draggedObject){if(!e.tb.enableRotatingObjects)return;t="rotate",this.getCanvasContainer().style.cursor="move",Math.min(n.x,u.x),Math.max(n.x,u.x),Math.min(n.y,u.y),Math.max(n.y,u.y);let i={x:0,y:0,z:Math.round(s[2]+~~((u.x-n.x)/this.tb.rotationStep)%360*this.tb.rotationStep%360)};return this.draggedObject.setRotation(i),void this.draggedObject.addHelp("rot: "+i.z+"&#176;")}if(i.originalEvent.shiftKey&&this.draggedObject){if(!e.tb.enableDraggingObjects)return;t="translate",this.getCanvasContainer().style.cursor="move";let n=i.lngLat,o=[Number((n.lng+r).toFixed(this.tb.gridStep)),Number((n.lat+a).toFixed(this.tb.gridStep)),this.draggedObject.modelHeight];return this.draggedObject.setCoords(o),void this.draggedObject.addHelp("lng: "+o[0]+"&#176;, lat: "+o[1]+"&#176;")}if(i.originalEvent.ctrlKey&&this.draggedObject){if(!e.tb.enableDraggingObjects)return;t="altitude",this.getCanvasContainer().style.cursor="move";let n=i.point.y*this.tb.altitudeStep,r=[this.draggedObject.coordinates[0],this.draggedObject.coordinates[1],Number((-n-o).toFixed(this.tb.gridStep))];return this.draggedObject.setCoords(r),void this.draggedObject.addHelp("alt: "+r[2]+"m")}let h=[];if(e.tb.enableSelectingObjects&&(h=this.tb.queryRenderedFeatures(i.point)),l="object"==typeof h[0]){let e=fe.prototype.findParent3DObject(h[0]);e&&(this.outFeature(this.overedFeature),this.getCanvasContainer().style.cursor="pointer",this.selectedObject&&e.uuid==this.selectedObject.uuid||(this.overedObject&&this.overedObject.uuid!=e.uuid&&this.outObject(),e.over=!0,this.overedObject=e),this.repaint=!0,i.preventDefault())}else{this.overedObject&&this.outObject();let t=[];e.tb.enableSelectingFeatures&&(t=this.queryRenderedFeatures(i.point)),t.length>0&&(this.outFeature(t[0]),"fill-extrusion"==t[0].layer.type&&void 0!==t[0].id&&(this.selectedFeature&&this.selectedFeature.id==t[0].id||(this.getCanvasContainer().style.cursor="pointer",this.overedFeature=t[0],this.setFeatureState({source:this.overedFeature.source,sourceLayer:this.overedFeature.sourceLayer,id:this.overedFeature.id},{hover:!0}),this.overedFeature=e.queryRenderedFeatures({layers:[this.overedFeature.layer.id],filter:["==",["id"],this.overedFeature.id]})[0],this.addTooltip(this.overedFeature))))}},this.onMouseDown=function(t){(t.originalEvent.shiftKey||t.originalEvent.altKey||t.originalEvent.ctrlKey)&&0===t.originalEvent.button&&this.selectedObject&&(e.tb.enableDraggingObjects||e.tb.enableRotatingObjects)&&(t.preventDefault(),e.getCanvasContainer().style.cursor="move",e.once("mouseup",this.onMouseUp),this.draggedObject=this.selectedObject,n=c(t),l=this.draggedObject.coordinates,s=u.degreeify(this.draggedObject.rotation),r=l[0]-t.lngLat.lng,a=l[1]-t.lngLat.lat,o=-this.draggedObject.modelHeight-t.point.y*this.tb.altitudeStep)},this.onMouseUp=function(e){this.getCanvasContainer().style.cursor="default",this.off("mouseup",this.onMouseUp),this.off("mouseout",this.onMouseUp),this.dragPan.enable(),this.draggedObject&&(this.draggedObject.dispatchEvent({type:"ObjectDragged",detail:{draggedObject:this.draggedObject,draggedAction:t}}),this.draggedObject.removeHelp(),this.draggedObject=null,t=null)},this.onMouseOut=function(e){if(this.overedFeature){let t=this.queryRenderedFeatures(e.point);t.length>0&&this.overedFeature.id!=t[0].id&&(this.getCanvasContainer().style.cursor="default",this.outFeature(t[0]))}},this.onZoom=function(e){this.tb.zoomLayers.forEach(e=>{this.tb.toggleLayer(e)}),this.tb.world.children.filter(e=>null!=e.fixedZoom).forEach(e=>{e.setObjectScale(this.transform.scale)})};let h=!1,d=!1;this.on("click",this.onClick),this.on("mousemove",this.onMouseMove),this.on("mouseout",this.onMouseOut),this.on("mousedown",this.onMouseDown),this.on("zoom",this.onZoom),document.addEventListener("keydown",function(e){17!==e.which&&91!==e.which||(h=!0),16===e.which&&(d=!0);let t=this.selectedObject;if(d&&83===e.which&&t){let e=u.toDecimal;if(t.help)t.removeHelp();else{let n=t.modelSize,i=1;"meters"!==t.userData.units&&((i=u.projectedUnitsPerMeter(t.coordinates[1]))||(i=1),i=e(i,7)),t.addHelp("size(m): "+e(n.x/i,3)+" W, "+e(n.y/i,3)+" L, "+e(n.z/i,3)+" H"),this.repaint=!0}return!1}}.bind(this),!0),document.addEventListener("keyup",function(e){17!=e.which&&91!=e.which||(h=!1),16===e.which&&(d=!1)}.bind(this))}))},get sky(){return this.options.sky},set sky(e){e!=this.sky&&(e?this.createSkyLayer():this.removeLayer(this.skyLayerName),this.options.sky=e)},get fov(){return this.options.fov},set fov(e){this.camera instanceof i.PerspectiveCamera&&this.options.fov!==e&&(this.map.transform.fov=e,this.camera.fov=this.map.transform.fov,this.cameraSync.setupCamera(),this.map.repaint=!0,this.options.fov=e)},get orthographic(){return this.options.orthographic},set orthographic(e){const t=this.map.getCanvas().clientHeight,n=this.map.getCanvas().clientWidth;e?(this.map.transform.fov=0,this.camera=new i.OrthographicCamera(n/-2,n/2,t/2,t/-2,.1,1e21)):(this.map.transform.fov=this.fov,this.camera=new i.PerspectiveCamera(this.map.transform.fov,n/t,.1,1e21)),this.camera.layers.enable(0),this.camera.layers.enable(1),this.cameraSync=new d(this.map,this.camera,this.world),this.map.repaint=!0,this.options.orthographic=e},createSkyLayer:function(){this.map.getLayer(this.skyLayerName)||this.map.addLayer({id:this.skyLayerName,type:"sky",paint:{"sky-opacity":["interpolate",["linear"],["zoom"],0,0,5,.3,8,1],"sky-type":"atmosphere","sky-atmosphere-sun":this.getSunSky(this.lightDateTime),"sky-atmosphere-sun-intensity":10}})},sphere:function(e){return this.setDefaultView(e,this.options),E(e,this.world)},line:le,label:R,tooltip:C,tube:function(e){return this.setDefaultView(e,this.options),ue(e,this.world)},extrusion:function(e){return this.setDefaultView(e,this.options),A(e)},Object3D:function(e){return this.setDefaultView(e,this.options),T(e)},loadObj:async function(e,t){this.setDefaultView(e,this.options);let n=this.objectsCache.get(e.obj);n?n.promise.then(n=>{t(n.duplicate(e))}).catch(t=>{this.objectsCache.delete(e.obj),console.error("Could not load model file: "+e.obj)}):this.objectsCache.set(e.obj,{promise:new Promise(async(n,i)=>{Q(e,t,async e=>{e.duplicate?n(e.duplicate()):i(e)})})})},material:function(e){return g(e)},initLights:{ambientLight:null,dirLight:null,dirLightBack:null,dirLightHelper:null,hemiLight:null,pointLight:null},utils:u,SunCalc:f,Constants:r,projectToWorld:function(e){return this.utils.projectToWorld(e)},unprojectFromWorld:function(e){return this.utils.unprojectFromWorld(e)},projectedUnitsPerMeter:function(e){return this.utils.projectedUnitsPerMeter(e)},getFeatureCenter:function(e,t,n){return u.getFeatureCenter(e,t,n)},getObjectHeightOnFloor:function(e,t,n){return u.getObjectHeightOnFloor(e,t,n)},queryRenderedFeatures:function(e){let t=new i.Vector2;return t.x=e.x/this.map.transform.width*2-1,t.y=1-e.y/this.map.transform.height*2,this.raycaster.setFromCamera(t,this.camera),this.raycaster.intersectObjects(this.world.children,!0)},findParent3DObject:function(e){var t;return e.object.traverseAncestors((function(e){e.parent&&"Group"==e.parent.type&&e.userData.obj&&(t=e)})),t},setLayoutProperty:function(e,t,n){this.map.setLayoutProperty(e,t,n),null==n||"visibility"!==t||this.world.children.forEach((function(t){t.layer===e&&(t.visibility=n)}))},setLayerZoomRange:function(e,t,n){this.map.getLayer(e)&&(this.map.setLayerZoomRange(e,t,n),this.zoomLayers.includes(e)||this.zoomLayers.push(e),this.toggleLayer(e))},setLayerHeigthProperty:function(e,t){let n=this.map.getLayer(e);if(n)if("fill-extrusion"==n.type){let e=this.map.getStyle().sources[n.source].data;e.features.forEach((function(e){e.properties.level=t})),this.map.getSource(n.source).setData(e)}else"custom"==n.type&&this.world.children.forEach((function(n){let i=n.userData.feature;if(i&&i.layer===e){let e=this.tb.getFeatureCenter(i,n,t);n.setCoords(e)}}))},setStyle:function(e,t){this.clear().then(()=>{this.map.setStyle(e,t)})},toggleLayer:function(e,t=!0){let n=this.map.getLayer(e);if(n){if(!t)return void this.toggle(n.id,!1);let e=this.map.getZoom();if(n.minzoom&&e<n.minzoom)return void this.toggle(n.id,!1);if(n.maxzoom&&e>=n.maxzoom)return void this.toggle(n.id,!1);this.toggle(n.id,!0)}},toggle:function(e,t){this.setLayoutProperty(e,"visibility",t?"visible":"none"),this.labelRenderer.toggleLabels(e,t)},update:function(){this.map.repaint&&(this.map.repaint=!1);var e=Date.now();this.objects.animationManager.update(e),this.updateLightHelper(),this.renderer.resetState(),this.renderer.render(this.scene,this.camera),this.labelRenderer.render(this.scene,this.camera),!1===this.options.passiveRendering&&this.map.triggerRepaint()},add:function(e,t,n){if(!this.enableTooltips&&e.tooltip&&(e.tooltip.visibility=!1),this.world.add(e),t){e.layer=t,e.source=n;let i=this.map.getLayer(t);if(i){let t=i.visibility,n=void 0===t;e.visibility=!(!n&&"visible"!==t)}}},removeByName:function(e){let t=this.world.getObjectByName(e);t&&this.remove(t)},remove:function(e){this.map.selectedObject&&e.uuid==this.map.selectedObject.uuid&&this.map.unselectObject(),this.map.draggedObject&&e.uuid==this.map.draggedObject.uuid&&(this.map.draggedObject=null),e.dispose&&e.dispose(),this.world.remove(e),e=null},clear:async function(e=null,t=!1){return new Promise((n,i)=>{let r=[];this.world.children.forEach((function(e){r.push(e)}));for(let t=0;t<r.length;t++){let n=r[t];n.layer!==e&&e||this.remove(n)}t&&this.objectsCache.forEach(e=>{e.promise.then(e=>{e.dispose(),e=null})}),n("clear")})},removeLayer:function(e){this.clear(e,!0).then(()=>{this.map.removeLayer(e)})},getSunPosition:function(e,t){return f.getPosition(e||Date.now(),t[1],t[0])},getSunTimes:function(e,t){return f.getTimes(e,t[1],t[0],t[2]?t[2]:0)},setBuildingShadows:function(e){if(this.map.getLayer(e.buildingsLayerId)){let t=new de(e,this);this.map.addLayer(t,e.buildingsLayerId)}else console.warn("The layer '"+e.buildingsLayerId+"' does not exist in the map.")},setSunlight:function(e=new Date,t){if(!this.lights.dirLight||!this.options.realSunlight)return void console.warn("To use setSunlight it's required to set realSunlight : true in Threebox initial options.");var n=new Date(e.getTime());if(t?t.lng&&t.lat?this.mapCenter=t:this.mapCenter={lng:t[0],lat:t[1]}:this.mapCenter=this.map.getCenter(),this.lightDateTime&&this.lightDateTime.getTime()===n.getTime()&&this.lightLng===this.mapCenter.lng&&this.lightLat===this.mapCenter.lat)return;this.lightDateTime=n,this.lightLng=this.mapCenter.lng,this.lightLat=this.mapCenter.lat,this.sunPosition=this.getSunPosition(n,[this.mapCenter.lng,this.mapCenter.lat]);let i=this.sunPosition.altitude,a=Math.PI+this.sunPosition.azimuth,o=r.WORLD_SIZE/2,s=Math.sin(i),l=Math.cos(i),c=Math.cos(a)*l,u=Math.sin(a)*l;this.lights.dirLight.position.set(u,c,s),this.lights.dirLight.position.multiplyScalar(o),this.lights.dirLight.intensity=Math.max(s,-.15),this.lights.dirLight.updateMatrixWorld(),this.updateLightHelper(),this.map.loaded()&&(this.map.setLight({anchor:"map",position:[3,180+180*this.sunPosition.azimuth/Math.PI,90-180*this.sunPosition.altitude/Math.PI],intensity:Math.cos(this.sunPosition.altitude),color:`hsl(40, ${50*Math.cos(this.sunPosition.altitude)}%, ${Math.max(20,20+96*Math.sin(this.sunPosition.altitude))}%)`},{duration:0}),this.sky&&this.updateSunSky(this.getSunSky(n,this.sunPosition)))},getSunSky:function(e,t){if(!t){var n=this.map.getCenter();t=this.getSunPosition(e||Date.now(),[n.lng,n.lat])}return[180+180*t.azimuth/Math.PI,90-180*t.altitude/Math.PI]},updateSunSky:function(e){this.sky&&this.map.setPaintProperty(tb.skyLayerName,"sky-atmosphere-sun",e)},updateLightHelper:function(){this.lights.dirLightHelper&&(this.lights.dirLightHelper.position.setFromMatrixPosition(this.lights.dirLight.matrixWorld),this.lights.dirLightHelper.updateMatrix(),this.lights.dirLightHelper.update())},dispose:async function(){return console.log(this.memory()),new Promise(e=>{e(this.clear(null,!0).then(e=>(this.map.remove(),this.map={},this.scene.remove(this.world),this.world.children=[],this.world=null,this.objectsCache.clear(),this.labelRenderer.dispose(),console.log(this.memory()),this.renderer.dispose(),e)))})},defaultLights:function(){this.lights.ambientLight=new i.AmbientLight(new i.Color("hsl(0, 0%, 100%)"),.75),this.scene.add(this.lights.ambientLight),this.lights.dirLightBack=new i.DirectionalLight(new i.Color("hsl(0, 0%, 100%)"),.25),this.lights.dirLightBack.position.set(30,100,100),this.scene.add(this.lights.dirLightBack),this.lights.dirLight=new i.DirectionalLight(new i.Color("hsl(0, 0%, 100%)"),.25),this.lights.dirLight.position.set(-30,100,-100),this.scene.add(this.lights.dirLight)},realSunlight:function(e=!1){this.renderer.shadowMap.enabled=!0,this.lights.dirLight=new i.DirectionalLight(16777215,1),this.scene.add(this.lights.dirLight),e&&(this.lights.dirLightHelper=new i.DirectionalLightHelper(this.lights.dirLight,5),this.scene.add(this.lights.dirLightHelper)),this.lights.dirLight.castShadow=!0,this.lights.dirLight.shadow.radius=2,this.lights.dirLight.shadow.mapSize.width=8192,this.lights.dirLight.shadow.mapSize.height=8192,this.lights.dirLight.shadow.camera.top=this.lights.dirLight.shadow.camera.right=1e3,this.lights.dirLight.shadow.camera.bottom=this.lights.dirLight.shadow.camera.left=-1e3,this.lights.dirLight.shadow.camera.near=1,this.lights.dirLight.shadow.camera.visible=!0,this.lights.dirLight.shadow.camera.far=4e8,this.lights.hemiLight=new i.HemisphereLight(new i.Color(16777215),new i.Color(16777215),.6),this.lights.hemiLight.color.setHSL(.661,.96,.12),this.lights.hemiLight.groundColor.setHSL(.11,.96,.14),this.lights.hemiLight.position.set(0,0,50),this.scene.add(this.lights.hemiLight),this.setSunlight()},setDefaultView:function(e,t){e.bbox=(e.bbox||null==e.bbox)&&t.enableSelectingObjects,e.tooltip=(e.tooltip||null==e.tooltip)&&t.enableTooltips,e.mapScale=this.map.transform.scale},memory:function(){return this.renderer.info.memory},programs:function(){return this.renderer.info.programs.length},version:"2.2.2"};var me={defaultLights:!1,realSunlight:!1,realSunlightHelper:!1,passiveRendering:!0,preserveDrawingBuffer:!1,enableSelectingFeatures:!1,enableSelectingObjects:!1,enableDraggingObjects:!1,enableRotatingObjects:!1,enableTooltips:!1,multiLayer:!1,orthographic:!1,fov:r.FOV_DEGREES,sky:!1};pe=pe=fe,window.Threebox=pe,window.THREE=i}();