PageSourceSearch

https://archive.x.io/_next/static/chunks/fb7d5399-4fb88232f76ae756.js

js x.io collected 2026-10-02 14:44:36 UTC 495,665 bytes, 186 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3737],{9477:function(e,t,r){let n;r.d(t,{$V:function(){return Spherical},CP7:function(){return WebGLRenderer},FM8:function(){return Vector2},Kj0:function(){return Mesh},M8C:function(){return d},Pa4:function(){return Vector3},cPb:function(){return PerspectiveCamera},dpR:function(){return TextureLoader},vBJ:function(){return MeshBasicMaterial},xo$:function(){return SphereGeometry},xsS:function(){return Scene}});let i="srgb",a="srgb-linear",s="display-p3",o="300 es";let EventDispatcher=class EventDispatcher{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners,n=r[e];if(void 0!==n){let e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;let t=r.slice(0);for(let r=0,n=t.length;r<n;r++)t[r].call(this,e);e.target=null}}};let l=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],u=1234567,h=Math.PI/180,c=180/Math.PI;function generateUUID(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=l[255&e]+l[e>>8&255]+l[e>>16&255]+l[e>>24&255]+"-"+l[255&t]+l[t>>8&255]+"-"+l[t>>16&15|64]+l[t>>24&255]+"-"+l[63&r|128]+l[r>>8&255]+"-"+l[r>>16&255]+l[r>>24&255]+l[255&n]+l[n>>8&255]+l[n>>16&255]+l[n>>24&255];return i.toLowerCase()}function clamp(e,t,r){return Math.max(t,Math.min(r,e))}function euclideanModulo(e,t){return(e%t+t)%t}function lerp(e,t,r){return(1-r)*e+r*t}function isPowerOfTwo(e){return(e&e-1)==0&&0!==e}function floorPowerOfTwo(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function denormalize(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function normalize(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let d={DEG2RAD:h,RAD2DEG:c,generateUUID:generateUUID,clamp:clamp,euclideanModulo:euclideanModulo,mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},inverseLerp:function(e,t,r){return e!==t?(r-e)/(t-e):0},lerp:lerp,damp:function(e,t,r,n){return lerp(e,t,1-Math.exp(-r*n))},pingpong:function(e,t=1){return t-Math.abs(euclideanModulo(e,2*t)-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-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){void 0!==e&&(u=e);let t=u+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*h},radToDeg:function(e){return e*c},isPowerOfTwo:isPowerOfTwo,ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:floorPowerOfTwo,setQuaternionFromProperEuler:function(e,t,r,n,i){let a=Math.cos,s=Math.sin,o=a(r/2),l=s(r/2),u=a((t+n)/2),h=s((t+n)/2),c=a((t-n)/2),d=s((t-n)/2),p=a((n-t)/2),f=s((n-t)/2);switch(i){case"XYX":e.set(o*h,l*c,l*d,o*u);break;case"YZY":e.set(l*d,o*h,l*c,o*u);break;case"ZXZ":e.set(l*c,l*d,o*h,o*u);break;case"XZX":e.set(o*h,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*h,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*h,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:normalize,denormalize:denormalize};let Vector2=class Vector2{constructor(e=0,t=0){Vector2.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw 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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 4,837 bytes, line 1
1sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[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){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let r=this.dot(e)/t;return Math.acos(clamp(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let r=Math.cos(t),n=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*r-a*n+e.x,this.y=i*n+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};let Matrix3=class Matrix3{constructor(){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,n,i,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=n,u[2]=s,u[3]=t,u[4]=i,u[5]=o,u[6]=r,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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){let r=e.elements,n=t.elements,i=this.elements,a=r[0],s=r[3],o=r[6],l=r[1],u=r[4],h=r[7],c=r[2],d=r[5],p=r[8],f=n[0],m=n[3],g=n[6],_=n[1],x=n[4],y=n[7],M=n[2],S=n[5],b=n[8];return i[0]=a*f+s*_+o*M,i[3]=a*m+s*x+o*S,i[6]=a*g+s*y+o*b,i[1]=l*f+u*_+h*M,i[4]=l*m+u*x+h*S,i[7]=l*g+u*y+h*b,i[2]=c*f+d*_+p*M,i[5]=c*m+d*x+p*S,i[8]=c*g+d*y+p*b,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-r*i*u+r*s*o+n*i*l-n*a*o}invert(){let e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=u*a-s*l,c=s*o-u*i,d=l*i-a*o,p=t*h+r*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=h*f,e[1]=(n*l-u*r)*f,e[2]=(s*r-n*a)*f,e[3]=c*f,e[4]=(u*t-n*o)*f,e[5]=(n*i-s*t)*f,e[6]=d*f,e[7]=(r*o-l*t)*f,e[8]=(a*t-r*i)*f,this}transpose(){let e;let 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){let 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,r,n,i,a,s){let o=Math.cos(i),l=Math.sin(i);return this.set(r*o,r*l,-r*(o*a+l*s)+a+e,-n*l,n*o,-n*(-l*a+o*s)+s+t,0,0,1),this}
1scale(e,t){return this.premultiply(p.makeScale(e,t)),this}rotate(e){return this.premultiply(p.makeRotation(-e)),this}translate(e,t){return this.premultiply(p.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,r=e.elements;for(let e=0;e<9;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}};let p=new Matrix3;function arrayNeedsUint32(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function createElementNS(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function LinearToSRGB(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let f=new Matrix3().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-.0000001,1e-7,.9105199]),m=new Matrix3().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),g={[a]:e=>e,[i]:e=>e.convertSRGBToLinear(),[s]:function(e){return e.convertSRGBToLinear().applyMatrix3(m)}},_={[a]:e=>e,[i]:e=>e.convertLinearToSRGB(),[s]:function(e){return e.applyMatrix3(f).convertLinearToSRGB()}},x={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(legacyMode){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!legacyMode},get workingColorSpace(){return a},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,r){if(!1===this.enabled||t===r||!t||!r)return e;let n=g[t],i=_[r];if(void 0===n||void 0===i)throw Error(`Unsupported color space conversion, "${t}" to "${r}".`);return i(n(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}};let ImageUtils=class ImageUtils{static getDataURL(e){let t;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===n&&(n=createElementNS("canvas")),n.width=e.width,n.height=e.height;let r=n.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=n}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=createElementNS("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let n=r.getImageData(0,0,e.width,e.height),i=n.data;for(let e=0;e<i.length;e++)i[e]=255*SRGBToLinear(i[e]/255);return r.putImageData(n,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*SRGBToLinear(t[e]/255)):t[e]=SRGBToLinear(t[e]);return{data:t,width:e.width,height:e.height}}}};let Source=class Source{constructor(e=null){this.isSource=!0,this.uuid=generateUUID(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let r={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,r=n.length;t<r;t++)n[t].isDataTexture?e.push(serializeImage(n[t].image)):e.push(serializeImage(n[t]))}else e=serializeImage(n);r.url=e}return t||(e.images[this.uuid]=r),r}};function serializeImage(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ImageUtils.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let y=0;
1let Texture=class Texture extends EventDispatcher{constructor(e=Texture.DEFAULT_IMAGE,t=Texture.DEFAULT_MAPPING,r=1001,n=1001,i=1006,a=1008,s=1023,o=1009,l=Texture.DEFAULT_ANISOTROPY,u=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:y++}),this.uuid=generateUUID(),this.name="",this.source=new Source(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=n,this.magFilter=i,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}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.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}};Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=300,Texture.DEFAULT_ANISOTROPY=1;let Vector4=class Vector4{constructor(e=0,t=0,r=0,n=1){Vector4.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=n}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,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,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 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 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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}
1sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,r=this.y,n=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*n+a[12]*i,this.y=a[1]*t+a[5]*r+a[9]*n+a[13]*i,this.z=a[2]*t+a[6]*r+a[10]*n+a[14]*i,this.w=a[3]*t+a[7]*r+a[11]*n+a[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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,r,n;let i=e.elements,a=i[0],s=i[4],o=i[8],l=i[1],u=i[5],h=i[9],c=i[2],d=i[6],p=i[10];if(.01>Math.abs(s-l)&&.01>Math.abs(o-c)&&.01>Math.abs(h-d)){if(.1>Math.abs(s+l)&&.1>Math.abs(o+c)&&.1>Math.abs(h+d)&&.1>Math.abs(a+u+p-3))return this.set(1,0,0,0),this;let e=(a+1)/2,i=(u+1)/2,f=(p+1)/2,m=(s+l)/4,g=(o+c)/4,_=(h+d)/4;return e>i&&e>f?e<.01?(t=0,r=.707106781,n=.707106781):(r=m/(t=Math.sqrt(e)),n=g/t):i>f?i<.01?(t=.707106781,r=0,n=.707106781):(t=m/(r=Math.sqrt(i)),n=_/r):f<.01?(t=.707106781,r=.707106781,n=0):(t=g/(n=Math.sqrt(f)),r=_/n),this.set(t,r,n,Math.PI),this}let f=Math.sqrt((d-h)*(d-h)+(o-c)*(o-c)+(l-s)*(l-s));return .001>Math.abs(f)&&(f=1),this.x=(d-h)/f,this.y=(o-c)/f,this.z=(l-s)/f,this.w=Math.acos((a+u+p-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){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};
1let WebGLRenderTarget=class WebGLRenderTarget extends EventDispatcher{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new Vector4(0,0,e,t),this.texture=new Texture({width:e,height:t,depth:1},r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,this.texture.internalFormat=void 0!==r.internalFormat?r.internalFormat:null,this.texture.minFilter=void 0!==r.minFilter?r.minFilter:1006,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null,this.samples=void 0!==r.samples?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,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){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new Source(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}};let DataArrayTexture=class DataArrayTexture extends Texture{constructor(e=null,t=1,r=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};let Quaternion=class Quaternion{constructor(e=0,t=0,r=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=n}static slerpFlat(e,t,r,n,i,a,s){let o=r[n+0],l=r[n+1],u=r[n+2],h=r[n+3],c=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(1===s){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(h!==f||o!==c||l!==d||u!==p){let e=1-s,t=o*c+l*d+u*p+h*f,r=t>=0?1:-1,n=1-t*t;if(n>Number.EPSILON){let i=Math.sqrt(n),a=Math.atan2(i,t*r);e=Math.sin(e*a)/i,s=Math.sin(s*a)/i}let i=s*r;if(o=o*e+c*i,l=l*e+d*i,u=u*e+p*i,h=h*e+f*i,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+h*h);o*=e,l*=e,u*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,n,i,a){let s=r[n],o=r[n+1],l=r[n+2],u=r[n+3],h=i[a],c=i[a+1],d=i[a+2],p=i[a+3];return e[t]=s*p+u*h+o*d-l*c,e[t+1]=o*p+u*c+l*h-s*d,e[t+2]=l*p+u*d+s*c-o*h,e[t+3]=u*p-s*h-o*c-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,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,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){let r=e._x,n=e._y,i=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(r/2),u=s(n/2),h=s(i/2),c=o(r/2),d=o(n/2),p=o(i/2);switch(a){case"XYZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"YXZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"ZXY":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"ZYX":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"YZX":this._x=c*u*h+l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h-c*d*p;break;case"XZY":this._x=c*u*h-l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],n=t[4],i=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],h=t[10],c=r+s+h;if(c>0){let e=.5/Math.sqrt(c+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(a-n)*e}else if(r>s&&r>h){let e=2*Math.sqrt(1+r-s-h);this._w=(u-o)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(i+l)/e}else if(s>h){let e=2*Math.sqrt(1+s-r-h);this._w=(i-l)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+h-r-s);this._w=(a-n)/e,this._x=(i+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>
vendor: 4,668 bytes, line 1
1Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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=r,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(clamp(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);return 0===r||this.slerp(e,Math.min(1,t/r)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,n=e._y,i=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=r*u+a*s+n*l-i*o,this._y=n*u+a*o+i*s-r*l,this._z=i*u+a*l+r*o-n*s,this._w=a*u-r*s-n*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let r=this._x,n=this._y,i=this._z,a=this._w,s=a*e._w+r*e._x+n*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=r,this._y=n,this._z=i,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*r+t*this._x,this._y=e*n+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),h=Math.sin((1-t)*u)/l,c=Math.sin(t*u)/l;return this._w=a*h+this._w*c,this._x=r*h+this._x*c,this._y=n*h+this._y*c,this._z=i*h+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),n=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(n),r*Math.sin(i),r*Math.cos(i),t*Math.sin(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}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};let Vector3=class Vector3{constructor(e=0,t=0,r=0){Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,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 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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(S.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(S.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6]*n,this.y=i[1]*t+i[4]*r+i[7]*n,this.z=i[2]*t+i[5]*r+i[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,r=this.y,n=this.z,i=e.elements,a=1/(i[3]*t+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*t+i[4]*r+i[8]*n+i[12])*a,this.y=(i[1]*t+i[5]*r+i[9]*n+i[13])*a,this.z=(i[2]*t+i[6]*r+i[10]*n+i[14])*a,this}
1applyQuaternion(e){let t=this.x,r=this.y,n=this.z,i=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*n-s*r,u=o*r+s*t-i*n,h=o*n+i*r-a*t,c=-i*t-a*r-s*n;return this.x=l*o+-(c*i)+-(u*s)- -(h*a),this.y=u*o+-(c*a)+-(h*i)- -(l*s),this.z=h*o+-(c*s)+-(l*a)- -(u*i),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n,this.y=i[1]*t+i[5]*r+i[9]*n,this.z=i[2]*t+i[6]*r+i[10]*n,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){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let r=e.x,n=e.y,i=e.z,a=t.x,s=t.y,o=t.z;return this.x=n*o-i*s,this.y=i*a-r*o,this.z=r*s-n*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return M.copy(this).projectOnVector(e),this.sub(M)}reflect(e){return this.sub(M.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let r=this.dot(e)/t;return Math.acos(clamp(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n}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,r){let n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};let M=new Vector3,S=new Quaternion;let Box3=class Box3{constructor(e=new Vector3(Infinity,Infinity,Infinity),t=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(T.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(T.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=T.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}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=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){if(e.updateWorldMatrix(!1,!1),void 0!==e.boundingBox)null===e.boundingBox&&e.computeBoundingBox(),w.copy(e.boundingBox),w.applyMatrix4(e.matrixWorld),this.union(w);else{let r=e.geometry;if(void 0!==r){if(t&&void 0!==r.attributes&&void 0!==r.attributes.position){let t=r.attributes.position;for(let r=0,n=t.count;r<n;r++)T.fromBufferAttribute(t,r).applyMatrix4(e.matrixWorld),this.expandByPoint(T)}
1else null===r.boundingBox&&r.computeBoundingBox(),w.copy(r.boundingBox),w.applyMatrix4(e.matrixWorld),this.union(w)}}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return!(e.x<this.min.x)&&!(e.x>this.max.x)&&!(e.y<this.min.y)&&!(e.y>this.max.y)&&!(e.z<this.min.z)&&!(e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x)&&!(e.min.x>this.max.x)&&!(e.max.y<this.min.y)&&!(e.min.y>this.max.y)&&!(e.max.z<this.min.z)&&!(e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,T),T.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(U),D.subVectors(this.max,U),E.subVectors(e.a,U),A.subVectors(e.b,U),C.subVectors(e.c,U),L.subVectors(A,E),P.subVectors(C,A),R.subVectors(E,C);let t=[0,-L.z,L.y,0,-P.z,P.y,0,-R.z,R.y,L.z,0,-L.x,P.z,0,-P.x,R.z,0,-R.x,-L.y,L.x,0,-P.y,P.x,0,-R.y,R.x,0];return!!(satForAxes(t,E,A,C,D)&&satForAxes(t=[1,0,0,0,1,0,0,0,1],E,A,C,D))&&(I.crossVectors(L,P),satForAxes(t=[I.x,I.y,I.z],E,A,C,D))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,T).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(T).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()||(b[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),b[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),b[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),b[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),b[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),b[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),b[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),b[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(b)),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)}};let b=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],T=new Vector3,w=new Box3,E=new Vector3,A=new Vector3,C=new Vector3,L=new Vector3,P=new Vector3,R=new Vector3,U=new Vector3,D=new Vector3,I=new Vector3,N=new Vector3;function satForAxes(e,t,r,n,i){for(let a=0,s=e.length-3;a<=s;a+=3){N.fromArray(e,a);let s=i.x*Math.abs(N.x)+i.y*Math.abs(N.y)+i.z*Math.abs(N.z),o=t.dot(N),l=r.dot(N),u=n.dot(N);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let V=new Box3,O=new Vector3,z=new Vector3;let Sphere=class Sphere{constructor(e=new Vector3,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;void 0!==t?r.copy(t):V.setFromPoints(e).getCenter(r);let n=0;for(let t=0,i=e.length;t<i;t++)n=Math.max(n,r.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),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){let 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){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}
1applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;O.subVectors(e,this.center);let t=O.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),r=(e-this.radius)*.5;this.center.addScaledVector(O,r/e),this.radius+=r}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(z.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(O.copy(e.center).add(z)),this.expandByPoint(O.copy(e.center).sub(z)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};let B=new Vector3,G=new Vector3,F=new Vector3,k=new Vector3,W=new Vector3,H=new Vector3,j=new Vector3;let Matrix4=class Matrix4{constructor(){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,n,i,a,s,o,l,u,h,c,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=n,g[1]=i,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=h,g[14]=c,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 Matrix4().fromArray(this.elements)}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){let t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){let 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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,r=e.elements,n=1/q.setFromMatrixColumn(e,0).length(),i=1/q.setFromMatrixColumn(e,1).length(),a=1/q.setFromMatrixColumn(e,2).length();return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,r=e.x,n=e.y,i=e.z,a=Math.cos(r),s=Math.sin(r),o=Math.cos(n),l=Math.sin(n),u=Math.cos(i),h=Math.sin(i);if("XYZ"===e.order){let e=a*u,r=a*h,n=s*u,i=s*h;t[0]=o*u,t[4]=-o*h,t[8]=l,t[1]=r+n*l,t[5]=e-i*l,t[9]=-s*o,t[2]=i-e*l,t[6]=n+r*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,r=o*h,n=l*u,i=l*h;t[0]=e+i*s,t[4]=n*s-r,t[8]=a*l,t[1]=a*h,t[5]=a*u,t[9]=-s,t[2]=r*s-n,t[6]=i+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,r=o*h,n=l*u,i=l*h;t[0]=e-i*s,t[4]=-a*h,t[8]=n+r*s,t[1]=r+n*s,t[5]=a*u,t[9]=i-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,r=a*h,n=s*u,i=s*h;t[0]=o*u,t[4]=n*l-r,t[8]=e*l+i,t[1]=o*h,t[5]=i*l+e,t[9]=r*l-n,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,r=a*l,n=s*o,i=s*l;t[0]=o*u,t[4]=i-e*h,t[8]=n*h+r,t[1]=h,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=r*h+n,t[10]=e-i*h}else if("XZY"===e.order){let e=a*o,r=a*l,n=s*o,i=s*l;t[0]=o*u,t[4]=-h,t[8]=l*u,t[1]=e*h+i,t[5]=a*u,t[9]=r*h-n,t[2]=n*h-r,t[6]=s*u,t[10]=i*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(J,e,Y)}lookAt(e,t,r){let n=this.elements;return Q.subVectors(e,t),0===Q.lengthSq()&&(Q.z=1),Q.normalize(),Z.crossVectors(r,Q),0===Z.lengthSq()&&(1===Math.abs(r.z)?Q.x+=1e-4:Q.z+=1e-4,Q.normalize(),Z.crossVectors(r,Q)),Z.normalize(),K.crossVectors(Q,Z),n[0]=Z.x,n[4]=K.x,n[8]=Q.x,n[1]=Z.y,n[5]=K.y,n[9]=Q.y,n[2]=Z.z,n[6]=K.z,n[10]=Q.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,n=t.elements,i=this.elements,a=r[0],s=r[4],o=r[8],l=r[12],u=r[1],h=r[5],c=r[9],d=r[13],p=r[2],f=r[6],m=r[10],g=r[14],_=r[3],x=r[7],y=r[11],M=r[15],S=n[0],b=n[4],T=n[8],w=n[12],E=n[1],A=n[5],C=n[9],L=n[13],P=n[2],R=n[6],U=n[10],D=n[14],I=n[3],N=n[7],V=n[11],O=n[15];return i[0]=a*S+s*E+o*P+l*I,i[4]=a*b+s*A+o*R+l*N,i[8]=a*T+s*C+o*U+l*V,i[12]=a*w+s*L+o*D+l*O,i[1]=u*S+h*E+c*P+d*I,i[5]=u*b+h*A+c*R+d*N,i[9]=u*T+h*C+c*U+d*V,i[13]=u*w+h*L+c*D+d*O,i[2]=p*S+f*E+m*P+g*I,i[6]=p*b+f*A+m*R+g*N,i[10]=p*T+f*C+m*U+g*V,i[14]=p*w+f*L+m*D+g*O,i[3]=_*S+x*E+y*P+M*I,i[7]=_*b+x*A+y*R+M*N,i[11]=_*T+x*C+y*U+M*V,i[15]=_*w+x*L+y*D+M
1*O,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],h=e[6],c=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+i*o*h-n*l*h-i*s*c+r*l*c+n*s*d-r*o*d)+f*(+t*o*d-t*l*c+i*a*c-n*a*d+n*l*u-i*o*u)+m*(+t*l*h-t*s*d-i*a*h+r*a*d+i*s*u-r*l*u)+g*(-n*s*u-t*o*h+t*s*c+n*a*h-r*a*c+r*o*u)}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,r){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this}invert(){let e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=e[9],c=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],_=h*m*l-f*c*l+f*o*d-s*m*d-h*o*g+s*c*g,x=p*c*l-u*m*l-p*o*d+a*m*d+u*o*g-a*c*g,y=u*f*l-p*h*l+p*s*d-a*f*d-u*s*g+a*h*g,M=p*h*o-u*f*o-p*s*c+a*f*c+u*s*m-a*h*m,S=t*_+r*x+n*y+i*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let b=1/S;return e[0]=_*b,e[1]=(f*c*i-h*m*i-f*n*d+r*m*d+h*n*g-r*c*g)*b,e[2]=(s*m*i-f*o*i+f*n*l-r*m*l-s*n*g+r*o*g)*b,e[3]=(h*o*i-s*c*i-h*n*l+r*c*l+s*n*d-r*o*d)*b,e[4]=x*b,e[5]=(u*m*i-p*c*i+p*n*d-t*m*d-u*n*g+t*c*g)*b,e[6]=(p*o*i-a*m*i-p*n*l+t*m*l+a*n*g-t*o*g)*b,e[7]=(a*c*i-u*o*i+u*n*l-t*c*l-a*n*d+t*o*d)*b,e[8]=y*b,e[9]=(p*h*i-u*f*i-p*r*d+t*f*d+u*r*g-t*h*g)*b,e[10]=(a*f*i-p*s*i+p*r*l-t*f*l-a*r*g+t*s*g)*b,e[11]=(u*s*i-a*h*i-u*r*l+t*h*l+a*r*d-t*s*d)*b,e[12]=M*b,e[13]=(u*f*n-p*h*n+p*r*c-t*f*c-u*r*m+t*h*m)*b,e[14]=(p*s*n-a*f*n-p*r*o+t*f*o+a*r*m-t*s*m)*b,e[15]=(a*h*n-u*s*n+u*r*o-t*h*o-a*r*c+t*s*c)*b,this}scale(e){let t=this.elements,r=e.x,n=e.y,i=e.z;return t[0]*=r,t[4]*=n,t[8]*=i,t[1]*=r,t[5]*=n,t[9]*=i,t[2]*=r,t[6]*=n,t[10]*=i,t[3]*=r,t[7]*=n,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let r=Math.cos(t),n=Math.sin(t),i=1-r,a=e.x,s=e.y,o=e.z,l=i*a,u=i*s;return this.set(l*a+r,l*s-n*o,l*o+n*s,0,l*s+n*o,u*s+r,u*o-n*a,0,l*o-n*s,u*o+n*a,i*o*o+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,n,i,a){return this.set(1,r,i,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,r){let n=this.elements,i=t._x,a=t._y,s=t._z,o=t._w,l=i+i,u=a+a,h=s+s,c=i*l,d=i*u,p=i*h,f=a*u,m=a*h,g=s*h,_=o*l,x=o*u,y=o*h,M=r.x,S=r.y,b=r.z;return n[0]=(1-(f+g))*M,n[1]=(d+y)*M,n[2]=(p-x)*M,n[3]=0,n[4]=(d-y)*S,n[5]=(1-(c+g))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(p+x)*b,n[9]=(m-_)*b,n[10]=(1-(c+f))*b,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,r){let n=this.elements,i=q.set(n[0],n[1],n[2]).length(),a=q.set(n[4],n[5],n[6]).length(),s=q.set(n[8],n[9],n[10]).length(),o=this.determinant();o<0&&(i=-i),e.x=n[12],e.y=n[13],e.z=n[14],X.copy(this);let l=1/i,u=1/a,h=1/s;return X.elements[0]*=l,X.elements[1]*=l,X.elements[2]*=l,X.elements[4]*=u,X.elements[5]*=u,X.elements[6]*=u,X.elements[8]*=h,X.elements[9]*=h,X.elements[10]*=h,t.setFromRotationMatrix(X),r.x=i,r.y=a,r.z=s,this}makePerspective(e,t,r,n,i,a){let s=this.elements;return s[0]=2*i/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*i/(r-n),s[9]=(r+n)/(r-n),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+i)/(a-i),s[14]=-2*a*i/(a-i),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,r,n,i,a){let s=this.elements,o=1/(t-e),l=1/(r-n),u=1/(a-i);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-((t+e)*o),s[1]=0,s[5]=2*l,s[9]=0,s[13]=-((r+n)*l),s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-((a+i)*u),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,r=e.elements;for(let e=0;e<16;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}};let q=new Vector3,X=new Matrix4,J=new Vector3(0,0,0),Y=new Vector3(1,1,1),Z=new Vector3,K=new Vector3,Q=new Vector3,$=new Matrix4,ee=new Quaternion;let Euler=class Euler{constructor(e=0,t=0,r=0,n=Euler.DEFAULT_ORDER){this.isEuler
1=!0,this._x=e,this._y=t,this._z=r,this._order=n}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,r,n=this._order){return this._x=e,this._y=t,this._z=r,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){let n=e.elements,i=n[0],a=n[4],s=n[8],o=n[1],l=n[5],u=n[9],h=n[2],c=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(clamp(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,i),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-clamp(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(clamp(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,i)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-clamp(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return $.makeRotationFromQuaternion(e),this.setFromRotationMatrix($,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ee.setFromEuler(this),this.setFromQuaternion(ee,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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Euler.DEFAULT_ORDER="XYZ";let Layers=class Layers{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}};let et=0,er=new Vector3,en=new Quaternion,ei=new Matrix4,ea=new Vector3,es=new Vector3,eo=new Vector3,el=new Quaternion,eu=new Vector3(1,0,0),eh=new Vector3(0,1,0),ec=new Vector3(0,0,1),ed={type:"added"},ep={type:"removed"};
1let Object3D=class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:et++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();let e=new Vector3,t=new Euler,r=new Quaternion,n=new Vector3(1,1,1);t._onChange(function(){r.setFromEuler(t,!1)}),r._onChange(function(){t.setFromQuaternion(r,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:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return en.setFromAxisAngle(e,t),this.quaternion.multiply(en),this}rotateOnWorldAxis(e,t){return en.setFromAxisAngle(e,t),this.quaternion.premultiply(en),this}rotateX(e){return this.rotateOnAxis(eu,e)}rotateY(e){return this.rotateOnAxis(eh,e)}rotateZ(e){return this.rotateOnAxis(ec,e)}translateOnAxis(e,t){return er.copy(e).applyQuaternion(this.quaternion),this.position.add(er.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(eu,e)}translateY(e){return this.translateOnAxis(eh,e)}translateZ(e){return this.translateOnAxis(ec,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ei.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?ea.copy(e):ea.set(e,t,r);let n=this.parent;this.updateWorldMatrix(!0,!1),es.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ei.lookAt(es,ea,this.up):ei.lookAt(ea,es,this.up),this.quaternion.setFromRotationMatrix(ei),n&&(ei.extractRotation(n.matrixWorld),en.setFromRotationMatrix(ei),this.quaternion.premultiply(en.invert()))}add(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):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(ed)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ep)),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(ep)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),ei.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),ei.multiply(e.parent.matrixWorld)),e.applyMatrix4(ei),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,n=this.children.length;r<n;r++){let n=this.children[r],i=n.getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t){let r=[];this[e]===t&&r.push(this);for(let n=0,i=this.children.length;n<i;n++){let i=this.children[n].getObjectsByProperty(e,t);i.length>0&&(r=r.concat(i))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(es,e,eo),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(es,el,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let r=0,n=t.length;r<n;r++)t[r].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let r=0,n=t.length;r<n;r++)t[r].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix
1):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let r=0,n=t.length;r<n;r++){let n=t[r];(!0===n.matrixWorldAutoUpdate||!0===e)&&n.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let r=this.parent;if(!0===e&&null!==r&&!0===r.matrixWorldAutoUpdate&&r.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){let e=this.children;for(let t=0,r=e.length;t<r;t++){let r=e[t];!0===r.matrixWorldAutoUpdate&&r.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};function serialize(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=serialize(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let r=t.shapes;if(Array.isArray(r))for(let t=0,n=r.length;t<n;t++){let n=r[t];serialize(e.shapes,n)}else serialize(e.shapes,r)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let t=[];for(let r=0,n=this.material.length;r<n;r++)t.push(serialize(e.materials,this.material[r]));n.material=t}else n.material=serialize(e.materials,this.material)}if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){let r=this.animations[t];n.animations.push(serialize(e.animations,r))}}if(t){let t=extractFromCache(e.geometries),n=extractFromCache(e.materials),i=extractFromCache(e.textures),a=extractFromCache(e.images),s=extractFromCache(e.shapes),o=extractFromCache(e.skeletons),l=extractFromCache(e.animations),u=extractFromCache(e.nodes);t.length>0&&(r.geometries=t),n.length>0&&(r.materials=n),i.length>0&&(r.textures=i),a.length>0&&(r.images=a),s.length>0&&(r.shapes=s),o.length>0&&(r.skeletons=o),l.length>0&&(r.animations=l),u.length>0&&(r.nodes=u)}return r.object=n,r;function extractFromCache(e){let t=[];for(let r in e){let n=e[r];delete n.metadata,t.push(n)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let r=e.children[t];this.add(r.clone())}return this}};Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let ef=new Vector3,em=new Vector3,eg=new Vector3,ev=new Vector3,e_=new Vector3,ex=new Vector3,ey=new Vector3,eM=new Vector3,eS=new Vector3,eb=new Vector3,eT=!1;let Triangle=class Triangle{constructor(e=new Vector3,t=new Vector3,r=new Vector3){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,n){n.subVectors(r,t),ef.subVectors(e,t),n.cross(ef);let i=n.lengthSq();return i>0?n.multiplyScalar(1/Math.sqrt(i)):n.set(0,0,0)}static getBarycoord(e,t,r,n,i){ef.subVectors(n,t),em.subVectors(r,t),eg.subVectors(e,t);let a=ef.dot(ef),s=ef.dot(em),o=ef.dot(eg),l=em.dot(em),u=em.dot(eg),h=a*l-s*s;if(0===h)return i.set(-2,-1,-1);let c=1/h,d=(l*o-s*u)*c,p=(a*u-s*o)*c;return i.set(1-d-p,p,d)}static containsPoint(e,t,r,n){return this.getBarycoord(e,t,r,n,ev),ev.x>=0&&ev.y>=0&&ev.x+ev.y<=1}static getUV(e,t,r,n,i,a,s,o){return!1===eT&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),eT=!0),this.getInterpolation(e,t,r,n,i,a,s,o)}static getInterpolation(e,t,r,n,i,a,s,o){return this.getBarycoord(e,t,r,n,ev),o.setScalar(0),o.addScaledVector(i,ev.x),o.addScaledVector(a,ev.y),o.addScaledVector(s,ev.z),o}static isFrontFacing(e,t,r,n){return ef.subVectors(r,t),em.subVectors(e,t),0>ef.cross(em).dot(n)}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,r,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,n),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 ef.subVectors(this.c,this.b),em.subVectors(this.a,this.b),.5*ef.cross(em).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Triangle.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Triangle.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,n,i){return!1===eT&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),eT=!0),Triangle.getInterpolation(e,this.a,this.b,this.c,t,r,n,i)}getInterpolation(e,t,r,n,i){return Triangle.getInterpolation(e,this.a,this.b,this.c,t,r,n,i)}containsPoint(e){return Triangle.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Triangle.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let r,n;let i=this.a,a=this.b,s=this.c;e_.subVectors(a,i),ex.subVectors(s,i),eM.subVectors(e,i);let o=e_.dot(eM),l=ex.dot(eM);if(o<=0&&l<=0)return t.copy(i);eS.subVectors(e,a);let u=e_.dot(eS),h=ex.dot(eS);if(u>=0&&h<=u)return t.copy(a);let c=o*h-u*l;if(c<=0&&o>=0&&u<=0)return r=o/(o-u),t.copy(i).addScaledVector(e_,r);eb.subVectors(e,s);let d=e_.dot(eb),p=ex.dot(eb);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(i).addScaledVector(ex,n);let m=u*p-d*h;if(m<=0&&h-u>=0&&d-p>
vendor: 9,668 bytes, line 1
1=0)return ey.subVectors(s,a),n=(h-u)/(h-u+(d-p)),t.copy(a).addScaledVector(ey,n);let g=1/(m+f+c);return r=f*g,n=c*g,t.copy(i).addScaledVector(e_,r).addScaledVector(ex,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};let ew=0;let Material=class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ew++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let r=e[t];if(void 0===r){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function extractFromCache(e){let t=[];for(let r in e){let n=e[r];delete n.metadata,t.push(n)}return t}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),void 0!==this.sheen&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(r.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(r.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(r.combine=this.combine)),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(r.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(r.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(r.size=this.size),null!==this.shadowSide&&(r.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(r.blending=this.blending),0!==this.side&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(r.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(r.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(r.flatShading=this.flatShading),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),!1===this.fog&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData),t){let t=extractFromCache(e.textures),n=extractFromCache(e.images);t.length>0&&(r.textures=t),n.length>0&&(r.images=n)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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;let t=e.clippingPlanes,r=null;if(null!==t){let e=t.length;r=Array(e);for(let n=0;n!==e;++n)r[n]=t[n].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
1adows,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.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}};let eE={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},eA={h:0,s:0,l:0},eC={h:0,s:0,l:0};function hue2rgb(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*6*(2/3-r):e}let Color=class Color{constructor(e,t,r){if(this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===r)return this.set(e);return this.setRGB(e,t,r)}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,t=i){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,x.toWorkingColorSpace(this,t),this}setRGB(e,t,r,n=x.workingColorSpace){return this.r=e,this.g=t,this.b=r,x.toWorkingColorSpace(this,n),this}setHSL(e,t,r,n=x.workingColorSpace){if(e=euclideanModulo(e,1),t=clamp(t,0,1),r=clamp(r,0,1),0===t)this.r=this.g=this.b=r;else{let n=r<=.5?r*(1+t):r+t-r*t,i=2*r-n;this.r=hue2rgb(i,n,e+1/3),this.g=hue2rgb(i,n,e),this.b=hue2rgb(i,n,e-1/3)}return x.toWorkingColorSpace(this,n),this}setStyle(e,t=i){let r;function handleAlpha(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let n;let i=r[1],a=r[2];switch(i){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,x.toWorkingColorSpace(this,t),handleAlpha(n[4]);break}(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))&&(this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,x.toWorkingColorSpace(this,t),handleAlpha(n[4]));break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let e=parseFloat(n[1])/360,r=parseFloat(n[2])/100,i=parseFloat(n[3])/100;return handleAlpha(n[4]),this.setHSL(e,r,i,t)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(3===i)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===i)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=i){let r=eE[e.toLowerCase()];return void 0!==r?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=SRGBToLinear(e.r),this.g=SRGBToLinear(e.g),this.b=SRGBToLinear(e.b),this}copyLinearToSRGB(e){return this.r=LinearToSRGB(e.r),this.g=LinearToSRGB(e.g),this.b=LinearToSRGB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=i){return x.fromWorkingColorSpace(eL.copy(this),e),clamp(255*eL.r,0,255)<<16^clamp(255*eL.g,0,255)<<8^clamp(255*eL.b,0,255)<<0}getHexString(e=i){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=x.workingColorSpace){let r,n;x.fromWorkingColorSpace(eL.copy(this),t);let i=eL.r,a=eL.g,s=eL.b,o=Math.max(i,a,s),l=Math.min(i,a,s),u=(l+o)/2;if(l===o)r=0,n=0;else{let e=o-l;switch(n=u<=.5?e/(o+l):e/(2-o-l),o){case i:r=(a-s)/e+(a<s?6:0);break;case a:r=(s-i)/e+2;break;case s:r=(i-a)/e+4}r/=6}return e.h=r,e.s=n,e.l=u,e}getRGB(e,t=x.workingColorSpace){return x.fromWorkingColorSpace(eL.copy(this),t),e.r=eL.r,e.g=eL.g,e.b=eL.b,e}getStyle(e=i){x.fromWorkingColorSpace(eL.copy(this),e);let t=eL.r,r=eL.g,n=eL.b;return e!==i?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${n.toFixed(3)})`:`rgb(${255*t|0},${255*r|0},${255*n|0})`}offsetHSL(e,t,r){return this.getHSL(eA),eA.h+=e,eA.s+=t,eA.l+=r,this.setHSL(eA.h,eA.s,eA.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,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(eA),e.getHSL(eC);let r=lerp(eA.h,eC.h,t),n=lerp(eA.s,eC.s,t),i=lerp(eA.l,eC.l,t);return this.setHSL(r,n,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,n=this.b,i=e.elements;return this.r=i[0]*t+i[3]*r+i[6]*n,this.g=i[1]*t+i[4]*r+i[7]*n,this.b=i[2]*t+i[5]*r+i[8]*n,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),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};let eL=new Color;Color.NAMES=eE;let MeshBasicMaterial=class MeshBasicMaterial extends Material{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(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.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};let eP=new Vector3,eR=new Vector2;let BufferAttribute=class BufferAttribute{constructor(e,t,r=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=r,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;
1for(let n=0,i=this.itemSize;n<i;n++)this.array[e+n]=t.array[r+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,r=this.count;t<r;t++)eR.fromBufferAttribute(this,t),eR.applyMatrix3(e),this.setXY(t,eR.x,eR.y);else if(3===this.itemSize)for(let t=0,r=this.count;t<r;t++)eP.fromBufferAttribute(this,t),eP.applyMatrix3(e),this.setXYZ(t,eP.x,eP.y,eP.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)eP.fromBufferAttribute(this,t),eP.applyMatrix4(e),this.setXYZ(t,eP.x,eP.y,eP.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)eP.fromBufferAttribute(this,t),eP.applyNormalMatrix(e),this.setXYZ(t,eP.x,eP.y,eP.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)eP.fromBufferAttribute(this,t),eP.transformDirection(e),this.setXYZ(t,eP.x,eP.y,eP.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=denormalize(t,this.array)),t}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=denormalize(t,this.array)),t}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=denormalize(t,this.array)),t}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=denormalize(t,this.array)),t}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,n){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),n=normalize(n,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this}setXYZW(e,t,r,n,i){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),n=normalize(n,this.array),i=normalize(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}};let Uint16BufferAttribute=class Uint16BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint16Array(e),t,r)}};let Uint32BufferAttribute=class Uint32BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint32Array(e),t,r)}};let Float32BufferAttribute=class Float32BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Float32Array(e),t,r)}};let eU=0,eD=new Matrix4,eI=new Object3D,eN=new Vector3,eV=new Box3,eO=new Box3,ez=new Vector3;let BufferGeometry=class BufferGeometry extends EventDispatcher{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:eU++}),this.uuid=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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(arrayNeedsUint32(e)?Uint32BufferAttribute:Uint16BufferAttribute)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let r=this.attributes.normal;if(void 0!==r){let t=new Matrix3().getNormalMatrix(e);r.applyNormalMatrix(t),r.needsUpdate=!0}let n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return eD.makeRotationFromQuaternion(e),this.applyMatrix4(eD),this}rotateX(e){return eD.makeRotationX(e),this.applyMatrix4(eD),this}rotateY(e){return eD.makeRotationY(e),this.applyMatrix4(eD),this}rotateZ(e){return eD.makeRotationZ(e),this.applyMatrix4(eD),this}translate(e,t,r){return eD.makeTranslation(e,t,r),this.applyMatrix4(eD),this}scale(e,t,r){return eD.makeScale(e,t,r),this.applyMatrix4(eD),this}lookAt(e){return eI.lookAt(e),eI.updateMatrix(),this.applyMatrix4(eI.matrix
1),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(eN).negate(),this.translate(eN.x,eN.y,eN.z),this}setFromPoints(e){let t=[];for(let r=0,n=e.length;r<n;r++){let n=e[r];t.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new Float32BufferAttribute(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){let r=t[e];eV.setFromBufferAttribute(r),this.morphTargetsRelative?(ez.addVectors(this.boundingBox.min,eV.min),this.boundingBox.expandByPoint(ez),ez.addVectors(this.boundingBox.max,eV.max),this.boundingBox.expandByPoint(ez)):(this.boundingBox.expandByPoint(eV.min),this.boundingBox.expandByPoint(eV.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(){null===this.boundingSphere&&(this.boundingSphere=new Sphere);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
1se".',this),this.boundingSphere.set(new Vector3,1/0);return}if(e){let r=this.boundingSphere.center;if(eV.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){let r=t[e];eO.setFromBufferAttribute(r),this.morphTargetsRelative?(ez.addVectors(eV.min,eO.min),eV.expandByPoint(ez),ez.addVectors(eV.max,eO.max),eV.expandByPoint(ez)):(eV.expandByPoint(eO.min),eV.expandByPoint(eO.max))}eV.getCenter(r);let n=0;for(let t=0,i=e.count;t<i;t++)ez.fromBufferAttribute(e,t),n=Math.max(n,r.distanceToSquared(ez));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],s=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)ez.fromBufferAttribute(a,t),s&&(eN.fromBufferAttribute(e,t),ez.add(eN)),n=Math.max(n,r.distanceToSquared(ez))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let r=e.array,n=t.position.array,i=t.normal.array,a=t.uv.array,s=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*s),4));let o=this.getAttribute("tangent").array,l=[],u=[];for(let e=0;e<s;e++)l[e]=new Vector3,u[e]=new Vector3;let h=new Vector3,c=new Vector3,d=new Vector3,p=new Vector2,f=new Vector2,m=new Vector2,g=new Vector3,_=new Vector3,x=this.groups;0===x.length&&(x=[{start:0,count:r.length}]);for(let e=0,t=x.length;e<t;++e){let t=x[e],i=t.start,s=t.count;for(let e=i,t=i+s;e<t;e+=3)!function(e,t,r){h.fromArray(n,3*e),c.fromArray(n,3*t),d.fromArray(n,3*r),p.fromArray(a,2*e),f.fromArray(a,2*t),m.fromArray(a,2*r),c.sub(h),d.sub(h),f.sub(p),m.sub(p);let i=1/(f.x*m.y-m.x*f.y);isFinite(i)&&(g.copy(c).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(i),_.copy(d).multiplyScalar(f.x).addScaledVector(c,-m.x).multiplyScalar(i),l[e].add(g),l[t].add(g),l[r].add(g),u[e].add(_),u[t].add(_),u[r].add(_))}(r[e+0],r[e+1],r[e+2])}let y=new Vector3,M=new Vector3,S=new Vector3,b=new Vector3;function handleVertex(e){S.fromArray(i,3*e),b.copy(S);let t=l[e];y.copy(t),y.sub(S.multiplyScalar(S.dot(t))).normalize(),M.crossVectors(b,t);let r=M.dot(u[e]);o[4*e]=y.x,o[4*e+1]=y.y,o[4*e+2]=y.z,o[4*e+3]=r<0?-1:1}for(let e=0,t=x.length;e<t;++e){let t=x[e],n=t.start,i=t.count;for(let e=n,t=n+i;e<t;e+=3)handleVertex(r[e+0]),handleVertex(r[e+1]),handleVertex(r[e+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let r=this.getAttribute("normal");if(void 0===r)r=new BufferAttribute(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(let e=0,t=r.count;e<t;e++)r.setXYZ(e,0,0,0);let n=new Vector3,i=new Vector3,a=new Vector3,s=new Vector3,o=new Vector3,l=new Vector3,u=new Vector3,h=new Vector3;if(e)for(let c=0,d=e.count;c<d;c+=3){let d=e.getX(c+0),p=e.getX(c+1),f=e.getX(c+2);n.fromBufferAttribute(t,d),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,i),h.subVectors(n,i),u.cross(h),s.fromBufferAttribute(r,d),o.fromBufferAttribute(r,p),l.fromBufferAttribute(r,f),s.add(u),o.add(u),l.add(u),r.setXYZ(d,s.x,s.y,s.z),r.setXYZ(p,o.x,o.y,o.z),r.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,i),h.subVectors(n,i),u.cross(h),r.setXYZ(e+0,u.x,u.y,u.z),r.setXYZ(e+1,u.x,u.y,u.z),r.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)ez.fromBufferAttribute(e,t),ez.normalize(),e.setXYZ(t,ez.x,ez.y,ez.z)}toNonIndexed(){function convertBufferAttribute(e,t){let r=e.array,n=e.itemSize,i=e.normalized,a=new r.constructor(t.length*n),s=0,o=0;for(let i=0,l=t.length;i<l;i++){s=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*n;for(let e=0;e<n;e++)a[o++]=r[s++]}return new BufferAttribute(a,n,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new BufferGeometry,t=this.index.array,r=this.attributes;for(let n in r){let i=r[n],a=convertBufferAttribute(i,t);e.setAttribute(n,a)}let n=this.morphAttributes;for(let r in n){let i=[],a=n[r];for(let e=0,r=a.length;e<r;e++){let r=a[e],n=convertBufferAttribute(r,t);i.push(n)}e.morphAttributes[r]=i}e.morphTargetsRelative=this.morphTargetsRelative;let i=this.groups;for(let t=0,r=i.length;t<r;t++){let r=i[t];e.addGroup(r.start,r.count,r.materialIndex)}return e}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
1if(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){let t=this.parameters;for(let r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let r=this.attributes;for(let t in r){let n=r[t];e.data.attributes[t]=n.toJSON(e.data)}let n={},i=!1;for(let t in this.morphAttributes){let r=this.morphAttributes[t],a=[];for(let t=0,n=r.length;t<n;t++){let n=r[t];a.push(n.toJSON(e.data))}a.length>0&&(n[t]=a,i=!0)}i&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let r=e.index;null!==r&&this.setIndex(r.clone(t));let n=e.attributes;for(let e in n){let r=n[e];this.setAttribute(e,r.clone(t))}let i=e.morphAttributes;for(let e in i){let r=[],n=i[e];for(let e=0,i=n.length;e<i;e++)r.push(n[e].clone(t));this.morphAttributes[e]=r}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};let eB=new Matrix4,eG=new class{constructor(e=new Vector3,t=new Vector3(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,B)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=B.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(B.copy(this.origin).addScaledVector(this.direction,t),B.distanceToSquared(e))}distanceSqToSegment(e,t,r,n){let i,a,s,o;G.copy(e).add(t).multiplyScalar(.5),F.copy(t).sub(e).normalize(),k.copy(this.origin).sub(G);let l=.5*e.distanceTo(t),u=-this.direction.dot(F),h=k.dot(this.direction),c=-k.dot(F),d=k.lengthSq(),p=Math.abs(1-u*u);if(p>0){if(i=u*c-h,a=u*h-c,o=l*p,i>=0){if(a>=-o){if(a<=o){let e=1/p;i*=e,a*=e,s=i*(i+u*a+2*h)+a*(u*i+a+2*c)+d}else s=-(i=Math.max(0,-(u*(a=l)+h)))*i+a*(a+2*c)+d}else s=-(i=Math.max(0,-(u*(a=-l)+h)))*i+a*(a+2*c)+d}else a<=-o?(a=(i=Math.max(0,-(-u*l+h)))>0?-l:Math.min(Math.max(-l,-c),l),s=-i*i+a*(a+2*c)+d):a<=o?(i=0,s=(a=Math.min(Math.max(-l,-c),l))*(a+2*c)+d):(a=(i=Math.max(0,-(u*l+h)))>0?l:Math.min(Math.max(-l,-c),l),s=-i*i+a*(a+2*c)+d)}else a=u>0?-l:l,s=-(i=Math.max(0,-(u*a+h)))*i+a*(a+2*c)+d;return r&&r.copy(this.origin).addScaledVector(this.direction,i),n&&n.copy(G).addScaledVector(F,a),s}intersectSphere(e,t){B.subVectors(e.center,this.origin);let r=B.dot(this.direction),n=B.dot(B)-r*r,i=e.radius*e.radius;if(n>i)return null;let a=Math.sqrt(i-n),s=r-a,o=r+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let r=e.normal.dot(this.direction);return r*t<0}intersectBox(e,t){let r,n,i,a,s,o;let l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,c=this.origin;return(l>=0?(r=(e.min.x-c.x)*l,n=(e.max.x-c.x)*l):(r=(e.max.x-c.x)*l,n=(e.min.x-c.x)*l),u>=0?(i=(e.min.y-c.y)*u,a=(e.max.y-c.y)*u):(i=(e.max.y-c.y)*u,a=(e.min.y-c.y)*u),r>a||i>n)?null:((i>r||isNaN(r))&&(r=i),(a<n||isNaN(n))&&(n=a),h>=0?(s=(e.min.z-c.z)*h,o=(e.max.z-c.z)*h):(s=(e.max.z-c.z)*h,o=(e.min.z-c.z)*h),r>o||s>n)?null:((s>r||r!=r)&&(r=s),(o<n||n!=n)&&(n=o),n<0)?null:this.at(r>=0?r:n,t)}intersectsBox(e){return null!==this.intersectBox(e,B)}intersectTriangle(e,t,r,n,i){let a;W.subVectors(t,e),H.subVectors(r,e),j.crossVectors(W,H);let s=this.direction.dot(j);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}k.subVectors(this.origin,e);let o=a*this.direction.dot(H.crossVectors(k,H));if(o<0)return null;let l=a*this.direction.dot(W.cross(k));if(l<0||o+l>s)return null;let u=-a*k.dot(j);return u<0?null:this.at(u/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},eF=new Sphere,ek=new Vector3,eW=new Vector3,eH=new Vector3,ej=new Vector3,eq=new Vector3,eX=new Vector3,eJ=new Vector2,eY=new Vector2,eZ=new Vector2,eK=new Vector3,eQ=new Vector3,e$=new Vector3,e0=new Vector3,e1=new Vector3;let Mesh=class Mesh extends Object3D{constructor(e=new BufferGeometry,t=new MeshBasicMaterial){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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(){let e=this.geometry,t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let e=t[r[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,r=e.length;t<r;t++){let r=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}}}getVertexPosition(e,t){let r=this.geometry,n=r.attributes.position,i=r.morphAttributes.position,a=r.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(i&&s){eX.set(0,0,0);for(let r=0,n=i.length;r<n;r++){let n=s[r],o=i[r];0!==n&&(eq.fromBufferAttribute(o,e),a?eX.addScaledVector(eq,n):eX.addScaledVector(eq.sub(t),n))}t.add(eX)}return this.isSkinnedMesh&&this.applyBoneTransform(e,t),t}raycast(e,t){let r;let n=this.geometry,i=this.material,a=this.matrixWorld;if(void 0===i||(null===n.boundingSphere&&n.computeBoundingSphere(),eF.copy(n.boundingSphere),eF.applyMatrix4(a),eG.copy(e.ray).recast(e.near),!1===eF.containsPoint(eG.origin)&&(null===eG.intersectSphere(eF,ek)||eG.origin.distanceToSquared(ek)>(e.far-e.near)**2))||(eB.copy(a).invert(),eG.copy(e.ray).applyMatrix4(eB),null!==n.boundingBox&&!1===eG.intersectsBox(n.boundingBox)))return;let s=n.index,o=n.attributes.position,l=n.attributes.uv,u=n.attributes.uv2,h=n.attributes.normal,c=n.groups,d=n.drawRange;if(null!==s){if(Array.isArray(i))for(let n=0,a=c.length;n<a;n++){let a=c[n],o=i[a.materialIndex],p=Math.max(a.start,d.start),f=Math.min(s.count,Math.min(a.start+a.count,d.start+d.count));for(let n=p;n<f;n+=3){let i=s.getX(n),c=s.getX(n+1),d=s.getX(n+2);(r=checkGeometryIntersection(this,o,e,eG,l,u,h,i,c,d))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=a.materialIndex,t.push(r))}}else{let n=Math.max(0,d.start),a=Math.min(s.count,d.start+d.count);for(let o=n;o<a;o+=3){let n=s.getX(o),a=s.getX(o+1),c=s.getX(o+2);(r=checkGeometryIntersection(this,i,e,eG,l,u,h,n,a,c))&&(r.faceIndex=Math.floor(o/3),t.pu
1sh(r))}}}else if(void 0!==o){if(Array.isArray(i))for(let n=0,a=c.length;n<a;n++){let a=c[n],s=i[a.materialIndex],p=Math.max(a.start,d.start),f=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));for(let n=p;n<f;n+=3){let i=n,o=n+1,c=n+2;(r=checkGeometryIntersection(this,s,e,eG,l,u,h,i,o,c))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=a.materialIndex,t.push(r))}}else{let n=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);for(let s=n;s<a;s+=3){let n=s,a=s+1,o=s+2;(r=checkGeometryIntersection(this,i,e,eG,l,u,h,n,a,o))&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}};function checkGeometryIntersection(e,t,r,n,i,a,s,o,l,u){e.getVertexPosition(o,eW),e.getVertexPosition(l,eH),e.getVertexPosition(u,ej);let h=function(e,t,r,n,i,a,s,o){if(null===(1===t.side?n.intersectTriangle(s,a,i,!0,o):n.intersectTriangle(i,a,s,0===t.side,o)))return null;e1.copy(o),e1.applyMatrix4(e.matrixWorld);let l=r.ray.origin.distanceTo(e1);return l<r.near||l>r.far?null:{distance:l,point:e1.clone(),object:e}}(e,t,r,n,eW,eH,ej,e0);if(h){i&&(eJ.fromBufferAttribute(i,o),eY.fromBufferAttribute(i,l),eZ.fromBufferAttribute(i,u),h.uv=Triangle.getInterpolation(e0,eW,eH,ej,eJ,eY,eZ,new Vector2)),a&&(eJ.fromBufferAttribute(a,o),eY.fromBufferAttribute(a,l),eZ.fromBufferAttribute(a,u),h.uv2=Triangle.getInterpolation(e0,eW,eH,ej,eJ,eY,eZ,new Vector2)),s&&(eK.fromBufferAttribute(s,o),eQ.fromBufferAttribute(s,l),e$.fromBufferAttribute(s,u),h.normal=Triangle.getInterpolation(e0,eW,eH,ej,eK,eQ,e$,new Vector3),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let e={a:o,b:l,c:u,normal:new Vector3,materialIndex:0};Triangle.getNormal(eW,eH,ej,e.normal),h.face=e}return h}let BoxGeometry=class BoxGeometry extends BufferGeometry{constructor(e=1,t=1,r=1,n=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:a};let s=this;n=Math.floor(n),i=Math.floor(i),a=Math.floor(a);let o=[],l=[],u=[],h=[],c=0,d=0;function buildPlane(e,t,r,n,i,a,p,f,m,g,_){let x=a/m,y=p/g,M=a/2,S=p/2,b=f/2,T=m+1,w=g+1,E=0,A=0,C=new Vector3;for(let a=0;a<w;a++){let s=a*y-S;for(let o=0;o<T;o++){let c=o*x-M;C[e]=c*n,C[t]=s*i,C[r]=b,l.push(C.x,C.y,C.z),C[e]=0,C[t]=0,C[r]=f>0?1:-1,u.push(C.x,C.y,C.z),h.push(o/m),h.push(1-a/g),E+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let r=c+t+T*e,n=c+t+T*(e+1),i=c+(t+1)+T*(e+1),a=c+(t+1)+T*e;o.push(r,n,a),o.push(n,i,a),A+=6}s.addGroup(d,A,_),d+=A,c+=E}buildPlane("z","y","x",-1,-1,r,t,e,a,i,0),buildPlane("z","y","x",1,-1,r,t,-e,a,i,1),buildPlane("x","z","y",1,1,e,r,t,n,a,2),buildPlane("x","z","y",1,-1,e,r,-t,n,a,3),buildPlane("x","y","z",1,-1,e,t,r,n,i,4),buildPlane("x","y","z",-1,-1,e,t,-r,n,i,5),this.setIndex(o),this.setAttribute("position",new Float32BufferAttribute(l,3)),this.setAttribute("normal",new Float32BufferAttribute(u,3)),this.setAttribute("uv",new Float32BufferAttribute(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new BoxGeometry(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function cloneUniforms(e){let t={};for(let r in e)for(let n in t[r]={},e[r]){let i=e[r][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[r][n]=null):t[r][n]=i.clone():Array.isArray(i)?t[r][n]=i.slice():t[r][n]=i}return t}function mergeUniforms(e){let t={};for(let r=0;r<e.length;r++){let n=cloneUniforms(e[r]);for(let e in n)t[e]=n[e]}return t}function getUnlitUniformColorSpace(e){return null===e.getRenderTarget()&&3001===e.outputEncoding?i:a}let e3={clone:cloneUniforms,merge:mergeUniforms};let ShaderMaterial=class ShaderMaterial extends Material{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n	gl_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.forceSinglePass=!0,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&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cloneUniforms(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let r=0;r<e.length;r++)t.push(e[r].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[r],i=n.value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let r={};for(let e in this.extensions)!0===this.extensions[e]&&(r[e]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}};let Camera=class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};let PerspectiveCamera=class PerspectiveCamera extends Camera{constructor(e=50,t=1,r=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*c*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*h*this.fov);return .5*this.getFilmHeight()/e}
1getEffectiveFOV(){return 2*c*Math.atan(Math.tan(.5*h*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,n,i,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=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*h*this.fov)/this.zoom,r=2*t,n=this.aspect*r,i=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;i+=a.offsetX*n/e,t-=a.offsetY*r/s,n*=a.width/e,r*=a.height/s}let s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+n,t,t-r,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};let CubeCamera=class CubeCamera extends Object3D{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;let n=new PerspectiveCamera(-90,1,e,t);n.layers=this.layers,n.up.set(0,1,0),n.lookAt(1,0,0),this.add(n);let i=new PerspectiveCamera(-90,1,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(-1,0,0),this.add(i);let a=new PerspectiveCamera(-90,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let s=new PerspectiveCamera(-90,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(0,-1,0),this.add(s);let o=new PerspectiveCamera(-90,1,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new PerspectiveCamera(-90,1,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();let r=this.renderTarget,[n,i,a,s,o,l]=this.children,u=e.getRenderTarget(),h=e.toneMapping,c=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;let d=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,n),e.setRenderTarget(r,1),e.render(t,i),e.setRenderTarget(r,2),e.render(t,a),e.setRenderTarget(r,3),e.render(t,s),e.setRenderTarget(r,4),e.render(t,o),r.texture.generateMipmaps=d,e.setRenderTarget(r,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=c,r.texture.needsPMREMUpdate=!0}};let CubeTexture=class CubeTexture extends Texture{constructor(e,t,r,n,i,a,s,o,l,u){super(e=void 0!==e?e:[],t=void 0!==t?t:301,r,n,i,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};let WebGLCubeRenderTarget=class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let r={width:e,height:e,depth:1},n=[r,r,r,r,r,r];this.texture=new CubeTexture(n,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let r={uniforms:{tEquirect:{value:null}},vertexShader:`
2
3				varying vec3 vWorldDirection;
4
5				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
6
7					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
8
9				}
10
11				void main() {
12
13					vWorldDirection = transformDirection( position, modelMatrix );
14
15					#include <begin_vertex>
16					#include <project_vertex>
17
18				}
19			`,fragmentShader:`
20
21				uniform sampler2D tEquirect;
22
23				varying vec3 vWorldDirection;
24
25				#include <common>
26
27				void main() {
28
29					vec3 direction = normalize( vWorldDirection );
30
31					vec2 sampleUV = equirectUv( direction );
32
33					gl_FragColor = texture2D( tEquirect, sampleUV );
34
35				}
36			`},n=new BoxGeometry(5,5,5),i=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new Mesh(n,i),s=t.minFilter;1008===t.minFilter&&(t.minFilter=1006);let o=new CubeCamera(1,10,this);return o.update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,r,n){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,r,n);e.setRenderTarget(i)}};let e2=new Vector3,e4=new Vector3,e5=new Matrix3;let Plane=class Plane{constructor(e=new Vector3(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){let n=e2.subVectors(r,t).cross(e4.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let r=e.delta(e2),n=this.normal.dot(r);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;
36let i=-(e.start.dot(this.normal)+this.constant)/n;return i<0||i>1?null:t.copy(e.start).addScaledVector(r,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let r=t||e5.getNormalMatrix(e),n=this.coplanarPoint(e2).applyMatrix4(e),i=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};let e6=new Sphere,e7=new Vector3;let Frustum=class Frustum{constructor(e=new Plane,t=new Plane,r=new Plane,n=new Plane,i=new Plane,a=new Plane){this.planes=[e,t,r,n,i,a]}set(e,t,r,n,i,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(r),s[3].copy(n),s[4].copy(i),s[5].copy(a),this}copy(e){let t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){let t=this.planes,r=e.elements,n=r[0],i=r[1],a=r[2],s=r[3],o=r[4],l=r[5],u=r[6],h=r[7],c=r[8],d=r[9],p=r[10],f=r[11],m=r[12],g=r[13],_=r[14],x=r[15];return t[0].setComponents(s-n,h-o,f-c,x-m).normalize(),t[1].setComponents(s+n,h+o,f+c,x+m).normalize(),t[2].setComponents(s+i,h+l,f+d,x+g).normalize(),t[3].setComponents(s-i,h-l,f-d,x-g).normalize(),t[4].setComponents(s-a,h-u,f-p,x-_).normalize(),t[5].setComponents(s+a,h+u,f+p,x+_).normalize(),this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),e6.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),e6.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(e6)}intersectsSprite(e){return e6.center.set(0,0,0),e6.radius=.7071067811865476,e6.applyMatrix4(e.matrixWorld),this.intersectsSphere(e6)}intersectsSphere(e){let t=this.planes,r=e.center,n=-e.radius;for(let e=0;e<6;e++){let i=t[e].distanceToPoint(r);if(i<n)return!1}return!0}intersectsBox(e){let t=this.planes;for(let r=0;r<6;r++){let n=t[r];if(e7.x=n.normal.x>0?e.max.x:e.min.x,e7.y=n.normal.y>0?e.max.y:e.min.y,e7.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(e7))return!1}return!0}containsPoint(e){let t=this.planes;for(let r=0;r<6;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}};function WebGLAnimation(){let e=null,t=!1,r=null,n=null;function onAnimationFrame(t,i){r(t,i),n=e.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==t&&null!==r&&(n=e.requestAnimationFrame(onAnimationFrame),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function WebGLAttributes(e,t){let r=t.isWebGL2,n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){let e=n.get(t);(!e||e.version<t.version)&&n.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version});return}t.isInterleavedBufferAttribute&&(t=t.data);let a=n.get(t);void 0===a?n.set(t,function(t,n){let i;let a=t.array,s=t.usage,o=e.createBuffer();if(e.bindBuffer(n,o),e.bufferData(n,a,s),t.onUploadCallback(),a instanceof Float32Array)i=5126;else if(a instanceof Uint16Array){if(t.isFloat16BufferAttribute){if(r)i=5131;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.")}else i=5123}else if(a instanceof Int16Array)i=5122;else if(a instanceof Uint32Array)i=5125;else if(a instanceof Int32Array)i=5124;else if(a instanceof Int8Array)i=5120;else if(a instanceof Uint8Array)i=5121;else if(a instanceof Uint8ClampedArray)i=5121;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:o,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,i)):a.version<t.version&&(!function(t,n,i){let a=n.array,s=n.updateRange;e.bindBuffer(i,t),-1===s.count?e.bufferSubData(i,0,a):(r?e.bufferSubData(i,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):e.bufferSubData(i,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1),n.onUploadCallback()}(a.buffer,t,i),a.version=t.version)}}}let PlaneGeometry=class PlaneGeometry extends BufferGeometry{constructor(e=1,t=1,r=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};let i=e/2,a=t/2,s=Math.floor(r),o=Math.floor(n),l=s+1,u=o+1,h=e/s,c=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<u;e++){let t=e*c-a;for(let r=0;r<l;r++){let n=r*h-i;p.push(n,-t,0),f.push(0,0,1),m.push(r/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){let r=t+l*e,n=t+l*(e+1),i=t+1+l*(e+1),a=t+1+l*e;d.push(r,n,a),d.push(n,i,a)}this.setIndex(d),this.setAttribute("position",new Float32BufferAttribute(p,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PlaneGeometry(e.width,e.height,e.widthSegments,e.heightSegments)}};let e8={alphamap_fragment:"#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n	if ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n	uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n	reflectedLight.indirectDiffuse *= ambientOcclusion;\n	#if defined( USE_ENVMAP ) && defined( STANDARD )\n		float dotNV = saturate( dot
36( geometry.normal, geometry.viewDir ) );\n		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n	#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n	vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n	return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n	float G = G_BlinnPhong_Implicit( );\n	float D = D_BlinnPhong( shininess, dotNH );\n	return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n	const mat3 XYZ_TO_REC709 = mat3(\n		 3.2404542, -0.9692660,  0.0556434,\n		-1.5371385,  1.8760108, -0.2040259,\n		-0.4985314,  0.0415560,  1.0572252\n	);\n	vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n		vec3 sqrtF0 = sqrt( fresnel0 );\n		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n	}\n	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n	}\n	float IorToFresnel0( float transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n	}\n	vec3 evalSensitivity( float OPD, vec3 shift ) {\n		float phase = 2.0 * PI * OPD * 1.0e-9;\n		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n		xyz /= 1.0685e-7;\n		vec3 rgb = XYZ_TO_REC709 * xyz;\n		return rgb;\n	}\n	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n		vec3 I;\n		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n		float cosTheta2Sq = 1.0 - sinTheta2Sq;\n		if ( cosTheta2Sq < 0.0 ) {\n			 return vec3( 1.0 );\n		}\n		float cosTheta2 = sqrt( cosTheta2Sq );\n		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n		float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n		float R21 = R12;
36\n		float T121 = 1.0 - R12;\n		float phi12 = 0.0;\n		if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n		float phi21 = PI - phi12;\n		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n		vec3 phi23 = vec3( 0.0 );\n		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n		vec3 phi = vec3( phi21 ) + phi23;\n		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n		vec3 r123 = sqrt( R123 );\n		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n		vec3 C0 = R12 + Rs;\n		I = C0;\n		vec3 Cm = Rs - T121;\n		for ( int m = 1; m <= 2; ++ m ) {\n			Cm *= r123;\n			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n			I += Cm * Sm;\n		}\n		return max( I, vec3( 0.0 ) );\n	}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n	vec2 dHdxy_fwd() {\n		vec2 dSTdx = dFdx( vBumpMapUv );\n		vec2 dSTdy = dFdy( vBumpMapUv );\n		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n		return vec2( dBx, dBy );\n	}\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n		vec3 vSigmaX = dFdx( surf_pos.xyz );\n		vec3 vSigmaY = dFdy( surf_pos.xyz );\n		vec3 vN = surf_norm;\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n		float fDet = dot( vSigmaX, R1 ) * faceDirection;\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n	}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n	vec4 plane;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n		plane = clippingPlanes[ i ];\n		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n	}\n	#pragma unroll_loop_end\n	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n		bool clipped = true;\n		#pragma unroll_loop_start\n		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n			plane = clippingPlanes[ i ];\n			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n		}\n		#pragma unroll_loop_end\n		if ( clipped ) discard;\n	#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n	vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n	diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n	diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n	varying vec4 vColor;\n#elif defined( USE_COLOR )\n	varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n	varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n	varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n	vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n	vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n	vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n	vColor.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; }\nvec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n	const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n	return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n	float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n	float precisionSafeLength( vec3 v ) {\n		float maxComponent = max3( abs( v ) );\n		return length( v / maxComponent ) * maxComponent;\n	}\n#endif\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n	bool visible;\n};\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\nstruct GeometricContext {\n	vec3 position;\n	vec3 normal;\n	vec3 viewDir;\n#ifdef USE_CLEARCOAT\n	vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n	mat3 tmp;\n	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n	return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n	return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n	return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n	return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n	return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n	#define cubeUV_minMipLevel 4.0\n	#define cubeUV_minTileSize 16.0\n	float getFace( vec3 direction ) {\n		vec3 absDirection = abs( direction );\n		float face = - 1.0;\n		if ( absDirection.x > absDirection.z ) {\n			if ( absDirection.x > absDirection.y )\n				face = direction.x > 0.0 ? 0.0 : 3.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		} else {\n			if ( absDirection.z > absDirection.y )\n				face = direction.z > 0.0 ? 2.0 : 5.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		}\n		return face;\n	}\n	vec2 getUV( vec3 direction, float face ) {\n		vec2 uv;\n		if ( face == 0.0 ) {\n			uv = vec2( direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 1.0 ) {\n			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n		} else if ( face == 2.0 ) {\n			uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n		} else if ( face == 3.0 ) {\n			uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 4.0 ) {\n			uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n		} else {\n			uv = vec2( direction.x, direction.y ) / abs( direction.z );\n		}\n		return 0.5 * ( uv + 1.0 );\n	}\n	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n		float face = getFace( direction );\n		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n		mipInt = max( mipInt, cubeUV_minMipLevel );\n		float faceSize = exp2( mipInt );\n		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n		if ( face > 2.0 ) {\n			uv.y += faceSize;\n			face -= 3.0;\n		}\n		uv.x += face * faceSize;\n		uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n		uv.x *= CUBEUV_TEXEL_WIDTH;\n		uv.y *= CUBEUV_TEXEL_HEIGHT;\n		#ifdef texture2DGradEXT\n			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n		#else\n			return texture2D( envMap, uv ).rgb;\n		#endif\n	}\n	#define cubeUV_r0 1.0\n	#define cubeUV_v0 0.339\n	#define cubeUV_m0 - 2.0\n	#define cubeUV_r1 0.8\n	#define cubeUV_v1 0.276\n	#define cubeUV_m1 - 1.0\n	#define cubeUV_r4 0.4\n	#define cubeUV_v4 0.046\n	#define cubeUV_m4 2.0\n	#define cubeUV_r5 0.305\n	#define cubeUV_v5 0.016\n	#define cubeUV_m5 3.0\n	#define cubeUV_r6 0.21\n	#define cubeUV_v6 0.0038\n	#define cubeUV_m6 4.0\n	float roughnessToMip( float roughness ) {\n		float mip = 0.0;\n		if ( roughness >= cubeUV_r1 ) {\n			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n		} else if ( roughness >= cubeUV_r4 ) {\n			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n		} else if ( roughness >= cubeUV_r5 ) {\n			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n		} else if ( roughness >= cubeUV_r6 ) {\n			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n		} else {\n			mip = - 2.0 * log2( 1.16 * roughness );		}\n		return mip;\n	}\n	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n		float mipF = fract( mip );\n		float mipInt = floor( mip );\n		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n		if ( mipF == 0.0 ) {\n			return vec4( color0, 1.0 );\n		} else {\n			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n			return vec4( mix( color0, color1, mipF ), 1.0 );\n		}\n	}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n	mat3 m = mat3( instanceMatrix );\n	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n	transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n	transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n	#ifdef FLIP_SIDED\n		transformedTangent = - transformedTangent;\n	#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
36placementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n	totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n	uniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n	return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n	return 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}",envmap_fragment:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vec3 cameraToFrag;\n		if ( isOrthographic ) {\n			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		} else {\n			cameraToFrag = normalize( vWorldPosition - cameraPosition );\n		}\n		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n		#else\n			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n		#endif\n	#else\n		vec3 reflectVec = vReflect;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n	#else\n		vec4 envColor = vec4( 0.0 );\n	#endif\n	#ifdef ENVMAP_BLENDING_MULTIPLY\n		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_MIX )\n		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_ADD )\n		outgoingLight += envColor.xyz * specularStrength * reflectivity;\n	#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float envMapIntensity;\n	uniform float flipEnvMap;\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n	\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float reflectivity;\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		varying vec3 vWorldPosition;\n		uniform float refractionRatio;\n	#else\n		varying vec3 vReflect;\n	#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		\n		varying vec3 vWorldPosition;\n	#else\n		varying vec3 vReflect;\n		uniform float refractionRatio;\n	#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n	vec3 getIBLIrradiance( const in vec3 normal ) {\n		#if defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n			return PI * envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n		#if defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 reflectVec = reflect( - viewDir, normal );\n			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n			return envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vWorldPosition = worldPosition.xyz;\n	#else\n		vec3 cameraToVertex;\n		if ( isOrthographic ) {\n			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		}
36 else {\n			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n		}\n		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vReflect = reflect( cameraToVertex, worldNormal );\n		#else\n			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n	vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n	varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n	#ifdef FOG_EXP2\n		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n	#else\n		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n	#endif\n	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n	uniform vec3 fogColor;\n	varying float vFogDepth;\n	#ifdef FOG_EXP2\n		uniform float fogDensity;\n	#else\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n	uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n	float dotNL = dot( normal, lightDirection );\n	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n	#ifdef USE_GRADIENTMAP\n		return vec3( texture2D( gradientMap, coord ).r );\n	#else\n		vec2 fw = fwidth( coord ) * 0.5;\n		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n	#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n	vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n	reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n	vec3 diffuseColor;\n	float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Lambert\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n	float x = normal.x, y = normal.y, z = normal.z;\n	vec3 result = shCoefficients[ 0 ] * 0.886227;\n	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n	return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n	return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n	vec3 irradiance = ambientLightColor;\n	return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n	#if defined ( LEGACY_LIGHTS )\n		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n		}\n		return 1.0;\n	#else\n		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n		if ( cutoffDistance > 0.0 ) {\n			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n		}\n		return distanceFalloff;\n	#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n	return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n	struct DirectionalLight {\n		vec3 direction;\n		vec3 color;\n	};\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n		light.color = directionalLight.color;\n		light.direction = directionalLight.direction;\n		light.visible = true;\n	}\n#endif\n#if NUM_POINT_LIGHTS > 0\n	struct PointLight {\n		vec3 position;\n		vec3 color;\n		float distance;\n		float decay;\n	};\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n		vec3 lVector = pointLight.position - geometry.position;\n		light.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		light.color = pointLight.color;\n		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n		light.visible = ( light.color != vec3( 0.0 ) );\n	}
36\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	struct SpotLight {\n		vec3 position;\n		vec3 direction;\n		vec3 color;\n		float distance;\n		float decay;\n		float coneCos;\n		float penumbraCos;\n	};\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n		vec3 lVector = spotLight.position - geometry.position;\n		light.direction = normalize( lVector );\n		float angleCos = dot( light.direction, spotLight.direction );\n		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n		if ( spotAttenuation > 0.0 ) {\n			float lightDistance = length( lVector );\n			light.color = spotLight.color * spotAttenuation;\n			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n			light.visible = ( light.color != vec3( 0.0 ) );\n		} else {\n			light.color = vec3( 0.0 );\n			light.visible = false;\n		}\n	}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n	struct RectAreaLight {\n		vec3 color;\n		vec3 position;\n		vec3 halfWidth;\n		vec3 halfHeight;\n	};\n	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;\n	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	struct HemisphereLight {\n		vec3 direction;\n		vec3 skyColor;\n		vec3 groundColor;\n	};\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n		float dotNL = dot( normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n		return irradiance;\n	}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n	vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Toon\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon",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;\nstruct BlinnPhongMaterial {\n	vec3 diffuseColor;\n	vec3 specularColor;\n	float specularShininess;\n	float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong",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.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n	material.ior = ior;\n	#ifdef USE_SPECULAR\n		float specularIntensityFactor = specularIntensity;\n		vec3 specularColorFactor = specularColor;\n		#ifdef USE_SPECULAR_COLORMAP\n			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n		#endif\n		#ifdef USE_SPECULAR_INTENSITYMAP\n			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n		#endif\n		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n	#else\n		float specularIntensityFactor = 1.0;\n		vec3 specularColorFactor = vec3( 1.0 );\n		material.specularF90 = 1.0;\n	#endif\n	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n	material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n	material.clearcoat = clearcoat;
36\n	material.clearcoatRoughness = clearcoatRoughness;\n	material.clearcoatF0 = vec3( 0.04 );\n	material.clearcoatF90 = 1.0;\n	#ifdef USE_CLEARCOATMAP\n		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n	#endif\n	#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n	#endif\n	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n	material.clearcoatRoughness += geometryRoughness;\n	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n	material.iridescence = iridescence;\n	material.iridescenceIOR = iridescenceIOR;\n	#ifdef USE_IRIDESCENCEMAP\n		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n	#endif\n	#ifdef USE_IRIDESCENCE_THICKNESSMAP\n		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n	#else\n		material.iridescenceThickness = iridescenceThicknessMaximum;\n	#endif\n#endif\n#ifdef USE_SHEEN\n	material.sheenColor = sheenColor;\n	#ifdef USE_SHEEN_COLORMAP\n		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n	#endif\n	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n	#ifdef USE_SHEEN_ROUGHNESSMAP\n		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n	#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n	vec3 diffuseColor;\n	float roughness;\n	vec3 specularColor;\n	float specularF90;\n	#ifdef USE_CLEARCOAT\n		float clearcoat;\n		float clearcoatRoughness;\n		vec3 clearcoatF0;\n		float clearcoatF90;\n	#endif\n	#ifdef USE_IRIDESCENCE\n		float iridescence;\n		float iridescenceIOR;\n		float iridescenceThickness;\n		vec3 iridescenceFresnel;\n		vec3 iridescenceF0;\n	#endif\n	#ifdef USE_SHEEN\n		vec3 sheenColor;\n		float sheenRoughness;\n	#endif\n	#ifdef IOR\n		float ior;\n	#endif\n	#ifdef USE_TRANSMISSION\n		float transmission;\n		float transmissionAlpha;\n		float thickness;\n		float attenuationDistance;\n		vec3 attenuationColor;\n	#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n	float a2 = pow2( alpha );\n	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n	return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_CLEARCOAT\n	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n		vec3 f0 = material.clearcoatF0;\n		float f90 = material.clearcoatF90;\n		float roughness = material.clearcoatRoughness;\n		float alpha = pow2( roughness );\n		vec3 halfDir = normalize( lightDir + viewDir );\n		float dotNL = saturate( dot( normal, lightDir ) );\n		float dotNV = saturate( dot( normal, viewDir ) );\n		float dotNH = saturate( dot( normal, halfDir ) );\n		float dotVH = saturate( dot( viewDir, halfDir ) );\n		vec3 F = F_Schlick( f0, f90, dotVH );\n		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n		float D = D_GGX( alpha, dotNH );\n		return F * ( V * D );\n	}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n	vec3 f0 = material.specularColor;\n	float f90 = material.specularF90;\n	float roughness = material.roughness;\n	float alpha = pow2( roughness );\n	vec3 halfDir = normalize( lightDir + viewDir );
36\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( f0, f90, dotVH );\n	#ifdef USE_IRIDESCENCE\n		F = mix( F, material.iridescenceFresnel, material.iridescence );\n	#endif\n	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n	float D = D_GGX( alpha, dotNH );\n	return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n	const float LUT_SIZE = 64.0;\n	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n	const float LUT_BIAS = 0.5 / LUT_SIZE;\n	float dotNV = saturate( dot( N, V ) );\n	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n	uv = uv * LUT_SCALE + LUT_BIAS;\n	return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n	float l = length( f );\n	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n	float x = dot( v1, v2 );\n	float y = abs( x );\n	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n	float b = 3.4175940 + ( 4.1616724 + y ) * y;\n	float v = a / b;\n	float theta_sintheta = ( x >
36 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n	return 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	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n	vec3 lightNormal = cross( v1, v2 );\n	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n	vec3 T1, T2;\n	T1 = normalize( V - N * dot( V, N ) );\n	T2 = - cross( N, T1 );\n	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n	vec3 coords[ 4 ];\n	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n	coords[ 0 ] = normalize( coords[ 0 ] );\n	coords[ 1 ] = normalize( coords[ 1 ] );\n	coords[ 2 ] = normalize( coords[ 2 ] );\n	coords[ 3 ] = normalize( coords[ 3 ] );\n	vec3 vectorFormFactor = vec3( 0.0 );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n	return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n	float alpha = pow2( roughness );\n	float invAlpha = 1.0 / alpha;\n	float cos2h = dotNH * dotNH;\n	float sin2h = max( 1.0 - cos2h, 0.0078125 );\n	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float D = D_Charlie( sheenRoughness, dotNH );\n	float V = V_Neubelt( dotNV, dotNL );\n	return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float r2 = roughness * roughness;\n	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n	return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n	vec4 r = roughness * c0 + c1;\n	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n	return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n	vec2 fab = DFGApprox( normal, viewDir, roughness );\n	return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n	vec2 fab = DFGApprox( normal, viewDir, roughness );
36\n	#ifdef USE_IRIDESCENCE\n		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n	#else\n		vec3 Fr = specularColor;\n	#endif\n	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n	float Ess = fab.x + fab.y;\n	float Ems = 1.0 - Ess;\n	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n	singleScatter += FssEss;\n	multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n		vec3 normal = geometry.normal;\n		vec3 viewDir = geometry.viewDir;\n		vec3 position = geometry.position;\n		vec3 lightPos = rectAreaLight.position;\n		vec3 halfWidth = rectAreaLight.halfWidth;\n		vec3 halfHeight = rectAreaLight.halfHeight;\n		vec3 lightColor = rectAreaLight.color;\n		float roughness = material.roughness;\n		vec3 rectCoords[ 4 ];\n		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n		vec2 uv = LTC_Uv( normal, viewDir, roughness );\n		vec4 t1 = texture2D( ltc_1, uv );\n		vec4 t2 = texture2D( ltc_2, uv );\n		mat3 mInv = mat3(\n			vec3( t1.x, 0, t1.y ),\n			vec3(    0, 1,    0 ),\n			vec3( t1.z, 0, t1.w )\n		);\n		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n	}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifdef USE_CLEARCOAT\n		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n		vec3 ccIrradiance = dotNLcc * directLight.color;\n		clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n	#endif\n	#ifdef USE_SHEEN\n		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n	#endif\n	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_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	#ifdef USE_CLEARCOAT\n		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n	#endif\n	#ifdef USE_SHEEN\n		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n	#endif\n	vec3 singleScattering = vec3( 0.0 );\n	vec3 multiScattering = vec3( 0.0 );\n	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n	#ifdef USE_IRIDESCENCE\n		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n	#else\n		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n	#endif\n	vec3 totalScattering = singleScattering + multiScattering;\n	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n	reflectedLight.indirectSpecular += radiance * singleScattering;\n	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct				RE_Direct_Physical\n#define RE_Direct_RectArea		RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular		RE_IndirectSpecular_Physical\nfloat c
36omputeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n	return 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 USE_CLEARCOAT\n	geometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n	float dotNVi = saturate( dot( normal, geometry.viewDir ) );\n	if ( material.iridescenceThickness == 0.0 ) {\n		material.iridescence = 0.0;\n	} else {\n		material.iridescence = saturate( material.iridescence );\n	}\n	if ( material.iridescence > 0.0 ) {\n		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n	}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n	PointLight pointLight;\n	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n	PointLightShadow pointLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		getPointLightInfo( pointLight, geometry, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n		pointLightShadow = pointLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n	SpotLight spotLight;\n	vec4 spotColor;\n	vec3 spotLightCoord;\n	bool inSpotLightMap;\n	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		getSpotLightInfo( spotLight, geometry, directLight );\n		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n		#else\n		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n		#endif\n		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n		#endif\n		#undef SPOT_LIGHT_MAP_INDEX\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		spotLightShadow = spotLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n	DirectionalLight directionalLight;\n	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		getDirectionalLightInfo( directionalLight, geometry, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n		directionalLightShadow = directionalLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n	RectAreaLight rectAreaLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n		rectAreaLight = rectAreaLights[ i ];\n		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n	vec3 iblIrradiance = vec3( 0.0 );\n	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n	#if ( NUM_HEMI_LIGHTS > 0 )\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n		}\n		#pragma unroll_loop_end\n	#endif\n#endif\n#if defined( RE_IndirectSpecular )\n	vec3 radiance = vec3( 0.0 );\n	vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n		irradiance += lightMapIrradiance;\n	#endif\n	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n		iblIrradiance += getIBLIrradiance( geometry.normal );\n	#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n	#ifdef USE_CLEARCOAT\n		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n	#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n	gl_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	uniform float logDepthBufFC;\n	varying float vFragDepth;\n	varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n	#ifdef USE_LOGDEPTHBUF_EXT\n		varying float vFragDepth;\n		varying float vIsPerspective;\n	#else\n		uniform float logDepthBufFC;\n	#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n	#ifdef USE_LOGDEPTHBUF_EXT\n		vFragDepth = 1.0 + gl_Position.w;\n		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n	#else\n		if ( isPerspectiveMatrix( projectionMatrix ) ) {\n			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n			gl_Position.z *= gl_Position.w;\n		}\n	#endif\n#endif",map_fragment:"#ifdef USE_MAP\n	vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n	#endif\n	diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n	uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n	#if defined( USE_POINTS_UV )\n		vec2 uv = vUv;\n	#else\n		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n	#endif\n#endif\n#ifdef USE_MAP\n	diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n	varying vec2 vUv;\n#else\n	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n		uniform mat3 uvTransform;\n	#endif\n#endif\n#ifdef USE_MAP\n	uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n	metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n	uniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n	vColor *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		#if defined( USE_COLOR_ALPHA )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n		#elif defined( USE_COLOR )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n		#endif\n	}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n	objectNormal *= morphTargetBaseInfluence;\n	#ifdef MORPHTARGETS_TEXTURE\n		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n		}\n	#else\n		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n	#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n	uniform float morphTargetBaseInfluence;\n	#ifdef MORPHTARGETS_TEXTURE\n		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n		uniform sampler2DArray morphTargetsTexture;\n		uniform ivec2 morphTargetsTextureSize;\n		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n			int y = texelIndex / morphTargetsTextureSize.x;\n			int x = texelIndex - y * morphTargetsTextureSize.x;\n			ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n			return texelFetch( morphTargetsTexture, morphUV, 0 );\n		}\n	#else\n		#ifndef USE_MORPHNORMALS\n			uniform float morphTargetInfluences[ 8 ];\n		#else\n			uniform float morphTargetInfluences[ 4 ];\n		#endif\n	#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n	transformed *= morphTargetBaseInfluence;\n	#ifdef MORPHTARGETS_TEXTURE\n		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n		}\n	#else\n		transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n		transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n		transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n		transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n		#ifndef USE_MORPHNORMALS\n			transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n			transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n			transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n			transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n		#endif\n	#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n	vec3 fdx = dFdx( vViewPosition );\n	vec3 fdy = dFdy( vViewPosition );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n	vec3 normal = normalize( vNormal );\n	#ifdef DOUBLE_SIDED\n		normal *= faceDirection;\n	#endif\n#endif\n#ifdef USE_NORMALMAP_TANGENTSPACE\n	#ifdef USE_TANGENT\n		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n	#else\n		mat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n	#endif\n	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n		tbn[0] *= faceDirection;\n		tbn[1] *= faceDirection;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	#ifdef USE_TANGENT\n		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n	#else\n		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n	#endif\n	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n		tbn2[0] *= faceDirection;\n		tbn2[1] *= faceDirection;\n	#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n	#ifdef FLIP_SIDED\n		normal = - normal;\n	#endif\n	#ifdef DOUBLE_SIDED\n		normal = normal * faceDirection;\n	#endif\n	normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n	mapN.xy *= normalScale;\n	normal = normalize( tbn * mapN );
36\n#elif defined( USE_BUMPMAP )\n	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n	#ifdef USE_TANGENT\n		vTangent = normalize( transformedTangent );\n		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n	#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n	uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( uv.st );\n		vec2 st1 = dFdy( uv.st );\n		vec3 N = surf_norm;\n		vec3 q1perp = cross( q1, N );\n		vec3 q0perp = cross( N, q0 );\n		vec3 T = q1perp * st0.x + q0perp * st1.x;\n		vec3 B = q1perp * st0.y + q0perp * st1.y;\n		float det = max( dot( T, T ), dot( B, B ) );\n		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n		return mat3( T * scale, B * scale, N );\n	}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n	vec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n	clearcoatMapN.xy *= clearcoatNormalScale;\n	clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n	uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform sampler2D clearcoatNormalMap;\n	uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n	uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n	return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n	return 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	vec4 r = vec4( fract( v * PackFactors ), v );\n	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n	return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n	return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n	return 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	return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n	return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n	return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n	gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n	mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n	gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n	vec3 dithering( vec3 color ) {\n		float grid_position = rand( gl_FragCoord.xy );\n		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n		return color + dither_shift_RGB;\n	}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n	roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n	uniform sampler2D roughnessMap;
36\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n		struct SpotLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n	}\n	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n		return unpackRGBATo2Half( texture2D( shadow, uv ) );\n	}\n	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n		float occlusion = 1.0;\n		vec2 distribution = texture2DDistribution( shadow, uv );\n		float hard_shadow = step( compare , distribution.x );\n		if (hard_shadow != 1.0 ) {\n			float distance = compare - distribution.x ;\n			float variance = max( 0.00000, distribution.y * distribution.y );\n			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n		}\n		return occlusion;\n	}\n	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n		float shadow = 1.0;\n		shadowCoord.xyz /= shadowCoord.w;\n		shadowCoord.z += shadowBias;\n		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n		if ( frustumTest ) {\n		#if defined( SHADOWMAP_TYPE_PCF )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx0 = - texelSize.x * shadowRadius;\n			float dy0 = - texelSize.y * shadowRadius;\n			float dx1 = + texelSize.x * shadowRadius;\n			float dy1 = + texelSize.y * shadowRadius;\n			float dx2 = dx0 / 2.0;\n			float dy2 = dy0 / 2.0;\n			float dx3 = dx1 / 2.0;\n			float dy3 = dy1 / 2.0;\n			shadow = (\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n			) * ( 1.0 / 17.0 );\n		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx = texelSize.x;\n			float dy = texelSize.y;\n			vec2 uv = shadowCoord.xy;
36\n			vec2 f = fract( uv * shadowMapSize + 0.5 );\n			uv -= f * texelSize;\n			shadow = (\n				texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n					 f.x ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n					 f.x ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n					 f.y ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n					 f.y ) +\n				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n						  f.x ),\n					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n						  f.x ),\n					 f.y )\n			) * ( 1.0 / 9.0 );\n		#elif defined( SHADOWMAP_TYPE_VSM )\n			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n		#else\n			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n		#endif\n		}\n		return shadow;\n	}\n	vec2 cubeToUV( vec3 v, float texelSizeY ) {\n		vec3 absV = abs( v );\n		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n		absV *= scaleToCube;\n		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n		vec2 planar = v.xy;\n		float almostATexel = 1.5 * texelSizeY;\n		float almostOne = 1.0 - almostATexel;\n		if ( absV.z >= almostOne ) {\n			if ( v.z > 0.0 )\n				planar.x = 4.0 - v.x;\n		} else if ( absV.x >= almostOne ) {\n			float signX = sign( v.x );\n			planar.x = v.z * signX + 2.0 * signX;\n		} else if ( absV.y >= almostOne ) {\n			float signY = sign( v.y );\n			planar.x = v.x + 2.0 * signY + 2.0;\n			planar.y = v.z * signY - 2.0;\n		}\n		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n	}\n	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n		vec3 lightToPosition = shadowCoord.xyz;\n		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;\n		vec3 bd3D = normalize( lightToPosition );\n		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n			return (\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n			) * ( 1.0 / 9.0 );\n		#else\n			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n		#endif\n	}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
36\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		struct SpotLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n	vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n		}\n		#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n		}\n		#pragma unroll_loop_end\n	#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n		shadowWorldPosition = worldPosition;\n		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n		#endif\n		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n	}\n	#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n	float shadow = 1.0;\n	#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n		directionalLight = directionalLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n		spotLight = spotLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n	PointLightShadow pointLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n		pointLight = pointLightShadows[ i ];\n		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#endif\n	return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n	uniform highp sampler2D boneTexture;\n	uniform int boneTextureSize;\n	mat4 getBoneMatrix( const in float i ) {\n		float j = i * 4.0;\n		float x = mod( j, float( boneTextureSize ) );\n		float y = floor( j / float( boneTextureSize ) );\n		float dx = 1.0 / float( boneTextureSize );\n		float dy = 1.0 / float( boneTextureSize );\n		y = dy * ( y + 0.5 );\n		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n		mat4 bone = mat4( v1, v2, v3, v4 );\n		return bone;\n	}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n	#ifdef USE_TANGENT\n		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n	#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n	specularStrength = texelSpecular.r;\n#else\n	specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n	uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n	gl_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;
36\nvec3 LinearToneMapping( vec3 color ) {\n	return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	color = max( vec3( 0.0 ), color - 0.004 );\n	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n	return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n	const mat3 ACESInputMat = mat3(\n		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),\n		vec3( 0.04823, 0.01566, 0.83777 )\n	);\n	const mat3 ACESOutputMat = mat3(\n		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),\n		vec3( -0.07367, -0.00605,  1.07602 )\n	);\n	color *= toneMappingExposure / 0.6;\n	color = ACESInputMat * color;\n	color = RRTAndODTFit( color );\n	color = ACESOutputMat * color;\n	return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n	material.transmission = transmission;\n	material.transmissionAlpha = 1.0;\n	material.thickness = thickness;\n	material.attenuationDistance = attenuationDistance;\n	material.attenuationColor = attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n	#endif\n	vec3 pos = vWorldPosition;\n	vec3 v = normalize( cameraPosition - pos );\n	vec3 n = inverseTransformDirection( normal, viewMatrix );\n	vec4 transmission = getIBLVolumeRefraction(\n		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n		material.attenuationColor, material.attenuationDistance );\n	material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n	totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n	uniform float transmission;\n	uniform float thickness;\n	uniform float attenuationDistance;\n	uniform vec3 attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		uniform sampler2D transmissionMap;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		uniform sampler2D thicknessMap;\n	#endif\n	uniform vec2 transmissionSamplerSize;\n	uniform sampler2D transmissionSamplerMap;\n	uniform mat4 modelMatrix;\n	uniform mat4 projectionMatrix;\n	varying vec3 vWorldPosition;\n	float w0( float a ) {\n		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n	}\n	float w1( float a ) {\n		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\n	}\n	float w2( float a ){\n		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n	}\n	float w3( float a ) {\n		return ( 1.0 / 6.0 ) * ( a * a * a );\n	}\n	float g0( float a ) {\n		return w0( a ) + w1( a );\n	}\n	float g1( float a ) {\n		return w2( a ) + w3( a );\n	}\n	float h0( float a ) {\n		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n	}\n	float h1( float a ) {\n		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n	}\n	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) {\n		uv = uv * texelSize.zw + 0.5;\n		vec2 iuv = floor( uv );\n		vec2 fuv = fract( uv );\n		float g0x = g0( fuv.x );\n		float g1x = g1( fuv.x );\n		float h0x = h0( fuv.x );\n		float h1x = h1( fuv.x );\n		float h0y = h0( fuv.y );\n		float h1y = h1( fuv.y );\n		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n		\n		vec2 lodFudge = pow( 1.95, lod ) / fullSize;\n		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n	}\n	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n		vec2 fLodSizeInv = 1.0 / fLodSize;\n		vec2 cLodSizeInv = 1.0 / cLodSize;\n		vec2 fullSize = vec2( textureSize( sampler, 0 ) );\n		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) );\n		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) );\n		return mix( fSample, cSample, fract( lod ) );\n	}\n	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n		vec3 modelScale;\n		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n		return normalize( refractionVector ) * thickness * modelScale;\n	}\n	float applyIorToRoughness( const in float roughness, const in float ior ) {\n		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n	}\n	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n	}\n	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n		if ( isinf( attenuationDistance ) ) {\n			return radiance;\n		} else {\n			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;\n		}\n	}\n	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n		const in vec3 attenuationColor, const in float attenuationDistance ) {\n		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n		vec3 refractedRayExit = position + transmissionRay;\n		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n		vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n		refractionCoords += 1.0;\n		refractionCoords /= 2.0;\n		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n	}\n#endif",uv_pars_fragment:"#ifdef USE_UV\n	varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n	varying vec2 vMapUv;
36\n#endif\n#ifdef USE_ALPHAMAP\n	varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n	varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n	varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n	varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n	varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n	varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n	varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n	varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n	varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	uniform mat3 transmissionMapTransform;\n	varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n	uniform mat3 thicknessMapTransform;\n	varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n	varying vec2 vUv;\n#endif\n#ifdef USE_UV2\n	attribute vec2 uv2;\n#endif\n#ifdef USE_MAP\n	uniform mat3 mapTransform;\n	varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform mat3 alphaMapTransform;\n	varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n	uniform mat3 lightMapTransform;\n	varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n	uniform mat3 aoMapTransform;\n	varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n	uniform mat3 bumpMapTransform;\n	varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n	uniform mat3 normalMapTransform;\n	varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n	uniform mat3 displacementMapTransform;\n	varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n	uniform mat3 emissiveMapTransform;\n	varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n	uniform mat3 metalnessMapTransform;\n	varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	uniform mat3 roughnessMapTransform;\n	varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n	uniform mat3 clearcoatMapTransform;\n	varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform mat3 clearcoatNormalMapTransform;\n	varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform mat3 clearcoatRoughnessMapTransform;\n	varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	uniform mat3 sheenColorMapTransform;\n	varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	uniform mat3 sheenRoughnessMapTransform;\n	varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	uniform mat3 iridescenceMapTransform;\n	varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform mat3 iridescenceThicknessMapTransform;\n	varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n	uniform mat3 specularMapTransform;\n	varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	uniform mat3 specularColorMapTransform;\n	varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	uniform mat3 specularIntensityMapTransform;\n	varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	uniform mat3 transmissionMapTransform;\n	varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n	uniform mat3 thicknessMapTransform;\n	varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#ifdef USE_UV\n	vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
36\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n	vec4 worldPosition = vec4( transformed, 1.0 );\n	#ifdef USE_INSTANCING\n		worldPosition = instanceMatrix * worldPosition;\n	#endif\n	worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n	vec4 texColor = texture2D( t2D, vUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n	#endif\n	texColor.rgb *= backgroundIntensity;\n	gl_FragColor = texColor;\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n	uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n	uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n	#elif defined( ENVMAP_TYPE_CUBE_UV )\n		vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n	#else\n		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n	#endif\n	texColor.rgb *= backgroundIntensity;\n	gl_FragColor = texColor;\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n	gl_FragColor = texColor;\n	gl_FragColor.a *= opacity;\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\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	#include <uv_vertex>\n	#include <skinbase_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n	uniform 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 <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( 1.0 );\n	#if DEPTH_PACKING == 3200\n		diffuseColor.a = opacity;\n	#endif\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <logdepthbuf_fragment>\n	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n	#if DEPTH_PACKING == 3200\n		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n	#elif DEPTH_PACKING == 3201\n		gl_FragColor = packDepthToRGBA( fragCoordZ );\n	#endif\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	#include <uv_vertex>\n	#include <skinbase_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <clipping_planes_vertex>\n	vWorldPosition = worldPosition.xyz;\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 <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( 1.0 );\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	float dist = length( vWorldPosition - referencePosition );\n	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n	dist = saturate( dist );\n	gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vec3 direction = normalize( vWorldDirection );\n	vec2 sampleUV = equirectUv( direction );\n	gl_FragColor = texture2D( tEquirect, sampleUV );\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\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	vLineDistance = scale * lineDistance;\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_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 <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	if ( mod( vLineDistance, totalSize ) > dashSize ) {\n		discard;\n	}\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_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	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinbase_vertex>\n		#include <skinnormal_vertex>\n		#include <defaultnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n	varying 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 <alphatest_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 <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n	#else\n		reflectedLight.indirectDiffuse += vec3( 1.0 );\n	#endif\n	#include <aomap_fragment>\n	reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n	vec3 outgoingLight = reflectedLight.indirectDiffuse;\n	#include <envmap_fragment>\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_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 <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_lambert_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\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 <normal_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	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n	vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\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 <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	vec3 viewDir = normalize( vViewPosition );\n	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x )
36 );\n	vec3 y = cross( viewDir, x );\n	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n	#ifdef USE_MATCAP\n		vec4 matcapColor = texture2D( matcap, uv );\n	#else\n		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n	#endif\n	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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	#include <uv_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_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	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n	#ifdef OPAQUE\n		gl_FragColor.a = 1.0;\n	#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_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 <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_phong_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n	varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n	vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n	#define IOR\n	#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n	uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n	uniform float specularIntensity;\n	uniform vec3 specularColor;\n	#ifdef USE_SPECULAR_COLORMAP\n		uniform sampler2D specularColorMap;\n	#endif\n	#ifdef USE_SPECULAR_INTENSITYMAP\n		uniform sampler2D specularIntensityMap;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT\n	uniform float clearcoat;
36\n	uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n	uniform float iridescence;\n	uniform float iridescenceIOR;\n	uniform float iridescenceThicknessMinimum;\n	uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n	uniform vec3 sheenColor;\n	uniform float sheenRoughness;\n	#ifdef USE_SHEEN_COLORMAP\n		uniform sampler2D sheenColorMap;\n	#endif\n	#ifdef USE_SHEEN_ROUGHNESSMAP\n		uniform sampler2D sheenRoughnessMap;\n	#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\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 <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <roughnessmap_fragment>\n	#include <metalnessmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <clearcoat_normal_fragment_begin>\n	#include <clearcoat_normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_physical_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n	#include <transmission_fragment>\n	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n	#ifdef USE_SHEEN\n		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n	#endif\n	#ifdef USE_CLEARCOAT\n		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
36\n	#endif\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_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 <normal_pars_fragment>\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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_toon_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_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>\n#ifdef USE_POINTS_UV\n	varying vec2 vUv;\n	uniform mat3 uvTransform;\n#endif\nvoid main() {\n	#ifdef USE_POINTS_UV\n		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	#endif\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	gl_PointSize = size;\n	#ifdef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n	#endif\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <fog_vertex>\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 <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_particle_fragment>\n	#include <color_fragment>\n	#include <alphatest_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#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 <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n	#include <logdepthbuf_fragment>\n	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#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	#include <uv_vertex>\n	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n	vec2 scale;\n	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n	#ifndef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) scale *= - mvPosition.z;\n	#endif\n	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n	vec2 rotatedPosition;\n	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n	mvPosition.xy += rotatedPosition;\n	gl_Position = projectionMatrix * mvPosition;\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#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 <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}"},e9={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Matrix3}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Matrix3},normalScale:{value:new Vector2(1,1)}}
vendor: 2,300 bytes, line 36
36,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(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:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{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 Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaTest:{value:0}}},te={basic:{uniforms:mergeUniforms([e9.common,e9.specularmap,e9.envmap,e9.aomap,e9.lightmap,e9.fog]),vertexShader:e8.meshbasic_vert,fragmentShader:e8.meshbasic_frag},lambert:{uniforms:mergeUniforms([e9.common,e9.specularmap,e9.envmap,e9.aomap,e9.lightmap,e9.emissivemap,e9.bumpmap,e9.
36normalmap,e9.displacementmap,e9.fog,e9.lights,{emissive:{value:new Color(0)}}]),vertexShader:e8.meshlambert_vert,fragmentShader:e8.meshlambert_frag},phong:{uniforms:mergeUniforms([e9.common,e9.specularmap,e9.envmap,e9.aomap,e9.lightmap,e9.emissivemap,e9.bumpmap,e9.normalmap,e9.displacementmap,e9.fog,e9.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:e8.meshphong_vert,fragmentShader:e8.meshphong_frag},standard:{uniforms:mergeUniforms([e9.common,e9.envmap,e9.aomap,e9.lightmap,e9.emissivemap,e9.bumpmap,e9.normalmap,e9.displacementmap,e9.roughnessmap,e9.metalnessmap,e9.fog,e9.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:e8.meshphysical_vert,fragmentShader:e8.meshphysical_frag},toon:{uniforms:mergeUniforms([e9.common,e9.aomap,e9.lightmap,e9.emissivemap,e9.bumpmap,e9.normalmap,e9.displacementmap,e9.gradientmap,e9.fog,e9.lights,{emissive:{value:new Color(0)}}]),vertexShader:e8.meshtoon_vert,fragmentShader:e8.meshtoon_frag}
36,matcap:{uniforms:mergeUniforms([e9.common,e9.bumpmap,e9.normalmap,e9.displacementmap,e9.fog,{matcap:{value:null}}]),vertexShader:e8.meshmatcap_vert,fragmentShader:e8.meshmatcap_frag},points:{uniforms:mergeUniforms([e9.points,e9.fog]),vertexShader:e8.points_vert,fragmentShader:e8.points_frag},dashed:{uniforms:mergeUniforms([e9.common,e9.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:e8.linedashed_vert,fragmentShader:e8.linedashed_frag},depth:{uniforms:mergeUniforms([e9.common,e9.displacementmap]),vertexShader:e8.depth_vert,fragmentShader:e8.depth_frag},normal:{uniforms:mergeUniforms([e9.common,e9.bumpmap,e9.normalmap,e9.displacementmap,{opacity:{value:1}}]),vertexShader:e8.meshnormal_vert,fragmentShader:e8.meshnormal_frag},sprite:{uniforms:mergeUniforms([e9.sprite,e9.fog]),vertexShader:e8.sprite_vert,fragmentShader:e8.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:e8.background_vert,fragmentShader:e8.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:e8.backgroundCube_vert,fragmentShader:e8.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:e8.cube_vert,fragmentShader:e8.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:e8.equirect_vert,fragmentShader:e8.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([e9.common,e9.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:e8.distanceRGBA_vert,fragmentShader:e8.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([e9.lights,e9.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:e8.shadow_vert,fragmentShader:e8.shadow_frag}};te.physical={uniforms:mergeUniforms([te.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Matrix3},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix3},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Matrix3},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix3},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Matrix3}}]),vertexShader:e8.meshphysical_vert,fragmentShader:e8.meshphysical_frag};let tt={r:0,b:0,g:0};function WebGLBackground(e,t,r,n,i,a,s){let o,l;let u=new Color(0),h=!0===a?0:1,c=null,d=0,p=null;function setClear(t,r){t.getRGB(tt,getUnlitUniformColorSpace(e)),n.buffers.color.setClear(tt.r,tt.g,tt.b,r,s)}return{getClearColor:function(){return u},setClearColor:function(e,t=1){u.set(e),setClear(u,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){setClear(u,h=e)},render:function(n,a){let s=!1,f=!0===a.isScene?a.background:null;if(f&&f.isTexture){let e=a.backgroundBlurriness>0;f=(e?r:t).get(f)}let m=e.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?setClear(u,h):f&&f.isColor&&(setClear(f,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===l&&((l
36=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(te.backgroundCube.uniforms),vertexShader:te.backgroundCube.vertexShader,fragmentShader:te.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=f,l.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=a.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,l.material.toneMapped=3001!==f.encoding,(c!==f||d!==f.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,c=f,d=f.version,p=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(te.background.uniforms),vertexShader:te.background.vertexShader,fragmentShader:te.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=f,o.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,o.material.toneMapped=3001!==f.encoding,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),(c!==f||d!==f.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,c=f,d=f.version,p=e.toneMapping),o.layers.enableAll(),n.unshift(o,o.geometry,o.material,0,0,null))}}}function WebGLBindingStates(e,t,r,n){let i=e.getParameter(34921),a=n.isWebGL2?null:t.get("OES_vertex_array_object"),s=n.isWebGL2||null!==a,o={},l=createBindingState(null),u=l,h=!1;function bindVertexArrayObject(t){return n.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function deleteVertexArrayObject(t){return n.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function createBindingState(e){let t=[],r=[],n=[];for(let e=0;e<i;e++)t[e]=0,r[e]=0,n[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:n,object:e,attributes:{},index:null}}function initAttributes(){let e=u.newAttributes;for(let t=0,r=e.length;t<r;t++)e[t]=0}function enableAttribute(e){enableAttributeAndDivisor(e,0)}function enableAttributeAndDivisor(r,i){let a=u.newAttributes,s=u.enabledAttributes,o=u.attributeDivisors;if(a[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),o[r]!==i){let a=n.isWebGL2?e:t.get("ANGLE_instanced_arrays");a[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](r,i),o[r]=i}}function disableUnusedAttributes(){let t=u.newAttributes,r=u.enabledAttributes;for(let n=0,i=r.length;n<i;n++)r[n]!==t[n]&&(e.disableVertexAttribArray(n),r[n]=0)}function vertexAttribPointer(t,r,i,a,s,o){!0===n.isWebGL2&&(5124===i||5125===i)?e.vertexAttribIPointer(t,r,i,s,o):e.vertexAttribPointer(t,r,i,a,s,o)}function reset(){resetDefaultState(),h=!0,u!==l&&bindVertexArrayObject((u=l).object)}function resetDefaultState(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,c,d,p){let f=!1;if(s){let t=function(t,r,i){let s=!0===i.wireframe,l=o[t.id];void 0===l&&(l={},o[t.id]=l);let u=l[r.id];void 0===u&&(u={},l[r.id]=u);let h=u[s];return void 0===h&&(h=createBindingState(n.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[s]=h),h}(d,c,l);u!==t&&bindVertexArrayObject((u=t).object),(f=function(e,t,r,n){let i=u.attributes,a=t.attributes,s=0,o=r.getAttributes();for(let t in o){let r=o[t];if(r.location>=0){let r=i[t],n=a[t];if(void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor)),void 0===r||r.attribute!==n||n&&r.data!==n.data)return!0;s++}}return u.attributesNum!==s||u.index!==n}(i,d,c,p))&&function(e,t,r,n){let i={},a=t.attributes,s=0,o=r.getAttributes();for(let t in o){let r=o[t];if(r.location>=0){let r=a[t];void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor));let n={};n.attribute=r,r&&r.data&&(n.data=r.data),i[t]=n,s++}}u.attributes=i,u.attributesNum=s,u.index=n}(i,d,c,p)}else{let e=!0===l.wireframe;
36(u.geometry!==d.id||u.program!==c.id||u.wireframe!==e)&&(u.geometry=d.id,u.program=c.id,u.wireframe=e,f=!0)}null!==p&&r.update(p,34963),(f||h)&&(h=!1,function(i,a,s,o){if(!1===n.isWebGL2&&(i.isInstancedMesh||o.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;initAttributes();let l=o.attributes,u=s.getAttributes(),h=a.defaultAttributeValues;for(let t in u){let n=u[t];if(n.location>=0){let a=l[t];if(void 0===a&&("instanceMatrix"===t&&i.instanceMatrix&&(a=i.instanceMatrix),"instanceColor"===t&&i.instanceColor&&(a=i.instanceColor)),void 0!==a){let t=a.normalized,s=a.itemSize,l=r.get(a);if(void 0===l)continue;let u=l.buffer,h=l.type,c=l.bytesPerElement;if(a.isInterleavedBufferAttribute){let r=a.data,l=r.stride,d=a.offset;if(r.isInstancedInterleavedBuffer){for(let e=0;e<n.locationSize;e++)enableAttributeAndDivisor(n.location+e,r.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=r.meshPerAttribute*r.count)}else for(let e=0;e<n.locationSize;e++)enableAttribute(n.location+e);e.bindBuffer(34962,u);for(let e=0;e<n.locationSize;e++)vertexAttribPointer(n.location+e,s/n.locationSize,h,t,l*c,(d+s/n.locationSize*e)*c)}else{if(a.isInstancedBufferAttribute){for(let e=0;e<n.locationSize;e++)enableAttributeAndDivisor(n.location+e,a.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let e=0;e<n.locationSize;e++)enableAttribute(n.location+e);e.bindBuffer(34962,u);for(let e=0;e<n.locationSize;e++)vertexAttribPointer(n.location+e,s/n.locationSize,h,t,s*c,s/n.locationSize*e*c)}}else if(void 0!==h){let r=h[t];if(void 0!==r)switch(r.length){case 2:e.vertexAttrib2fv(n.location,r);break;case 3:e.vertexAttrib3fv(n.location,r);break;case 4:e.vertexAttrib4fv(n.location,r);break;default:e.vertexAttrib1fv(n.location,r)}}}}disableUnusedAttributes()}(i,l,c,d),null!==p&&e.bindBuffer(34963,r.get(p).buffer))},reset:reset,resetDefaultState:resetDefaultState,dispose:function(){for(let e in reset(),o){let t=o[e];for(let e in t){let r=t[e];for(let e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete o[e]}},releaseStatesOfGeometry:function(e){if(void 0===o[e.id])return;let t=o[e.id];for(let e in t){let r=t[e];for(let e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete o[e.id]},releaseStatesOfProgram:function(e){for(let t in o){let r=o[t];if(void 0===r[e.id])continue;let n=r[e.id];for(let e in n)deleteVertexArrayObject(n[e].object),delete n[e];delete r[e.id]}},initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes}}function WebGLBufferRenderer(e,t,r,n){let i;let a=n.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,n){e.drawArrays(i,t,n),r.update(n,i,1)},this.renderInstances=function(n,s,o){let l,u;if(0!==o){if(a)l=e,u="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),u="drawArraysInstancedANGLE",null===l){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}l[u](i,n,s,o),r.update(s,i,o)}}}function WebGLCapabilities(e,t,r){let n;function getMaxPrecision(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"}let i="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,a=void 0!==r.precision?r.precision:"highp",s=getMaxPrecision(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);let o=i||t.has("WEBGL_draw_buffers"),l=!0===r.logarithmicDepthBuffer,u=e.getParameter(34930),h=e.getParameter(35660),c=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),_=h>0,x=i||t.has("OES_texture_float"),y=i?e.getParameter(36183):0;return{isWebGL2:i,drawBuffers:o,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let r=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:getMaxPrecision,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:c,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:_,floatFragmentTextures:x,floatVertexTextures:_&&x,maxSamples:y}}function WebGLClipping(e){let t=this,r=null,n=0,i=!1,a=!1,s=new Plane,o=new Matrix3,l={value:null,needsUpdate:!1};function projectPlanes(e,r,n,i){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){let t=n+4*a,i=r.matrixWorldInverse;o.getNormalMatrix(i),(null===u||u.length<t)&&(u=new Float32Array(t));for(let t=0,r=n;t!==a;++t,r+=4)s.copy(e[t]).applyMatrix4(i,o),s.normal.toArray(u,r),u[r+3]=s.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let r=0!==e.length||t||0!==n||i;return i=t,n=e.length,r},this.beginShadows=function(){a=!0,projectPlanes(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){r=projectPlanes(e,t,0)},this.setState=function(s,o,u){let h=s.clippingPlanes,c=s.clipIntersection,d=s.clipShadows,p=e.get(s);if(i&&null!==h&&0!==h.length&&(!a||d)){let e=a?0:n,t=4*e,i=p.clippingState||null;l.value=i,i=projectPlanes(h,o,t,u);for(let e=0;e!==t;++e)i[e]=r[e];p.clippingState=i,this.numIntersection=c?this.numPlanes:0,this.numPlanes+=e}else a?projectPlanes(null):(l.value!==r&&(l.value=r,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0)}}function WebGLCubeMaps(e){let t=new WeakMap;function mapTextureMapping(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function onTextureDispose(e){let r=e.target;r.removeEventListener("dispose",onTextureDispose);let n=t.get(r);void 0!==n&&(t.delete(r),n.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){let n=r.mapping;if(303===n||304===n){if(t.has(r)){let e=t.get(r).texture;return mapTextureMapping(e,r.mapping)}{let n=r.image;if(!n||!(n.height>0))return null;
36{let i=new WebGLCubeRenderTarget(n.height/2);return i.fromEquirectangularTexture(e,r),t.set(r,i),r.addEventListener("dispose",onTextureDispose),mapTextureMapping(i.texture,r.mapping)}}}}return r},dispose:function(){t=new WeakMap}}}let tr=[.125,.215,.35,.446,.526,.582],tn=new class extends Camera{constructor(e=-1,t=1,r=1,n=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=n,this.near=i,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,r,n,i,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=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-e,a=r+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},ti=new Color,ta=null,ts=(1+Math.sqrt(5))/2,to=1/ts,tl=[new Vector3(1,1,1),new Vector3(-1,1,1),new Vector3(1,1,-1),new Vector3(-1,1,-1),new Vector3(0,ts,to),new Vector3(0,ts,-to),new Vector3(to,0,ts),new Vector3(-to,0,ts),new Vector3(ts,to,0),new Vector3(-ts,to,0)];let PMREMGenerator=class PMREMGenerator{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,n=100){ta=this._renderer.getRenderTarget(),this._setSize(256);let i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,r,n,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ta),e.scissorTest=!1,_setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ta=this._renderer.getRenderTarget();let r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,encoding:3e3,depthBuffer:!1},n=_createRenderTarget(e,t,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(e,t,r);let{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}
36=function(e){let t=[],r=[],n=[],i=e,a=e-4+1+tr.length;for(let s=0;s<a;s++){let a=Math.pow(2,i);r.push(a);let o=1/a;s>e-4?o=tr[s-e+4-1]:0===s&&(o=0),n.push(o);let l=1/(a-2),u=-l,h=1+l,c=[u,u,h,u,h,h,u,u,h,h,u,h],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,r=e>2?0:-1,n=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0];d.set(n,18*e),p.set(c,12*e);let i=[e,e,e,e,e,e];f.set(i,6*e)}let m=new BufferGeometry;m.setAttribute("position",new BufferAttribute(d,3)),m.setAttribute("uv",new BufferAttribute(p,2)),m.setAttribute("faceIndex",new BufferAttribute(f,1)),t.push(m),i>4&&i--}return{lodPlanes:t,sizeLods:r,sigmas:n}}(n)),this._blurMaterial=function(e,t,r){let n=new Float32Array(20),i=new Vector3(0,1,0),a=new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/r,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:_getCommonVertexShader(),fragmentShader:`
37
38			precision mediump float;
39			precision mediump int;
40
41			varying vec3 vOutputDirection;
42
43			uniform sampler2D envMap;
44			uniform int samples;
45			uniform float weights[ n ];
46			uniform bool latitudinal;
47			uniform float dTheta;
48			uniform float mipInt;
49			uniform vec3 poleAxis;
50
51			#define ENVMAP_TYPE_CUBE_UV
52			#include <cube_uv_reflection_fragment>
53
54			vec3 getSample( float theta, vec3 axis ) {
55
56				float cosTheta = cos( theta );
57				// Rodrigues' axis-angle rotation
58				vec3 sampleDirection = vOutputDirection * cosTheta
59					+ cross( axis, vOutputDirection ) * sin( theta )
60					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
61
62				return bilinearCubeUV( envMap, sampleDirection, mipInt );
63
64			}
65
66			void main() {
67
68				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
69
70				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
71
72					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
73
74				}
75
76				axis = normalize( axis );
77
78				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
79				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
80
81				for ( int i = 1; i < n; i++ ) {
82
83					if ( i >= samples ) {
84
85						break;
86
87					}
88
89					float theta = dTheta * float( i );
90					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
91					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
92
93				}
94
95			}
96		`,blending:0,depthTest:!1,depthWrite:!1});return a}(n,e,t)}return n}_compileMaterial(e){let t=new Mesh(this._lodPlanes[0],e);this._renderer.compile(t,tn)}_sceneToCubeUV(e,t,r,n){let i=new PerspectiveCamera(90,1,t,r),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,u=o.toneMapping;o.getClearColor(ti),o.toneMapping=0,o.autoClear=!1;
96let h=new MeshBasicMaterial({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),c=new Mesh(new BoxGeometry,h),d=!1,p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(ti),d=!0);for(let t=0;t<6;t++){let r=t%3;0===r?(i.up.set(0,a[t],0),i.lookAt(s[t],0,0)):1===r?(i.up.set(0,0,a[t]),i.lookAt(0,s[t],0)):(i.up.set(0,a[t],0),i.lookAt(0,0,s[t]));let l=this._cubeSize;_setViewport(n,r*l,t>2?l:0,l,l),o.setRenderTarget(n),d&&o.render(c,i),o.render(e,i)}c.geometry.dispose(),c.material.dispose(),o.toneMapping=u,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let r=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());let i=n?this._cubemapMaterial:this._equirectMaterial,a=new Mesh(this._lodPlanes[0],i),s=i.uniforms;s.envMap.value=e;let o=this._cubeSize;_setViewport(t,0,0,3*o,2*o),r.setRenderTarget(t),r.render(a,tn)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let t=1;t<this._lodPlanes.length;t++){let r=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),n=tl[(t-1)%tl.length];this._blur(e,t-1,t,r,n)}t.autoClear=r}_blur(e,t,r,n,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,n,"latitudinal",i),this._halfBlur(a,e,r,r,n,"longitudinal",i)}_halfBlur(e,t,r,n,i,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let u=new Mesh(this._lodPlanes[n],l),h=l.uniforms,c=this._sizeLods[r]-1,d=isFinite(i)?Math.PI/(2*c):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,r=Math.exp(-t*t/2);m.push(r),0===e?g+=r:e<f&&(g+=2*r)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);let{_lodMax:_}=this;h.dTheta.value=d,h.mipInt.value=_-r;let x=this._sizeLods[n],y=3*x*(n>_-4?n-_+4:0),M=4*(this._cubeSize-x);_setViewport(t,y,M,3*x,2*x),o.setRenderTarget(t),o.render(u,tn)}};function _createRenderTarget(e,t,r){let n=new WebGLRenderTarget(e,t,r);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function _setViewport(e,t,r,n,i){e.viewport.set(t,r,n,i),e.scissor.set(t,r,n,i)}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:`
97
98			precision mediump float;
99			precision mediump int;
100
101			varying vec3 vOutputDirection;
102
103			uniform sampler2D envMap;
104
105			#include <common>
106
107			void main() {
108
109				vec3 outputDirection = normalize( vOutputDirection );
110				vec2 uv = equirectUv( outputDirection );
111
112				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
113
114			}
115		`,blending:0,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:`
116
117			precision mediump float;
118			precision mediump int;
119
120			uniform float flipEnvMap;
121
122			varying vec3 vOutputDirection;
123
124			uniform samplerCube envMap;
125
126			void main() {
127
128				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
129
130			}
131		`,blending:0,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return`
132
133		precision mediump float;
134		precision mediump int;
135
136		attribute float faceIndex;
137
138		varying vec3 vOutputDirection;
139
140		// RH coordinate system; PMREM face-indexing convention
141		vec3 getDirection( vec2 uv, float face ) {
142
143			uv = 2.0 * uv - 1.0;
144
145			vec3 direction = vec3( uv, 1.0 );
146
147			if ( face == 0.0 ) {
148
149				direction = direction.zyx; // ( 1, v, u ) pos x
150
151			} else if ( face == 1.0 ) {
152
153				direction = direction.xzy;
154				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
155
156			} else if ( face == 2.0 ) {
157
158				direction.x *= -1.0; // ( -u, v, 1 ) pos z
159
160			} else if ( face == 3.0 ) {
161
162				direction = direction.zyx;
163				direction.xz *= -1.0; // ( -1, v, -u ) neg x
164
165			} else if ( face == 4.0 ) {
166
167				direction = direction.xzy;
168				direction.xy *= -1.0; // ( -u, -1, v ) neg y
169
170			} else if ( face == 5.0 ) {
171
172				direction.z *= -1.0; // ( u, v, -1 ) neg z
173
174			}
175
176			return direction;
177
178		}
179
180		void main() {
181
182			vOutputDirection = getDirection( uv, faceIndex );
183			gl_Position = vec4( position, 1.0 );
184
185		}
186	`}function WebGLCubeUVMaps(e){let t=new WeakMap,r=null;function onTextureDispose(e){let r=e.target;r.removeEventListener("dispose",onTextureDispose);let n=t.get(r);void 0!==n&&(t.delete(r),n.dispose())}return{get:function(n){if(n&&n.isTexture){let i=n.mapping,a=303===i||304===i,s=301===i||302===i;if(a||s){if(n.isRenderTargetTexture&&!0===n.needsPMREMUpdate){n.needsPMREMUpdate=!1;let i=t.get(n);return null===r&&(r=new PMREMGenerator(e)),i=a?r.fromEquirectangular(n,i):r.fromCubemap(n,i),t.set(n,i),i.texture}if(t.has(n))return t.get(n).texture;{let i=n.image;if(!(a&&i&&i.height>0||s&&i&&function(e){let t=0;for(let r=0;r<6;r++)void 0!==e[r]&&t++;return 6===t}(i)))return null;{null===r&&(r=new PMREMGenerator(e));let i=a?r.fromEquirectangular(n):r.fromCubemap(n);return t.set(n,i),n.addEventListener("dispose",onTextureDispose),i.texture}}}}return n},dispose:function(){t=new WeakMap,null!==r&&(r.dispose(),r=null)}}}function WebGLExtensions(e){let t={};function getExtension(r){let n;if(void 0!==t[r])return t[r];switch(r){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(r)}return t[r]=n,n}return{has:function(e){return null!==getExtension(e)},init:function(e){e.isWebGL2?getExtension("EXT_color_buffer_float"):(getExtension("WEBGL_depth_texture"),getExtension("OES_texture_float"),getExtension("OES_texture_half_float"),getExtension("OES_texture_half_float_linear"),getExtension("OES_standard_derivatives"),getExtension("OES_element_index_uint"),getExtension("OES_vertex_array_object"),getExtension("ANGLE_instanced_arrays")),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture")},get:function(e){let t=getExtension(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function WebGLGeometries(e,t,r,n){let i={},a=new WeakMap;function onGeometryDispose(e){let s=e.target;for(let e in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[e]);s.removeEventListener("dispose",onGeometryDispose),delete i[s.id];let o=a.get(s);o&&(t.remove(o),a.delete(s)),n.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,r.memory.geometries--}function updateWireframeAttribute(e){let r=[],n=e.index,i=e.attributes.position,s=0;if(null!==n){let e=n.array;s=n.version;for(let t=0,n=e.length;t<n;t+=3){let n=e[t+0],i=e[t+1],a=e[t+2];r.push(n,i,i,a,a,n)}}else{let e=i.array;s=i.version;for(let t=0,n=e.length/3-1;t<n;t+=3){let e=t+0,n=t+1,i=t+2;r.push(e,n,n,i,i,e)}}let o=new(arrayNeedsUint32(r)?Uint32BufferAttribute:Uint16BufferAttribute)(r,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",onGeometryDispose),i[t.id]=!0,r.memory.geometries++),t},update:function(e){let r=e.attributes;for(let e in r)t.update(r[e],34962);let n=e.morphAttributes;for(let e in n){let r=n[e];for(let e=0,n=r.length;e<n;e++)t.update(r[e],34962)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let r=e.index;null!==r&&t.version<r.version&&updateWireframeAttribute(e)}else updateWireframeAttribute(e);return a.get(e)}}}function WebGLIndexedBufferRenderer(e,t,r,n){let i,a,s;
186let o=n.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,s=e.bytesPerElement},this.render=function(t,n){e.drawElements(i,n,a,t*s),r.update(n,i,1)},this.renderInstances=function(n,l,u){let h,c;if(0!==u){if(o)h=e,c="drawElementsInstanced";else if(h=t.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===h){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}h[c](i,l,a,n*s,u),r.update(l,i,u)}}}function WebGLInfo(e){let 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,r,n){switch(t.calls++,r){case 4:t.triangles+=n*(e/3);break;case 1:t.lines+=n*(e/2);break;case 3:t.lines+=n*(e-1);break;case 2:t.lines+=n*e;break;case 0:t.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function numericalSort(e,t){return e[0]-t[0]}function absNumericalSort(e,t){return Math.abs(t[1])-Math.abs(e[1])}function WebGLMorphtargets(e,t,r){let n={},i=new Float32Array(8),a=new WeakMap,s=new Vector4,o=[];for(let e=0;e<8;e++)o[e]=[e,0];return{update:function(l,u,h){let c=l.morphTargetInfluences;if(!0===t.isWebGL2){let n=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,i=void 0!==n?n.length:0,o=a.get(u);if(void 0===o||o.count!==i){void 0!==o&&o.texture.dispose();let e=void 0!==u.morphAttributes.position,r=void 0!==u.morphAttributes.normal,n=void 0!==u.morphAttributes.color,l=u.morphAttributes.position||[],h=u.morphAttributes.normal||[],c=u.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===r&&(d=2),!0===n&&(d=3);let p=u.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*i),g=new DataArrayTexture(m,p,f,i);g.type=1015,g.needsUpdate=!0;let _=4*d;for(let t=0;t<i;t++){let i=l[t],a=h[t],o=c[t],u=p*f*4*t;for(let t=0;t<i.count;t++){let l=t*_;!0===e&&(s.fromBufferAttribute(i,t),m[u+l+0]=s.x,m[u+l+1]=s.y,m[u+l+2]=s.z,m[u+l+3]=0),!0===r&&(s.fromBufferAttribute(a,t),m[u+l+4]=s.x,m[u+l+5]=s.y,m[u+l+6]=s.z,m[u+l+7]=0),!0===n&&(s.fromBufferAttribute(o,t),m[u+l+8]=s.x,m[u+l+9]=s.y,m[u+l+10]=s.z,m[u+l+11]=4===o.itemSize?s.w:1)}}o={count:i,texture:g,size:new Vector2(p,f)},a.set(u,o),u.addEventListener("dispose",function disposeTexture(){g.dispose(),a.delete(u),u.removeEventListener("dispose",disposeTexture)})}let l=0;for(let e=0;e<c.length;e++)l+=c[e];let d=u.morphTargetsRelative?1:1-l;h.getUniforms().setValue(e,"morphTargetBaseInfluence",d),h.getUniforms().setValue(e,"morphTargetInfluences",c),h.getUniforms().setValue(e,"morphTargetsTexture",o.texture,r),h.getUniforms().setValue(e,"morphTargetsTextureSize",o.size)}else{let t=void 0===c?0:c.length,r=n[u.id];if(void 0===r||r.length!==t){r=[];for(let e=0;e<t;e++)r[e]=[e,0];n[u.id]=r}for(let e=0;e<t;e++){let t=r[e];t[0]=e,t[1]=c[e]}r.sort(absNumericalSort);for(let e=0;e<8;e++)e<t&&r[e][1]?(o[e][0]=r[e][0],o[e][1]=r[e][1]):(o[e][0]=Number.MAX_SAFE_INTEGER,o[e][1]=0);o.sort(numericalSort);let a=u.morphAttributes.position,s=u.morphAttributes.normal,l=0;for(let e=0;e<8;e++){let t=o[e],r=t[0],n=t[1];r!==Number.MAX_SAFE_INTEGER&&n?(a&&u.getAttribute("morphTarget"+e)!==a[r]&&u.setAttribute("morphTarget"+e,a[r]),s&&u.getAttribute("morphNormal"+e)!==s[r]&&u.setAttribute("morphNormal"+e,s[r]),i[e]=n,l+=n):(a&&!0===u.hasAttribute("morphTarget"+e)&&u.deleteAttribute("morphTarget"+e),s&&!0===u.hasAttribute("morphNormal"+e)&&u.deleteAttribute("morphNormal"+e),i[e]=0)}let d=u.morphTargetsRelative?1:1-l;h.getUniforms().setValue(e,"morphTargetBaseInfluence",d),h.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function WebGLObjects(e,t,r,n){let i=new WeakMap;function onInstancedMeshDispose(e){let t=e.target;t.removeEventListener("dispose",onInstancedMeshDispose),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}return{update:function(e){let a=n.render.frame,s=e.geometry,o=t.get(e,s);return i.get(o)!==a&&(t.update(o),i.set(o,a)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",onInstancedMeshDispose)&&e.addEventListener("dispose",onInstancedMeshDispose),r.update(e.instanceMatrix,34962),null!==e.instanceColor&&r.update(e.instanceColor,34962)),o},dispose:function(){i=new WeakMap}}}let tu=new Texture,th=new DataArrayTexture,tc=new class extends Texture{constructor(e=null,t=1,r=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}
186,td=new CubeTexture,tp=[],tf=[],tm=new Float32Array(16),tg=new Float32Array(9),tv=new Float32Array(4);function flatten(e,t,r){let n=e[0];if(n<=0||n>0)return e;let i=t*r,a=tp[i];if(void 0===a&&(a=new Float32Array(i),tp[i]=a),0!==t){n.toArray(a,0);for(let n=1,i=0;n!==t;++n)i+=r,e[n].toArray(a,i)}return a}function arraysEqual(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function copyArray(e,t){for(let r=0,n=t.length;r<n;r++)e[r]=t[r]}function allocTexUnits(e,t){let r=tf[t];void 0===r&&(r=new Int32Array(t),tf[t]=r);for(let n=0;n!==t;++n)r[n]=e.allocateTextureUnit();return r}function setValueV1f(e,t){let r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function setValueV2f(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2fv(this.addr,t),copyArray(r,t)}}function setValueV3f(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(arraysEqual(r,t))return;e.uniform3fv(this.addr,t),copyArray(r,t)}}function setValueV4f(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4fv(this.addr,t),copyArray(r,t)}}function setValueM2(e,t){let r=this.cache,n=t.elements;if(void 0===n){if(arraysEqual(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,n))return;tv.set(n),e.uniformMatrix2fv(this.addr,!1,tv),copyArray(r,n)}}function setValueM3(e,t){let r=this.cache,n=t.elements;if(void 0===n){if(arraysEqual(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,n))return;tg.set(n),e.uniformMatrix3fv(this.addr,!1,tg),copyArray(r,n)}}function setValueM4(e,t){let r=this.cache,n=t.elements;if(void 0===n){if(arraysEqual(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,n))return;tm.set(n),e.uniformMatrix4fv(this.addr,!1,tm),copyArray(r,n)}}function setValueV1i(e,t){let r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function setValueV2i(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2iv(this.addr,t),copyArray(r,t)}}function setValueV3i(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3iv(this.addr,t),copyArray(r,t)}}function setValueV4i(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4iv(this.addr,t),copyArray(r,t)}}function setValueV1ui(e,t){let r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function setValueV2ui(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2uiv(this.addr,t),copyArray(r,t)}}function setValueV3ui(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3uiv(this.addr,t),copyArray(r,t)}}function setValueV4ui(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4uiv(this.addr,t),copyArray(r,t)}}function setValueT1(e,t,r){let n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture2D(t||tu,i)}function setValueT3D1(e,t,r){let n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture3D(t||tc,i)}function setValueT6(e,t,r){let n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTextureCube(t||td,i)}function setValueT2DArray1(e,t,r){let n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture2DArray(t||th,i)}function setValueV1fArray(e,t){e.uniform1fv(this.addr,t)}function setValueV2fArray(e,t){let r=flatten(t,this.size,2);e.uniform2fv(this.addr,r)}function setValueV3fArray(e,t){let r=flatten(t,this.size,3);e.uniform3fv(this.addr,r)}function setValueV4fArray(e,t){let r=flatten(t,this.size,4);e.uniform4fv(this.addr,r)}function setValueM2Array(e,t){let r=flatten(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function setValueM3Array(e,t){let r=flatten(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function setValueM4Array(e,t){let r=flatten(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function setValueV1iArray(e,t){e.uniform1iv(this.addr,t)}function setValueV2iArray(e,t){e.uniform2iv(this.addr,t)}function setValueV3iArray(e,t){e.uniform3iv(this.addr,t)}function setValueV4iArray(e,t){e.uniform4iv(this.addr,t)}function setValueV1uiArray(e,t){e.uniform1uiv(this.addr,t)}function setValueV2uiArray(e,t){e.uniform2uiv(this.addr,t)}function setValueV3uiArray(e,t){e.uniform3uiv(this.addr,t)}function setValueV4uiArray(e,t){e.uniform4uiv(this.addr,t)}function setValueT1Array(e,t,r){let n=this.cache,i=t.length,a=allocTexUnits(r,i);arraysEqual(n,a)||(e.uniform1iv(this.addr,a),copyArray(n,a));for(let e=0;e!==i;++e)r.setTexture2D(t[e]||tu,a[e])}function setValueT3DArray(e,t,r){let n=this.cache,i=t.length,a=allocTexUnits(r,i);arraysEqual(n,a)||(e.uniform1iv(this.addr,a),copyArray(n,a));for(let e=0;e!==i;++e)r.setTexture3D(t[e]||tc,a[e])}function setValueT6Array(e,t,r){let n=this.cache,i=t.length,a=allocTexUnits(r,i);arraysEqual(n,a)||(e.uniform1iv(this.addr,a),copyArray(n,a));for(let e=0;e!==i;++e)r.setTextureCube(t[e]||td,a[e])}function setValueT2DArrayArray(e,t,r){let n=this.cache,i=t.length,a=allocTexUnits(r,i);arraysEqual(n,a)||(e.uniform1iv(this.addr,a),copyArray(n,a));for(let e=0;e!==i;++e)r.setTexture2DArray(t[e]||th,a[e])}let SingleUniform=class SingleUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(t.type)}};let PureArrayUniform=class PureArrayUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(t.type)}};let StructuredUniform=class StructuredUniform{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){let n=this.seq;for(let i=0,a=n.length;i!==a;++i){let a=n[i];a.setValue(e,t[a.id],r)}}};let t_=/(\w+)(\])?(\[|\.)?/g;function addUniform(e,t){e.seq.push(t),e.map[t.id]=t}let WebGLUniforms=class WebGLUniforms{constructor(e,t){this.seq=[],this.map={};let r=e.getProgramParameter(t,35718);for(let n=0;n<r;++n){let r=e.getActiveUniform(t,n),i=e.getUniformLocation(t,r.name);!function(e,t,r){let n=e.name,i=n.length;for(t_.lastIndex=0;;){let a=t_.exec(n),s=t_.lastIndex,o=a[1],l="]"===a[2],u=a[3];if(l&&(o|=0),void 0===u||"["===u&&s+2===i){addUniform(r,void 0===u?new SingleUniform(o,e,t):new PureArrayUniform(o,e,t));break}{let e=r.map,t=e[o];void 0===t&&addUniform(r,t=new StructuredUniform(o)),r=t}}}(r,i,this)}}setValue(e,t,r,n){let i=this.map[t];void 0!==i&&i.setValue(e,r,n)}setOptional(e,t,r){let n=t[r];void 0!==n&&this.setValue(e,r,n)}static upload(e,t,r,n){for(let i=0,a=t.length;i!==a;++i){let a=t[i],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}}static seqWithValue(e,t){let r=[];for(let n=0,i=e.length;n!==i;++n){let i=e[n];i.id in t&&r.push(i)}return r}};function WebGLShader(e,t,r){let n=e.createShader(t);return e.shaderSource(n,r),e.compileShader(n),n}let tx=0;function getShaderErrors(e,t,r){let n=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(n&&""===i)return"";let a=/ERROR: 0:(\d+)/.exec(i);if(!a)return i;{let n=parseInt(a[1]);return r.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){let r=e.split("\n"),n=[],i=Math.max(t-6,0),a=Math.min(t+6,r.length);for(let e=i;e<a;e++){let i=e+1;n.push(`${i===t?">":" "} ${i}: ${r[e]}`)}return n.join("\n")}(e.getShaderSource(t),n)}}function filterEmptyLine(e){return""!==e}function replaceLightNums(e,t){let r=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_L
186IGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,r).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_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function replaceClippingPlaneNums(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let ty=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(e){return e.replace(ty,includeReplacer)}function includeReplacer(e,t){let r=e8[t];if(void 0===r)throw Error("Can not resolve #include <"+t+">");return resolveIncludes(r)}let tM=/#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 unrollLoops(e){return e.replace(tM,loopReplacer)}function loopReplacer(e,t,r,n){let i="";for(let e=parseInt(t);e<parseInt(r);e++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function generatePrecision(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 WebGLProgram(e,t,r,n){let i,a,s,l,u,h;let c=e.getContext(),d=r.defines,p=r.vertexShader,f=r.fragmentShader,m=(u="SHADOWMAP_TYPE_BASIC",1===r.shadowMapType?u="SHADOWMAP_TYPE_PCF":2===r.shadowMapType?u="SHADOWMAP_TYPE_PCF_SOFT":3===r.shadowMapType&&(u="SHADOWMAP_TYPE_VSM"),u),g=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(r),_=(h="ENVMAP_MODE_REFLECTION",r.envMap&&302===r.envMapMode&&(h="ENVMAP_MODE_REFRACTION"),h),x=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}(r),y=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let r=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,r),112)),texelHeight:1/t,maxMip:r}}(r),M=r.isWebGL2?"":function(e){let t=[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||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.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return t.filter(filterEmptyLine).join("\n")}(r),S=function(e){let t=[];for(let r in e){let n=e[r];!1!==n&&t.push("#define "+r+" "+n)}return t.join("\n")}(d),b=c.createProgram(),T=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?((i=[S].filter(filterEmptyLine).join("\n")).length>0&&(i+="\n"),(a=[M,S].filter(filterEmptyLine).join("\n")).length>0&&(a+="\n")):(i=[generatePrecision(r),"#define SHADER_NAME "+r.shaderName,S,r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+_:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.displacementMap?"#define USE_DISPLACEMENTMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IR
186IDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.mapUv?"#define MAP_UV "+r.mapUv:"",r.alphaMapUv?"#define ALPHAMAP_UV "+r.alphaMapUv:"",r.lightMapUv?"#define LIGHTMAP_UV "+r.lightMapUv:"",r.aoMapUv?"#define AOMAP_UV "+r.aoMapUv:"",r.emissiveMapUv?"#define EMISSIVEMAP_UV "+r.emissiveMapUv:"",r.bumpMapUv?"#define BUMPMAP_UV "+r.bumpMapUv:"",r.normalMapUv?"#define NORMALMAP_UV "+r.normalMapUv:"",r.displacementMapUv?"#define DISPLACEMENTMAP_UV "+r.displacementMapUv:"",r.metalnessMapUv?"#define METALNESSMAP_UV "+r.metalnessMapUv:"",r.roughnessMapUv?"#define ROUGHNESSMAP_UV "+r.roughnessMapUv:"",r.clearcoatMapUv?"#define CLEARCOATMAP_UV "+r.clearcoatMapUv:"",r.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+r.clearcoatNormalMapUv:"",r.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+r.clearcoatRoughnessMapUv:"",r.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+r.iridescenceMapUv:"",r.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+r.iridescenceThicknessMapUv:"",r.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+r.sheenColorMapUv:"",r.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+r.sheenRoughnessMapUv:"",r.specularMapUv?"#define SPECULARMAP_UV "+r.specularMapUv:"",r.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+r.specularColorMapUv:"",r.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+r.specularIntensityMapUv:"",r.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+r.transmissionMapUv:"",r.thicknessMapUv?"#define THICKNESSMAP_UV "+r.thicknessMapUv:"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs2?"#define USE_UV2":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors&&r.isWebGL2?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+m:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.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","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),a=[M,generatePrecision(r),"#define SHADER_NAME "+r.shaderName,S,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.envMap?"#define "+_:"",r.envMap?"#define "+x:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescence?"#define USE_IR
186IDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs2?"#define USE_UV2":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+m:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.useLegacyLights?"#define LEGACY_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==r.toneMapping?"#define TONE_MAPPING":"",0!==r.toneMapping?e8.tonemapping_pars_fragment:"",0!==r.toneMapping?function(e,t){let r;switch(t){case 1:r="Linear";break;case 2:r="Reinhard";break;case 3:r="OptimizedCineon";break;case 4:r="ACESFilmic";break;case 5:r="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),r="Linear"}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",e8.encodings_pars_fragment,function(e,t){let r=function(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}("linearToOutputTexel",r.outputEncoding),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),p=replaceClippingPlaneNums(p=replaceLightNums(p=resolveIncludes(p),r),r),f=replaceClippingPlaneNums(f=replaceLightNums(f=resolveIncludes(f),r),r),p=unrollLoops(p),f=unrollLoops(f),r.isWebGL2&&!0!==r.isRawShaderMaterial&&(T="#version 300 es\n",i="precision mediump sampler2DArray;\n#define attribute in\n#define varying out\n#define texture2D texture\n"+i,a=["#define varying in",r.glslVersion===o?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===o?"":"#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"+a);let w=T+i+p,E=T+a+f,A=WebGLShader(c,35633,w),C=WebGLShader(c,35632,E);if(c.attachShader(b,A),c.attachShader(b,C),void 0!==r.index0AttributeName?c.bindAttribLocation(b,0,r.index0AttributeName):!0===r.morphTargets&&c.bindAttribLocation(b,0,"position"),c.linkProgram(b),e.debug.checkShaderErrors){let t=c.getProgramInfoLog(b).trim(),r=c.getShaderInfoLog(A).trim(),n=c.getShaderInfoLog(C).trim(),s=!0,o=!0;if(!1===c.getProgramParameter(b,35714)){if(s=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,b,A,C);else{let e=getShaderErrors(c,A,"vertex"),r=getShaderErrors(c,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(b,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+r)}}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):(""===r||""===n)&&(o=!1);o&&(this.diagnostics={runnable:s,programLog:t,vertexShader:{log:r,prefix:i},fragmentShader:{log:n,prefix:a}})}return c.deleteShader(A),c.deleteShader(C),this.getUniforms=function(){return void 0===s&&(s=new WebGLUniforms(c,b)),s},this.getAttributes=function(){return void 0===l&&(l=function(e,t){let r={},n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let n=e.getActiveAttrib(t,i),a=n.name,s=1;35674===n.type&&(s=2),35675===n.type&&(s=3),35676===n.type&&(s=4),r[a]={type:n.type,location:e.getAttribLocation(t,a),locationSize:s}}return r}(c,b)),l},this.destroy=function(){n.releaseStatesOfProgram(this),c.deleteProgram(b),this.program=void 0},this.name=r.shaderName,this.id=tx++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=A,this.fragmentShader=C,this}let tS=0;let WebGLShaderCache=class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,r=e.fragmentShader,n=this._getShaderStage(t),i=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,r=t.get(e);return void 0===r&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){let t=this.shaderCache,r=t.get(e);return void 0===r&&(r=new WebGLShaderStage(e),t.set(e,r)),r}};let WebGLShaderStage=class WebGLShaderStage{constructor(e){this.id=tS++,this.code=e,this.usedTimes=0}};function WebGLPrograms(e,t,r,n,i,a,s){let o=new Layers,l=new WebGLShaderCache,u=[],h=i.isWebG
186L2,c=i.logarithmicDepthBuffer,d=i.vertexTextures,p=i.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function getChannel(e){return 1===e?"uv2":"uv"}return{getParameters:function(a,o,u,m,g){let _,x,y,M;let S=m.fog,b=g.geometry,T=a.isMeshStandardMaterial?m.environment:null,w=(a.isMeshStandardMaterial?r:t).get(a.envMap||T),E=w&&306===w.mapping?w.image.height:null,A=f[a.type];null!==a.precision&&(p=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let C=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,L=void 0!==C?C.length:0,P=0;if(void 0!==b.morphAttributes.position&&(P=1),void 0!==b.morphAttributes.normal&&(P=2),void 0!==b.morphAttributes.color&&(P=3),A){let e=te[A];_=e.vertexShader,x=e.fragmentShader}else _=a.vertexShader,x=a.fragmentShader,l.update(a),y=l.getVertexShaderID(a),M=l.getFragmentShaderID(a);let R=e.getRenderTarget(),U=!0===g.isInstancedMesh,D=!!a.map,I=!!a.matcap,N=!!w,V=!!a.aoMap,O=!!a.lightMap,z=!!a.bumpMap,B=!!a.normalMap,G=!!a.displacementMap,F=!!a.emissiveMap,k=!!a.metalnessMap,W=!!a.roughnessMap,H=a.clearcoat>0,j=a.iridescence>0,q=a.sheen>0,X=a.transmission>0,J=H&&!!a.clearcoatMap,Y=H&&!!a.clearcoatNormalMap,Z=H&&!!a.clearcoatRoughnessMap,K=j&&!!a.iridescenceMap,Q=j&&!!a.iridescenceThicknessMap,$=q&&!!a.sheenColorMap,ee=q&&!!a.sheenRoughnessMap,et=!!a.specularMap,er=!!a.specularColorMap,en=!!a.specularIntensityMap,ei=X&&!!a.transmissionMap,ea=X&&!!a.thicknessMap,es=!!a.gradientMap,eo=!!a.alphaMap,el=a.alphaTest>0,eu=!!a.extensions,eh=!!b.attributes.uv2,ec={isWebGL2:h,shaderID:A,shaderName:a.type,vertexShader:_,fragmentShader:x,defines:a.defines,customVertexShaderID:y,customFragmentShaderID:M,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:U,instancingColor:U&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===R?e.outputEncoding:!0===R.isXRRenderTarget?R.texture.encoding:3e3,map:D,matcap:I,envMap:N,envMapMode:N&&w.mapping,envMapCubeUVHeight:E,aoMap:V,lightMap:O,bumpMap:z,normalMap:B,displacementMap:d&&G,emissiveMap:F,normalMapObjectSpace:B&&1===a.normalMapType,normalMapTangentSpace:B&&0===a.normalMapType,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&3001===a.map.encoding,metalnessMap:k,roughnessMap:W,clearcoat:H,clearcoatMap:J,clearcoatNormalMap:Y,clearcoatRoughnessMap:Z,iridescence:j,iridescenceMap:K,iridescenceThicknessMap:Q,sheen:q,sheenColorMap:$,sheenRoughnessMap:ee,specularMap:et,specularColorMap:er,specularIntensityMap:en,transmission:X,transmissionMap:ei,thicknessMap:ea,gradientMap:es,opaque:!1===a.transparent&&1===a.blending,alphaMap:eo,alphaTest:el,combine:a.combine,mapUv:D&&getChannel(a.map.channel),aoMapUv:V&&getChannel(a.aoMap.channel),lightMapUv:O&&getChannel(a.lightMap.channel),bumpMapUv:z&&getChannel(a.bumpMap.channel),normalMapUv:B&&getChannel(a.normalMap.channel),displacementMapUv:G&&getChannel(a.displacementMap.channel),emissiveMapUv:F&&getChannel(a.emissiveMap.channel),metalnessMapUv:k&&getChannel(a.metalnessMap.channel),roughnessMapUv:W&&getChannel(a.roughnessMap.channel),clearcoatMapUv:J&&getChannel(a.clearcoatMap.channel),clearcoatNormalMapUv:Y&&getChannel(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&getChannel(a.clearcoatRoughnessMap.channel),iridescenceMapUv:K&&getChannel(a.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&getChannel(a.iridescenceThicknessMap.channel),sheenColorMapUv:$&&getChannel(a.sheenColorMap.channel),sheenRoughnessMapUv:ee&&getChannel(a.sheenRoughnessMap.channel),specularMapUv:et&&getChannel(a.specularMap.channel),specularColorMapUv:er&&getChannel(a.specularColorMap.channel),specularIntensityMapUv:en&&getChannel(a.specularIntensityMap.channel),transmissionMapUv:ei&&getChannel(a.transmissionMap.channel),thicknessMapUv:ea&&getChannel(a.thicknessMap.channel),alphaMapUv:eo&&getChannel(a.alphaMap.channel),vertexTangents:B&&!!b.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs2:eh,pointsUvs:!0===g.isPoints&&!!b.attributes.uv&&(D||eo),fog:!!S,useFog:!0===a.fog,fogExp2:S&&S.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:L,morphTextureStride:P,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:0,useLegacyLights:e.useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:eu&&!0===a.extensions.derivatives,extensionFragDepth:eu&&!0===a.extensions.fragDepth,extensionDrawBuffers:eu&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:eu&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()};return ec},getProgramCacheKey:function(t){let r=[];
186if(t.shaderID?r.push(t.shaderID):(r.push(t.customVertexShaderID),r.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)r.push(e),r.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(r.push(t.precision),r.push(t.outputEncoding),r.push(t.envMapMode),r.push(t.envMapCubeUVHeight),r.push(t.mapUv),r.push(t.alphaMapUv),r.push(t.lightMapUv),r.push(t.aoMapUv),r.push(t.bumpMapUv),r.push(t.normalMapUv),r.push(t.displacementMapUv),r.push(t.emissiveMapUv),r.push(t.metalnessMapUv),r.push(t.roughnessMapUv),r.push(t.clearcoatMapUv),r.push(t.clearcoatNormalMapUv),r.push(t.clearcoatRoughnessMapUv),r.push(t.iridescenceMapUv),r.push(t.iridescenceThicknessMapUv),r.push(t.sheenColorMapUv),r.push(t.sheenRoughnessMapUv),r.push(t.specularMapUv),r.push(t.specularColorMapUv),r.push(t.specularIntensityMapUv),r.push(t.transmissionMapUv),r.push(t.thicknessMapUv),r.push(t.combine),r.push(t.fogExp2),r.push(t.sizeAttenuation),r.push(t.morphTargetsCount),r.push(t.morphAttributeCount),r.push(t.numDirLights),r.push(t.numPointLights),r.push(t.numSpotLights),r.push(t.numSpotLightMaps),r.push(t.numHemiLights),r.push(t.numRectAreaLights),r.push(t.numDirLightShadows),r.push(t.numPointLightShadows),r.push(t.numSpotLightShadows),r.push(t.numSpotLightShadowsWithMaps),r.push(t.shadowMapType),r.push(t.toneMapping),r.push(t.numClippingPlanes),r.push(t.numClipIntersection),r.push(t.depthPacking),o.disableAll(),t.isWebGL2&&o.enable(0),t.supportsVertexTextures&&o.enable(1),t.instancing&&o.enable(2),t.instancingColor&&o.enable(3),t.matcap&&o.enable(4),t.envMap&&o.enable(5),t.normalMapObjectSpace&&o.enable(6),t.normalMapTangentSpace&&o.enable(7),t.clearcoat&&o.enable(8),t.iridescence&&o.enable(9),t.alphaTest&&o.enable(10),t.vertexColors&&o.enable(11),t.vertexAlphas&&o.enable(12),t.vertexUvs2&&o.enable(13),t.vertexTangents&&o.enable(14),r.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.skinning&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.morphColors&&o.enable(7),t.premultipliedAlpha&&o.enable(8),t.shadowMapEnabled&&o.enable(9),t.useLegacyLights&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.transmission&&o.enable(15),t.sheen&&o.enable(16),t.decodeVideoTexture&&o.enable(17),t.opaque&&o.enable(18),t.pointsUvs&&o.enable(19),r.push(o.mask),r.push(e.outputEncoding)),r.push(t.customProgramCacheKey),r.join()},getUniforms:function(e){let t;let r=f[e.type];if(r){let e=te[r];t=e3.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,r){let n;for(let e=0,t=u.length;e<t;e++){let t=u[e];if(t.cacheKey===r){n=t,++n.usedTimes;break}}return void 0===n&&(n=new WebGLProgram(e,r,t,a),u.push(n)),n},releaseProgram:function(e){if(0==--e.usedTimes){let t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function WebGLProperties(){let e=new WeakMap;return{get:function(t){let r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,n){e.get(t)[r]=n},dispose:function(){e=new WeakMap}}}function painterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder: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 reversePainterSortStable(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 WebGLRenderList(){let e=[],t=0,r=[],n=[],i=[];function getNextRenderItem(r,n,i,a,s,o){let l=e[t];return void 0===l?(l={id:r.id,object:r,geometry:n,material:i,groupOrder:a,renderOrder:r.renderOrder,z:s,group:o},e[t]=l):(l.id=r.id,l.object=r,l.geometry=n,l.material=i,l.groupOrder=a,l.renderOrder=r.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:r,transmissive:n,transparent:i,init:function(){t=0,r.length=0,n.length=0,i.length=0},push:function(e,t,a,s,o,l){let u=getNextRenderItem(e,t,a,s,o,l);a.transmission>0?n.push(u):!0===a.transparent?i.push(u):r.push(u)},unshift:function(e,t,a,s,o,l){let u=getNextRenderItem(e,t,a,s,o,l);a.transmission>0?n.unshift(u):!0===a.transparent?i.unshift(u):r.unshift(u)},finish:function(){for(let r=t,n=e.length;r<n;r++){let t=e[r];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){r.length>1&&r.sort(e||painterSortStable),n.length>1&&n.sort(t||reversePainterSortStable),i.length>1&&i.sort(t||reversePainterSortStable)}}}function WebGLRenderLists(){let e=new WeakMap;return{get:function(t,r){let n;let i=e.get(t);return void 0===i?(n=new WebGLRenderList,e.set(t,[n])):r>=i.length?(n=new WebGLRenderList,i.push(n)):n=i[r],n},dispose:function(){e=new WeakMap}}}function UniformsCache(){let e={};return{get:function(t){let r;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":r={direction:new Vector3,color:new Color};break;case"SpotLight":r={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":r={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":r={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3}}return e[t.id]=r,r}}}let tb=0;function shadowCastingAndTexturingLightsFirst(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function WebGLLights(e,t){let r=new UniformsCache,n=function(){let e={};return{get:function(t){let r;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let e=0;e<9;e++)i.probe.push(new Vector3);let a=new Vector3,s=new Matrix4,o=new Matrix4;return{setup:function(a,s){let o=0,l=0,u=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let h=0,c=0,d=0,p=0,f=0,m=0,g=0,_=0,x=0,y=0;a.sort(shadowCastingAndTexturingLightsFirst);let M=!0===s?Math.PI:1;for(let e=0,t=a.length;e<t;e++){let t=a[e],s=t.color,S=t.intensity,b=t.distance,T=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)o+=s.r*S*M,l+=s.g*S*M,u+=s.b*S*M;else if(t.isLightProbe)for(let e=0;e<9;e++)i.probe[e].addScaledVector(t.sh.coefficients[e],S);else if(t.isDirectionalLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*M),t.castShadow){let e=t.shadow,r=n.get(t);
186r.shadowBias=e.bias,r.shadowNormalBias=e.normalBias,r.shadowRadius=e.radius,r.shadowMapSize=e.mapSize,i.directionalShadow[h]=r,i.directionalShadowMap[h]=T,i.directionalShadowMatrix[h]=t.shadow.matrix,m++}i.directional[h]=e,h++}else if(t.isSpotLight){let e=r.get(t);e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(s).multiplyScalar(S*M),e.distance=b,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,i.spot[d]=e;let a=t.shadow;if(t.map&&(i.spotLightMap[x]=t.map,x++,a.updateMatrices(t),t.castShadow&&y++),i.spotLightMatrix[d]=a.matrix,t.castShadow){let e=n.get(t);e.shadowBias=a.bias,e.shadowNormalBias=a.normalBias,e.shadowRadius=a.radius,e.shadowMapSize=a.mapSize,i.spotShadow[d]=e,i.spotShadowMap[d]=T,_++}d++}else if(t.isRectAreaLight){let e=r.get(t);e.color.copy(s).multiplyScalar(S),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),i.rectArea[p]=e,p++}else if(t.isPointLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*M),e.distance=t.distance,e.decay=t.decay,t.castShadow){let e=t.shadow,r=n.get(t);r.shadowBias=e.bias,r.shadowNormalBias=e.normalBias,r.shadowRadius=e.radius,r.shadowMapSize=e.mapSize,r.shadowCameraNear=e.camera.near,r.shadowCameraFar=e.camera.far,i.pointShadow[c]=r,i.pointShadowMap[c]=T,i.pointShadowMatrix[c]=t.shadow.matrix,g++}i.point[c]=e,c++}else if(t.isHemisphereLight){let e=r.get(t);e.skyColor.copy(t.color).multiplyScalar(S*M),e.groundColor.copy(t.groundColor).multiplyScalar(S*M),i.hemi[f]=e,f++}}p>0&&(t.isWebGL2?(i.rectAreaLTC1=e9.LTC_FLOAT_1,i.rectAreaLTC2=e9.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=e9.LTC_FLOAT_1,i.rectAreaLTC2=e9.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=e9.LTC_HALF_1,i.rectAreaLTC2=e9.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=l,i.ambient[2]=u;let S=i.hash;(S.directionalLength!==h||S.pointLength!==c||S.spotLength!==d||S.rectAreaLength!==p||S.hemiLength!==f||S.numDirectionalShadows!==m||S.numPointShadows!==g||S.numSpotShadows!==_||S.numSpotMaps!==x)&&(i.directional.length=h,i.spot.length=d,i.rectArea.length=p,i.point.length=c,i.hemi.length=f,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=g,i.spotLightMatrix.length=_+x-y,i.spotLightMap.length=x,i.numSpotLightShadowsWithMaps=y,S.directionalLength=h,S.pointLength=c,S.spotLength=d,S.rectAreaLength=p,S.hemiLength=f,S.numDirectionalShadows=m,S.numPointShadows=g,S.numSpotShadows=_,S.numSpotMaps=x,i.version=tb++)},setupView:function(e,t){let r=0,n=0,l=0,u=0,h=0,c=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=i.directional[r];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(c),r++}else if(d.isSpotLight){let e=i.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(c),l++}else if(d.isRectAreaLight){let e=i.rectArea[u];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),o.identity(),s.copy(d.matrixWorld),s.premultiply(c),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),u++}else if(d.isPointLight){let e=i.point[n];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),n++}else if(d.isHemisphereLight){let e=i.hemi[h];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(c),h++}}},state:i}}function WebGLRenderState(e,t){let r=new WebGLLights(e,t),n=[],i=[];return{init:function(){n.length=0,i.length=0},state:{lightsArray:n,shadowsArray:i,lights:r},setupLights:function(e){r.setup(n,e)},setupLightsView:function(e){r.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function WebGLRenderStates(e,t){let r=new WeakMap;return{get:function(n,i=0){let a;let s=r.get(n);return void 0===s?(a=new WebGLRenderState(e,t),r.set(n,[a])):i>=s.length?(a=new WebGLRenderState(e,t),s.push(a)):a=s[i],a},dispose:function(){r=new WeakMap}}}let MeshDepthMaterial=class MeshDepthMaterial extends Material{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};let MeshDistanceMaterial=class MeshDistanceMaterial extends Material{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function WebGLShadowMap(e,t,r){let n=new Frustum,i=new Vector2,a=new Vector2,s=new Vector4,o=new MeshDepthMaterial({depthPacking:3201}),l=new MeshDistanceMaterial,u={},h=r.maxTextureSize,c={0:1,1:0,2:2}
186,d=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:"void main() {\n	gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n	const float samples = float( VSM_SAMPLES );\n	float mean = 0.0;\n	float squared_mean = 0.0;\n	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n	for ( float i = 0.0; i < samples; i ++ ) {\n		float uvOffset = uvStart + i * uvStride;\n		#ifdef HORIZONTAL_PASS\n			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n			mean += distribution.x;\n			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n		#else\n			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n			mean += depth;\n			squared_mean += depth * depth;\n		#endif\n	}\n	mean = mean / samples;\n	squared_mean = squared_mean / samples;\n	float std_dev = sqrt( squared_mean - mean * mean );\n	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new BufferGeometry;f.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Mesh(f,d),g=this;function getDepthMaterial(t,r,n,i){let a=null,s=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?l:o,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0){let e=a.uuid,t=r.uuid,n=u[e];void 0===n&&(n={},u[e]=n);let i=n[t];void 0===i&&(i=a.clone(),n[t]=i),a=i}if(a.visible=r.visible,a.wireframe=r.wireframe,3===i?a.side=null!==r.shadowSide?r.shadowSide:r.side:a.side=null!==r.shadowSide?r.shadowSide:c[r.side],a.alphaMap=r.alphaMap,a.alphaTest=r.alphaTest,a.map=r.map,a.clipShadows=r.clipShadows,a.clippingPlanes=r.clippingPlanes,a.clipIntersection=r.clipIntersection,a.displacementMap=r.displacementMap,a.displacementScale=r.displacementScale,a.displacementBias=r.displacementBias,a.wireframeLinewidth=r.wireframeLinewidth,a.linewidth=r.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial){let t=e.properties.get(a);t.light=n}return a}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(r,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===r.length)return;let u=e.getRenderTarget(),c=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.state;_.setBlending(0),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);for(let u=0,c=r.length;u<c;u++){let c=r[u],f=c.shadow;if(void 0===f){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;i.copy(f.mapSize);let g=f.getFrameExtents();if(i.multiply(g),a.copy(f.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(a.x=Math.floor(h/g.x),i.x=a.x*g.x,f.mapSize.x=a.x),i.y>h&&(a.y=Math.floor(h/g.y),i.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};f.map=new WebGLRenderTarget(i.x,i.y,e),f.map.texture.name=c.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let x=f.getViewportCount();for(let r=0;r<x;r++){let i=f.getViewport(r);s.set(a.x*i.x,a.y*i.y,a.x*i.z,a.y*i.w),_.viewport(s),f.updateMatrices(c,r),n=f.getFrustum(),function renderObject(r,i,a,s,o){if(!1===r.visible)return;let l=r.layers.test(i.layers);if(l&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===o)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,r.matrixWorld);let n=t.update(r),i=r.material;if(Array.isArray(i)){let t=n.groups;for(let l=0,u=t.length;l<u;l++){let u=t[l],h=i[u.materialIndex];if(h&&h.visible){let t=getDepthMaterial(r,h,s,o);e.renderBufferDirect(a,null,n,t,r,u)}}}else if(i.visible){let t=getDepthMaterial(r,i,s,o);e.renderBufferDirect(a,null,n,t,r,null)}}let u=r.children;for(let e=0,t=u.length;e<t;e++)renderObject(u[e],i,a,s,o)}(o,l,f.camera,c,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(r,n){let a=t.update(m);d.defines.VSM_SAMPLES!==r.blurSamples&&(d.defines.VSM_SAMPLES=r.blurSamples,p.defines.VSM_SAMPLES=r.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===r.mapPass&&(r.mapPass=new WebGLRenderTarget(i.x,i.y)),d.uniforms.shadow_pass.value=r.map.texture,d.uniforms.resolution.value=r.mapSize,d.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(n,null,a,d,m,null),p.uniforms.shadow_pass.value=r.mapPass.texture,p.uniforms.resolution.value=r.mapSize,p.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(n,null,a,p,m,null)}(f,l),f.needsUpdate=!1}g.needsUpdate=!1,e.setRenderTarget(u,c,f)}}function WebGLState(e,t,r){let n=r.isWebGL2,i=new function(){let t=!1,r=new Vector4,n=null,i=new Vector4(0,0,0,0);return{setMask:function(r){n===r||t||(e.colorMask(r,r,r,r),n=r)},setLocked:function(e){t=e},setClear:function(t,n,a,s,o){!0===o&&(t*=s,n*=s,a*=s),r.set(t,n,a,s),!1===i.equals(r)&&(e.clearColor(t,n,a,s),i.copy(r))},reset:function(){t=!1,n=null,i.set(-1,0,0,0)}}},a=new function(){let t=!1,r=null,n=null,i=null;return{setTest:function(e){e?enable(2929):disable(2929)},setMask:function(n){r===n||t||(e.depthMask(n),r=n)},setFunc:function(t){if(n!==t){switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;
186case 3:default: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)}n=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,r=null,n=null,i=null}}},s=new function(){let t=!1,r=null,n=null,i=null,a=null,s=null,o=null,l=null,u=null;return{setTest:function(e){t||(e?enable(2960):disable(2960))},setMask:function(n){r===n||t||(e.stencilMask(n),r=n)},setFunc:function(t,r,s){(n!==t||i!==r||a!==s)&&(e.stencilFunc(t,r,s),n=t,i=r,a=s)},setOp:function(t,r,n){(s!==t||o!==r||l!==n)&&(e.stencilOp(t,r,n),s=t,o=r,l=n)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,r=null,n=null,i=null,a=null,s=null,o=null,l=null,u=null}}},o=new WeakMap,l=new WeakMap,u={},h={},c=new WeakMap,d=[],p=null,f=!1,m=null,g=null,_=null,x=null,y=null,M=null,S=null,b=!1,T=null,w=null,E=null,A=null,C=null,L=e.getParameter(35661),P=!1,R=e.getParameter(7938);-1!==R.indexOf("WebGL")?P=parseFloat(/^WebGL (\d)/.exec(R)[1])>=1:-1!==R.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(R)[1])>=2);let U=null,D={},I=e.getParameter(3088),N=e.getParameter(2978),V=new Vector4().fromArray(I),O=new Vector4().fromArray(N);function createTexture(t,r,n){let i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<n;t++)e.texImage2D(r+t,0,6408,1,1,0,6408,5121,i);return a}let z={};function enable(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function disable(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}z[3553]=createTexture(3553,3553,1),z[34067]=createTexture(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),s.setClear(0),enable(2929),a.setFunc(3),setFlipSided(!1),setCullFace(1),enable(2884),setBlending(0);let B={100:32774,101:32778,102:32779};if(n)B[103]=32775,B[104]=32776;else{let e=t.get("EXT_blend_minmax");null!==e&&(B[103]=e.MIN_EXT,B[104]=e.MAX_EXT)}let G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function setBlending(t,r,n,i,a,s,o,l){if(0===t){!0===f&&(disable(3042),f=!1);return}if(!1===f&&(enable(3042),f=!0),5!==t){if(t!==m||l!==b){if((100!==g||100!==y)&&(e.blendEquation(32774),g=100,y=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,769,0,1);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.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}_=null,x=null,M=null,S=null,m=t,b=l}return}a=a||r,s=s||n,o=o||i,(r!==g||a!==y)&&(e.blendEquationSeparate(B[r],B[a]),g=r,y=a),(n!==_||i!==x||s!==M||o!==S)&&(e.blendFuncSeparate(G[n],G[i],G[s],G[o]),_=n,x=i,M=s,S=o),m=t,b=!1}function setFlipSided(t){T!==t&&(t?e.frontFace(2304):e.frontFace(2305),T=t)}function setCullFace(t){0!==t?(enable(2884),t!==w&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):disable(2884),w=t}function setPolygonOffset(t,r,n){t?(enable(32823),(A!==r||C!==n)&&(e.polygonOffset(r,n),A=r,C=n)):disable(32823)}return{buffers:{color:i,depth:a,stencil:s},enable:enable,disable:disable,bindFramebuffer:function(t,r){return h[t]!==r&&(e.bindFramebuffer(t,r),h[t]=r,n&&(36009===t&&(h[36160]=r),36160===t&&(h[36009]=r)),!0)},drawBuffers:function(n,i){let a=d,s=!1;if(n){if(void 0===(a=c.get(i))&&(a=[],c.set(i,a)),n.isWebGLMultipleRenderTargets){let e=n.texture;if(a.length!==e.length||36064!==a[0]){for(let t=0,r=e.length;t<r;t++)a[t]=36064+t;a.length=e.length,s=!0}}else 36064!==a[0]&&(a[0]=36064,s=!0)}else 1029!==a[0]&&(a[0]=1029,s=!0);s&&(r.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:setBlending,setMaterial:function(e,t){2===e.side?disable(2884):enable(2884);let r=1===e.side;t&&(r=!r),setFlipSided(r),1===e.blending&&!1===e.transparent?setBlending(0):setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite);let n=e.stencilWrite;s.setTest(n),n&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?enable(32926):disable(32926)}
186,setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:function(t){t!==E&&(P&&e.lineWidth(t),E=t)},setPolygonOffset:setPolygonOffset,setScissorTest:function(e){e?enable(3089):disable(3089)},activeTexture:function(t){void 0===t&&(t=33984+L-1),U!==t&&(e.activeTexture(t),U=t)},bindTexture:function(t,r,n){void 0===n&&(n=null===U?33984+L-1:U);let i=D[n];void 0===i&&(i={type:void 0,texture:void 0},D[n]=i),(i.type!==t||i.texture!==r)&&(U!==n&&(e.activeTexture(n),U=n),e.bindTexture(t,r||z[t]),i.type=t,i.texture=r)},unbindTexture:function(){let t=D[U];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)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.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)}},updateUBOMapping:function(t,r){let n=l.get(r);void 0===n&&(n=new WeakMap,l.set(r,n));let i=n.get(t);void 0===i&&(i=e.getUniformBlockIndex(r,t.name),n.set(t,i))},uniformBlockBinding:function(t,r){let n=l.get(r),i=n.get(t);o.get(r)!==i&&(e.uniformBlockBinding(r,i,t.__bindingPointIndex),o.set(r,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===V.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),V.copy(t))},viewport:function(t){!1===O.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),O.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===n&&(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),u={},U=null,D={},h={},c=new WeakMap,d=[],p=null,f=!1,m=null,g=null,_=null,x=null,y=null,M=null,S=null,b=!1,T=null,w=null,E=null,A=null,C=null,V.set(0,0,e.canvas.width,e.canvas.height),O.set(0,0,e.canvas.width,e.canvas.height),i.reset(),a.reset(),s.reset()}}}function WebGLTextures(e,t,r,n,i,a,s){let o;let l=i.isWebGL2,u=i.maxTextures,h=i.maxCubemapSize,c=i.maxTextureSize,d=i.maxSamples,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,f="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap,g=new WeakMap,_=!1;try{_="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function createCanvas(e,t){return _?new OffscreenCanvas(e,t):createElementNS("canvas")}function resizeImage(e,t,r,n){let i=1;if((e.width>n||e.height>n)&&(i=n/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let n=t?floorPowerOfTwo:Math.floor,a=n(i*e.width),s=n(i*e.height);void 0===o&&(o=createCanvas(a,s));let l=r?createCanvas(a,s):o;l.width=a,l.height=s;let u=l.getContext("2d");return u.drawImage(e,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+s+")."),l}
186"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").")}return e}function isPowerOfTwo$1(e){return isPowerOfTwo(e.width)&&isPowerOfTwo(e.height)}function textureNeedsGenerateMipmaps(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function generateMipmap(t){e.generateMipmap(t)}function getInternalFormat(r,n,i,a,s=!1){if(!1===l)return n;if(null!==r){if(void 0!==e[r])return e[r];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}let o=n;return 6403===n&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),33319===n&&(5126===i&&(o=33328),5131===i&&(o=33327),5121===i&&(o=33323)),6408===n&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=3001===a&&!1===s?35907:32856),32819===i&&(o=32854),32820===i&&(o=32855)),(33325===o||33326===o||33327===o||33328===o||34842===o||34836===o)&&t.get("EXT_color_buffer_float"),o}function getMipLevels(e,t,r){return!0===textureNeedsGenerateMipmaps(e,r)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function filterFallback(e){return 1003===e||1004===e||1005===e?9728:9729}function onTextureDispose(e){let t=e.target;t.removeEventListener("dispose",onTextureDispose),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let r=e.source,i=g.get(r);if(i){let n=i[t.__cacheKey];n.usedTimes--,0===n.usedTimes&&deleteTexture(e),0===Object.keys(i).length&&g.delete(r)}n.remove(e)}(t),t.isVideoTexture&&m.delete(t)}function onRenderTargetDispose(t){let r=t.target;r.removeEventListener("dispose",onRenderTargetDispose),function(t){let r=t.texture,i=n.get(t),a=n.get(r);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),s.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t]);else{if(e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(let t=0,i=r.length;t<i;t++){let i=n.get(r[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),n.remove(r[t])}n.remove(r),n.remove(t)}(r)}function deleteTexture(t){let r=n.get(t);e.deleteTexture(r.__webglTexture);let i=t.source,a=g.get(i);delete a[r.__cacheKey],s.memory.textures--}let x=0;function setTexture2D(e,t){let i=n.get(e);if(e.isVideoTexture&&function(e){let t=s.render.frame;m.get(e)!==t&&(m.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&i.__version!==e.version){let r=e.image;if(null===r)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===r.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{uploadTexture(i,e,t);return}}r.bindTexture(3553,i.__webglTexture,33984+t)}let y={1e3:10497,1001:33071,1002:33648},M={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function setTextureParameters(r,a,s){if(s?(e.texParameteri(r,10242,y[a.wrapS]),e.texParameteri(r,10243,y[a.wrapT]),(32879===r||35866===r)&&e.texParameteri(r,32882,y[a.wrapR]),e.texParameteri(r,10240,M[a.magFilter]),e.texParameteri(r,10241,M[a.minFilter])):(e.texParameteri(r,10242,33071),e.texParameteri(r,10243,33071),(32879===r||35866===r)&&e.texParameteri(r,32882,33071),(1001!==a.wrapS||1001!==a.wrapT)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(r,10240,filterFallback(a.magFilter)),e.texParameteri(r,10241,filterFallback(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&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")){let s=t.get("EXT_texture_filter_anisotropic");1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==l||1016!==a.type||!1!==t.has("OES_texture_half_float_linear"))&&(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(e.texParameterf(r,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function initTexture(t,r){let n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",onTextureDispose));let i=r.source,a=g.get(i);void 0===a&&(a={},g.set(i,a));let o=function(e){let t=[];
186return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(r);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,n=!0),a[o].usedTimes++;let i=a[t.__cacheKey];void 0!==i&&(a[t.__cacheKey].usedTimes--,0===i.usedTimes&&deleteTexture(r)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return n}function uploadTexture(t,i,s){let o=3553;(i.isDataArrayTexture||i.isCompressedArrayTexture)&&(o=35866),i.isData3DTexture&&(o=32879);let u=initTexture(t,i),h=i.source;r.bindTexture(o,t.__webglTexture,33984+s);let d=n.get(h);if(h.version!==d.__version||!0===u){let t;r.activeTexture(33984+s),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);let n=!l&&(1001!==i.wrapS||1001!==i.wrapT||1003!==i.minFilter&&1006!==i.minFilter)&&!1===isPowerOfTwo$1(i.image),p=resizeImage(i.image,n,!1,c);p=verifyColorSpace(i,p);let f=isPowerOfTwo$1(p)||l,m=a.convert(i.format,i.encoding),g=a.convert(i.type),_=getInternalFormat(i.internalFormat,m,g,i.encoding,i.isVideoTexture);setTextureParameters(o,i,f);let x=i.mipmaps,y=l&&!0!==i.isVideoTexture,M=void 0===d.__version||!0===u,S=getMipLevels(i,p,f);if(i.isDepthTexture)_=6402,l?_=1015===i.type?36012:1014===i.type?33190:1020===i.type?35056:33189:1015===i.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===i.format&&6402===_&&1012!==i.type&&1014!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=1014,g=a.convert(i.type)),1027===i.format&&6402===_&&(_=34041,1020!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=1020,g=a.convert(i.type))),M&&(y?r.texStorage2D(3553,1,_,p.width,p.height):r.texImage2D(3553,0,_,p.width,p.height,0,m,g,null));else if(i.isDataTexture){if(x.length>0&&f){y&&M&&r.texStorage2D(3553,S,_,x[0].width,x[0].height);for(let e=0,n=x.length;e<n;e++)t=x[e],y?r.texSubImage2D(3553,e,0,0,t.width,t.height,m,g,t.data):r.texImage2D(3553,e,_,t.width,t.height,0,m,g,t.data);i.generateMipmaps=!1}else y?(M&&r.texStorage2D(3553,S,_,p.width,p.height),r.texSubImage2D(3553,0,0,0,p.width,p.height,m,g,p.data)):r.texImage2D(3553,0,_,p.width,p.height,0,m,g,p.data)}else if(i.isCompressedTexture){if(i.isCompressedArrayTexture){y&&M&&r.texStorage3D(35866,S,_,x[0].width,x[0].height,p.depth);for(let e=0,n=x.length;e<n;e++)t=x[e],1023!==i.format?null!==m?y?r.compressedTexSubImage3D(35866,e,0,0,0,t.width,t.height,p.depth,m,t.data,0,0):r.compressedTexImage3D(35866,e,_,t.width,t.height,p.depth,0,t.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):y?r.texSubImage3D(35866,e,0,0,0,t.width,t.height,p.depth,m,g,t.data):r.texImage3D(35866,e,_,t.width,t.height,p.depth,0,m,g,t.data)}else{y&&M&&r.texStorage2D(3553,S,_,x[0].width,x[0].height);for(let e=0,n=x.length;e<n;e++)t=x[e],1023!==i.format?null!==m?y?r.compressedTexSubImage2D(3553,e,0,0,t.width,t.height,m,t.data):r.compressedTexImage2D(3553,e,_,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):y?r.texSubImage2D(3553,e,0,0,t.width,t.height,m,g,t.data):r.texImage2D(3553,e,_,t.width,t.height,0,m,g,t.data)}}else if(i.isDataArrayTexture)y?(M&&r.texStorage3D(35866,S,_,p.width,p.height,p.depth),r.texSubImage3D(35866,0,0,0,0,p.width,p.height,p.depth,m,g,p.data)):r.texImage3D(35866,0,_,p.width,p.height,p.depth,0,m,g,p.data);else if(i.isData3DTexture)y?(M&&r.texStorage3D(32879,S,_,p.width,p.height,p.depth),r.texSubImage3D(32879,0,0,0,0,p.width,p.height,p.depth,m,g,p.data)):r.texImage3D(32879,0,_,p.width,p.height,p.depth,0,m,g,p.data);else if(i.isFramebufferTexture){if(M){if(y)r.texStorage2D(3553,S,_,p.width,p.height);else{let e=p.width,t=p.height;for(let n=0;n<S;n++)r.texImage2D(3553,n,_,e,t,0,m,g,null),e>>=1,t>>=1}}}else if(x.length>0&&f){y&&M&&r.texStorage2D(3553,S,_,x[0].width,x[0].height);for(let e=0,n=x.length;e<n;e++)t=x[e],y?r.texSubImage2D(3553,e,0,0,m,g,t):r.texImage2D(3553,e,_,m,g,t);i.generateMipmaps=!1}else y?(M&&r.texStorage2D(3553,S,_,p.width,p.height),r.texSubImage2D(3553,0,0,0,m,g,p)):r.texImage2D(3553,0,_,m,g,p);textureNeedsGenerateMipmaps(i,f)&&generateMipmap(o),d.__version=h.version,i.onUp
186date&&i.onUpdate(i)}t.__version=i.version}function setupFrameBufferTexture(t,i,s,o,l){let u=a.convert(s.format,s.encoding),h=a.convert(s.type),c=getInternalFormat(s.internalFormat,u,h,s.encoding),d=n.get(i);d.__hasExternalTextures||(32879===l||35866===l?r.texImage3D(l,0,c,i.width,i.height,i.depth,0,u,h,null):r.texImage2D(l,0,c,i.width,i.height,0,u,h,null)),r.bindFramebuffer(36160,t),useMultisampledRTT(i)?p.framebufferTexture2DMultisampleEXT(36160,o,l,n.get(s).__webglTexture,0,getRenderTargetSamples(i)):(3553===l||l>=34069&&l<=34074)&&e.framebufferTexture2D(36160,o,l,n.get(s).__webglTexture,0),r.bindFramebuffer(36160,null)}function setupRenderBufferStorage(t,r,n){if(e.bindRenderbuffer(36161,t),r.depthBuffer&&!r.stencilBuffer){let i=33189;if(n||useMultisampledRTT(r)){let t=r.depthTexture;t&&t.isDepthTexture&&(1015===t.type?i=36012:1014===t.type&&(i=33190));let n=getRenderTargetSamples(r);useMultisampledRTT(r)?p.renderbufferStorageMultisampleEXT(36161,n,i,r.width,r.height):e.renderbufferStorageMultisample(36161,n,i,r.width,r.height)}else e.renderbufferStorage(36161,i,r.width,r.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(r.depthBuffer&&r.stencilBuffer){let i=getRenderTargetSamples(r);n&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(36161,i,35056,r.width,r.height):useMultisampledRTT(r)?p.renderbufferStorageMultisampleEXT(36161,i,35056,r.width,r.height):e.renderbufferStorage(36161,34041,r.width,r.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{let t=!0===r.isWebGLMultipleRenderTargets?r.texture:[r.texture];for(let i=0;i<t.length;i++){let s=t[i],o=a.convert(s.format,s.encoding),l=a.convert(s.type),u=getInternalFormat(s.internalFormat,o,l,s.encoding),h=getRenderTargetSamples(r);n&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(36161,h,u,r.width,r.height):useMultisampledRTT(r)?p.renderbufferStorageMultisampleEXT(36161,h,u,r.width,r.height):e.renderbufferStorage(36161,u,r.width,r.height)}}e.bindRenderbuffer(36161,null)}function setupDepthRenderbuffer(t){let i=n.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");!function(t,i){let a=i&&i.isWebGLCubeRenderTarget;if(a)throw Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(36160,t),!(i.depthTexture&&i.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),setTexture2D(i.depthTexture,0);let s=n.get(i.depthTexture).__webglTexture,o=getRenderTargetSamples(i);if(1026===i.depthTexture.format)useMultisampledRTT(i)?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,s,0,o):e.framebufferTexture2D(36160,36096,3553,s,0);else if(1027===i.depthTexture.format)useMultisampledRTT(i)?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,s,0,o):e.framebufferTexture2D(36160,33306,3553,s,0);else throw Error("Unknown depthTexture format")}(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let n=0;n<6;n++)r.bindFramebuffer(36160,i.__webglFramebuffer[n]),i.__webglDepthbuffer[n]=e.createRenderbuffer(),setupRenderBufferStorage(i.__webglDepthbuffer[n],t,!1)}else r.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),setupRenderBufferStorage(i.__webglDepthbuffer,t,!1);r.bindFramebuffer(36160,null)}function getRenderTargetSamples(e){return Math.min(d,e.samples)}function useMultisampledRTT(e){let r=n.get(e);return l&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==r.__useRenderToTexture}function verifyColorSpace(e,r){let n=e.encoding,i=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||1035===e.format||3e3!==n&&(3001===n?!1===l?!0===t.has("EXT_sRGB")&&1023===i?(e.format=1035,e.minFilter=1006,e.generateMipmaps=!1):r=ImageUtils.sRGBToLinear(r):(1023!==i||1009!==a)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",n)),r}this.allocateTextureUnit=function(){let e=x;return e>=u&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+u),x+=1,e},this.resetTextureUnits=function(){x=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function(e,t){let i=n.get(e);if(e.version>0&&i.__version!==e.version){uploadTexture(i,e,t);return}r.bindTexture(35866,i.__webglTexture,33984+t)},this.setTexture3D=function(e,t){let i=n.get(e);if(e.version>0&&i.__version!==e.version){uploadTexture(i,e,t);return}r.bindTexture(32879,i.__webglTexture,33984+t)},this.setTextureCube=function(t,i){let s=n.get(t);if(t.version>0&&s.__version!==t.version){(function(t,i,s){if(6!==i.image.length)return;let o=initTexture(t,i),u=i.source;r.bindTexture(34067,t.__webglTexture,33984+s);let c=n.get(u);if(u.version!==c.__version||!0===o){let t;r.activeTexture(33984+s),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);let n=i.isCompressedTexture||i.image[0].isCompressedTexture,d=i.image[0]&&i.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)n||d?p[e]=d?i.image[e].image:i.image[e]:p[e]=resizeImage(i.image[e],!1,!0,h),p[e]=verifyColorSpace(i,p[e]);let f=p[0],m=isPowerOfTwo$1(f)||l,g=a.convert(i.format,i.encoding),_=a.convert(i.type),x=getInternalFormat(i.internalFormat,g,_,i.encoding),y=l&&!0!==i.isVideoTexture,M=void 0===c.__version||!0===o,S=getMipLevels(i,f,m);if(setTextureParameters(34067,i,m),n){y&&M&&r.texStorage2D(34067,S,x,f.width,f.height);for(let e=0;e<6;e++){t=p[e].mipmaps;for(let n=0;n<t.length;n++){let a=t[n];1023!==i.format?null!==g?y?r.compressedTexSubImage2D(34069+e,n,0,0,a.width,a.height,g,a.data):r.compressedTexImage2D(34069+e,n,x,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):y?r.texSubImage2D(34069+e,n,0,0,a.width,a.height,g,_,a.data):r.texImage2D(34069+e,n,x,a.width,a.height,0,g,_,a.data)}}}else{t=i.mipmaps,y&&M&&(t.length>0&&S++,r.texStorage2D(34067,S,x,p[0].width,p[0].height));for(let e=0;e<6;e++)if(d){y?r.texSubImage2D(34069+e,0,0,0,p[e].width,p[e].height,g,_,p[e].data):r.texImage2D(34069+e,0,x,p[e].width,p[e].height,0,g,_,p[e].data);for(let n=0;n<t.length;n++){let i=t[n],a=i.image[e].image;y?r.texSubImage2D(34069+e,n+1,0,0,a.width,a.height,g,_,a.data):r.texImage2D(34069+e,n+1,x,a.width,a.height,0,g,_,a.data)}}else{y?r.texSubImage2D(34069+e,0,0,0,g,_,p[e]):r.texImage2D(34069+e,0,x,g,_,p[e]);for(let n=0;n<t.length;n++){let i=t[n];y?r.texSubImage2D(34069+e,n+1,0,0,g,_,i.image[e]):r.texImage2D(34069+e,n+1,x,g,_,i.image[e])}}}textureNeedsGenerateMipmaps(i,m)&&generateMipmap(34067),c.__version=u.version,i.onUp
186date&&i.onUpdate(i)}t.__version=i.version})(s,t,i);return}r.bindTexture(34067,s.__webglTexture,33984+i)},this.rebindTextures=function(e,t,r){let i=n.get(e);void 0!==t&&setupFrameBufferTexture(i.__webglFramebuffer,e,e.texture,36064,3553),void 0!==r&&setupDepthRenderbuffer(e)},this.setupRenderTarget=function(t){let o=t.texture,u=n.get(t),h=n.get(o);t.addEventListener("dispose",onRenderTargetDispose),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=o.version,s.memory.textures++);let c=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=isPowerOfTwo$1(t)||l;if(c){u.__webglFramebuffer=[];for(let t=0;t<6;t++)u.__webglFramebuffer[t]=e.createFramebuffer()}else{if(u.__webglFramebuffer=e.createFramebuffer(),d){if(i.drawBuffers){let r=t.texture;for(let t=0,i=r.length;t<i;t++){let i=n.get(r[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.")}if(l&&t.samples>0&&!1===useMultisampledRTT(t)){let n=d?o:[o];u.__webglMultisampledFramebuffer=e.createFramebuffer(),u.__webglColorRenderbuffer=[],r.bindFramebuffer(36160,u.__webglMultisampledFramebuffer);for(let r=0;r<n.length;r++){let i=n[r];u.__webglColorRenderbuffer[r]=e.createRenderbuffer(),e.bindRenderbuffer(36161,u.__webglColorRenderbuffer[r]);let s=a.convert(i.format,i.encoding),o=a.convert(i.type),l=getInternalFormat(i.internalFormat,s,o,i.encoding,!0===t.isXRRenderTarget),h=getRenderTargetSamples(t);e.renderbufferStorageMultisample(36161,h,l,t.width,t.height),e.framebufferRenderbuffer(36160,36064+r,36161,u.__webglColorRenderbuffer[r])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(u.__webglDepthRenderbuffer=e.createRenderbuffer(),setupRenderBufferStorage(u.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(36160,null)}}if(c){r.bindTexture(34067,h.__webglTexture),setTextureParameters(34067,o,p);for(let e=0;e<6;e++)setupFrameBufferTexture(u.__webglFramebuffer[e],t,o,36064,34069+e);textureNeedsGenerateMipmaps(o,p)&&generateMipmap(34067),r.unbindTexture()}else if(d){let e=t.texture;for(let i=0,a=e.length;i<a;i++){let a=e[i],s=n.get(a);r.bindTexture(3553,s.__webglTexture),setTextureParameters(3553,a,p),setupFrameBufferTexture(u.__webglFramebuffer,t,a,36064+i,3553),textureNeedsGenerateMipmaps(a,p)&&generateMipmap(3553)}r.unbindTexture()}else{let e=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l?e=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),r.bindTexture(e,h.__webglTexture),setTextureParameters(e,o,p),setupFrameBufferTexture(u.__webglFramebuffer,t,o,36064,e),textureNeedsGenerateMipmaps(o,p)&&generateMipmap(e),r.unbindTexture()}t.depthBuffer&&setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function(e){let t=isPowerOfTwo$1(e)||l,i=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let a=0,s=i.length;a<s;a++){let s=i[a];if(textureNeedsGenerateMipmaps(s,t)){let t=e.isWebGLCubeRenderTarget?34067:3553,i=n.get(s).__webglTexture;r.bindTexture(t,i),generateMipmap(t),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(l&&t.samples>0&&!1===useMultisampledRTT(t)){let i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,s=t.height,o=16384,l=[],u=t.stencilBuffer?33306:36096,h=n.get(t),c=!0===t.isWebGLMultipleRenderTargets;if(c)for(let t=0;t<i.length;t++)r.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,3
1866161,null),r.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,null,0);r.bindFramebuffer(36008,h.__webglMultisampledFramebuffer),r.bindFramebuffer(36009,h.__webglFramebuffer);for(let r=0;r<i.length;r++){l.push(36064+r),t.depthBuffer&&l.push(u);let d=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===d&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),c&&e.framebufferRenderbuffer(36008,36064,36161,h.__webglColorRenderbuffer[r]),!0===d&&(e.invalidateFramebuffer(36008,[u]),e.invalidateFramebuffer(36009,[u])),c){let t=n.get(i[r]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,9728),f&&e.invalidateFramebuffer(36008,l)}if(r.bindFramebuffer(36008,null),r.bindFramebuffer(36009,null),c)for(let t=0;t<i.length;t++){r.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,36161,h.__webglColorRenderbuffer[t]);let a=n.get(i[t]).__webglTexture;r.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,a,0)}r.bindFramebuffer(36009,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(e,t,r){let n=r.isWebGL2;return{convert:function(r,i=null){let a;if(1009===r)return 5121;if(1017===r)return 32819;if(1018===r)return 32820;if(1010===r)return 5120;if(1011===r)return 5122;if(1012===r)return 5123;if(1013===r)return 5124;if(1014===r)return 5125;if(1015===r)return 5126;if(1016===r)return n?5131:null!==(a=t.get("OES_texture_half_float"))?a.HALF_FLOAT_OES:null;if(1021===r)return 6406;if(1023===r)return 6408;if(1024===r)return 6409;if(1025===r)return 6410;if(1026===r)return 6402;if(1027===r)return 34041;if(1035===r)return null!==(a=t.get("EXT_sRGB"))?a.SRGB_ALPHA_EXT:null;if(1028===r)return 6403;if(1029===r)return 36244;if(1030===r)return 33319;if(1031===r)return 33320;if(1033===r)return 36249;if(33776===r||33777===r||33778===r||33779===r){if(3001===i){if(null===(a=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===r)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===r)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===r)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===r)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===r)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===r)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===r)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===r)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(35840===r||35841===r||35842===r||35843===r){if(null===(a=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===r)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===r)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===r)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===r)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===r)return null!==(a=t.get("WEBGL_compressed_texture_etc1"))?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===r||37496===r){if(null===(a=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===r)return 3001===i?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===r||37809===r||37810===r||37811===r||37812===r||37813===r||37814===r||37815===r||37816===r||37817===r||37818===r||37819===r||37820===r||37821===r){if(null===(a=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===r)return 3001===i?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===r){if(null===(a=t.get("EXT_texture_compression_bptc")))return null;if(36492===r)return 3001===i?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===r||36284===r||36285===r||36286===r){if(null===(a=t.get("EXT_texture_compression_rgtc")))return null;
186if(36492===r)return a.COMPRESSED_RED_RGTC1_EXT;if(36284===r)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===r)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===r)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===r?n?34042:null!==(a=t.get("WEBGL_depth_texture"))?a.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[r]?e[r]:null}}}let ArrayCamera=class ArrayCamera extends PerspectiveCamera{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};let Group=class Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}};let tT={type:"move"};let WebXRController=class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(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(e,t,r){let n=null,i=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let n of(a=!0,e.hand.values())){let e=t.getJointPose(n,r),i=this._getHandJoint(l,n);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}let n=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],s=n.position.distanceTo(i.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,r))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(n=t.getPose(e.targetRaySpace,r))&&null!==i&&(n=i),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(tT)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==i),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let r=new Group;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}};let DepthTexture=class DepthTexture extends Texture{constructor(e,t,r,n,i,a,s,o,l,u){if(1026!==(u=void 0!==u?u:1026)&&1027!==u)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===u&&(r=1014),void 0===r&&1027===u&&(r=1020),super(null,n,i,a,s,o,u,r,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1}};
186let WebXRManager=class WebXRManager extends EventDispatcher{constructor(e,t){super();let r=this,n=null,i=1,a=null,s="local-floor",o=1,l=null,u=null,h=null,d=null,p=null,f=null,m=t.getContextAttributes(),g=null,_=null,x=[],y=[],M=new Set,S=new Map,b=new PerspectiveCamera;b.layers.enable(1),b.viewport=new Vector4;let T=new PerspectiveCamera;T.layers.enable(2),T.viewport=new Vector4;let w=[b,T],E=new ArrayCamera;E.layers.enable(1),E.layers.enable(2);let A=null,C=null;function onSessionEvent(e){let t=y.indexOf(e.inputSource);if(-1===t)return;let r=x[t];void 0!==r&&r.dispatchEvent({type:e.type,data:e.inputSource})}function onSessionEnd(){n.removeEventListener("select",onSessionEvent),n.removeEventListener("selectstart",onSessionEvent),n.removeEventListener("selectend",onSessionEvent),n.removeEventListener("squeeze",onSessionEvent),n.removeEventListener("squeezestart",onSessionEvent),n.removeEventListener("squeezeend",onSessionEvent),n.removeEventListener("end",onSessionEnd),n.removeEventListener("inputsourceschange",onInputSourcesChange);for(let e=0;e<x.length;e++){let t=y[e];null!==t&&(y[e]=null,x[e].disconnect(t))}A=null,C=null,e.setRenderTarget(g),p=null,d=null,h=null,n=null,_=null,U.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(e){for(let t=0;t<e.removed.length;t++){let r=e.removed[t],n=y.indexOf(r);n>=0&&(y[n]=null,x[n].disconnect(r))}for(let t=0;t<e.added.length;t++){let r=e.added[t],n=y.indexOf(r);if(-1===n){for(let e=0;e<x.length;e++){if(e>=y.length){y.push(r),n=e;break}if(null===y[e]){y[e]=r,n=e;break}}if(-1===n)break}let i=x[n];i&&i.connect(r)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new WebXRController,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new WebXRController,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new WebXRController,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:p},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return n},this.setSession=async function(u){if(null!==(n=u)){if(g=e.getRenderTarget(),n.addEventListener("select",onSessionEvent),n.addEventListener("selectstart",onSessionEvent),n.addEventListener("selectend",onSessionEvent),n.addEventListener("squeeze",onSessionEvent),n.addEventListener("squeezestart",onSessionEvent),n.addEventListener("squeezeend",onSessionEvent),n.addEventListener("end",onSessionEnd),n.addEventListener("inputsourceschange",onInputSourcesChange),!0!==m.xrCompatible&&await t.makeXRCompatible(),void 0===n.renderState.layers||!1===e.capabilities.isWebGL2){let r={antialias:void 0!==n.renderState.layers||m.antialias,alpha:m.alpha,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:i};p=new XRWebGLLayer(n,t,r),n.updateRenderState({baseLayer:p}),_=new WebGLRenderTarget(p.framebufferWidth,p.framebufferHeight,{format:1023,type:1009,encoding:e.outputEncoding,stencilBuffer:m.stencil})}else{let r=null,a=null,s=null;m.depth&&(s=m.stencil?35056:33190,r=m.stencil?1027:1026,a=m.stencil?1020:1014);let o={colorFormat:32856,depthFormat:s,scaleFactor:i};d=(h=new XRWebGLBinding(n,t)).createProjectionLayer(o),n.updateRenderState({layers:[d]}),_=new WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:1023,type:1009,depthTexture:new DepthTexture(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,r),stencilBuffer:m.stencil,encoding:e.outputEncoding,samples:m.antialias?4:0});let l=e.properties.get(_);l.__ignoreDepthValues=d.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await n.requestReferenceSpace(s),U.setContext(n),U.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};let L=new Vector3,P=new Vector3;function updateCamera(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===n)return;E.near=T.near=b.near=e.near,E.far=T.far=b.far=e.far,(A!==E.near||C!==E.far)&&(n.updateRenderState({depthNear:E.near,depthFar:E.far}),A=E.near,C=E.far);let t=e.parent,r=E.cameras;updateCamera(E,t);for(let e=0;e<r.length;e++)updateCamera(r[e],t);2===r.length?function(e,t,r){L.setFromMatrixPosition(t.matrixWorld),P.setFromMatrixPosition(r.matrixWorld);let n=L.distanceTo(P),i=t.projectionMatrix.elements,a=r.projectionMatrix.elements,s=i[14]/(i[10]-1),o=i[14]/(i[10]+1),l=(i[9]+1)/i[5],u=(i[9]-1)/i[5],h=(i[8]-1)/i[0],c=(a[8]+1)/a[0],d=n/(-h+c),p=-(d*h);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();let f=s+d,m=o+d,g=s*h-p,_=s*c+(n-p),x=l*o/m*f,y=u*o/m*f;e.projectionMatrix.makePerspective(g,_,x,y,f,m),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(E,b,T):E.projectionMatrix.copy(b.projectionMatrix),function(e,t,r){null===r?e.matrix.copy(t.matrixWorld):(e.matrix.copy(r.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0);let n=e.children;for(let e=0,t=n.length;e<t;e++)n[e].updateMatrixWorld(!0);e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*c*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,E,t)},this.getCamera=function(){return E},this.getFoveation=function(){if(null!==d||null!==p)return o},this.setFoveation=function(e){o=e,null!==d&&(d.fixedFoveation=e),null!==p&&void 0!==p.fixedFoveation&&(p.fixedFoveation=e)},this.getPlanes=function(){return M};let R=null,U=new WebGLAnimation;U.setAnimationLoop(function(t,n){if(u=n.getViewerPose(l||a),f=n,null!==u){let t=u.views;null!==p&&(e.setRenderTargetFramebuffer(_,p.framebuffer),e.setRenderTarget(_));let r=!1;t.length!==E.cameras.length&&(E.cameras.length=0,r=!0);for(let n=0;n<t.length;n++){let i=t[n],a=null;if(null!==p)a=p.getViewport(i);else{let t=h.getViewSubImage(d,i);a=t.viewport,0===n&&(e.setRenderTargetTextures(_,t.colorTexture,d.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(_))}let s=w[n];void 0===s&&((s=new PerspectiveCamera).layers.enable(n),s.viewport=new Vector4,w[n]=s),s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(i.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&(E.matrix.copy(s.matrix
186),E.matrix.decompose(E.position,E.quaternion,E.scale)),!0===r&&E.cameras.push(s)}}for(let e=0;e<x.length;e++){let t=y[e],r=x[e];null!==t&&void 0!==r&&r.update(t,n,l||a)}if(R&&R(t,n),n.detectedPlanes){r.dispatchEvent({type:"planesdetected",data:n.detectedPlanes});let e=null;for(let t of M)n.detectedPlanes.has(t)||(null===e&&(e=[]),e.push(t));if(null!==e)for(let t of e)M.delete(t),S.delete(t),r.dispatchEvent({type:"planeremoved",data:t});for(let e of n.detectedPlanes)if(M.has(e)){let t=S.get(e);e.lastChangedTime>t&&(S.set(e,e.lastChangedTime),r.dispatchEvent({type:"planechanged",data:e}))}else M.add(e),S.set(e,n.lastChangedTime),r.dispatchEvent({type:"planeadded",data:e})}f=null}),this.setAnimationLoop=function(e){R=e},this.dispose=function(){}}};function WebGLMaterials(e,t){function refreshTransformUniform(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function refreshUniformsCommon(r,n){r.opacity.value=n.opacity,n.color&&r.diffuse.value.copy(n.color),n.emissive&&r.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(r.map.value=n.map,refreshTransformUniform(n.map,r.mapTransform)),n.alphaMap&&(r.alphaMap.value=n.alphaMap,refreshTransformUniform(n.alphaMap,r.alphaMapTransform)),n.bumpMap&&(r.bumpMap.value=n.bumpMap,refreshTransformUniform(n.bumpMap,r.bumpMapTransform),r.bumpScale.value=n.bumpScale,1===n.side&&(r.bumpScale.value*=-1)),n.normalMap&&(r.normalMap.value=n.normalMap,refreshTransformUniform(n.normalMap,r.normalMapTransform),r.normalScale.value.copy(n.normalScale),1===n.side&&r.normalScale.value.negate()),n.displacementMap&&(r.displacementMap.value=n.displacementMap,refreshTransformUniform(n.displacementMap,r.displacementMapTransform),r.displacementScale.value=n.displacementScale,r.displacementBias.value=n.displacementBias),n.emissiveMap&&(r.emissiveMap.value=n.emissiveMap,refreshTransformUniform(n.emissiveMap,r.emissiveMapTransform)),n.specularMap&&(r.specularMap.value=n.specularMap,refreshTransformUniform(n.specularMap,r.specularMapTransform)),n.alphaTest>0&&(r.alphaTest.value=n.alphaTest);let i=t.get(n).envMap;if(i&&(r.envMap.value=i,r.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,r.reflectivity.value=n.reflectivity,r.ior.value=n.ior,r.refractionRatio.value=n.refractionRatio),n.lightMap){r.lightMap.value=n.lightMap;let t=!0===e.useLegacyLights?Math.PI:1;r.lightMapIntensity.value=n.lightMapIntensity*t,refreshTransformUniform(n.lightMap,r.lightMapTransform)}n.aoMap&&(r.aoMap.value=n.aoMap,r.aoMapIntensity.value=n.aoMapIntensity,refreshTransformUniform(n.aoMap,r.aoMapTransform))}return{refreshFogUniforms:function(t,r){r.color.getRGB(t.fogColor.value,getUnlitUniformColorSpace(e)),r.isFog?(t.fogNear.value=r.near,t.fogFar.value=r.far):r.isFogExp2&&(t.fogDensity.value=r.density)},refreshMaterialUniforms:function(e,r,n,i,a){r.isMeshBasicMaterial?refreshUniformsCommon(e,r):r.isMeshLambertMaterial?refreshUniformsCommon(e,r):r.isMeshToonMaterial?(refreshUniformsCommon(e,r),r.gradientMap&&(e.gradientMap.value=r.gradientMap)):r.isMeshPhongMaterial?(refreshUniformsCommon(e,r),e.specular.value.copy(r.specular),e.shininess.value=Math.max(r.shininess,1e-4)):r.isMeshStandardMaterial?(refreshUniformsCommon(e,r),function(e,r){e.metalness.value=r.metalness,r.metalnessMap&&(e.metalnessMap.value=r.metalnessMap,refreshTransformUniform(r.metalnessMap,e.metalnessMapTransform)),e.roughness.value=r.roughness,r.roughnessMap&&(e.roughnessMap.value=r.roughnessMap,refreshTransformUniform(r.roughnessMap,e.roughnessMapTransform));let n=t.get(r).envMap;n&&(e.envMapIntensity.value=r.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&(e.ior.value=r.ior,r.sheen>0&&(e.sheenColor.value.copy(r.sheenColor).multiplyScalar(r.sheen),e.sheenRoughness.value=r.sheenRoughness,r.sheenColorMap&&(e.sheenColorMap.value=r.sheenColorMap,refreshTransformUniform(r.sheenColorMap,e.sheenColorMapTransform)),r.sheenRoughnessMap&&(e.sheenRoughnessMap.value=r.sheenRoughnessMap,refreshTransformUniform(r.sheenRoughnessMap,e.sheenRoughnessMapTransform))),r.clearcoat>0&&(e.clearcoat.value=r.clearcoat,e.clearcoatRoughness.value=r.clearcoatRoughness,r.clearcoatMap&&(e.clearcoatMap.value=r.clearcoatMap,refreshTransformUniform(r.clearcoatMap,e.clearcoatMapTransform)),r.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=r.clearcoatRoughnessMap,refreshTransformUniform(r.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),r.clearcoatNormalMap&&(e.clearcoatNormalMap.value=r.clearcoatNormalMap,refreshTransformUniform(r.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(r.clearcoatNormalScale),1===r.side&&e.clearcoatNormalScale.value.negate())),r.iridescence>
1860&&(e.iridescence.value=r.iridescence,e.iridescenceIOR.value=r.iridescenceIOR,e.iridescenceThicknessMinimum.value=r.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=r.iridescenceThicknessRange[1],r.iridescenceMap&&(e.iridescenceMap.value=r.iridescenceMap,refreshTransformUniform(r.iridescenceMap,e.iridescenceMapTransform)),r.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=r.iridescenceThicknessMap,refreshTransformUniform(r.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),r.transmission>0&&(e.transmission.value=r.transmission,e.transmissionSamplerMap.value=a.texture,e.transmissionSamplerSize.value.set(a.width,a.height),r.transmissionMap&&(e.transmissionMap.value=r.transmissionMap,refreshTransformUniform(r.transmissionMap,e.transmissionMapTransform)),e.thickness.value=r.thickness,r.thicknessMap&&(e.thicknessMap.value=r.thicknessMap,refreshTransformUniform(r.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=r.attenuationDistance,e.attenuationColor.value.copy(r.attenuationColor)),e.specularIntensity.value=r.specularIntensity,e.specularColor.value.copy(r.specularColor),r.specularColorMap&&(e.specularColorMap.value=r.specularColorMap,refreshTransformUniform(r.specularColorMap,e.specularColorMapTransform)),r.specularIntensityMap&&(e.specularIntensityMap.value=r.specularIntensityMap,refreshTransformUniform(r.specularIntensityMap,e.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(refreshUniformsCommon(e,r),r.matcap&&(e.matcap.value=r.matcap)):r.isMeshDepthMaterial?refreshUniformsCommon(e,r):r.isMeshDistanceMaterial?(refreshUniformsCommon(e,r),function(e,r){let n=t.get(r).light;e.referencePosition.value.setFromMatrixPosition(n.matrixWorld),e.nearDistance.value=n.shadow.camera.near,e.farDistance.value=n.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?refreshUniformsCommon(e,r):r.isLineBasicMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,r.map&&(e.map.value=r.map,refreshTransformUniform(r.map,e.mapTransform)),r.isLineDashedMaterial&&(e.dashSize.value=r.dashSize,e.totalSize.value=r.dashSize+r.gapSize,e.scale.value=r.scale)):r.isPointsMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.size.value=r.size*n,e.scale.value=.5*i,r.map&&(e.map.value=r.map,refreshTransformUniform(r.map,e.uvTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest)):r.isSpriteMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.rotation.value=r.rotation,r.map&&(e.map.value=r.map,refreshTransformUniform(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(e,t,r,n){let i={},a={},s=[],o=r.isWebGL2?e.getParameter(35375):0;function getUniformSize(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function onUniformsGroupsDispose(t){let r=t.target;r.removeEventListener("dispose",onUniformsGroupsDispose);let n=s.indexOf(r.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(i[r.id]),delete i[r.id],delete a[r.id]}return{bind:function(e,t){let r=t.program;n.uniformBlockBinding(e,r)},update:function(r,l){let u=i[r.id];void 0===u&&(function(e){let t=e.uniforms,r=0,n=0;for(let e=0,i=t.length;e<i;e++){let i=t[e],a={boundary:0,storage:0},s=Array.isArray(i.value)?i.value:[i.value];for(let e=0,t=s.length;e<t;e++){let t=s[e],r=getUniformSize(t);a.boundary+=r.boundary,a.storage+=r.storage}if(i.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),i.__offset=r,e>0){n=r%16;let e=16-n;0!==n&&e-a.boundary<0&&(r+=16-n,i.__offset=r)}r+=a.storage}(n=r%16)>0&&(r+=16-n),e.__size=r,e.__cache={}}(r),u=function(t){let r=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=r;let n=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(35345,n),e.bufferData(35345,i,a),e.bindBuffer(35345,null),e.bindBufferBase(35345,r,n),n}(r),i[r.id]=u,r.addEventListener("dispose",onUniformsGroupsDispose));let h=l.program;n.updateUBOMapping(r,h);let c=t.render.frame;a[r.id]!==c&&(function(t){let r=i[t.id],n=t.uniforms,a=t.__cache;e.bindBuffer(35345,r);for(let t=0,r=n.length;t<r;t++){let r=n[t];if(!0===function(e,t,r){let n=e.value;if(void 0===r[t]){if("number"==typeof n)r[t]=n;else{let e=Array.isArray(n)?n:[n],i=[];for(let t=0;t<e.length;t++)i.push(e[t].clone());r[t]=i}return!0}if("number"==typeof n){if(r[t]!==n)return r[t]=n,!0}else{let e=Array.isArray(r[t])?r[t]:[r[t]],i=Array.isArray(n)?n:[n];for(let t=0;t<e.length;t++){let r=e[t];if(!1===r.equals(i[t]))return r.copy(i[t]),!0}}return!1}(r,t,a)){let t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value],i=0;for(let a=0;a<n.length;a++){let s=n[a],o=getUniformSize(s);"number"==typeof s?(r.__data[0]=s,e.bufferSubData(35345,t+i,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=s.elements[0],r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=s.elements[0],r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=s.elements[0]):(s.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(35345,t,r.__data)}}e.bindBuffer(35345,null)}(r),a[r.id]=c)},dispose:function(){for(let t in i)e.deleteBuffer(i[t]);s=[],i={},a={}}}}let WebGLRenderer=class WebGLRenderer{constructor(e={}){let t,r,n,i,a,s,o,l,u,h,c,d,p,f,m,g,_,x,y,M,S,b,T,w,E;let{canvas:A=function(){let e=createElementNS("canvas");return e.style.display="block",e}(),context:C=null,depth:L=!0,stencil:P=!0,alpha:R=!1,antialias:U=!1,premultipliedAlpha:D=!0,preserveDrawingBuffer:I=!1,powerPreference:N="default",failIfMajorPerformanceCaveat:V=!1}=e;
186this.isWebGLRenderer=!0,t=null!==C?C.getContextAttributes().alpha:R;let O=null,z=null,B=[],G=[];this.domElement=A,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=3e3,this.useLegacyLights=!0,this.toneMapping=0,this.toneMappingExposure=1;let F=this,k=!1,W=0,H=0,j=null,q=-1,X=null,J=new Vector4,Y=new Vector4,Z=null,K=A.width,Q=A.height,$=1,ee=null,et=null,er=new Vector4(0,0,K,Q),en=new Vector4(0,0,K,Q),ei=!1,ea=new Frustum,es=!1,eo=!1,el=null,eu=new Matrix4,eh=new Vector3,ec={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function getTargetPixelRatio(){return null===j?$:1}let ed=C;function getContext(e,t){for(let r=0;r<e.length;r++){let n=e[r],i=A.getContext(n,t);if(null!==i)return i}return null}try{if("setAttribute"in A&&A.setAttribute("data-engine","three.js r151"),A.addEventListener("webglcontextlost",onContextLost,!1),A.addEventListener("webglcontextrestored",onContextRestore,!1),A.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===ed){let e=["webgl2","webgl","experimental-webgl"];if(!0===F.isWebGL1Renderer&&e.shift(),ed=getContext(e,{alpha:!0,depth:L,stencil:P,antialias:U,premultipliedAlpha:D,preserveDrawingBuffer:I,powerPreference:N,failIfMajorPerformanceCaveat:V}),null===ed){if(getContext(e))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}}void 0===ed.getShaderPrecisionFormat&&(ed.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function initGLContext(){r=new WebGLExtensions(ed),n=new WebGLCapabilities(ed,r,e),r.init(n),T=new WebGLUtils(ed,r,n),i=new WebGLState(ed,r,n),a=new WebGLInfo,s=new WebGLProperties,o=new WebGLTextures(ed,r,i,s,n,T,a),l=new WebGLCubeMaps(F),u=new WebGLCubeUVMaps(F),h=new WebGLAttributes(ed,n),w=new WebGLBindingStates(ed,r,h,n),c=new WebGLGeometries(ed,h,a,w),d=new WebGLObjects(ed,c,h,a),M=new WebGLMorphtargets(ed,n,o),_=new WebGLClipping(s),p=new WebGLPrograms(F,l,u,r,n,w,_),f=new WebGLMaterials(F,s),m=new WebGLRenderLists,g=new WebGLRenderStates(r,n),y=new WebGLBackground(F,l,u,i,d,t,D),x=new WebGLShadowMap(F,d,n),E=new WebGLUniformsGroups(ed,a,n,i),S=new WebGLBufferRenderer(ed,r,a,n),b=new WebGLIndexedBufferRenderer(ed,r,a,n),a.programs=p.programs,F.capabilities=n,F.extensions=r,F.properties=s,F.renderLists=m,F.shadowMap=x,F.state=i,F.info=a}initGLContext();let ep=new WebXRManager(F,ed);function onContextLost(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),k=!0}function onContextRestore(){console.log("THREE.WebGLRenderer: Context Restored."),k=!1;let e=a.autoReset,t=x.enabled,r=x.autoUpdate,n=x.needsUpdate,i=x.type;initGLContext(),a.autoReset=e,x.enabled=t,x.autoUpdate=r,x.needsUpdate=n,x.type=i}function onContextCreationError(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function onMaterialDispose(e){let t=e.target;t.removeEventListener("dispose",onMaterialDispose),function(e){let t=s.get(e).programs;void 0!==t&&(t.forEach(function(e){p.releaseProgram(e)}),e.isShaderMaterial&&p.releaseShaderCache(e))}(t),s.remove(t)}this.xr=ep,this.getContext=function(){return ed},this.getContextAttributes=function(){return ed.getContextAttributes()},this.forceContextLoss=function(){let e=r.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=r.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(e){void 0!==e&&($=e,this.setSize(K,Q,!1))},this.getSize=function(e){return e.set(K,Q)},this.setSize=function(e,t,r=!0){if(ep.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}K=e,Q=t,A.width=Math.floor(e*$),A.height=Math.floor(t*$),!0===r&&(A.style.width=e+"px",A.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(K*$,Q*$).floor()},this.setDrawingBufferSize=function(e,t,r){K=e,Q=t,$=r,A.width=Math.floor(e*r),A.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(J)},this.getViewport=function(e){return e.copy(er)},this.setViewport=function(e,t,r,n){e.isVector4?er.set(e.x,e.y,e.z,e.w):er.set(e,t,r,n),i.viewport(J.copy(er).multiplyScalar($).floor())}
186,this.getScissor=function(e){return e.copy(en)},this.setScissor=function(e,t,r,n){e.isVector4?en.set(e.x,e.y,e.z,e.w):en.set(e,t,r,n),i.scissor(Y.copy(en).multiplyScalar($).floor())},this.getScissorTest=function(){return ei},this.setScissorTest=function(e){i.setScissorTest(ei=e)},this.setOpaqueSort=function(e){ee=e},this.setTransparentSort=function(e){et=e},this.getClearColor=function(e){return e.copy(y.getClearColor())},this.setClearColor=function(){y.setClearColor.apply(y,arguments)},this.getClearAlpha=function(){return y.getClearAlpha()},this.setClearAlpha=function(){y.setClearAlpha.apply(y,arguments)},this.clear=function(e=!0,t=!0,r=!0){let n=0;e&&(n|=16384),t&&(n|=256),r&&(n|=1024),ed.clear(n)},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(){A.removeEventListener("webglcontextlost",onContextLost,!1),A.removeEventListener("webglcontextrestored",onContextRestore,!1),A.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),m.dispose(),g.dispose(),s.dispose(),l.dispose(),u.dispose(),d.dispose(),w.dispose(),E.dispose(),p.dispose(),ep.dispose(),ep.removeEventListener("sessionstart",onXRSessionStart),ep.removeEventListener("sessionend",onXRSessionEnd),el&&(el.dispose(),el=null),em.stop()},this.renderBufferDirect=function(e,t,r,a,d,p){let m;null===t&&(t=ec);let g=d.isMesh&&0>d.matrixWorld.determinant(),x=function(e,t,r,a,h){var c;!0!==t.isScene&&(t=ec),o.resetTextureUnits();let d=t.fog,p=a.isMeshStandardMaterial?t.environment:null,m=null===j?F.outputEncoding:!0===j.isXRRenderTarget?j.texture.encoding:3e3,g=(a.isMeshStandardMaterial?u:l).get(a.envMap||p),x=!0===a.vertexColors&&!!r.attributes.color&&4===r.attributes.color.itemSize,y=!!a.normalMap&&!!r.attributes.tangent,S=!!r.morphAttributes.position,b=!!r.morphAttributes.normal,T=!!r.morphAttributes.color,w=a.toneMapped?F.toneMapping:0,A=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,C=void 0!==A?A.length:0,L=s.get(a),P=z.state.lights;if(!0===es&&(!0===eo||e!==X)){let t=e===X&&a.id===q;_.setState(a,e,t)}let R=!1;a.version===L.__version?L.needsLights&&L.lightsStateVersion!==P.state.version?R=!0:L.outputEncoding!==m?R=!0:h.isInstancedMesh&&!1===L.instancing?R=!0:h.isInstancedMesh||!0!==L.instancing?h.isSkinnedMesh&&
186!1===L.skinning?R=!0:h.isSkinnedMesh||!0!==L.skinning?L.envMap!==g?R=!0:!0===a.fog&&L.fog!==d?R=!0:void 0!==L.numClippingPlanes&&(L.numClippingPlanes!==_.numPlanes||L.numIntersection!==_.numIntersection)?R=!0:L.vertexAlphas!==x?R=!0:L.vertexTangents!==y?R=!0:L.morphTargets!==S?R=!0:L.morphNormals!==b?R=!0:L.morphColors!==T?R=!0:L.toneMapping!==w?R=!0:!0===n.isWebGL2&&L.morphTargetsCount!==C&&(R=!0):R=!0:R=!0:(R=!0,L.__version=a.version);let U=L.currentProgram;!0===R&&(U=getProgram(a,t,h));let D=!1,I=!1,N=!1,V=U.getUniforms(),O=L.uniforms;if(i.useProgram(U.program)&&(D=!0,I=!0,N=!0),a.id!==q&&(q=a.id,I=!0),D||X!==e){if(V.setValue(ed,"projectionMatrix",e.projectionMatrix),n.logarithmicDepthBuffer&&V.setValue(ed,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),X!==e&&(X=e,I=!0,N=!0),a.isShaderMaterial||a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshStandardMaterial||a.envMap){let t=V.map.cameraPosition;void 0!==t&&t.setValue(ed,eh.setFromMatrixPosition(e.matrixWorld))}(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&V.setValue(ed,"isOrthographic",!0===e.isOrthographicCamera),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial||a.isShadowMaterial||h.isSkinnedMesh)&&V.setValue(ed,"viewMatrix",e.matrixWorldInverse)}if(h.isSkinnedMesh){V.setOptional(ed,h,"bindMatrix"),V.setOptional(ed,h,"bindMatrixInverse");let e=h.skeleton;e&&(n.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),V.setValue(ed,"boneTexture",e.boneTexture,o),V.setValue(ed,"boneTextureSize",e.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let B=r.morphAttributes;if((void 0!==B.position||void 0!==B.normal||void 0!==B.color&&!0===n.isWebGL2)&&M.update(h,r,U),(I||L.receiveShadow!==h.receiveShadow)&&(L.receiveShadow=h.receiveShadow,V.setValue(ed,"receiveShadow",h.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(O.envMap.value=g,O.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1),I&&(V.setValue(ed,"toneMappingExposure",F.toneMappingExposure),L.needsLights&&(c=N,O.ambientLightColor.needsUpdate=c,O.lightProbe.needsUpdate=c,O.directionalLights.needsUpdate=c,O.directionalLightShadows.needsUpdate=c,O.pointLights.needsUpdate=c,O.pointLightShadows.needsUpdate=c,O.spotLights.needsUpdate=c,O.spotLightShadows.needsUpdate=c,O.rectAreaLights.needsUpdate=c,O.hemisphereLights.needsUpdate=c),d&&!0===a.fog&&f.refreshFogUniforms(O,d),f.refreshMaterialUniforms(O,a,$,Q,el),WebGLUniforms.upload(ed,L.uniformsList,O,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(WebGLUniforms.upload(ed,L.uniformsList,O,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&V.setValue(ed,"center",h.center),V.setValue(ed,"modelViewMatrix",h.modelViewMatrix),V.setValue(ed,"normalMatrix",h.normalMatrix),V.setValue(ed,"modelMatrix",h.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,r=e.length;t<r;
186t++)if(n.isWebGL2){let r=e[t];E.update(r,U),E.bind(r,U)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return U}(e,t,r,a,d);i.setMaterial(a,g);let y=r.index,T=1;!0===a.wireframe&&(y=c.getWireframeAttribute(r),T=2);let A=r.drawRange,C=r.attributes.position,L=A.start*T,P=(A.start+A.count)*T;null!==p&&(L=Math.max(L,p.start*T),P=Math.min(P,(p.start+p.count)*T)),null!==y?(L=Math.max(L,0),P=Math.min(P,y.count)):null!=C&&(L=Math.max(L,0),P=Math.min(P,C.count));let R=P-L;if(R<0||R===1/0)return;w.setup(d,a,x,r,y);let U=S;if(null!==y&&(m=h.get(y),(U=b).setIndex(m)),d.isMesh)!0===a.wireframe?(i.setLineWidth(a.wireframeLinewidth*getTargetPixelRatio()),U.setMode(1)):U.setMode(4);else if(d.isLine){let e=a.linewidth;void 0===e&&(e=1),i.setLineWidth(e*getTargetPixelRatio()),d.isLineSegments?U.setMode(1):d.isLineLoop?U.setMode(2):U.setMode(3)}else d.isPoints?U.setMode(0):d.isSprite&&U.setMode(4);if(d.isInstancedMesh)U.renderInstances(L,R,d.count);else if(r.isInstancedBufferGeometry){let e=void 0!==r._maxInstanceCount?r._maxInstanceCount:1/0,t=Math.min(r.instanceCount,e);U.renderInstances(L,R,t)}else U.render(L,R)},this.compile=function(e,t){function prepare(e,t,r){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,getProgram(e,t,r),e.side=0,e.needsUpdate=!0,getProgram(e,t,r),e.side=2):getProgram(e,t,r)}(z=g.get(e)).init(),G.push(z),e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),z.setupLights(F.useLegacyLights),e.traverse(function(t){let r=t.material;if(r){if(Array.isArray(r))for(let n=0;n<r.length;n++){let i=r[n];prepare(i,e,t)}else prepare(r,e,t)}}),G.pop(),z=null};let ef=null;function onXRSessionStart(){em.stop()}function onXRSessionEnd(){em.start()}let em=new WebGLAnimation;
186function renderScene(e,t,a,s){let l=e.opaque,u=e.transmissive,h=e.transparent;z.setupLightsView(a),!0===es&&_.setGlobalState(F.clippingPlanes,a),u.length>0&&function(e,t,i,a){if(null===el){let e=n.isWebGL2;el=new WebGLRenderTarget(1024,1024,{generateMipmaps:!0,type:r.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:e&&!0===U?4:0})}let s=F.getRenderTarget();F.setRenderTarget(el),F.clear();let l=F.toneMapping;F.toneMapping=0,renderObjects(e,i,a),o.updateMultisampleRenderTarget(el),o.updateRenderTargetMipmap(el);let u=!1;for(let e=0,r=t.length;e<r;e++){let r=t[e],n=r.object,s=r.geometry,o=r.material,l=r.group;if(2===o.side&&n.layers.test(a.layers)){let e=o.side;o.side=1,o.needsUpdate=!0,renderObject(n,i,a,s,o,l),o.side=e,o.needsUpdate=!0,u=!0}}!0===u&&(o.updateMultisampleRenderTarget(el),o.updateRenderTargetMipmap(el)),F.setRenderTarget(s),F.toneMapping=l}(l,u,t,a),s&&i.viewport(J.copy(s)),l.length>0&&renderObjects(l,t,a),u.length>0&&renderObjects(u,t,a),h.length>0&&renderObjects(h,t,a),i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),i.setPolygonOffset(!1)}function renderObjects(e,t,r){let n=!0===t.isScene?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],s=a.object,o=a.geometry,l=null===n?a.material:n,u=a.group;s.layers.test(r.layers)&&renderObject(s,t,r,o,l,u)}}function renderObject(e,t,r,n,i,a){e.onBeforeRender(F,t,r,n,i,a),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(F,t,r,n,e,a),!0===i.transparent&&2===i.side&&!1===i.forceSinglePass?(i.side=1,i.needsUpdate=!0,F.renderBufferDirect(r,t,n,i,e,a),i.side=0,i.needsUpdate=!0,F.renderBufferDirect(r,t,n,i,e,a),i.side=2):F.renderBufferDirect(r,t,n,i,e,a),e.onAfterRender(F,t,r,n,i,a)}function getProgram(e,t,r){!0!==t.isScene&&(t=ec);let n=s.get(e),i=z.state.lights,a=z.state.shadowsArray,o=i.state.version,h=p.getParameters(e,i.state,a,t,r),c=p.getProgramCacheKey(h),d=n.programs;n.environment=e.isMeshStandardMaterial?t.environment:null,n.fog=t.fog,n.envMap=(e.isMeshStandardMaterial?u:l).get(e.envMap||n.environment),void 0===d&&(e.addEventListener("dispose",onMaterialDispose),d=new Map,n.programs=d);let f=d.get(c);if(void 0!==f){if(n.currentProgram===f&&n.lightsStateVersion===o)return updateCommonMaterialProperties(e,h),f}else h.uniforms=p.getUniforms(e),e.onBuild(r,h,F),e.onBeforeCompile(h,F),f=p.acquireProgram(h,c),d.set(c,f),n.uniforms=h.uniforms;let m=n.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(m.clippingPlanes=_.uniform),updateCommonMaterialProperties(e,h),n.needsLights=e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights,n.lightsStateVersion=o,n.needsLights&&(m.ambientLightColor.value=i.state.ambient,m.lightProbe.value=i.state.probe,m.directionalLights.value=i.state.directional,m.directionalLightShadows.value=i.state.directionalShadow,m.spotLights.value=i.state.spot,m.spotLightShadows.value=i.state.spotShadow,m.rectAreaLights.value=i.state.rectArea,m.ltc_1.value=i.state.rectAreaLTC1,m.ltc_2.value=i.state.rectAreaLTC2,m.pointLights.value=i.state.point,m.pointLightShadows.value=i.state.pointShadow,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotLightMatrix.value=i.state.spotLightMatrix,m.spotLightMap.value=i.state.spotLightMap,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix);let g=f.getUniforms(),x=WebGLUniforms.seqWithValue(g.seq,m);return n.currentProgram=f,n.uniformsList=x,f}function updateCommonMaterialProperties(e,t){let r=s.get(e);r.outputEncoding=t.outputEncoding,r.instancing=t.instancing,r.skinning=t.skinning,r.morphTargets=t.morphTargets,r.morphNormals=t.morphNormals,r.morphColors=t.morphColors,r.morphTargetsCount=t.morphTargetsCount,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas,r.vertexTangents=t.vertexTangents,r.toneMapping=t.toneMapping}em.setAnimationLoop(function(e){ef&&ef(e)}),"undefined"!=typeof self&&em.setContext(self),this.setAnimationLoop=function(e){ef=e,ep.setAnimationLoop(e),null===e?em.stop():em.start()},ep.addEventListener("sessionstart",onXRSessionStart),ep.addEventListener("sessionend",onXRSessionEnd),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===k)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ep.enabled&&!0===ep.isPresenting&&(!0===ep.cameraAutoUpdate&&ep.updateCamera(t),t=ep.getCamera()),!0===e.isScene&&e.onBeforeRender(F,e,t,j),(z=g.get(e,G.length)).init(),G.push(z),eu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ea.setFromProjectionMatrix(eu),eo=this.localClippingEnabled,es=_.init(this.clippingPlanes,eo),(O=m.get(e,B.length)).init(),B.push(O),function projectObject(e,t,r,n){if(!1===e.visible)return;let i=e.layers.test(t.layers);if(i){if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)z.pushLight(e),e.castShadow&&z.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ea.intersectsSprite(e)){n&&eh.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eu);let t=d.update(e),i=e.material;i.visible&&O.push(e,t,i,r,eh.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==a.render.frame&&(e.skeleton.update(),e.skeleton.frame=a.render.frame),!e.frustumCulled||ea.intersectsObject(e))){n&&eh.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eu);let t=d.update(e),i=e.material;if(Array.isArray(i)){let n=t.groups;for(let a=0,s=n.length;a<s;a++){let s=n[a],o=i[s.materialIndex];o&&o.visible&&O.push(e,t,o,r,eh.z,s)}}else i.visible&&O.push(e,t,i,r,eh.z,null)}}let s=e.children;for(let e=0,i=s.length;e<i;e++)projectObject(s[e],t,r,n)}(e,t,0,F.sortObjects),O.finish(),!0===F.sortObjects&&O.sort(ee,et),!0===es&&_.beginShadows();let r=z.state.shadowsArray;if(x.render(r,e,t),!0===es&&_.endShadows(),!0===this.info.autoReset&&this.info.reset(),y.render(O,e),z.setupLights(F.useLegacyLights),t.isArrayCamera){let r=t.cameras;for(let t=0,n=r.length;t<n;t++){let n=r[t];
186renderScene(O,e,n,n.viewport)}}else renderScene(O,e,t);null!==j&&(o.updateMultisampleRenderTarget(j),o.updateRenderTargetMipmap(j)),!0===e.isScene&&e.onAfterRender(F,e,t),w.resetDefaultState(),q=-1,X=null,G.pop(),z=G.length>0?G[G.length-1]:null,B.pop(),O=B.length>0?B[B.length-1]:null},this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return H},this.getRenderTarget=function(){return j},this.setRenderTargetTextures=function(e,t,n){s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=n;let i=s.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0!==r.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let r=s.get(e);r.__webglFramebuffer=t,r.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,r=0){j=e,W=t,H=r;let a=!0,l=null,u=!1,h=!1;if(e){let r=s.get(e);void 0!==r.__useDefaultFramebuffer?(i.bindFramebuffer(36160,null),a=!1):void 0===r.__webglFramebuffer?o.setupRenderTarget(e):r.__hasExternalTextures&&o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(h=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(l=d[t],u=!0):l=n.isWebGL2&&e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:d,J.copy(e.viewport),Y.copy(e.scissor),Z=e.scissorTest}else J.copy(er).multiplyScalar($).floor(),Y.copy(en).multiplyScalar($).floor(),Z=ei;let c=i.bindFramebuffer(36160,l);if(c&&n.drawBuffers&&a&&i.drawBuffers(e,l),i.viewport(J),i.scissor(Y),i.setScissorTest(Z),u){let n=s.get(e.texture);ed.framebufferTexture2D(36160,36064,34069+t,n.__webglTexture,r)}else if(h){let n=s.get(e.texture),i=t||0;ed.framebufferTextureLayer(36160,36064,n.__webglTexture,r||0,i)}q=-1},this.readRenderTargetPixels=function(e,t,a,o,l,u,h){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let c=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(c=c[h]),c){i.bindFramebuffer(36160,c);try{let i=e.texture,s=i.format,h=i.type;if(1023!==s&&T.convert(s)!==ed.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let c=1016===h&&(r.has("EXT_color_buffer_half_float")||n.isWebGL2&&r.has("EXT_color_buffer_float"));if(1009!==h&&T.convert(h)!==ed.getParameter(35738)&&!(1015===h&&(n.isWebGL2||r.has("OES_texture_float")||r.has("WEBGL_color_buffer_float")))&&!c){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-o&&a>=0&&a<=e.height-l&&ed.readPixels(t,a,o,l,T.convert(s),T.convert(h),u)}finally{let e=null!==j?s.get(j).__webglFramebuffer:null;i.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,r=0){let n=Math.pow(2,-r),a=Math.floor(t.image.width*n),s=Math.floor(t.image.height*n);o.setTexture2D(t,0),ed.copyTexSubImage2D(3553,r,0,0,e.x,e.y,a,s),i.unbindTexture()},this.copyTextureToTexture=function(e,t,r,n=0){let a=t.image.width,s=t.image.height,l=T.convert(r.format),u=T.convert(r.type);o.setTexture2D(r,0),ed.pixelStorei(37440,r.flipY),ed.pixelStorei(37441,r.premultiplyAlpha),ed.pixelStorei(3317,r.unpackAlignment),t.isDataTexture?ed.texSubImage2D(3553,n,e.x,e.y,a,s,l,u,t.image.data):t.isCompressedTexture?ed.compressedTexSubImage2D(3553,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,l,t.mipmaps[0].data):ed.texSubImage2D(3553,n,e.x,e.y,l,u,t.image),0===n&&r.generateMipmaps&&ed.generateMipmap(3553),i.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r,n,a=0){let s;if(F.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let l=e.max.x-e.min.x+1,u=e.max.y-e.min.y+1,h=e.max.z-e.min.z+1,c=T.convert(n.format),d=T.convert(n.type);if(n.isData3DTexture)o.setTexture3D(n,0),s=32879;else if(n.isDataArrayTexture)o.setTexture2DArray(n,0),s=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ed.pixelStorei(37440,n.flipY),ed.pixelStorei(37441,n.premultiplyAlpha),ed.pixelStorei(3317,n.unpackAlignment);let p=ed.getParameter(3314),f=ed.getParameter(32878),m=ed.getParameter(3316),g=ed.getParameter(3315),_=ed.getParameter(32877),x=r.isCompressedTexture?r.mipmaps[0]:r.image;ed.pixelStorei(3314,x.width),ed.pixelStorei(32878,x.height),ed.pixelStorei(3316,e.min.x),ed.pixelStorei(3315,e.min.y),ed.pixelStorei(32877,e.min.z),r.isDataTexture||r.isData3DTexture?ed.texSubImage3D(s,a,t.x,t.y,t.z,l,u,h,c,d,x.data):r.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ed.compressedTexSubImage3D(s,a,t.x,t.y,t.z,l,u,h,c,x.data)):ed.texSubImage3D(s,a,t.x,t.y,t.z,l,u,h,c,d,x),ed.pixelStorei(3314,p),ed.pixelStorei(32878,f),ed.pixelStorei(3316,m),ed.pixelStorei(3315,g),ed.pixelStorei(32877,_),0===a&&n.generateMipmaps&&ed.generateMipmap(s),i.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),i.unbindTexture()},this.resetState=function(){W=0,H=0,j=null,i.reset(),w.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}};(class extends WebGLRenderer{}).prototype.isWebGL1Renderer=!0;let Scene=class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"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()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}};let Curve=class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],r,n=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)t.push(i+=(r=this.getPoint(a/e)).distanceTo(n)),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r;let n=this.getLengths(),i=0,a=n.length;r=t||e*n[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=n[i=Math.floor(s+(o-s)/2)]-r)<0)s=i+1;else if(l>0)o=i-1;else{o=i;break}if(n[i=o]===r)return i/(a-1);let u=n[i],h=n[i+1],c=(i+(r-u)/(h-u))/(a-1);return c}getTangent(e,t){let r=e-1e-4,n=e+1e-4;r<0&&(r=0),n>1&&(n=1);let i=this.getPoint(r),a=this.getPoint(n),s=t||(i.isVector2?new Vector2:new Vector3);return s.copy(a).sub(i).normalize(),s}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}
186computeFrenetFrames(e,t){let r=new Vector3,n=[],i=[],a=[],s=new Vector3,o=new Matrix4;for(let t=0;t<=e;t++){let r=t/e;n[t]=this.getTangentAt(r,new Vector3)}i[0]=new Vector3,a[0]=new Vector3;let l=Number.MAX_VALUE,u=Math.abs(n[0].x),h=Math.abs(n[0].y),c=Math.abs(n[0].z);u<=l&&(l=u,r.set(1,0,0)),h<=l&&(l=h,r.set(0,1,0)),c<=l&&r.set(0,0,1),s.crossVectors(n[0],r).normalize(),i[0].crossVectors(n[0],s),a[0].crossVectors(n[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(n[t-1],n[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(clamp(n[t-1].dot(n[t]),-1,1));i[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(n[t],i[t])}if(!0===t){let t=Math.acos(clamp(i[0].dot(i[e]),-1,1));t/=e,n[0].dot(s.crossVectors(i[0],i[e]))>0&&(t=-t);for(let r=1;r<=e;r++)i[r].applyMatrix4(o.makeRotationAxis(n[r],t*r)),a[r].crossVectors(n[r],i[r])}return{tangents:n,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};let EllipseCurve=class EllipseCurve extends Curve{constructor(e=0,t=0,r=1,n=1,i=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t){let r=t||new Vector2,n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=n;for(;i>n;)i-=n;i<Number.EPSILON&&(i=a?0:n),!0!==this.aClockwise||a||(i===n?i=-n:i-=n);let s=this.aStartAngle+e*i,o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),r=o-this.aX,n=l-this.aY;o=r*e-n*t+this.aX,l=r*t+n*e+this.aY}return r.set(o,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(){let 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}};function CubicPoly(){let e=0,t=0,r=0,n=0;function init(i,a,s,o){e=i,t=s,r=-3*i+3*a-2*s-o,n=2*i-2*a+s+o}return{initCatmullRom:function(e,t,r,n,i){init(t,r,i*(r-e),i*(n-t))},initNonuniformCatmullRom:function(e,t,r,n,i,a,s){let o=(t-e)/i-(r-e)/(i+a)+(r-t)/a,l=(r-t)/a-(n-t)/(a+s)+(n-r)/s;init(t,r,o*=a,l*=a)},calc:function(i){let a=i*i;return e+t*i+r*a+n*(a*i)}}}let tw=new Vector3,tE=new CubicPoly,tA=new CubicPoly,tC=new CubicPoly;function CatmullRom(e,t,r,n,i){let a=(n-t)*.5,s=(i-r)*.5,o=e*e;return(2*r-2*n+a+s)*(e*o)+(-3*r+3*n-2*a-s)*o+a*e+r}function QuadraticBezier(e,t,r,n){return function(e,t){let r=1-e;return r*r*t}(e,t)+2*(1-e)*e*r+e*e*n}function CubicBezier(e,t,r,n,i){return function(e,t){let r=1-e;return r*r*r*t}(e,t)+function(e,t){let r=1-e;return 3*r*r*e*t}(e,r)+3*(1-e)*e*e*n+e*e*e*i}let CubicBezierCurve=class CubicBezierCurve extends Curve{constructor(e=new Vector2,t=new Vector2,r=new Vector2,n=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new Vector2){let r=this.v0,n=this.v1,i=this.v2,a=this.v3;
186return t.set(CubicBezier(e,r.x,n.x,i.x,a.x),CubicBezier(e,r.y,n.y,i.y,a.y)),t}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(){let 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}};let LineCurve=class LineCurve extends Curve{constructor(e=new Vector2,t=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Vector2){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Vector2){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};let QuadraticBezierCurve=class QuadraticBezierCurve extends Curve{constructor(e=new Vector2,t=new Vector2,r=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new Vector2){let r=this.v0,n=this.v1,i=this.v2;return t.set(QuadraticBezier(e,r.x,n.x,i.x),QuadraticBezier(e,r.y,n.y,i.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};let QuadraticBezierCurve3=class QuadraticBezierCurve3 extends Curve{constructor(e=new Vector3,t=new Vector3,r=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new Vector3){let r=this.v0,n=this.v1,i=this.v2;return t.set(QuadraticBezier(e,r.x,n.x,i.x),QuadraticBezier(e,r.y,n.y,i.y),QuadraticBezier(e,r.z,n.z,i.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}};let SplineCurve=class SplineCurve extends Curve{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Vector2){let r=this.points,n=(r.length-1)*e,i=Math.floor(n),a=n-i,s=r[0===i?i:i-1],o=r[i],l=r[i>r.length-2?r.length-1:i+1],u=r[i>r.length-3?r.length-1:i+2];return t.set(CatmullRom(a,s.x,o.x,l.x,u.x),CatmullRom(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(new Vector2().fromArray(r))}return this}};var tL=Object.freeze({__proto__:null,ArcCurve:class extends EllipseCurve{constructor(e,t,r,n,i,a){super(e,t,r,r,n,i,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Curve{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new Vector3){let r,n;let i=this.points,a=i.length,s=(a-(this.closed?0:1))*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?r=i[(o-1)%a]:(tw.subVectors(i[0],i[1]).add(i[0]),r=tw);let u=i[o%a],h=i[(o+1)%a];if(this.closed||o+2<a?n=i[(o+2)%a]:(tw.subVectors(i[a-1],i[a-2]).add(i[a-1]),n=tw),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(r.distanceToSquared(u),e),i=Math.pow(u.distanceToSquared(h),e),a=Math.pow(h.distanceToSquared(n),e);i<1e-4&&(i=1),t<1e-4&&(t=i),a<1e-4&&(a=i),tE.initNonuniformCatmullRom(r.x,u.x,h.x,n.x,t,i,a),tA.initNonuniformCatmullRom(r.y,u.y,h.y,n.y,t,i,a),tC.initNonuniformCatmullRom(r.z,u.z,h.z,n.z,t,i,a)}else"catmullrom"===this.curveType&&(tE.initCatmullRom(r.x,u.x,h.x,n.x,this.tension),tA.initCatmullRom(r.y,u.y,h.y,n.y,this.tension),tC.initCatmullRom(r.z,u.z,h.z,n.z,this.tension));return t.set(tE.calc(l),tA.calc(l),tC.calc(l)),t}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let r=this.points[t];e.points.push(r.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,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(new Vector3().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:class extends Curve{constructor(e=new Vector3,t=new Vector3,r=new Vector3,
186n=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new Vector3){let r=this.v0,n=this.v1,i=this.v2,a=this.v3;return t.set(CubicBezier(e,r.x,n.x,i.x,a.x),CubicBezier(e,r.y,n.y,i.y,a.y),CubicBezier(e,r.z,n.z,i.z,a.z)),t}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(){let 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}},EllipseCurve:EllipseCurve,LineCurve:LineCurve,LineCurve3:class extends Curve{constructor(e=new Vector3,t=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Vector3){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Vector3){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,SplineCurve:SplineCurve});let CurvePath=class CurvePath extends Curve{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new LineCurve(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),i=0;for(;i<n.length;){if(n[i]>=r){let e=n[i]-r,a=this.curves[i],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}i++}return null}getLength(){let 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;let e=[],t=0;for(let r=0,n=this.curves.length;r<n;r++)e.push(t+=this.curves[r].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t;let r=[];for(let n=0,i=this.curves;n<i.length;n++){let a=i[n],s=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isS
186plineCurve?e*a.points.length:e,o=a.getPoints(s);for(let e=0;e<o.length;e++){let n=o[e];t&&t.equals(n)||(r.push(n),t=n)}}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let r=e.curves[t];this.curves.push(new tL[r.type]().fromJSON(r))}return this}};let Path=class Path extends CurvePath{constructor(e){super(),this.type="Path",this.currentPoint=new Vector2,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new LineCurve(this.currentPoint.clone(),new Vector2(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let i=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(r,n));return this.curves.push(i),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,i,a){let s=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(r,n),new Vector2(i,a));return this.curves.push(s),this.currentPoint.set(i,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new SplineCurve(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,i,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,r,n,i,a),this}absarc(e,t,r,n,i,a){return this.absellipse(e,t,r,r,n,i,a),this}ellipse(e,t,r,n,i,a,s,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,r,n,i,a,s,o),this}absellipse(e,t,r,n,i,a,s,o){let l=new EllipseCurve(e,t,r,n,i,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};let LatheGeometry=class LatheGeometry extends BufferGeometry{constructor(e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],t=12,r=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=clamp(n,0,2*Math.PI);let i=[],a=[],s=[],o=[],l=[],u=1/t,h=new Vector3,c=new Vector2,d=new Vector3,p=new Vector3,f=new Vector3,m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let i=0;i<=t;i++){let d=r+i*u*n,p=Math.sin(d),f=Math.cos(d);for(let r=0;r<=e.length-1;r++){h.x=e[r].x*p,h.y=e[r].y,h.z=e[r].x*f,a.push(h.x,h.y,h.z),c.x=i/t,c.y=r/(e.length-1),s.push(c.x,c.y);let n=o[3*r+0]*p,u=o[3*r+1],d=o[3*r+0]*f;l.push(n,u,d)}}for(let r=0;r<t;r++)for(let t=0;t<e.length-1;t++){let n=t+r*e.length,a=n+e.length,s=n+e.length+1,o=n+1;i.push(n,a,o),i.push(s,o,a)}this.setIndex(i),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("uv",new Float32BufferAttribute(s,2)),this.setAttribute("normal",new Float32BufferAttribute(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new LatheGeometry(e.points,e.segments,e.phiStart,e.phiLength)}};let CapsuleGeometry=class CapsuleGeometry extends LatheGeometry{constructor(e=1,t=1,r=4,n=8){let i=new Path;i.absarc(0,-t/2,e,1.5*Math.PI,0),i.absarc(0,t/2,e,0,.5*Math.PI),super(i.getPoints(r),n),this.type="CapsuleGeometry",this.parameters={radiu
186s:e,height:t,capSegments:r,radialSegments:n}}static fromJSON(e){return new CapsuleGeometry(e.radius,e.length,e.capSegments,e.radialSegments)}};let CircleGeometry=class CircleGeometry extends BufferGeometry{constructor(e=1,t=32,r=0,n=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},t=Math.max(3,t);let i=[],a=[],s=[],o=[],l=new Vector3,u=new Vector2;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let i=0,h=3;i<=t;i++,h+=3){let c=r+i/t*n;l.x=e*Math.cos(c),l.y=e*Math.sin(c),a.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(a[h]/e+1)/2,u.y=(a[h+1]/e+1)/2,o.push(u.x,u.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("normal",new Float32BufferAttribute(s,3)),this.setAttribute("uv",new Float32BufferAttribute(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CircleGeometry(e.radius,e.segments,e.thetaStart,e.thetaLength)}};let CylinderGeometry=class CylinderGeometry extends BufferGeometry{constructor(e=1,t=1,r=1,n=32,i=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:s,thetaLength:o};let l=this;n=Math.floor(n),i=Math.floor(i);let u=[],h=[],c=[],d=[],p=0,f=[],m=r/2,g=0;function generateCap(r){let i=p,a=new Vector2,f=new Vector3,_=0,x=!0===r?e:t,y=!0===r?1:-1;for(let e=1;e<=n;e++)h.push(0,m*y,0),c.push(0,y,0),d.push(.5,.5),p++;let M=p;for(let e=0;e<=n;e++){let t=e/n,r=t*o+s,i=Math.cos(r),l=Math.sin(r);f.x=x*l,f.y=m*y,f.z=x*i,h.push(f.x,f.y,f.z),c.push(0,y,0),a.x=.5*i+.5,a.y=.5*l*y+.5,d.push(a.x,a.y),p++}for(let e=0;e<n;e++){let t=i+e,n=M+e;!0===r?u.push(n,n+1,t):u.push(n+1,n,t),_+=3}l.addGroup(g,_,!0===r?1:2),g+=_}(function(){let a=new Vector3,_=new Vector3,x=0,y=(t-e)/r;for(let l=0;l<=i;l++){let u=[],g=l/i,x=g*(t-e)+e;for(let e=0;e<=n;e++){let t=e/n,i=t*o+s,l=Math.sin(i),f=Math.cos(i);_.x=x*l,_.y=-g*r+m,_.z=x*f,h.push(_.x,_.y,_.z),a.set(l,y,f).normalize(),c.push(a.x,a.y,a.z),d.push(t,1-g),u.push(p++)}f.push(u)}for(let e=0;e<n;e++)for(let t=0;t<i;t++){let r=f[t][e],n=f[t+1][e],i=f[t+1][e+1],a=f[t][e+1];u.push(r,n,a),u.push(n,i,a),x+=6}l.addGroup(g,x,0),g+=x})(),!1===a&&(e>0&&generateCap(!0),t>0&&generateCap(!1)),this.setIndex(u),this.setAttribute("position",new Float32BufferAttribute(h,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};let ConeGeometry=class ConeGeometry extends CylinderGeometry{constructor(e=1,t=1,r=32,n=1,i=!1,a=0,s=2*Math.PI){super(0,e,t,r,n,i,a,s),this.type="C
186oneGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:s}}static fromJSON(e){return new ConeGeometry(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};let PolyhedronGeometry=class PolyhedronGeometry extends BufferGeometry{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let i=[],a=[];function pushVertex(e){i.push(e.x,e.y,e.z)}function getVertexByIndex(t,r){let n=3*t;r.x=e[n+0],r.y=e[n+1],r.z=e[n+2]}function correctUV(e,t,r,n){n<0&&1===e.x&&(a[t]=e.x-1),0===r.x&&0===r.z&&(a[t]=n/2/Math.PI+.5)}function azimuth(e){return Math.atan2(e.z,-e.x)}(function(e){let r=new Vector3,n=new Vector3,i=new Vector3;for(let a=0;a<t.length;a+=3)getVertexByIndex(t[a+0],r),getVertexByIndex(t[a+1],n),getVertexByIndex(t[a+2],i),function(e,t,r,n){let i=n+1,a=[];for(let n=0;n<=i;n++){a[n]=[];let s=e.clone().lerp(r,n/i),o=t.clone().lerp(r,n/i),l=i-n;for(let e=0;e<=l;e++)0===e&&n===i?a[n][e]=s:a[n][e]=s.clone().lerp(o,e/l)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){let r=Math.floor(t/2);t%2==0?(pushVertex(a[e][r+1]),pushVertex(a[e+1][r]),pushVertex(a[e][r])):(pushVertex(a[e][r+1]),pushVertex(a[e+1][r+1]),pushVertex(a[e+1][r]))}}(r,n,i,e)})(n),function(e){let t=new Vector3;for(let r=0;r<i.length;r+=3)t.x=i[r+0],t.y=i[r+1],t.z=i[r+2],t.normalize().multiplyScalar(e),i[r+0]=t.x,i[r+1]=t.y,i[r+2]=t.z}(r),function(){let e=new Vector3;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];let r=azimuth(e)/2/Math.PI+.5,n=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;a.push(r,1-n)}(function(){let e=new Vector3,t=new Vector3,r=new Vector3,n=new Vector3,s=new Vector2,o=new Vector2,l=new Vector2;for(let u=0,h=0;u<i.length;u+=9,h+=6){e.set(i[u+0],i[u+1],i[u+2]),t.set(i[u+3],i[u+4],i[u+5]),r.set(i[u+6],i[u+7],i[u+8]),s.set(a[h+0],a[h+1]),o.set(a[h+2],a[h+3]),l.set(a[h+4],a[h+5]),n.copy(e).add(t).add(r).divideScalar(3);let c=azimuth(n);correctUV(s,h+0,e,c),correctUV(o,h+2,t,c),correctUV(l,h+4,r,c)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],r=a[e+2],n=a[e+4],i=Math.max(t,r,n),s=Math.min(t,r,n);i>.9&&s<.1&&(t<.2&&(a[e+0]+=1),r<.2&&(a[e+2]+=1),n<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Float32BufferAttribute(i,3)),this.setAttribute("normal",new Float32BufferAttribute(i.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(a,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PolyhedronGeometry(e.vertices,e.indices,e.radius,e.details)}};let DodecahedronGeometry=class DodecahedronGeometry extends PolyhedronGeometry{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n];super(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,
18619,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}}static fromJSON(e){return new DodecahedronGeometry(e.radius,e.detail)}};let Shape=class Shape extends Path{constructor(e){super(e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].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,r=e.holes.length;t<r;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let r=e.holes[t];this.holes.push(new Path().fromJSON(r))}return this}};let tP={triangulate:function(e,t,r=2){let n,i,a,s,o,l,u;let h=t&&t.length,c=h?t[0]*r:e.length,d=linkedList(e,0,c,r,!0),p=[];if(!d||d.next===d.prev)return p;if(h&&(d=function(e,t,r,n){let i,a,s,o,l;let u=[];for(i=0,a=t.length;i<a;i++)s=t[i]*n,o=i<a-1?t[i+1]*n:e.length,(l=linkedList(e,s,o,n,!1))===l.next&&(l.steiner=!0),u.push(function(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}(l));for(u.sort(compareX),i=0;i<u.length;i++)r=function(e,t){let r=function(e,t){let r=t,n=-1/0,i,a=e.x,s=e.y;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let e=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y
186);if(e<=a&&e>n&&(n=e,i=r.x<r.next.x?r:r.next,e===a))return i}r=r.next}while(r!==t);if(!i)return null;let o=i,l=i.x,u=i.y,h=1/0,c;r=i;do{var d,p;a>=r.x&&r.x>=l&&a!==r.x&&pointInTriangle(s<u?a:n,s,l,u,s<u?n:a,s,r.x,r.y)&&(c=Math.abs(s-r.y)/(a-r.x),locallyInside(r,e)&&(c<h||c===h&&(r.x>i.x||r.x===i.x&&(d=i,p=r,0>area(d.prev,d,p.prev)&&0>area(p.next,d,d.next))))&&(i=r,h=c)),r=r.next}while(r!==o);return i}(e,t);if(!r)return t;let n=splitPolygon(r,e);return filterPoints(n,n.next),filterPoints(r,r.next)}(u[i],r);return r}(e,t,d,r)),e.length>80*r){n=a=e[0],i=s=e[1];for(let t=r;t<c;t+=r)o=e[t],l=e[t+1],o<n&&(n=o),l<i&&(i=l),o>a&&(a=o),l>s&&(s=l);u=0!==(u=Math.max(a-n,s-i))?32767/u:0}return function earcutLinked(e,t,r,n,i,a,s){if(!e)return;!s&&a&&function(e,t,r,n){let i=e;do 0===i.z&&(i.z=zOrder(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,r,n,i,a,s,o,l,u=1;do{for(r=e,e=null,a=null,s=0;r;){for(s++,n=r,o=0,t=0;t<u&&(o++,n=n.nextZ);t++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(s>1)}(i)}(e,n,i,a);let o=e,l,u;for(;e.prev!==e.next;){if(l=e.prev,u=e.next,a?function(e,t,r,n){let i=e.prev,a=e.next;if(area(i,e,a)>=0)return!1;let s=i.x,o=e.x,l=a.x,u=i.y,h=e.y,c=a.y,d=s<o?s<l?s:l:o<l?o:l,p=u<h?u<c?u:c:h<c?h:c,f=s>o?s>l?s:l:o>l?o:l,m=u>h?u>c?u:c:h>c?h:c,g=zOrder(d,p,t,r,n),_=zOrder(f,m,t,r,n),x=e.prevZ,y=e.nextZ;for(;x&&x.z>=g&&y&&y.z<=_;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==i&&x!==a&&pointInTriangle(s,u,o,h,l,c,x.x,x.y)&&area(x.prev,x,x.next)>=0||(x=x.prevZ,y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&pointInTriangle(s,u,o,h,l,c,y.x,y.y)&&area(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;x&&x.z>=g;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==i&&x!==a&&pointInTriangle(s,u,o,h,l,c,x.x,x.y)&&area(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=_;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&pointInTriangle(s,u,o,h,l,c,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}(e,n,i,a):function(e){let t=e.prev,r=e.next;if(area(t,e,r)>=0)return!1;let n=t.x,i=e.x,a=r.x,s=t.y,o=e.y,l=r.y,u=n<i?n<a?n:a:i<a?i:a,h=s<o?s<l?s:l:o<l?o:l,c=n>i?n>a?n:a:i>a?i:a,d=s>o?s>l?s:l:o>l?o:l,p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=c&&p.y>=h&&p.y<=d&&pointInTriangle(n,s,i,o,a,l,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),removeNode(e),e=u.next,o=u.next;continue}if((e=u)===o){s?1===s?earcutLinked(e=function(e,t,r){let n=e;do{let i=n.prev,a=n.next.next;!equals(i,a)&&intersects(i,n,n.next,a)&&locallyInside(i,a)&&locallyInside(a,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(a.i/r|0),removeNode(n),removeNode(n.next),n=e=a),n=n.next}while(n!==e);return filterPoints(n)}(filterPoints(e),t,r),t,r,n,i,a,2):2===s&&function(e,t,r,n,i,a){let s=e;do{let e=s.next.next;for(;e!==s.prev;){var o,l;if(s.i!==e.i&&(o=s,l=e,o.next.i!==l.i&&o.prev.i!==l.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&intersects(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(o,l)&&(locallyInside(o,l)&&locallyInside(l,o)&&function(e,t){let r=e,n=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do r.y>a!=r.next.y>
186a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}(o,l)&&(area(o.prev,o,l.prev)||area(o,l.prev,l))||equals(o,l)&&area(o.prev,o,o.next)>0&&area(l.prev,l,l.next)>0))){let o=splitPolygon(s,e);s=filterPoints(s,s.next),o=filterPoints(o,o.next),earcutLinked(s,t,r,n,i,a,0),earcutLinked(o,t,r,n,i,a,0);return}e=e.next}s=s.next}while(s!==e)}(e,t,r,n,i,a):earcutLinked(filterPoints(e),t,r,n,i,a,1);break}}}(d,p,r,n,i,u,0),p}};function linkedList(e,t,r,n,i){let a,s;if(i===function(e,t,r,n){let i=0;for(let a=t,s=r-n;a<r;a+=n)i+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return i}(e,t,r,n)>0)for(a=t;a<r;a+=n)s=insertNode(a,e[a],e[a+1],s);else for(a=r-n;a>=t;a-=n)s=insertNode(a,e[a],e[a+1],s);return s&&equals(s,s.next)&&(removeNode(s),s=s.next),s}function filterPoints(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(equals(r,r.next)||0===area(r.prev,r,r.next))){if(removeNode(r),(r=t=r.prev)===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function compareX(e,t){return e.x-t.x}function zOrder(e,t,r,n,i){return(e=((e=((e=((e=((e=(e-r)*i|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-n)*i|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function pointInTriangle(e,t,r,n,i,a,s,o){return(i-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(n-o)>=(r-s)*(t-o)&&(r-s)*(a-o)>=(i-s)*(n-o)}function area(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function equals(e,t){return e.x===t.x&&e.y===t.y}function intersects(e,t,r,n){let i=sign(area(e,t,r)),a=sign(area(e,t,n)),s=sign(area(r,n,e)),o=sign(area(r,n,t));return!!(i!==a&&s!==o||0===i&&onSegment(e,r,t)||0===a&&onSegment(e,n,t)||0===s&&onSegment(r,e,n)||0===o&&onSegment(r,t,n))}function onSegment(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function sign(e){return e>0?1:e<0?-1:0}function locallyInside(e,t){return 0>area(e.prev,e,e.next)?area(e,t,e.next)>=0&&area(e,e.prev,t)>=0:0>area(e,t,e.prev)||0>area(e,e.next,t)}function splitPolygon(e,t){let r=new Node(e.i,e.x,e.y),n=new Node(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function insertNode(e,t,r,n){let i=new Node(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function removeNode(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 Node(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}let ShapeUtils=class ShapeUtils{static area(e){let t=e.length,r=0;for(let n=t-1,i=0;i<t;n=i++)r+=e[n].x*e[i].y-e[i].x*e[n].y;return .5*r}static isClockWise(e){return 0>ShapeUtils.area(e)}static triangulateShape(e,t){let r=[],n=[],i=[];removeDupEndPts(e),addContour(r,e);let a=e.length;t.forEach(removeDupEndPts);for(let e=0;e<t.length;e++)n.push(a),a+=t[e].length,addContour(r,t[e]);let s=tP.triangulate(r,n);for(let e=0;e<s.length;e+=3)i.push(s.slice(e,e+3));return i}};function removeDupEndPts(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function addContour(e,t){for(let r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}let ExtrudeGeometry=class ExtrudeGeometry extends BufferGeometry{constructor(e=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],i=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];!function(e){let a,s,o,l;let u=[],h=void 0!==t.curveSegments?t.curveSegments:12,c=void 0!==t.steps?t.steps:1,d=void 0!==t.depth?t.depth:1,p=void 0===t.bevelEnabled||t.bevelEnabled,f=void 0!==t.bevelThickness?t.bevelThickness:.2,m=void 0!==t.bevelSize?t.bevelSize:f-.1,g=void 0!==t.bevelOffset?t.bevelOffset:0,_=void 0!==t.bevelSegments?t.bevelSegments:3,x=t.extrudePath,y=void 0!==t.UVGenerator?t.UVGenerator:tR,M,S=!1;x&&(M=x.getSpacedPoints(c),S=!0,p=!1,a=x.computeFrenetFrames(c,!1),s=new Vector3,o=new Vector3,l=new Vector3),p||(_=0,f=0,m=0,g=0);let b=e.extractPoints(h),T=b.shape,w=b.holes,E=!ShapeUtils.isClockWise(T);
186if(E){T=T.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];ShapeUtils.isClockWise(t)&&(w[e]=t.reverse())}}let A=ShapeUtils.triangulateShape(T,w),C=T;for(let e=0,t=w.length;e<t;e++){let t=w[e];T=T.concat(t)}function scalePt2(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,r)}let L=T.length,P=A.length;function getBevelVec(e,t,r){let n,i,a;let s=e.x-t.x,o=e.y-t.y,l=r.x-e.x,u=r.y-e.y,h=s*s+o*o,c=s*u-o*l;if(Math.abs(c)>Number.EPSILON){let c=Math.sqrt(h),d=Math.sqrt(l*l+u*u),p=t.x-o/c,f=t.y+s/c,m=r.x-u/d,g=r.y+l/d,_=((m-p)*u-(g-f)*l)/(s*u-o*l);n=p+s*_-e.x,i=f+o*_-e.y;let x=n*n+i*i;if(x<=2)return new Vector2(n,i);a=Math.sqrt(x/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(n=-o,i=s,a=Math.sqrt(h)):(n=s,i=o,a=Math.sqrt(h/2))}return new Vector2(n/a,i/a)}let R=[];for(let e=0,t=C.length,r=t-1,n=e+1;e<t;e++,r++,n++)r===t&&(r=0),n===t&&(n=0),R[e]=getBevelVec(C[e],C[r],C[n]);let U=[],D,I=R.concat();for(let e=0,t=w.length;e<t;e++){let t=w[e];D=[];for(let e=0,r=t.length,n=r-1,i=e+1;e<r;e++,n++,i++)n===r&&(n=0),i===r&&(i=0),D[e]=getBevelVec(t[e],t[n],t[i]);U.push(D),I=I.concat(D)}for(let e=0;e<_;e++){let t=e/_,r=f*Math.cos(t*Math.PI/2),n=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=C.length;e<t;e++){let t=scalePt2(C[e],R[e],n);v(t.x,t.y,-r)}for(let e=0,t=w.length;e<t;e++){let t=w[e];D=U[e];for(let e=0,i=t.length;e<i;e++){let i=scalePt2(t[e],D[e],n);v(i.x,i.y,-r)}}}let N=m+g;for(let e=0;e<L;e++){let t=p?scalePt2(T[e],I[e],N):T[e];S?(o.copy(a.normals[0]).multiplyScalar(t.x),s.copy(a.binormals[0]).multiplyScalar(t.y),l.copy(M[0]).add(o).add(s),v(l.x,l.y,l.z)):v(t.x,t.y,0)}for(let e=1;e<=c;e++)for(let t=0;t<L;t++){let r=p?scalePt2(T[t],I[t],N):T[t];S?(o.copy(a.normals[e]).multiplyScalar(r.x),s.copy(a.binormals[e]).multiplyScalar(r.y),l.copy(M[e]).add(o).add(s),v(l.x,l.y,l.z)):v(r.x,r.y,d/c*e)}for(let e=_-1;e>=0;e--){let t=e/_,r=f*Math.cos(t*Math.PI/2),n=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=C.length;e<t;e++){let t=scalePt2(C[e],R[e],n);v(t.x,t.y,d+r)}for(let e=0,t=w.length;e<t;e++){let t=w[e];D=U[e];for(let e=0,i=t.length;e<i;e++){let i=scalePt2(t[e],D[e],n);S?v(i.x,i.y+M[c-1].y,M[c-1].x+r):v(i.x,i.y,d+r)}}}function sidewalls(e,t){let i=e.length;for(;--i>=0;){let a=i,s=i-1;s<0&&(s=e.length-1);for(let e=0,i=c+2*_;e<i;e++){let i=L*e,o=L*(e+1),l=t+a+i,u=t+s+i,h=t+s+o,c=t+a+o;!function(e,t,i,a){addVertex(e),addVertex(t),addVertex(a),addVertex(t),addVertex(i),addVertex(a);let s=n.length/3,o=y.generateSideWallUV(r,n,s-6,s-3,s-2,s-1);addUV(o[0]),addUV(o[1]),addUV(o[3]),addUV(o[1]),addUV(o[2]),addUV(o[3])}(l,u,h,c)}}}function v(e,t,r){u.push(e),u.push(t),u.push(r)}function f3(e,t,i){addVertex(e),addVertex(t),addVertex(i);let a=n.length/3,s=y.generateTopUV(r,n,a-3,a-2,a-1);addUV(s[0]),addUV(s[1]),addUV(s[2])}function addVertex(e){n.push(u[3*e+0]),n.push(u[3*e+1]),n.push(u[3*e+2])}function addUV(e){i.push(e.x),i.push(e.y)}(function(){let e=n.length/3;if(p){let e=0*L;for(let t=0;t<P;t++){let r=A[t];f3(r[2]+e,r[1]+e,r[0]+e)}e=L*(c+2*_);for(let t=0;t<P;t++){let r=A[t];f3(r[0]+e,r[1]+e,r[2]+e)}}else{for(let e=0;e<P;e++){let t=A[e];f3(t[2],t[1],t[0])}for(let e=0;e<P;e++){let t=A[e];f3(t[0]+L*c,t[1]+L*c,t[2]+L*c)}}r.addGroup(e,n.length/3-e,0)})(),function(){let e=n.length/3,t=0;sidewalls(C,0),t+=C.length;for(let e=0,r=w.length;e<r;e++){let r=w[e];sidewalls(r,t),t+=r.length}r.addGroup(e,n.length/3-e,1)}()}(s)}this.setAttribute("position",new Float32BufferAttribute(n,3)),this.setAttribute("uv",new Float32BufferAttribute(i,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return function(e,t,r){if(r.shapes=[],Array.isArray(e))for(let t=0,n=e.length;t<n;t++){let n=e[t];r.shapes.push(n.uuid)}else r.shapes.push(e.uuid);return r.options=Object.assign({},t),void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}(t,r,e)}static fromJSON(e,t){let r=[];for(let n=0,i=e.shapes.length;n<i;n++){let i=t[e.shapes[n]];r.push(i)}let n=e.options.extrudePath;return void 0!==n&&(e.options.extrudePath=new tL[n.type]().fromJSON(n)),new ExtrudeGeometry(r,e.options)}};let tR={generateTopUV:function(e,t,r,n,i){let a=t[3*r],s=t[3*r+1],o=t[3*n],l=t[3*n+1],u=t[3*i],h=t[3*i+1];return[new Vector2(a,s),new Vector2(o,l),new Vector2(u,h)]},generateSideWallUV:function(e,t,r,n,i,a){let s=t[3*r],o=t[3*r+1],l=t[3*r+2],u=t[3*n],h=t[3*n+1],c=t[3*n+2],d=t[3*i],p=t[3*i+1],f=t[3*i+2],m=t[3*a],g=t[3*a+1],_=t[3*a+2];return Math.abs(o-h)<Math.abs(s-u)?[new Vector2(s,1-l),new Vector2(u,1-c),new Vector2(d,1-f),new Vector2(m,1-_)]:[new Vector2(o,1-l),new Vector2(h,1-c),new Vector2(p,1-f),new Vector2(g,1-_)]}};let IcosahedronGeometry=class IcosahedronGeometry extends PolyhedronGeometry{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1];super(n,[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={radiu
186s:e,detail:t}}static fromJSON(e){return new IcosahedronGeometry(e.radius,e.detail)}};let OctahedronGeometry=class OctahedronGeometry extends PolyhedronGeometry{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}}static fromJSON(e){return new OctahedronGeometry(e.radius,e.detail)}};let RingGeometry=class RingGeometry extends BufferGeometry{constructor(e=.5,t=1,r=32,n=1,i=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},r=Math.max(3,r),n=Math.max(1,n);let s=[],o=[],l=[],u=[],h=e,c=(t-e)/n,d=new Vector3,p=new Vector2;for(let e=0;e<=n;e++){for(let e=0;e<=r;e++){let n=i+e/r*a;d.x=h*Math.cos(n),d.y=h*Math.sin(n),o.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,u.push(p.x,p.y)}h+=c}for(let e=0;e<n;e++){let t=e*(r+1);for(let e=0;e<r;e++){let n=e+t,i=n+r+1,a=n+r+2,o=n+1;s.push(n,i,o),s.push(i,a,o)}}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new RingGeometry(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}};let ShapeGeometry=class ShapeGeometry extends BufferGeometry{constructor(e=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],i=[],a=[],s=0,o=0;if(!1===Array.isArray(e))addShape(e);else for(let t=0;t<e.length;t++)addShape(e[t]),this.addGroup(s,o,t),s+=o,o=0;function addShape(e){let s=n.length/3,l=e.extractPoints(t),u=l.shape,h=l.holes;!1===ShapeUtils.isClockWise(u)&&(u=u.reverse());for(let e=0,t=h.length;e<t;e++){let t=h[e];!0===ShapeUtils.isClockWise(t)&&(h[e]=t.reverse())}let c=ShapeUtils.triangulateShape(u,h);for(let e=0,t=h.length;e<t;e++){let t=h[e];u=u.concat(t)}for(let e=0,t=u.length;e<t;e++){let t=u[e];n.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=c.length;e<t;e++){let t=c[e],n=t[0]+s,i=t[1]+s,a=t[2]+s;r.push(n,i,a),o+=3}}this.setIndex(r),this.setAttribute("position",new Float32BufferAttribute(n,3)),this.setAttribute("normal",new Float32BufferAttribute(i,3)),this.setAttribute("uv",new Float32BufferAttribute(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return function(e,t){if(t.shapes=[],Array.isArray(e))for(let r=0,n=e.length;r<n;r++){let n=e[r];t.shapes.push(n.uuid)}else t.shapes.push(e.uuid);return t}(t,e)}static fromJSON(e,t){let r=[];for(let n=0,i=e.shapes.length;n<i;n++){let i=t[e.shapes[n]];r.push(i)}return new ShapeGeometry(r,e.curveSegments)}};let SphereGeometry=class SphereGeometry extends BufferGeometry{constructor(e=1,t=32,r=16,n=0,i=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let o=Math.min(a+s,Math.PI),l=0,u=[],h=new Vector3,c=new Vector3,d=[],p=[],f=[],m=[];for(let d=0;d<=r;d++){let g=[],_=d/r,x=0;0===d&&0===a?x=.5/t:d===r&&o===Math.PI&&(x=-.5/t);for(let r=0;r<=t;r++){let o=r/t;h.x=-e*Math.cos(n+o*i)*Math.sin(a+_*s),h.y=e*Math.cos(a+_*s),h.z=e*Math.sin(n+o*i)*Math.sin(a+_*s),p.push(h.x,h.y,h.z),c.copy(h).normalize(),f.push(c.x,c.y,c.z),m.push(o+x,1-_),g.push(l++)}u.push(g)}for(let e=0;e<r;e++)for(let n=0;n<t;n++){let t=u[e][n+1],i=u[e][n],s=u[e+1][n],l=u[e+1][n+1];(0!==e||a>0)&&d.push(t,i,l),(e!==r-1||o<Math.PI)&&d.push(i,s,l)}this.setIndex(d),this.setAttribute("position",new Float32BufferAttribute(p,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new SphereGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};let TetrahedronGeometry=class TetrahedronGeometry extends PolyhedronGeometry{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={radiu
186s:e,detail:t}}static fromJSON(e){return new TetrahedronGeometry(e.radius,e.detail)}};let TorusGeometry=class TorusGeometry extends BufferGeometry{constructor(e=1,t=.4,r=12,n=48,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},r=Math.floor(r),n=Math.floor(n);let a=[],s=[],o=[],l=[],u=new Vector3,h=new Vector3,c=new Vector3;for(let a=0;a<=r;a++)for(let d=0;d<=n;d++){let p=d/n*i,f=a/r*Math.PI*2;h.x=(e+t*Math.cos(f))*Math.cos(p),h.y=(e+t*Math.cos(f))*Math.sin(p),h.z=t*Math.sin(f),s.push(h.x,h.y,h.z),u.x=e*Math.cos(p),u.y=e*Math.sin(p),c.subVectors(h,u).normalize(),o.push(c.x,c.y,c.z),l.push(d/n),l.push(a/r)}for(let e=1;e<=r;e++)for(let t=1;t<=n;t++){let r=(n+1)*e+t-1,i=(n+1)*(e-1)+t-1,s=(n+1)*(e-1)+t,o=(n+1)*e+t;a.push(r,i,o),a.push(i,s,o)}this.setIndex(a),this.setAttribute("position",new Float32BufferAttribute(s,3)),this.setAttribute("normal",new Float32BufferAttribute(o,3)),this.setAttribute("uv",new Float32BufferAttribute(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TorusGeometry(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}};let TorusKnotGeometry=class TorusKnotGeometry extends BufferGeometry{constructor(e=1,t=.4,r=64,n=8,i=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:a},r=Math.floor(r),n=Math.floor(n);let s=[],o=[],l=[],u=[],h=new Vector3,c=new Vector3,d=new Vector3,p=new Vector3,f=new Vector3,m=new Vector3,g=new Vector3;for(let s=0;s<=r;++s){let _=s/r*i*Math.PI*2;calculatePositionOnCurve(_,i,a,e,d),calculatePositionOnCurve(_+.01,i,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<=n;++e){let i=e/n*Math.PI*2,a=-t*Math.cos(i),p=t*Math.sin(i);h.x=d.x+(a*g.x+p*f.x),h.y=d.y+(a*g.y+p*f.y),h.z=d.z+(a*g.z+p*f.z),o.push(h.x,h.y,h.z),c.subVectors(h,d).normalize(),l.push(c.x,c.y,c.z),u.push(s/r),u.push(e/n)}}for(let e=1;e<=r;e++)for(let t=1;t<=n;t++){let r=(n+1)*(e-1)+(t-1),i=(n+1)*e+(t-1),a=(n+1)*e+t,o=(n+1)*(e-1)+t;s.push(r,i,o),s.push(i,a,o)}function calculatePositionOnCurve(e,t,r,n,i){let a=r/t*e,s=Math.cos(a);i.x=n*(2+s)*.5*Math.cos(e),i.y=n*(2+s)*Math.sin(e)*.5,i.z=n*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TorusKnotGeometry(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};let TubeGeometry=class TubeGeometry extends BufferGeometry{constructor(e=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),t=64,r=1,n=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let s=new Vector3,o=new Vector3,l=new Vector2,u=new Vector3,h=[],c=[],d=[],p=[];function generateSegment(i){u=e.getPointAt(i/t,u);let l=a.normals[i],d=a.binormals[i];for(let e=0;e<=n;e++){let t=e/n*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+i*d.x,o.y=a*l.y+i*d.y,o.z=a*l.z+i*d.z,o.normalize(),c.push(o.x,o.y,o.z),s.x=u.x+r*o.x,s.y=u.y+r*o.y,s.z=u.z+r*o.z,h.push(s.x,s.y,s.z)}}(function(){for(let e=0;e<t;e++)generateSegment(e);generateSegment(!1===i?t:0),function(){for(let e=0;e<=t;e++)for(let r=0;r<=n;r++)l.x=e/t,l.y=r/n,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=n;t++){let r=(n+1)*(e-1)+(t-1),i=(n+1)*e+(t-1),a=(n+1)*e+t,s=(n+1)*(e-1)+t;p.push(r,i,s),p.push(i,a,s)}}()})(),this.setIndex(p),this.setAttribute("position",new Float32BufferAttribute(h,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new TubeGeometry(new tL[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}};function arraySlice(e,t,r){return isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==r?r:e.length)):e.slice(t,r)}function convertArray(e,t,r){return e&&(r||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}
186let Interpolant=class Interpolant{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],i=t[r-1];e:{t:{let a;r:{n:if(!(e<n)){for(let a=r+2;;){if(void 0===n){if(e<i)break n;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(i=n,e<(n=t[++r]))break t}a=t.length;break r}if(!(e>=i)){let s=t[1];e<s&&(r=2,i=s);for(let a=r-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(r===a)break;if(n=i,e>=(i=t[--r-1]))break t}a=r,r=0;break r}break e}for(;r<a;){let n=r+a>>>1;e<t[n]?a=n:r=n+1}if(n=t[r],void 0===(i=t[r-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n;for(let e=0;e!==n;++e)t[e]=r[i+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}};let CubicInterpolant=class CubicInterpolant extends Interpolant{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,r){let n=this.parameterPositions,i=e-2,a=e+1,s=n[i],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:i=e,s=2*t-r;break;case 2402:i=n.length-2,s=t+n[i]-n[i+1];break;default:i=e,s=r}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*r-t;break;case 2402:a=1,o=r+n[1]-n[0];break;default:a=e-1,o=t}let l=(r-t)*.5,u=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-r),this._offsetPrev=i*u,this._offsetNext=a*u}interpolate_(e,t,r,n){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this._offsetPrev,h=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,_=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,x=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let e=0;e!==s;++e)i[e]=g*a[u+e]+_*a[l+e]+x*a[o+e]+y*a[h+e];return i}};let LinearInterpolant=class LinearInterpolant extends Interpolant{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=(r-t)/(n-t),h=1-u;for(let e=0;e!==s;++e)i[e]=a[l+e]*h+a[o+e]*u;return i}};let DiscreteInterpolant=class DiscreteInterpolant extends Interpolant{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}};let KeyframeTrack=class KeyframeTrack{constructor(e,t,r,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=convertArray(t,this.TimeBufferType),this.values=convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t;let r=e.constructor;if(r.toJSON!==this.toJSON)t=r.toJSON(e);else{t={name:e.name,times:convertArray(e.times,Array),values:convertArray(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,i=0,a=n-1;for(;i!==n&&r[i]<e;)++i;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==i||a!==n){i>=a&&(i=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=arraySlice(r,i,a),this.values=arraySlice(this.values,i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,n=this.values,i=r.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==i;t++){let n=r[t];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,n),e=!1;break}if(null!==a&&a>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,n,a),e=!1;break}a=n}if(void 0!==n&&isTypedArray(n))for(let t=0,r=n.length;t!==r;++t){let r=n[t];if(isNaN(r)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,r),e=!1;break}}return e}optimize(){let e=arraySlice(this.times),t=arraySlice(this.values),r=this.getValueSize(),n=2302===this.getInterpolation(),i=e.length-1,a=1;for(let s=1;s<i;++s){let i=!1,o=e[s],l=e[s+1];if(o!==l&&(1!==s||o!==e[0])){if(n)i=!0;else{let e=s*r,n=e-r,a=e+r;for(let s=0;s!==r;++s){let r=t[e+s];if(r!==t[n+s]||r!==t[a+s]){i=!0;break}}}}if(i){if(s!==a){e[a]=e[s];let n=s*r,i=a*r;for(let e=0;e!==r;++e)t[i+e]=t[n+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*r,n=a*r,s=0;s!==r;++s)t[n+s]=t[e+s];++a}return a!==e.length?(this.times=arraySlice(e,0,a),this.values=arraySlice(t,0,a*r)):(this.times=e,this.values=t),this}clone(){let e=arraySlice(this.times,0),t=arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=2301;let BooleanKeyframeTrack=class BooleanKeyframeTrack extends KeyframeTrack{};BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=2300,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends KeyframeTrack{}).prototype.ValueTypeName="color",(class extends KeyframeTrack{}).prototype.ValueTypeName="number";let QuaternionLinearInterpolant=class QuaternionLinearInterpolant extends Interpolant{
186constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(r-t)/(n-t),l=e*s;for(let e=l+s;l!==e;l+=4)Quaternion.slerpFlat(i,0,a,l-s,a,l,o);return i}};let QuaternionKeyframeTrack=class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)}};QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",QuaternionKeyframeTrack.prototype.DefaultInterpolation=2301,QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let StringKeyframeTrack=class StringKeyframeTrack extends KeyframeTrack{};StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=2300,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends KeyframeTrack{}).prototype.ValueTypeName="vector";let tU={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={}}},tD=new class{constructor(e,t,r){let n;let i=this,a=!1,s=0,o=0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){o++,!1===a&&void 0!==i.onStart&&i.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return n?n(e):e},this.setURLModifier=function(e){return n=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,r=l.length;t<r;t+=2){let r=l[t],n=l[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return n}return null}}};let Loader=class Loader{constructor(e){this.manager=void 0!==e?e:tD,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,i){r.load(e,n,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};let ImageLoader=class ImageLoader extends Loader{constructor(e){super(e)}load(e,t,r,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=tU.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let s=createElementNS("img");function onImageLoad(){removeEventListeners(),tU.add(e,this),t&&t(this),i.manager.itemEnd(e)}function onImageError(t){removeEventListeners(),n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)}function removeEventListeners(){s.removeEventListener("load",onImageLoad,!1),s.removeEventListener("error",onImageError,!1)}return s.addEventListener("load",onImageLoad,!1),s.addEventListener("error",onImageError,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),i.manager.itemStart(e),s.src=e,s}};let TextureLoader=class TextureLoader extends Loader{constructor(e){super(e)}load(e,t,r,n){let i=new Texture,a=new ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)},r,n),i}};let tI="\\[\\]\\.:\\/",tN=RegExp("["+tI+"]","g"),tV="[^"+tI+"]",tO="[^"+tI.replace("\\.","")+"]",tz=/((?:WC+[\/:])*)/.source.replace("WC",tV),tB=/(WCOD+)?/.source.replace("WCOD",tO),tG=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tV),tF=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tV),tk=RegExp("^"+tz+tB+tG+tF+"$"),tW=["material","materials","bones","map"];let PropertyBinding=class PropertyBinding{constructor(e,t,r){this.path=t,this.parsedPath=r||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new PropertyBinding.Composite(e,t,r):new PropertyBinding(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(tN,"")}static parseTrackName(e){let t=tk.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let e=r.nodeName.substring(n+1);-1!==tW.indexOf(e)&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=e)}if(null===r.propertyName||0===r.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){let searchNodeSubtree=function(e){for(let r=0;r<e.length;r++){let n=e[r];if(n.name===t||n.uuid===t)return n;let i=searchNodeSubtree(n.children);if(i)return i}return null},r=searchNodeSubtree(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,i=r.length;n!==i;++n)e[t++]=r[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let n=0,i=r.length;n!==i;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}
186_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,i=t.propertyIndex;if(e||(e=PropertyBinding.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(r){let n=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===n){n=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(void 0===e[r]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(void 0!==n){if(void 0===e[n]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[n]}}let a=e[n];if(void 0===a){let r=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+r+"."+n+" but it wasn't found.",e);return}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===n){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=i}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};PropertyBinding.Composite=class{constructor(e,t,r){let n=r||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];void 0!==n&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatr
186ixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1);let Spherical=class Spherical{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,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,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(clamp(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"151"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="151")}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.